Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/command_observer.h" | 12 #include "chrome/browser/command_observer.h" |
| 13 #include "chrome/browser/ui/toolbar/app_menu_badge_controller.h" | 13 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" |
| 14 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 14 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
| 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 16 #include "components/prefs/pref_member.h" | 16 #include "components/prefs/pref_member.h" |
| 17 #include "ui/base/accelerators/accelerator.h" | 17 #include "ui/base/accelerators/accelerator.h" |
| 18 #include "ui/views/accessible_pane_view.h" | 18 #include "ui/views/accessible_pane_view.h" |
| 19 #include "ui/views/controls/button/menu_button.h" | 19 #include "ui/views/controls/button/menu_button.h" |
| 20 #include "ui/views/controls/button/menu_button_listener.h" | 20 #include "ui/views/controls/button/menu_button_listener.h" |
| 21 #include "ui/views/view.h" | 21 #include "ui/views/view.h" |
| 22 | 22 |
| 23 class AppMenuButton; | 23 class AppMenuButton; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 35 | 35 |
| 36 // The Browser Window's toolbar. | 36 // The Browser Window's toolbar. |
| 37 class ToolbarView : public views::AccessiblePaneView, | 37 class ToolbarView : public views::AccessiblePaneView, |
| 38 public views::MenuButtonListener, | 38 public views::MenuButtonListener, |
| 39 public ui::AcceleratorProvider, | 39 public ui::AcceleratorProvider, |
| 40 public LocationBarView::Delegate, | 40 public LocationBarView::Delegate, |
| 41 public content::NotificationObserver, | 41 public content::NotificationObserver, |
| 42 public CommandObserver, | 42 public CommandObserver, |
| 43 public views::ButtonListener, | 43 public views::ButtonListener, |
| 44 public views::ViewTargeterDelegate, | 44 public views::ViewTargeterDelegate, |
| 45 public AppMenuBadgeController::Delegate { | 45 public AppMenuIconController::Delegate { |
| 46 public: | 46 public: |
| 47 // The view class name. | 47 // The view class name. |
| 48 static const char kViewClassName[]; | 48 static const char kViewClassName[]; |
| 49 | 49 |
| 50 explicit ToolbarView(Browser* browser); | 50 explicit ToolbarView(Browser* browser); |
| 51 ~ToolbarView() override; | 51 ~ToolbarView() override; |
| 52 | 52 |
| 53 // Create the contents of the Browser Toolbar. | 53 // Create the contents of the Browser Toolbar. |
| 54 void Init(); | 54 void Init(); |
| 55 | 55 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 // Returns the maximum width the browser actions container can have. | 89 // Returns the maximum width the browser actions container can have. |
| 90 int GetMaxBrowserActionsWidth() const; | 90 int GetMaxBrowserActionsWidth() const; |
| 91 | 91 |
| 92 // Accessors. | 92 // Accessors. |
| 93 Browser* browser() const { return browser_; } | 93 Browser* browser() const { return browser_; } |
| 94 BrowserActionsContainer* browser_actions() const { return browser_actions_; } | 94 BrowserActionsContainer* browser_actions() const { return browser_actions_; } |
| 95 ReloadButton* reload_button() const { return reload_; } | 95 ReloadButton* reload_button() const { return reload_; } |
| 96 LocationBarView* location_bar() const { return location_bar_; } | 96 LocationBarView* location_bar() const { return location_bar_; } |
| 97 AppMenuButton* app_menu_button() const { return app_menu_button_; } | 97 AppMenuButton* app_menu_button() const { return app_menu_button_; } |
| 98 HomeButton* home_button() const { return home_; } | 98 HomeButton* home_button() const { return home_; } |
| 99 AppMenuBadgeController* app_menu_badge_controller() { | 99 AppMenuIconController* app_menu_icon_controller() { |
| 100 return &badge_controller_; | 100 return &icon_controller_; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // AccessiblePaneView: | 103 // AccessiblePaneView: |
| 104 bool SetPaneFocus(View* initial_focus) override; | 104 bool SetPaneFocus(View* initial_focus) override; |
| 105 void GetAccessibleState(ui::AXViewState* state) override; | 105 void GetAccessibleState(ui::AXViewState* state) override; |
| 106 | 106 |
| 107 // views::MenuButtonListener: | 107 // views::MenuButtonListener: |
| 108 void OnMenuButtonClicked(views::MenuButton* source, | 108 void OnMenuButtonClicked(views::MenuButton* source, |
| 109 const gfx::Point& point, | 109 const gfx::Point& point, |
| 110 const ui::Event* event) override; | 110 const ui::Event* event) override; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 enum DisplayMode { | 157 enum DisplayMode { |
| 158 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. | 158 DISPLAYMODE_NORMAL, // Normal toolbar with buttons, etc. |
| 159 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location | 159 DISPLAYMODE_LOCATION // Slimline toolbar showing only compact location |
| 160 // bar, used for popups. | 160 // bar, used for popups. |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // views::ViewTargeterDelegate: | 163 // views::ViewTargeterDelegate: |
| 164 bool DoesIntersectRect(const views::View* target, | 164 bool DoesIntersectRect(const views::View* target, |
| 165 const gfx::Rect& rect) const override; | 165 const gfx::Rect& rect) const override; |
| 166 | 166 |
| 167 // AppMenuBadgeController::Delegate: | 167 // AppMenuIconController::Delegate: |
| 168 void UpdateBadgeSeverity(AppMenuBadgeController::BadgeType type, | 168 void UpdateIconSeverity(AppMenuIconController::IconType type, |
|
Evan Stade
2016/06/10 18:01:57
in cases like this I would go ahead and remove the
kylix_rd
2016/06/10 19:08:53
Done.
| |
| 169 AppMenuIconPainter::Severity severity, | 169 AppMenuIconPainter::Severity severity, |
| 170 bool animate) override; | 170 bool animate) override; |
| 171 | 171 |
| 172 // Used to avoid duplicating the near-identical logic of | 172 // Used to avoid duplicating the near-identical logic of |
| 173 // ToolbarView::GetPreferredSize() and ToolbarView::GetMinimumSize(). These | 173 // ToolbarView::GetPreferredSize() and ToolbarView::GetMinimumSize(). These |
| 174 // two functions call through to GetSizeInternal(), passing themselves as the | 174 // two functions call through to GetSizeInternal(), passing themselves as the |
| 175 // function pointer |View::*get_size|. | 175 // function pointer |View::*get_size|. |
| 176 gfx::Size GetSizeInternal(gfx::Size (View::*get_size)() const) const; | 176 gfx::Size GetSizeInternal(gfx::Size (View::*get_size)() const) const; |
| 177 | 177 |
| 178 // Given toolbar contents of size |size|, returns the total toolbar size. | 178 // Given toolbar contents of size |size|, returns the total toolbar size. |
| 179 gfx::Size SizeForContentSize(gfx::Size size) const; | 179 gfx::Size SizeForContentSize(gfx::Size size) const; |
| 180 | 180 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 201 BackButton* back_; | 201 BackButton* back_; |
| 202 ToolbarButton* forward_; | 202 ToolbarButton* forward_; |
| 203 ReloadButton* reload_; | 203 ReloadButton* reload_; |
| 204 HomeButton* home_; | 204 HomeButton* home_; |
| 205 LocationBarView* location_bar_; | 205 LocationBarView* location_bar_; |
| 206 BrowserActionsContainer* browser_actions_; | 206 BrowserActionsContainer* browser_actions_; |
| 207 AppMenuButton* app_menu_button_; | 207 AppMenuButton* app_menu_button_; |
| 208 | 208 |
| 209 Browser* browser_; | 209 Browser* browser_; |
| 210 | 210 |
| 211 AppMenuBadgeController badge_controller_; | 211 AppMenuIconController icon_controller_; |
|
Evan Stade
2016/06/10 18:01:57
can you rename to app_menu_icon_controller_? In th
kylix_rd
2016/06/10 19:08:53
Done.
| |
| 212 | 212 |
| 213 // Controls whether or not a home button should be shown on the toolbar. | 213 // Controls whether or not a home button should be shown on the toolbar. |
| 214 BooleanPrefMember show_home_button_; | 214 BooleanPrefMember show_home_button_; |
| 215 | 215 |
| 216 // The display mode used when laying out the toolbar. | 216 // The display mode used when laying out the toolbar. |
| 217 const DisplayMode display_mode_; | 217 const DisplayMode display_mode_; |
| 218 | 218 |
| 219 content::NotificationRegistrar registrar_; | 219 content::NotificationRegistrar registrar_; |
| 220 | 220 |
| 221 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 221 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ | 224 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_ |
| OLD | NEW |