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_BROWSER_ACTIONS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
7 | 7 |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 9 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
10 #include "chrome/browser/extensions/extension_toolbar_model.h" | 10 #include "chrome/browser/extensions/extension_toolbar_model.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // The class that registers for keyboard shortcuts for extension commands. | 157 // The class that registers for keyboard shortcuts for extension commands. |
158 extensions::ExtensionKeybindingRegistry* extension_keybinding_registry() { | 158 extensions::ExtensionKeybindingRegistry* extension_keybinding_registry() { |
159 return extension_keybinding_registry_.get(); | 159 return extension_keybinding_registry_.get(); |
160 } | 160 } |
161 | 161 |
162 // Get a particular browser action view. | 162 // Get a particular browser action view. |
163 BrowserActionView* GetBrowserActionViewAt(int index) { | 163 BrowserActionView* GetBrowserActionViewAt(int index) { |
164 return browser_action_views_[index]; | 164 return browser_action_views_[index]; |
165 } | 165 } |
166 | 166 |
| 167 // Returns the ID of the action represented by the view at |index|. |
| 168 const std::string& GetIdAt(size_t index); |
| 169 |
167 // Returns the BrowserActionView* associated with the given |extension|, or | 170 // Returns the BrowserActionView* associated with the given |extension|, or |
168 // NULL if none exists. | 171 // NULL if none exists. |
169 BrowserActionView* GetViewForExtension( | 172 BrowserActionView* GetViewForExtension( |
170 const extensions::Extension* extension); | 173 const extensions::Extension* extension); |
171 | 174 |
172 // Update the views to reflect the state of the browser action icons. | 175 // Update the views to reflect the state of the browser action icons. |
173 void RefreshBrowserActionViews(); | 176 void RefreshBrowserActionViews(); |
174 | 177 |
175 // Sets up the browser action view vector. | 178 // Sets up the browser action view vector. |
176 void CreateBrowserActionViews(); | 179 void CreateBrowserActionViews(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 234 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
232 virtual void AnimationEnded(const gfx::Animation* animation) override; | 235 virtual void AnimationEnded(const gfx::Animation* animation) override; |
233 | 236 |
234 // Overridden from BrowserActionView::Delegate: | 237 // Overridden from BrowserActionView::Delegate: |
235 virtual content::WebContents* GetCurrentWebContents() override; | 238 virtual content::WebContents* GetCurrentWebContents() override; |
236 virtual bool ShownInsideMenu() const override; | 239 virtual bool ShownInsideMenu() const override; |
237 virtual void OnBrowserActionViewDragDone() override; | 240 virtual void OnBrowserActionViewDragDone() override; |
238 virtual views::MenuButton* GetOverflowReferenceView() override; | 241 virtual views::MenuButton* GetOverflowReferenceView() override; |
239 virtual void SetPopupOwner(BrowserActionView* popup_owner) override; | 242 virtual void SetPopupOwner(BrowserActionView* popup_owner) override; |
240 virtual void HideActivePopup() override; | 243 virtual void HideActivePopup() override; |
241 virtual BrowserActionView* GetMainViewForExtension( | 244 virtual BrowserActionView* GetMainViewForAction( |
242 const extensions::Extension* extension) override; | 245 BrowserActionView* view) override; |
243 | 246 |
244 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: | 247 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: |
245 virtual extensions::ActiveTabPermissionGranter* | 248 virtual extensions::ActiveTabPermissionGranter* |
246 GetActiveTabPermissionGranter() override; | 249 GetActiveTabPermissionGranter() override; |
247 | 250 |
248 // Retrieve the current popup. This should only be used by unit tests. | 251 // Retrieve the current popup. This should only be used by unit tests. |
249 ExtensionPopup* TestGetPopup(); | 252 gfx::NativeView TestGetPopup(); |
250 | 253 |
251 // Returns the width of an icon, optionally with its padding. | 254 // Returns the width of an icon, optionally with its padding. |
252 static int IconWidth(bool include_padding); | 255 static int IconWidth(bool include_padding); |
253 | 256 |
254 // Returns the height of an icon. | 257 // Returns the height of an icon. |
255 static int IconHeight(); | 258 static int IconHeight(); |
256 | 259 |
257 // During testing we can disable animations by setting this flag to true, | 260 // During testing we can disable animations by setting this flag to true, |
258 // so that the bar resizes instantly, instead of having to poll it while it | 261 // so that the bar resizes instantly, instead of having to poll it while it |
259 // animates to open/closed status. | 262 // animates to open/closed status. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 ObserverList<BrowserActionsContainerObserver> observers_; | 398 ObserverList<BrowserActionsContainerObserver> observers_; |
396 | 399 |
397 // The maximum number of icons to show per row when in overflow mode (showing | 400 // The maximum number of icons to show per row when in overflow mode (showing |
398 // icons in the application menu). | 401 // icons in the application menu). |
399 static int icons_per_overflow_menu_row_; | 402 static int icons_per_overflow_menu_row_; |
400 | 403 |
401 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 404 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
402 }; | 405 }; |
403 | 406 |
404 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 407 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |