Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1208)

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.h

Issue 1004063003: [Extensions] Add logic for when to show the toolbar redesign bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/scoped_observer.h" 10 #include "base/scoped_observer.h"
11 #include "chrome/browser/extensions/extension_toolbar_model.h" 11 #include "chrome/browser/extensions/extension_toolbar_model.h"
12 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" 12 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h"
13 #include "ui/gfx/animation/tween.h" 13 #include "ui/gfx/animation/tween.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 class Extension; 17 class Extension;
18 } 18 }
19 19
20 namespace user_prefs {
21 class PrefRegistrySyncable;
22 }
23
20 class ToolbarActionsBarDelegate; 24 class ToolbarActionsBarDelegate;
21 class ToolbarActionViewController; 25 class ToolbarActionViewController;
22 26
23 // A platform-independent version of the container for toolbar actions, 27 // A platform-independent version of the container for toolbar actions,
24 // including extension actions and component actions. 28 // including extension actions and component actions.
25 // This class manages the order of the actions, the actions' state, and owns the 29 // This class manages the order of the actions, the actions' state, and owns the
26 // action controllers, in addition to (for extensions) interfacing with the 30 // action controllers, in addition to (for extensions) interfacing with the
27 // extension toolbar model. Further, it manages dimensions for the bar, 31 // extension toolbar model. Further, it manages dimensions for the bar,
28 // excluding animations. 32 // excluding animations.
29 // This can come in two flavors, main and "overflow". The main bar is visible 33 // This can come in two flavors, main and "overflow". The main bar is visible
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 ToolbarActionsBar* main_bar); 70 ToolbarActionsBar* main_bar);
67 ~ToolbarActionsBar() override; 71 ~ToolbarActionsBar() override;
68 72
69 // Returns the width of a browser action icon, optionally including the 73 // Returns the width of a browser action icon, optionally including the
70 // following padding. 74 // following padding.
71 static int IconWidth(bool include_padding); 75 static int IconWidth(bool include_padding);
72 76
73 // Returns the height of a browser action icon. 77 // Returns the height of a browser action icon.
74 static int IconHeight(); 78 static int IconHeight();
75 79
80 // Registers profile preferences.
81 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
82
76 // Returns the preferred size for the toolbar; this does *not* reflect any 83 // Returns the preferred size for the toolbar; this does *not* reflect any
77 // animations that may be running. 84 // animations that may be running.
78 gfx::Size GetPreferredSize() const; 85 gfx::Size GetPreferredSize() const;
79 86
80 // Returns the [minimum|maximum] possible width for the toolbar. 87 // Returns the [minimum|maximum] possible width for the toolbar.
81 int GetMinimumWidth() const; 88 int GetMinimumWidth() const;
82 int GetMaximumWidth() const; 89 int GetMaximumWidth() const;
83 90
84 // Returns the width for the given number of icons. 91 // Returns the width for the given number of icons.
85 int IconCountToWidth(int icons) const; 92 int IconCountToWidth(int icons) const;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void OnToolbarExtensionUpdated( 170 void OnToolbarExtensionUpdated(
164 const extensions::Extension* extension) override; 171 const extensions::Extension* extension) override;
165 bool ShowExtensionActionPopup(const extensions::Extension* extension, 172 bool ShowExtensionActionPopup(const extensions::Extension* extension,
166 bool grant_active_tab) override; 173 bool grant_active_tab) override;
167 void OnToolbarVisibleCountChanged() override; 174 void OnToolbarVisibleCountChanged() override;
168 void OnToolbarHighlightModeChanged(bool is_highlighting) override; 175 void OnToolbarHighlightModeChanged(bool is_highlighting) override;
169 void OnToolbarModelInitialized() override; 176 void OnToolbarModelInitialized() override;
170 Browser* GetBrowser() override; 177 Browser* GetBrowser() override;
171 178
172 // ToolbarActionsBarBubbleDelegate: 179 // ToolbarActionsBarBubbleDelegate:
180 void OnToolbarActionsBarBubbleShown() override;
173 void OnToolbarActionsBarBubbleClosed(CloseAction action) override; 181 void OnToolbarActionsBarBubbleClosed(CloseAction action) override;
174 182
175 // Resizes the delegate (if necessary) to the preferred size using the given 183 // Resizes the delegate (if necessary) to the preferred size using the given
176 // |tween_type| and optionally suppressing the chevron. 184 // |tween_type| and optionally suppressing the chevron.
177 void ResizeDelegate(gfx::Tween::Type tween_type, bool suppress_chevron); 185 void ResizeDelegate(gfx::Tween::Type tween_type, bool suppress_chevron);
178 186
179 // Returns the action for the given |id|, if one exists. 187 // Returns the action for the given |id|, if one exists.
180 ToolbarActionViewController* GetActionForId(const std::string& id); 188 ToolbarActionViewController* GetActionForId(const std::string& id);
181 189
182 // Returns the current web contents. 190 // Returns the current web contents.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // alter. 244 // alter.
237 static bool send_overflowed_action_changes_; 245 static bool send_overflowed_action_changes_;
238 246
239 // True if an action in the overflow menu wants to run. 247 // True if an action in the overflow menu wants to run.
240 bool overflowed_action_wants_to_run_; 248 bool overflowed_action_wants_to_run_;
241 249
242 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); 250 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar);
243 }; 251 };
244 252
245 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ 253 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698