OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.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/minimize_button_metrics_win.h" | 11 #include "chrome/browser/ui/views/frame/minimize_button_metrics_win.h" |
12 #include "chrome/browser/ui/views/frame/native_browser_frame.h" | 12 #include "chrome/browser/ui/views/frame/native_browser_frame.h" |
13 #include "ui/views/controls/button/image_button.h" | 13 #include "ui/views/controls/button/image_button.h" |
14 #include "ui/views/widget/native_widget_win.h" | 14 #include "ui/views/widget/native_widget_win.h" |
15 | 15 |
16 class BrowserView; | 16 class BrowserView; |
17 class EncodingMenuModel; | |
18 class SystemMenuModel; | |
19 class SystemMenuModelDelegate; | |
20 class ZoomMenuModel; | |
21 | 17 |
22 namespace views { | 18 namespace views { |
23 class NativeMenuWin; | 19 class NativeMenuWin; |
24 } | 20 } |
25 | 21 |
26 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
27 // BrowserFrameWin | 23 // BrowserFrameWin |
28 // | 24 // |
29 // BrowserFrameWin is a NativeWidgetWin subclass that provides the window frame | 25 // BrowserFrameWin is a NativeWidgetWin subclass that provides the window frame |
30 // for the Chrome browser window. | 26 // for the Chrome browser window. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const gfx::Rect& restored_bounds) OVERRIDE; | 58 const gfx::Rect& restored_bounds) OVERRIDE; |
63 virtual void ShowWithWindowState(ui::WindowShowState show_state) OVERRIDE; | 59 virtual void ShowWithWindowState(ui::WindowShowState show_state) OVERRIDE; |
64 virtual void Close() OVERRIDE; | 60 virtual void Close() OVERRIDE; |
65 virtual void FrameTypeChanged() OVERRIDE; | 61 virtual void FrameTypeChanged() OVERRIDE; |
66 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 62 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
67 virtual void Activate() OVERRIDE; | 63 virtual void Activate() OVERRIDE; |
68 | 64 |
69 // Overridden from NativeBrowserFrame: | 65 // Overridden from NativeBrowserFrame: |
70 virtual views::NativeWidget* AsNativeWidget() OVERRIDE; | 66 virtual views::NativeWidget* AsNativeWidget() OVERRIDE; |
71 virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE; | 67 virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE; |
72 virtual void InitSystemContextMenu() OVERRIDE; | 68 virtual bool UsesNativeSystemMenu() const OVERRIDE; |
73 virtual int GetMinimizeButtonOffset() const OVERRIDE; | 69 virtual int GetMinimizeButtonOffset() const OVERRIDE; |
74 virtual void TabStripDisplayModeChanged() OVERRIDE; | 70 virtual void TabStripDisplayModeChanged() OVERRIDE; |
75 | 71 |
76 // Overriden from views::ImageButton override: | 72 // Overriden from views::ImageButton override: |
77 virtual void ButtonPressed(views::Button* sender, | 73 virtual void ButtonPressed(views::Button* sender, |
78 const ui::Event& event) OVERRIDE; | 74 const ui::Event& event) OVERRIDE; |
79 | 75 |
80 private: | 76 private: |
81 // Updates the DWM with the frame bounds. | 77 // Updates the DWM with the frame bounds. |
82 void UpdateDWMFrame(); | 78 void UpdateDWMFrame(); |
83 | 79 |
84 // Builds the correct menu for when we have minimal chrome. | |
85 void BuildSystemMenuForBrowserWindow(); | |
86 void BuildSystemMenuForAppOrPopupWindow(); | |
87 | |
88 // Adds optional debug items for frame type toggling. | |
89 void AddFrameToggleItems(); | |
90 | |
91 // Handles metro navigation and search requests. | 80 // Handles metro navigation and search requests. |
92 void HandleMetroNavSearchRequest(WPARAM w_param, LPARAM l_param); | 81 void HandleMetroNavSearchRequest(WPARAM w_param, LPARAM l_param); |
93 | 82 |
94 // Returns information about the currently displayed tab in metro mode. | 83 // Returns information about the currently displayed tab in metro mode. |
95 void GetMetroCurrentTabInfo(WPARAM w_param); | 84 void GetMetroCurrentTabInfo(WPARAM w_param); |
96 | 85 |
97 // Ensures that the window frame follows the Windows 8 metro app guidelines, | 86 // Ensures that the window frame follows the Windows 8 metro app guidelines, |
98 // i.e. no system menu, etc. | 87 // i.e. no system menu, etc. |
99 void AdjustFrameForImmersiveMode(); | 88 void AdjustFrameForImmersiveMode(); |
100 | 89 |
101 // Called when the frame is closed. Only applies to Windows 8 metro mode. | 90 // Called when the frame is closed. Only applies to Windows 8 metro mode. |
102 void CloseImmersiveFrame(); | 91 void CloseImmersiveFrame(); |
103 | 92 |
| 93 views::NativeMenuWin* GetSystemMenu(); |
| 94 |
104 // The BrowserView is our ClientView. This is a pointer to it. | 95 // The BrowserView is our ClientView. This is a pointer to it. |
105 BrowserView* browser_view_; | 96 BrowserView* browser_view_; |
106 | 97 |
107 BrowserFrame* browser_frame_; | 98 BrowserFrame* browser_frame_; |
108 | 99 |
109 // The additional items we insert into the system menu. | |
110 scoped_ptr<SystemMenuModelDelegate> system_menu_delegate_; | |
111 scoped_ptr<SystemMenuModel> system_menu_contents_; | |
112 scoped_ptr<ZoomMenuModel> zoom_menu_contents_; | |
113 scoped_ptr<EncodingMenuModel> encoding_menu_contents_; | |
114 // The wrapped system menu itself. | 100 // The wrapped system menu itself. |
115 scoped_ptr<views::NativeMenuWin> system_menu_; | 101 scoped_ptr<views::NativeMenuWin> system_menu_; |
116 | 102 |
117 MinimizeButtonMetrics minimize_button_metrics_; | 103 MinimizeButtonMetrics minimize_button_metrics_; |
118 | 104 |
119 DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); | 105 DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); |
120 }; | 106 }; |
121 | 107 |
122 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_ | 108 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_ |
OLD | NEW |