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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 virtual void SetPopupOwner(BrowserActionView* popup_owner) OVERRIDE; | 237 virtual void SetPopupOwner(BrowserActionView* popup_owner) OVERRIDE; |
238 virtual void HideActivePopup() OVERRIDE; | 238 virtual void HideActivePopup() OVERRIDE; |
239 | 239 |
240 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: | 240 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: |
241 virtual extensions::ActiveTabPermissionGranter* | 241 virtual extensions::ActiveTabPermissionGranter* |
242 GetActiveTabPermissionGranter() OVERRIDE; | 242 GetActiveTabPermissionGranter() OVERRIDE; |
243 | 243 |
244 // Moves a browser action with |id| to |new_index|. | 244 // Moves a browser action with |id| to |new_index|. |
245 void MoveBrowserAction(const std::string& extension_id, size_t new_index); | 245 void MoveBrowserAction(const std::string& extension_id, size_t new_index); |
246 | 246 |
247 // Shows the popup for |extension| if possible. Returns true if a new popup | |
248 // was shown. Showing the popup will grant active tab permissions if | |
249 // |grant_tab_permissions| is true. Only pass true for this argument for | |
250 // popups triggered interactively, not popups triggered by an API. | |
251 // If |can_override| is true, this popup can override other popups (hiding | |
252 // them) and does not have to be in the active window. | |
253 bool ShowPopupForExtension(const extensions::Extension* extension, | |
254 bool grant_tab_permissions, | |
255 bool can_override); | |
256 | |
257 // Retrieve the current popup. This should only be used by unit tests. | 247 // Retrieve the current popup. This should only be used by unit tests. |
258 ExtensionPopup* TestGetPopup(); | 248 ExtensionPopup* TestGetPopup(); |
259 | 249 |
260 // Set how many icons the container should show. This should only be used by | 250 // Set how many icons the container should show. This should only be used by |
261 // unit tests. | 251 // unit tests. |
262 void TestSetIconVisibilityCount(size_t icons); | 252 void TestSetIconVisibilityCount(size_t icons); |
263 | 253 |
264 // During testing we can disable animations by setting this flag to true, | 254 // During testing we can disable animations by setting this flag to true, |
265 // so that the bar resizes instantly, instead of having to poll it while it | 255 // so that the bar resizes instantly, instead of having to poll it while it |
266 // animates to open/closed status. | 256 // animates to open/closed status. |
(...skipping 24 matching lines...) Expand all Loading... |
291 // extensions::ExtensionToolbarModel::Observer implementation. | 281 // extensions::ExtensionToolbarModel::Observer implementation. |
292 virtual void ToolbarExtensionAdded(const extensions::Extension* extension, | 282 virtual void ToolbarExtensionAdded(const extensions::Extension* extension, |
293 int index) OVERRIDE; | 283 int index) OVERRIDE; |
294 virtual void ToolbarExtensionRemoved( | 284 virtual void ToolbarExtensionRemoved( |
295 const extensions::Extension* extension) OVERRIDE; | 285 const extensions::Extension* extension) OVERRIDE; |
296 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, | 286 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, |
297 int index) OVERRIDE; | 287 int index) OVERRIDE; |
298 virtual void ToolbarExtensionUpdated( | 288 virtual void ToolbarExtensionUpdated( |
299 const extensions::Extension* extension) OVERRIDE; | 289 const extensions::Extension* extension) OVERRIDE; |
300 virtual bool ShowExtensionActionPopup( | 290 virtual bool ShowExtensionActionPopup( |
301 const extensions::Extension* extension) OVERRIDE; | 291 const extensions::Extension* extension, |
| 292 bool grant_active_tab) OVERRIDE; |
302 virtual void ToolbarVisibleCountChanged() OVERRIDE; | 293 virtual void ToolbarVisibleCountChanged() OVERRIDE; |
303 virtual void ToolbarHighlightModeChanged(bool is_highlighting) OVERRIDE; | 294 virtual void ToolbarHighlightModeChanged(bool is_highlighting) OVERRIDE; |
| 295 virtual Browser* GetBrowser() OVERRIDE; |
304 | 296 |
305 void LoadImages(); | 297 void LoadImages(); |
306 | 298 |
307 // Called when a browser action's visibility may have changed. | 299 // Called when a browser action's visibility may have changed. |
308 void OnBrowserActionVisibilityChanged(); | 300 void OnBrowserActionVisibilityChanged(); |
309 | 301 |
310 // Sets the initial container width. | 302 // Sets the initial container width. |
311 void SetContainerWidth(); | 303 void SetContainerWidth(); |
312 | 304 |
313 // Closes the overflow menu if open. | 305 // Closes the overflow menu if open. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 423 |
432 // Handles delayed showing of the overflow menu when hovering. | 424 // Handles delayed showing of the overflow menu when hovering. |
433 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; | 425 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; |
434 | 426 |
435 ObserverList<BrowserActionsContainerObserver> observers_; | 427 ObserverList<BrowserActionsContainerObserver> observers_; |
436 | 428 |
437 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 429 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
438 }; | 430 }; |
439 | 431 |
440 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 432 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |