| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 void ToolbarExtensionAdded(const extensions::Extension* extension, | 278 void ToolbarExtensionAdded(const extensions::Extension* extension, |
| 279 int index) override; | 279 int index) override; |
| 280 void ToolbarExtensionRemoved(const extensions::Extension* extension) override; | 280 void ToolbarExtensionRemoved(const extensions::Extension* extension) override; |
| 281 void ToolbarExtensionMoved(const extensions::Extension* extension, | 281 void ToolbarExtensionMoved(const extensions::Extension* extension, |
| 282 int index) override; | 282 int index) override; |
| 283 void ToolbarExtensionUpdated(const extensions::Extension* extension) override; | 283 void ToolbarExtensionUpdated(const extensions::Extension* extension) override; |
| 284 bool ShowExtensionActionPopup(const extensions::Extension* extension, | 284 bool ShowExtensionActionPopup(const extensions::Extension* extension, |
| 285 bool grant_active_tab) override; | 285 bool grant_active_tab) override; |
| 286 void ToolbarVisibleCountChanged() override; | 286 void ToolbarVisibleCountChanged() override; |
| 287 void ToolbarHighlightModeChanged(bool is_highlighting) override; | 287 void ToolbarHighlightModeChanged(bool is_highlighting) override; |
| 288 void OnToolbarReorderNecessary(content::WebContents* web_contents) override; |
| 288 Browser* GetBrowser() override; | 289 Browser* GetBrowser() override; |
| 289 | 290 |
| 290 void LoadImages(); | 291 void LoadImages(); |
| 291 | 292 |
| 292 // Called when a browser action's visibility may have changed. | 293 // Called when a browser action's visibility may have changed. |
| 293 void OnBrowserActionVisibilityChanged(); | 294 void OnBrowserActionVisibilityChanged(); |
| 294 | 295 |
| 295 // Returns the preferred width of the container in order to show all icons | 296 // Returns the preferred width of the container in order to show all icons |
| 296 // that should be visible and, optionally, the chevron. | 297 // that should be visible and, optionally, the chevron. |
| 297 int GetPreferredWidth(); | 298 int GetPreferredWidth(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 312 size_t WidthToIconCount(int pixels) const; | 313 size_t WidthToIconCount(int pixels) const; |
| 313 | 314 |
| 314 // Returns the absolute minimum size you can shrink the container down to and | 315 // Returns the absolute minimum size you can shrink the container down to and |
| 315 // still show it. If there's no chevron (i.e., there's a separate overflow | 316 // still show it. If there's no chevron (i.e., there's a separate overflow |
| 316 // container), this leaves only enough room for the resize area; otherwise, | 317 // container), this leaves only enough room for the resize area; otherwise, |
| 317 // this assumes a visible chevron because the only way we would not have a | 318 // this assumes a visible chevron because the only way we would not have a |
| 318 // chevron when shrinking down this far is if there were no icons, in which | 319 // chevron when shrinking down this far is if there were no icons, in which |
| 319 // case the container wouldn't be shown at all. | 320 // case the container wouldn't be shown at all. |
| 320 int MinimumNonemptyWidth() const; | 321 int MinimumNonemptyWidth() const; |
| 321 | 322 |
| 322 // Animate to the target size (unless testing, in which case we go straight to | 323 // Animates to the target size (unless testing, in which case we go straight |
| 323 // the target size). | 324 // to the target size). |
| 324 void Animate(gfx::Tween::Type type, size_t num_visible_icons); | 325 void Animate(gfx::Tween::Type type, size_t num_visible_icons); |
| 325 | 326 |
| 327 // Reorders the views to match the toolbar model for the active tab. |
| 328 void ReorderViews(); |
| 329 |
| 326 // Returns the number of icons that this container should draw. This differs | 330 // Returns the number of icons that this container should draw. This differs |
| 327 // from the model's GetVisibleIconCount if this container is for the overflow. | 331 // from the model's visible_icon_count if this container is for the overflow. |
| 328 size_t GetIconCount() const; | 332 size_t GetIconCount() const; |
| 329 | 333 |
| 330 // Whether this container is in overflow mode (as opposed to in 'main' | 334 // Whether this container is in overflow mode (as opposed to in 'main' |
| 331 // mode). See class comments for details on the difference. | 335 // mode). See class comments for details on the difference. |
| 332 bool in_overflow_mode() const { return main_container_ != NULL; } | 336 bool in_overflow_mode() const { return main_container_ != NULL; } |
| 333 | 337 |
| 334 // Whether or not the container has been initialized. | 338 // Whether or not the container has been initialized. |
| 335 bool initialized_; | 339 bool initialized_; |
| 336 | 340 |
| 337 // The vector of browser actions (icons/image buttons for each action). Note | 341 // The vector of browser actions (icons/image buttons for each action). Note |
| (...skipping 30 matching lines...) Expand all Loading... |
| 368 | 372 |
| 369 // The painter used when we are highlighting a subset of extensions. | 373 // The painter used when we are highlighting a subset of extensions. |
| 370 scoped_ptr<views::Painter> highlight_painter_; | 374 scoped_ptr<views::Painter> highlight_painter_; |
| 371 | 375 |
| 372 // The animation that happens when the container snaps to place. | 376 // The animation that happens when the container snaps to place. |
| 373 scoped_ptr<gfx::SlideAnimation> resize_animation_; | 377 scoped_ptr<gfx::SlideAnimation> resize_animation_; |
| 374 | 378 |
| 375 // Don't show the chevron while animating. | 379 // Don't show the chevron while animating. |
| 376 bool suppress_chevron_; | 380 bool suppress_chevron_; |
| 377 | 381 |
| 382 // True if we should suppress animation; we typically do this e.g. when |
| 383 // switching tabs changes the state of the icons. |
| 384 bool suppress_animation_; |
| 385 |
| 386 // True if we should suppress layout, such as when we are creating or |
| 387 // adjusting a lot of views. |
| 388 bool suppress_layout_; |
| 389 |
| 378 // This is used while the user is resizing (and when the animations are in | 390 // This is used while the user is resizing (and when the animations are in |
| 379 // progress) to know how wide the delta is between the current state and what | 391 // progress) to know how wide the delta is between the current state and what |
| 380 // we should draw. | 392 // we should draw. |
| 381 int resize_amount_; | 393 int resize_amount_; |
| 382 | 394 |
| 383 // Keeps track of the absolute pixel width the container should have when we | 395 // Keeps track of the absolute pixel width the container should have when we |
| 384 // are done animating. | 396 // are done animating. |
| 385 int animation_target_size_; | 397 int animation_target_size_; |
| 386 | 398 |
| 387 // The DropPosition for the current drag-and-drop operation, or NULL if there | 399 // The DropPosition for the current drag-and-drop operation, or NULL if there |
| 388 // is none. | 400 // is none. |
| 389 scoped_ptr<DropPosition> drop_position_; | 401 scoped_ptr<DropPosition> drop_position_; |
| 390 | 402 |
| 391 // The class that registers for keyboard shortcuts for extension commands. | 403 // The class that registers for keyboard shortcuts for extension commands. |
| 392 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 404 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
| 393 | 405 |
| 394 ObserverList<BrowserActionsContainerObserver> observers_; | 406 ObserverList<BrowserActionsContainerObserver> observers_; |
| 395 | 407 |
| 396 // The maximum number of icons to show per row when in overflow mode (showing | 408 // The maximum number of icons to show per row when in overflow mode (showing |
| 397 // icons in the application menu). | 409 // icons in the application menu). |
| 398 static int icons_per_overflow_menu_row_; | 410 static int icons_per_overflow_menu_row_; |
| 399 | 411 |
| 400 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 412 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
| 401 }; | 413 }; |
| 402 | 414 |
| 403 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 415 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
| OLD | NEW |