| OLD | NEW |
| (Empty) |
| 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 | |
| 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 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/ui/views/frame/browser_frame.h" | |
| 11 #include "chrome/browser/ui/views/frame/minimize_button_metrics_win.h" | |
| 12 #include "chrome/browser/ui/views/frame/native_browser_frame.h" | |
| 13 #include "ui/views/controls/button/image_button.h" | |
| 14 #include "ui/views/widget/native_widget_win.h" | |
| 15 | |
| 16 class BrowserView; | |
| 17 class BrowserWindowPropertyManager; | |
| 18 | |
| 19 namespace views { | |
| 20 class NativeMenuWin; | |
| 21 } | |
| 22 | |
| 23 //////////////////////////////////////////////////////////////////////////////// | |
| 24 // BrowserFrameWin | |
| 25 // | |
| 26 // BrowserFrameWin is a NativeWidgetWin subclass that provides the window frame | |
| 27 // for the Chrome browser window. | |
| 28 // | |
| 29 class BrowserFrameWin : public views::NativeWidgetWin, | |
| 30 public NativeBrowserFrame, | |
| 31 public views::ButtonListener { | |
| 32 public: | |
| 33 BrowserFrameWin(BrowserFrame* browser_frame, BrowserView* browser_view); | |
| 34 virtual ~BrowserFrameWin(); | |
| 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::NativeWidgetWin: | |
| 45 virtual int GetInitialShowState() const OVERRIDE; | |
| 46 virtual bool GetClientAreaInsets(gfx::Insets* insets) const OVERRIDE; | |
| 47 virtual void HandleCreate() OVERRIDE; | |
| 48 virtual void HandleFrameChanged() OVERRIDE; | |
| 49 virtual bool PreHandleMSG(UINT message, | |
| 50 WPARAM w_param, | |
| 51 LPARAM l_param, | |
| 52 LRESULT* result) OVERRIDE; | |
| 53 virtual void PostHandleMSG(UINT message, | |
| 54 WPARAM w_param, | |
| 55 LPARAM l_param) OVERRIDE; | |
| 56 virtual bool ShouldUseNativeFrame() const OVERRIDE; | |
| 57 virtual void Show() OVERRIDE; | |
| 58 virtual void ShowMaximizedWithBounds( | |
| 59 const gfx::Rect& restored_bounds) OVERRIDE; | |
| 60 virtual void ShowWithWindowState(ui::WindowShowState show_state) OVERRIDE; | |
| 61 virtual void Close() OVERRIDE; | |
| 62 virtual void FrameTypeChanged() OVERRIDE; | |
| 63 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | |
| 64 virtual void Activate() OVERRIDE; | |
| 65 | |
| 66 // Overridden from NativeBrowserFrame: | |
| 67 virtual views::NativeWidget* AsNativeWidget() OVERRIDE; | |
| 68 virtual const views::NativeWidget* AsNativeWidget() const OVERRIDE; | |
| 69 virtual bool UsesNativeSystemMenu() const OVERRIDE; | |
| 70 virtual int GetMinimizeButtonOffset() const OVERRIDE; | |
| 71 | |
| 72 // Overriden from views::ImageButton override: | |
| 73 virtual void ButtonPressed(views::Button* sender, | |
| 74 const ui::Event& event) OVERRIDE; | |
| 75 | |
| 76 private: | |
| 77 // Updates the DWM with the frame bounds. | |
| 78 void UpdateDWMFrame(); | |
| 79 | |
| 80 // Handles metro navigation and search requests. | |
| 81 void HandleMetroNavSearchRequest(WPARAM w_param, LPARAM l_param); | |
| 82 | |
| 83 // Returns information about the currently displayed tab in metro mode. | |
| 84 void GetMetroCurrentTabInfo(WPARAM w_param); | |
| 85 | |
| 86 // Ensures that the window frame follows the Windows 8 metro app guidelines, | |
| 87 // i.e. no system menu, etc. | |
| 88 void AdjustFrameForImmersiveMode(); | |
| 89 | |
| 90 // Called when the frame is closed. Only applies to Windows 8 metro mode. | |
| 91 void CloseImmersiveFrame(); | |
| 92 | |
| 93 views::NativeMenuWin* GetSystemMenu(); | |
| 94 | |
| 95 // The BrowserView is our ClientView. This is a pointer to it. | |
| 96 BrowserView* browser_view_; | |
| 97 | |
| 98 BrowserFrame* browser_frame_; | |
| 99 | |
| 100 // The wrapped system menu itself. | |
| 101 scoped_ptr<views::NativeMenuWin> system_menu_; | |
| 102 | |
| 103 MinimizeButtonMetrics minimize_button_metrics_; | |
| 104 | |
| 105 scoped_ptr<BrowserWindowPropertyManager> browser_window_property_manager_; | |
| 106 | |
| 107 DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); | |
| 108 }; | |
| 109 | |
| 110 // Helper function to create the incognito/normal browser window switcher. | |
| 111 views::Button* MakeWindowSwitcherButton(views::ButtonListener* listener, | |
| 112 bool is_off_the_record); | |
| 113 | |
| 114 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_ | |
| OLD | NEW |