| 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_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_member.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 12 #include "ui/views/context_menu_controller.h" | 13 #include "ui/views/context_menu_controller.h" |
| 13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 14 | 15 |
| 15 class AvatarMenuButton; | 16 class AvatarMenuButton; |
| 16 class BrowserRootView; | 17 class BrowserRootView; |
| 17 class BrowserView; | 18 class BrowserView; |
| 18 class NativeBrowserFrame; | 19 class NativeBrowserFrame; |
| 19 class NewAvatarButton; | 20 class NewAvatarButton; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 68 |
| 68 // Returns the amount that the theme background should be inset. | 69 // Returns the amount that the theme background should be inset. |
| 69 int GetThemeBackgroundXInset() const; | 70 int GetThemeBackgroundXInset() const; |
| 70 | 71 |
| 71 // Tells the frame to update the throbber. | 72 // Tells the frame to update the throbber. |
| 72 void UpdateThrobber(bool running); | 73 void UpdateThrobber(bool running); |
| 73 | 74 |
| 74 // Returns the NonClientFrameView of this frame. | 75 // Returns the NonClientFrameView of this frame. |
| 75 views::View* GetFrameView() const; | 76 views::View* GetFrameView() const; |
| 76 | 77 |
| 78 // Returns |true| if we should use the custom frame. |
| 79 bool UseCustomFrame() const; |
| 80 |
| 77 // Overridden from views::Widget: | 81 // Overridden from views::Widget: |
| 78 virtual views::internal::RootView* CreateRootView() OVERRIDE; | 82 virtual views::internal::RootView* CreateRootView() OVERRIDE; |
| 79 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 83 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
| 80 virtual bool GetAccelerator(int command_id, | 84 virtual bool GetAccelerator(int command_id, |
| 81 ui::Accelerator* accelerator) OVERRIDE; | 85 ui::Accelerator* accelerator) OVERRIDE; |
| 82 virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE; | 86 virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE; |
| 83 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; | 87 virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; |
| 84 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; | 88 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; |
| 85 | 89 |
| 86 // Overridden from views::ContextMenuController: | 90 // Overridden from views::ContextMenuController: |
| 87 virtual void ShowContextMenuForView(views::View* source, | 91 virtual void ShowContextMenuForView(views::View* source, |
| 88 const gfx::Point& p, | 92 const gfx::Point& p, |
| 89 ui::MenuSourceType source_type) OVERRIDE; | 93 ui::MenuSourceType source_type) OVERRIDE; |
| 90 | 94 |
| 91 // Returns true if we should leave any offset at the frame caption. Typically | 95 // Returns true if we should leave any offset at the frame caption. Typically |
| 92 // when the frame is maximized/full screen we want to leave no offset at the | 96 // when the frame is maximized/full screen we want to leave no offset at the |
| 93 // top. | 97 // top. |
| 94 bool ShouldLeaveOffsetNearTopBorder(); | 98 bool ShouldLeaveOffsetNearTopBorder(); |
| 95 | 99 |
| 96 AvatarMenuButton* GetAvatarMenuButton(); | 100 AvatarMenuButton* GetAvatarMenuButton(); |
| 97 | 101 |
| 98 NewAvatarButton* GetNewAvatarMenuButton(); | 102 NewAvatarButton* GetNewAvatarMenuButton(); |
| 99 | 103 |
| 100 // Returns the menu model. BrowserFrame owns the returned model. | 104 // Returns the menu model. BrowserFrame owns the returned model. |
| 101 // Note that in multi user mode this will upon each call create a new model. | 105 // Note that in multi user mode this will upon each call create a new model. |
| 102 ui::MenuModel* GetSystemMenuModel(); | 106 ui::MenuModel* GetSystemMenuModel(); |
| 103 | 107 |
| 104 private: | 108 private: |
| 109 // Called when the preference changes. |
| 110 void OnUseCustomChromeFrameChanged(); |
| 111 |
| 105 NativeBrowserFrame* native_browser_frame_; | 112 NativeBrowserFrame* native_browser_frame_; |
| 106 | 113 |
| 107 // A weak reference to the root view associated with the window. We save a | 114 // A weak reference to the root view associated with the window. We save a |
| 108 // copy as a BrowserRootView to avoid evil casting later, when we need to call | 115 // copy as a BrowserRootView to avoid evil casting later, when we need to call |
| 109 // functions that only exist on BrowserRootView (versus RootView). | 116 // functions that only exist on BrowserRootView (versus RootView). |
| 110 BrowserRootView* root_view_; | 117 BrowserRootView* root_view_; |
| 111 | 118 |
| 112 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. | 119 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. |
| 113 BrowserNonClientFrameView* browser_frame_view_; | 120 BrowserNonClientFrameView* browser_frame_view_; |
| 114 | 121 |
| 115 // The BrowserView is our ClientView. This is a pointer to it. | 122 // The BrowserView is our ClientView. This is a pointer to it. |
| 116 BrowserView* browser_view_; | 123 BrowserView* browser_view_; |
| 117 | 124 |
| 118 scoped_ptr<SystemMenuModelBuilder> menu_model_builder_; | 125 scoped_ptr<SystemMenuModelBuilder> menu_model_builder_; |
| 119 | 126 |
| 120 // Used to show the system menu. Only used if | 127 // Used to show the system menu. Only used if |
| 121 // NativeBrowserFrame::UsesNativeSystemMenu() returns false. | 128 // NativeBrowserFrame::UsesNativeSystemMenu() returns false. |
| 122 scoped_ptr<views::MenuRunner> menu_runner_; | 129 scoped_ptr<views::MenuRunner> menu_runner_; |
| 123 | 130 |
| 124 // SetThemeProvider() triggers setting both |owned_theme_provider_| and | 131 // SetThemeProvider() triggers setting both |owned_theme_provider_| and |
| 125 // |theme_provider_|. Initially |theme_provider_| is set to the ThemeService | 132 // |theme_provider_|. Initially |theme_provider_| is set to the ThemeService |
| 126 // and |owned_theme_provider_| is NULL (as ThemeServices lifetime is managed | 133 // and |owned_theme_provider_| is NULL (as ThemeServices lifetime is managed |
| 127 // externally). | 134 // externally). |
| 128 scoped_ptr<ui::ThemeProvider> owned_theme_provider_; | 135 scoped_ptr<ui::ThemeProvider> owned_theme_provider_; |
| 129 ui::ThemeProvider* theme_provider_; | 136 ui::ThemeProvider* theme_provider_; |
| 130 | 137 |
| 138 // Whether the custom chrome frame pref is set. Normally you want to use |
| 139 // UseCustomFrame() above to determine whether to use the custom frame or |
| 140 // not. |
| 141 BooleanPrefMember use_custom_frame_pref_; |
| 142 |
| 131 DISALLOW_COPY_AND_ASSIGN(BrowserFrame); | 143 DISALLOW_COPY_AND_ASSIGN(BrowserFrame); |
| 132 }; | 144 }; |
| 133 | 145 |
| 134 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ | 146 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ |
| OLD | NEW |