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