| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_ |
| 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/browser/views/frame/browser_frame.h" | 9 #include "chrome/browser/views/frame/browser_frame.h" |
| 10 #include "views/window/window_win.h" | 10 #include "views/window/window_win.h" |
| 11 | 11 |
| 12 class AeroGlassNonClientView; | 12 class AeroGlassNonClientView; |
| 13 class BrowserNonClientFrameView; | 13 class BrowserNonClientFrameView; |
| 14 class BrowserRootView; | 14 class BrowserRootView; |
| 15 class BrowserTabStrip; |
| 15 class BrowserView; | 16 class BrowserView; |
| 16 class NonClientFrameView; | 17 class NonClientFrameView; |
| 17 class Profile; | 18 class Profile; |
| 18 class TabStrip; | 19 class TabStrip; |
| 19 | 20 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 21 /////////////////////////////////////////////////////////////////////////////// |
| 21 // BrowserFrameWin | 22 // BrowserFrameWin |
| 22 // | 23 // |
| 23 // BrowserFrame is a WindowWin subclass that provides the window frame for the | 24 // BrowserFrame is a WindowWin subclass that provides the window frame for the |
| 24 // Chrome browser window. | 25 // Chrome browser window. |
| 25 // | 26 // |
| 26 class BrowserFrameWin : public BrowserFrame, public views::WindowWin { | 27 class BrowserFrameWin : public BrowserFrame, public views::WindowWin { |
| 27 public: | 28 public: |
| 28 // Normally you will create this class by calling BrowserFrame::Create. | 29 // Normally you will create this class by calling BrowserFrame::Create. |
| 29 // Init must be called before using this class, which Create will do for you. | 30 // Init must be called before using this class, which Create will do for you. |
| 30 BrowserFrameWin(BrowserView* browser_view, Profile* profile); | 31 BrowserFrameWin(BrowserView* browser_view, Profile* profile); |
| 31 virtual ~BrowserFrameWin(); | 32 virtual ~BrowserFrameWin(); |
| 32 | 33 |
| 33 // This initialization function must be called after construction, it is | 34 // This initialization function must be called after construction, it is |
| 34 // separate to avoid recursive calling of the frame from its constructor. | 35 // separate to avoid recursive calling of the frame from its constructor. |
| 35 void Init(); | 36 void Init(); |
| 36 | 37 |
| 37 // BrowserFrame implementation. | 38 // BrowserFrame implementation. |
| 38 virtual views::Window* GetWindow(); | 39 virtual views::Window* GetWindow(); |
| 39 virtual void TabStripCreated(TabStrip* tabstrip); | 40 virtual void TabStripCreated(TabStrip* tabstrip); |
| 40 virtual int GetMinimizeButtonOffset() const; | 41 virtual int GetMinimizeButtonOffset() const; |
| 41 virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const; | 42 virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const; |
| 42 virtual void UpdateThrobber(bool running); | 43 virtual void UpdateThrobber(bool running); |
| 44 virtual void ContinueDraggingDetachedTab(); |
| 43 virtual ThemeProvider* GetThemeProviderForFrame() const; | 45 virtual ThemeProvider* GetThemeProviderForFrame() const; |
| 44 | 46 |
| 45 // Overridden from views::Widget. | 47 // Overridden from views::Widget. |
| 46 virtual ThemeProvider* GetThemeProvider() const; | 48 virtual ThemeProvider* GetThemeProvider() const; |
| 47 virtual ThemeProvider* GetDefaultThemeProvider() const; | 49 virtual ThemeProvider* GetDefaultThemeProvider() const; |
| 48 | 50 |
| 49 BrowserView* browser_view() const { return browser_view_; } | 51 BrowserView* browser_view() const { return browser_view_; } |
| 50 | 52 |
| 51 protected: | 53 protected: |
| 52 // Overridden from views::WidgetWin: | 54 // Overridden from views::WidgetWin: |
| 53 virtual bool AcceleratorPressed(views::Accelerator* accelerator); | 55 virtual bool AcceleratorPressed(views::Accelerator* accelerator); |
| 54 virtual bool GetAccelerator(int cmd_id, views::Accelerator* accelerator); | 56 virtual bool GetAccelerator(int cmd_id, views::Accelerator* accelerator); |
| 57 virtual void OnEndSession(BOOL ending, UINT logoff); |
| 55 virtual void OnEnterSizeMove(); | 58 virtual void OnEnterSizeMove(); |
| 56 virtual void OnEndSession(BOOL ending, UINT logoff); | 59 virtual void OnExitSizeMove(); |
| 57 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); | 60 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); |
| 58 virtual LRESULT OnMouseActivate(HWND window, | 61 virtual LRESULT OnMouseActivate(HWND window, |
| 59 UINT hittest_code, | 62 UINT hittest_code, |
| 60 UINT message); | 63 UINT message); |
| 61 virtual void OnMove(const CPoint& point); | 64 virtual void OnMove(const CPoint& point); |
| 62 virtual void OnMoving(UINT param, const RECT* new_bounds); | 65 virtual void OnMoving(UINT param, const RECT* new_bounds); |
| 63 virtual LRESULT OnNCActivate(BOOL active); | 66 virtual LRESULT OnNCActivate(BOOL active); |
| 64 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); | 67 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); |
| 65 virtual LRESULT OnNCHitTest(const CPoint& pt); | 68 virtual LRESULT OnNCHitTest(const CPoint& pt); |
| 69 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); |
| 66 | 70 |
| 67 // Overridden from views::Window: | 71 // Overridden from views::Window: |
| 68 virtual int GetShowState() const; | 72 virtual int GetShowState() const; |
| 69 virtual bool IsAppWindow() const { return true; } | 73 virtual bool IsAppWindow() const { return true; } |
| 70 virtual views::NonClientFrameView* CreateFrameViewForWindow(); | 74 virtual views::NonClientFrameView* CreateFrameViewForWindow(); |
| 71 virtual void UpdateFrameAfterFrameChange(); | 75 virtual void UpdateFrameAfterFrameChange(); |
| 72 virtual views::RootView* CreateRootView(); | 76 virtual views::RootView* CreateRootView(); |
| 73 | 77 |
| 74 private: | 78 private: |
| 75 // Updates the DWM with the frame bounds. | 79 // Updates the DWM with the frame bounds. |
| 76 void UpdateDWMFrame(); | 80 void UpdateDWMFrame(); |
| 77 | 81 |
| 82 // Update the window's pacity when entering and exiting detached dragging |
| 83 // mode. |
| 84 void UpdateWindowAlphaForTabDragging(bool dragging); |
| 85 |
| 78 // The BrowserView is our ClientView. This is a pointer to it. | 86 // The BrowserView is our ClientView. This is a pointer to it. |
| 79 BrowserView* browser_view_; | 87 BrowserView* browser_view_; |
| 80 | 88 |
| 81 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. | 89 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. |
| 82 BrowserNonClientFrameView* browser_frame_view_; | 90 BrowserNonClientFrameView* browser_frame_view_; |
| 83 | 91 |
| 84 // An unowning reference to the root view associated with the window. We save | 92 // An unowning reference to the root view associated with the window. We save |
| 85 // a copy as a BrowserRootView to avoid evil casting later, when we need to | 93 // a copy as a BrowserRootView to avoid evil casting later, when we need to |
| 86 // call functions that only exist on BrowserRootView (versus RootView). | 94 // call functions that only exist on BrowserRootView (versus RootView). |
| 87 BrowserRootView* root_view_; | 95 BrowserRootView* root_view_; |
| 88 | 96 |
| 89 bool frame_initialized_; | 97 bool frame_initialized_; |
| 90 | 98 |
| 91 Profile* profile_; | 99 Profile* profile_; |
| 92 | 100 |
| 101 // The window styles before we modified them for a tab dragging operation. |
| 102 DWORD saved_window_style_; |
| 103 DWORD saved_window_ex_style_; |
| 104 |
| 105 // True if the window is currently being moved in a detached tab drag |
| 106 // operation. |
| 107 bool detached_drag_mode_; |
| 108 |
| 109 // When this frame represents a detached tab being dragged, this is a TabStrip |
| 110 // in another window that the tab being dragged would be docked to if the |
| 111 // mouse were released, or NULL if there is no suitable TabStrip. |
| 112 BrowserTabStrip* drop_tabstrip_; |
| 113 |
| 93 DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); | 114 DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); |
| 94 }; | 115 }; |
| 95 | 116 |
| 96 #endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_ | 117 #endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_WIN_ |
| OLD | NEW |