Home | History | Annotate | Download | only in frame
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
      6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
      7 #pragma once
      8 
      9 #include "base/basictypes.h"
     10 #include "chrome/browser/ui/views/frame/browser_frame.h"
     11 #include "chrome/browser/ui/views/frame/native_browser_frame.h"
     12 #include "views/window/window_win.h"
     13 
     14 class BrowserView;
     15 class Profile;
     16 
     17 ///////////////////////////////////////////////////////////////////////////////
     18 // BrowserFrameWin
     19 //
     20 //  BrowserFrame is a WindowWin subclass that provides the window frame for the
     21 //  Chrome browser window.
     22 //
     23 class BrowserFrameWin : public BrowserFrame,
     24                         public views::WindowWin,
     25                         public NativeBrowserFrame {
     26  public:
     27   // Normally you will create this class by calling BrowserFrame::Create.
     28   // Init must be called before using this class, which Create will do for you.
     29   BrowserFrameWin(BrowserView* browser_view, Profile* profile);
     30   virtual ~BrowserFrameWin();
     31 
     32   // This initialization function must be called after construction, it is
     33   // separate to avoid recursive calling of the frame from its constructor.
     34   void InitBrowserFrame();
     35 
     36   BrowserView* browser_view() const { return browser_view_; }
     37 
     38   // Explicitly sets how windows are shown. Use a value of -1 to give the
     39   // default behavior. This is used during testing and not generally useful
     40   // otherwise.
     41   static void SetShowState(int state);
     42 
     43  protected:
     44   // Overridden from views::WindowWin:
     45   virtual int GetShowState() const OVERRIDE;
     46   virtual gfx::Insets GetClientAreaInsets() const OVERRIDE;
     47   virtual bool GetAccelerator(int cmd_id,
     48                               ui::Accelerator* accelerator) OVERRIDE;
     49   virtual void OnEndSession(BOOL ending, UINT logoff) OVERRIDE;
     50   virtual void OnInitMenuPopup(HMENU menu,
     51                                UINT position,
     52                                BOOL is_system_menu) OVERRIDE;
     53   virtual void OnWindowPosChanged(WINDOWPOS* window_pos) OVERRIDE;
     54   virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE;
     55   virtual void OnScreenReaderDetected() OVERRIDE;
     56 
     57   // Overridden from views::Window:
     58   virtual void Activate() OVERRIDE;
     59   virtual bool IsAppWindow() const OVERRIDE { return true; }
     60   virtual void UpdateFrameAfterFrameChange() OVERRIDE;
     61   virtual views::RootView* CreateRootView() OVERRIDE;
     62   virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE;
     63   virtual bool ShouldUseNativeFrame() const OVERRIDE;
     64 
     65   // Overridden from NativeBrowserFrame:
     66   virtual views::NativeWindow* AsNativeWindow() OVERRIDE;
     67   virtual const views::NativeWindow* AsNativeWindow() const OVERRIDE;
     68   virtual BrowserNonClientFrameView* CreateBrowserNonClientFrameView() OVERRIDE;
     69   virtual int GetMinimizeButtonOffset() const OVERRIDE;
     70   virtual ui::ThemeProvider* GetThemeProviderForFrame() const OVERRIDE;
     71   virtual bool AlwaysUseNativeFrame() const OVERRIDE;
     72   virtual void TabStripDisplayModeChanged() OVERRIDE;
     73 
     74  private:
     75   // Updates the DWM with the frame bounds.
     76   void UpdateDWMFrame();
     77 
     78   NativeBrowserFrameDelegate* delegate_;
     79 
     80   // The BrowserView is our ClientView. This is a pointer to it.
     81   BrowserView* browser_view_;
     82 
     83   DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin);
     84 };
     85 
     86 #endif  // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_
     87