| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TOOLBAR_TOOLBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 public CommandObserver, | 50 public CommandObserver, |
| 51 public views::ButtonListener, | 51 public views::ButtonListener, |
| 52 public views::WidgetObserver, | 52 public views::WidgetObserver, |
| 53 public views::ViewTargeterDelegate, | 53 public views::ViewTargeterDelegate, |
| 54 public WrenchMenuBadgeController::Delegate { | 54 public WrenchMenuBadgeController::Delegate { |
| 55 public: | 55 public: |
| 56 // The view class name. | 56 // The view class name. |
| 57 static const char kViewClassName[]; | 57 static const char kViewClassName[]; |
| 58 | 58 |
| 59 explicit ToolbarView(Browser* browser); | 59 explicit ToolbarView(Browser* browser); |
| 60 virtual ~ToolbarView(); | 60 ~ToolbarView() override; |
| 61 | 61 |
| 62 // Create the contents of the Browser Toolbar. | 62 // Create the contents of the Browser Toolbar. |
| 63 void Init(); | 63 void Init(); |
| 64 | 64 |
| 65 // Forces the toolbar (and transitively the location bar) to update its | 65 // Forces the toolbar (and transitively the location bar) to update its |
| 66 // current state. If |tab| is non-NULL, we're switching (back?) to this tab | 66 // current state. If |tab| is non-NULL, we're switching (back?) to this tab |
| 67 // and should restore any previous location bar state (such as user editing) | 67 // and should restore any previous location bar state (such as user editing) |
| 68 // as well. | 68 // as well. |
| 69 void Update(content::WebContents* tab); | 69 void Update(content::WebContents* tab); |
| 70 | 70 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 | 100 |
| 101 // Accessors. | 101 // Accessors. |
| 102 Browser* browser() const { return browser_; } | 102 Browser* browser() const { return browser_; } |
| 103 BrowserActionsContainer* browser_actions() const { return browser_actions_; } | 103 BrowserActionsContainer* browser_actions() const { return browser_actions_; } |
| 104 ReloadButton* reload_button() const { return reload_; } | 104 ReloadButton* reload_button() const { return reload_; } |
| 105 LocationBarView* location_bar() const { return location_bar_; } | 105 LocationBarView* location_bar() const { return location_bar_; } |
| 106 views::MenuButton* app_menu() const; | 106 views::MenuButton* app_menu() const; |
| 107 HomeButton* home_button() const { return home_; } | 107 HomeButton* home_button() const { return home_; } |
| 108 | 108 |
| 109 // AccessiblePaneView: | 109 // AccessiblePaneView: |
| 110 virtual bool SetPaneFocus(View* initial_focus) override; | 110 bool SetPaneFocus(View* initial_focus) override; |
| 111 virtual void GetAccessibleState(ui::AXViewState* state) override; | 111 void GetAccessibleState(ui::AXViewState* state) override; |
| 112 | 112 |
| 113 // views::MenuButtonListener: | 113 // views::MenuButtonListener: |
| 114 virtual void OnMenuButtonClicked(views::View* source, | 114 void OnMenuButtonClicked(views::View* source, |
| 115 const gfx::Point& point) override; | 115 const gfx::Point& point) override; |
| 116 | 116 |
| 117 // LocationBarView::Delegate: | 117 // LocationBarView::Delegate: |
| 118 virtual content::WebContents* GetWebContents() override; | 118 content::WebContents* GetWebContents() override; |
| 119 virtual ToolbarModel* GetToolbarModel() override; | 119 ToolbarModel* GetToolbarModel() override; |
| 120 virtual const ToolbarModel* GetToolbarModel() const override; | 120 const ToolbarModel* GetToolbarModel() const override; |
| 121 virtual InstantController* GetInstant() override; | 121 InstantController* GetInstant() override; |
| 122 virtual views::Widget* CreateViewsBubble( | 122 views::Widget* CreateViewsBubble( |
| 123 views::BubbleDelegateView* bubble_delegate) override; | 123 views::BubbleDelegateView* bubble_delegate) override; |
| 124 virtual PageActionImageView* CreatePageActionImageView( | 124 PageActionImageView* CreatePageActionImageView( |
| 125 LocationBarView* owner, ExtensionAction* action) override; | 125 LocationBarView* owner, |
| 126 virtual ContentSettingBubbleModelDelegate* | 126 ExtensionAction* action) override; |
| 127 GetContentSettingBubbleModelDelegate() override; | 127 ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate() |
| 128 virtual void ShowWebsiteSettings(content::WebContents* web_contents, | 128 override; |
| 129 const GURL& url, | 129 void ShowWebsiteSettings(content::WebContents* web_contents, |
| 130 const content::SSLStatus& ssl) override; | 130 const GURL& url, |
| 131 const content::SSLStatus& ssl) override; |
| 131 | 132 |
| 132 // CommandObserver: | 133 // CommandObserver: |
| 133 virtual void EnabledStateChangedForCommand(int id, bool enabled) override; | 134 void EnabledStateChangedForCommand(int id, bool enabled) override; |
| 134 | 135 |
| 135 // views::ButtonListener: | 136 // views::ButtonListener: |
| 136 virtual void ButtonPressed(views::Button* sender, | 137 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 137 const ui::Event& event) override; | |
| 138 | 138 |
| 139 // views::WidgetObserver: | 139 // views::WidgetObserver: |
| 140 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 140 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; |
| 141 bool visible) override; | 141 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
| 142 virtual void OnWidgetActivationChanged(views::Widget* widget, | |
| 143 bool active) override; | |
| 144 | 142 |
| 145 // content::NotificationObserver: | 143 // content::NotificationObserver: |
| 146 virtual void Observe(int type, | 144 void Observe(int type, |
| 147 const content::NotificationSource& source, | 145 const content::NotificationSource& source, |
| 148 const content::NotificationDetails& details) override; | 146 const content::NotificationDetails& details) override; |
| 149 | 147 |
| 150 // ui::AcceleratorProvider: | 148 // ui::AcceleratorProvider: |
| 151 virtual bool GetAcceleratorForCommandId( | 149 bool GetAcceleratorForCommandId(int command_id, |
| 152 int command_id, ui::Accelerator* accelerator) override; | 150 ui::Accelerator* accelerator) override; |
| 153 | 151 |
| 154 // views::View: | 152 // views::View: |
| 155 virtual gfx::Size GetPreferredSize() const override; | 153 gfx::Size GetPreferredSize() const override; |
| 156 virtual gfx::Size GetMinimumSize() const override; | 154 gfx::Size GetMinimumSize() const override; |
| 157 virtual void Layout() override; | 155 void Layout() override; |
| 158 virtual void OnPaint(gfx::Canvas* canvas) override; | 156 void OnPaint(gfx::Canvas* canvas) override; |
| 159 virtual void OnThemeChanged() override; | 157 void OnThemeChanged() override; |
| 160 virtual const char* GetClassName() const override; | 158 const char* GetClassName() const override; |
| 161 virtual bool AcceleratorPressed(const ui::Accelerator& acc) override; | 159 bool AcceleratorPressed(const ui::Accelerator& acc) override; |
| 162 | 160 |
| 163 // Whether the wrench/hotdogs menu is currently showing. | 161 // Whether the wrench/hotdogs menu is currently showing. |
| 164 bool IsWrenchMenuShowing() const; | 162 bool IsWrenchMenuShowing() const; |
| 165 | 163 |
| 166 // Whether the toolbar view needs its background painted by the | 164 // Whether the toolbar view needs its background painted by the |
| 167 // BrowserNonClientFrameView. | 165 // BrowserNonClientFrameView. |
| 168 bool ShouldPaintBackground() const; | 166 bool ShouldPaintBackground() const; |
| 169 | 167 |
| 170 enum { | 168 enum { |
| 171 // The apparent horizontal space between most items, and the vertical | 169 // The apparent horizontal space between most items, and the vertical |
| 172 // padding above and below them. | 170 // padding above and below them. |
| 173 kStandardSpacing = 3, | 171 kStandardSpacing = 3, |
| 174 | 172 |
| 175 // The top of the toolbar has an edge we have to skip over in addition to | 173 // The top of the toolbar has an edge we have to skip over in addition to |
| 176 // the standard spacing. | 174 // the standard spacing. |
| 177 kVertSpacing = 5, | 175 kVertSpacing = 5, |
| 178 }; | 176 }; |
| 179 | 177 |
| 180 protected: | 178 protected: |
| 181 // AccessiblePaneView: | 179 // AccessiblePaneView: |
| 182 virtual bool SetPaneFocusAndFocusDefault() override; | 180 bool SetPaneFocusAndFocusDefault() override; |
| 183 virtual void RemovePaneFocus() override; | 181 void RemovePaneFocus() override; |
| 184 | 182 |
| 185 private: | 183 private: |
| 186 // Types of display mode this toolbar can have. | 184 // Types of display mode this toolbar can have. |
| 187 enum DisplayMode { | 185 enum DisplayMode { |
| 188 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. | 186 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. |
| 189 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location | 187 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location |
| 190 // bar, used for popups. | 188 // bar, used for popups. |
| 191 }; | 189 }; |
| 192 | 190 |
| 193 // views::ViewTargeterDelegate: | 191 // views::ViewTargeterDelegate: |
| 194 virtual bool DoesIntersectRect(const views::View* target, | 192 bool DoesIntersectRect(const views::View* target, |
| 195 const gfx::Rect& rect) const override; | 193 const gfx::Rect& rect) const override; |
| 196 | 194 |
| 197 // WrenchMenuBadgeController::Delegate: | 195 // WrenchMenuBadgeController::Delegate: |
| 198 virtual void UpdateBadgeSeverity(WrenchMenuBadgeController::BadgeType type, | 196 void UpdateBadgeSeverity(WrenchMenuBadgeController::BadgeType type, |
| 199 WrenchIconPainter::Severity severity, | 197 WrenchIconPainter::Severity severity, |
| 200 bool animate) override; | 198 bool animate) override; |
| 201 | 199 |
| 202 // Returns the number of pixels above the location bar in non-normal display. | 200 // Returns the number of pixels above the location bar in non-normal display. |
| 203 int PopupTopSpacing() const; | 201 int PopupTopSpacing() const; |
| 204 | 202 |
| 205 // Given toolbar contents of size |size|, returns the total toolbar size. | 203 // Given toolbar contents of size |size|, returns the total toolbar size. |
| 206 gfx::Size SizeForContentSize(gfx::Size size) const; | 204 gfx::Size SizeForContentSize(gfx::Size size) const; |
| 207 | 205 |
| 208 // Loads the images for all the child views. | 206 // Loads the images for all the child views. |
| 209 void LoadImages(); | 207 void LoadImages(); |
| 210 | 208 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 252 |
| 255 // A list of listeners to call when the menu opens. | 253 // A list of listeners to call when the menu opens. |
| 256 ObserverList<views::MenuListener> menu_listeners_; | 254 ObserverList<views::MenuListener> menu_listeners_; |
| 257 | 255 |
| 258 content::NotificationRegistrar registrar_; | 256 content::NotificationRegistrar registrar_; |
| 259 | 257 |
| 260 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 258 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
| 261 }; | 259 }; |
| 262 | 260 |
| 263 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 261 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
| OLD | NEW |