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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 const gfx::Point& p) override; | 228 const gfx::Point& p) override; |
229 | 229 |
230 // Overridden from views::ResizeAreaDelegate: | 230 // Overridden from views::ResizeAreaDelegate: |
231 virtual void OnResize(int resize_amount, bool done_resizing) override; | 231 virtual void OnResize(int resize_amount, bool done_resizing) override; |
232 | 232 |
233 // Overridden from gfx::AnimationDelegate: | 233 // Overridden from gfx::AnimationDelegate: |
234 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 234 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
235 virtual void AnimationEnded(const gfx::Animation* animation) override; | 235 virtual void AnimationEnded(const gfx::Animation* animation) override; |
236 | 236 |
237 // Overridden from BrowserActionView::Delegate: | 237 // Overridden from BrowserActionView::Delegate: |
238 virtual content::WebContents* GetCurrentWebContents() override; | 238 virtual content::WebContents* GetCurrentWebContents() const override; |
239 virtual bool ShownInsideMenu() const override; | 239 virtual bool ShownInsideMenu() const override; |
240 virtual void OnBrowserActionViewDragDone() override; | 240 virtual void OnBrowserActionViewDragDone() override; |
241 virtual views::MenuButton* GetOverflowReferenceView() override; | 241 virtual views::MenuButton* GetOverflowReferenceView() override; |
242 virtual void SetPopupOwner(BrowserActionView* popup_owner) override; | 242 virtual void SetPopupOwner(BrowserActionView* popup_owner) override; |
243 virtual void HideActivePopup() override; | 243 virtual void HideActivePopup() override; |
244 virtual BrowserActionView* GetMainViewForAction( | 244 virtual BrowserActionView* GetMainViewForAction( |
245 BrowserActionView* view) override; | 245 BrowserActionView* view) override; |
246 | 246 |
247 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: | 247 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: |
248 virtual extensions::ActiveTabPermissionGranter* | 248 virtual extensions::ActiveTabPermissionGranter* |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 const extensions::Extension* extension) override; | 282 const extensions::Extension* extension) override; |
283 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, | 283 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, |
284 int index) override; | 284 int index) override; |
285 virtual void ToolbarExtensionUpdated( | 285 virtual void ToolbarExtensionUpdated( |
286 const extensions::Extension* extension) override; | 286 const extensions::Extension* extension) override; |
287 virtual bool ShowExtensionActionPopup( | 287 virtual bool ShowExtensionActionPopup( |
288 const extensions::Extension* extension, | 288 const extensions::Extension* extension, |
289 bool grant_active_tab) override; | 289 bool grant_active_tab) override; |
290 virtual void ToolbarVisibleCountChanged() override; | 290 virtual void ToolbarVisibleCountChanged() override; |
291 virtual void ToolbarHighlightModeChanged(bool is_highlighting) override; | 291 virtual void ToolbarHighlightModeChanged(bool is_highlighting) override; |
| 292 virtual void ToolbarReorderNecessary(content::WebContents* web_contents) |
| 293 override; |
292 virtual Browser* GetBrowser() override; | 294 virtual Browser* GetBrowser() override; |
293 | 295 |
294 void LoadImages(); | 296 void LoadImages(); |
295 | 297 |
296 // Called when a browser action's visibility may have changed. | 298 // Called when a browser action's visibility may have changed. |
297 void OnBrowserActionVisibilityChanged(); | 299 void OnBrowserActionVisibilityChanged(); |
298 | 300 |
299 // Returns the preferred width of the container in order to show all icons | 301 // Returns the preferred width of the container in order to show all icons |
300 // that should be visible and, optionally, the chevron. | 302 // that should be visible and, optionally, the chevron. |
301 int GetPreferredWidth(); | 303 int GetPreferredWidth(); |
(...skipping 18 matching lines...) Expand all Loading... |
320 // container), this leaves only enough room for the resize area; otherwise, | 322 // container), this leaves only enough room for the resize area; otherwise, |
321 // this assumes a visible chevron because the only way we would not have a | 323 // this assumes a visible chevron because the only way we would not have a |
322 // chevron when shrinking down this far is if there were no icons, in which | 324 // chevron when shrinking down this far is if there were no icons, in which |
323 // case the container wouldn't be shown at all. | 325 // case the container wouldn't be shown at all. |
324 int MinimumNonemptyWidth() const; | 326 int MinimumNonemptyWidth() const; |
325 | 327 |
326 // Animate to the target size (unless testing, in which case we go straight to | 328 // Animate to the target size (unless testing, in which case we go straight to |
327 // the target size). | 329 // the target size). |
328 void Animate(gfx::Tween::Type type, size_t num_visible_icons); | 330 void Animate(gfx::Tween::Type type, size_t num_visible_icons); |
329 | 331 |
| 332 // Reorder the views to match the toolbar model for the active tab. |
| 333 void ReorderViews(); |
| 334 |
330 // Returns the number of icons that this container should draw. This differs | 335 // Returns the number of icons that this container should draw. This differs |
331 // from the model's GetVisibleIconCount if this container is for the overflow. | 336 // from the model's GetVisibleIconCount if this container is for the overflow. |
332 size_t GetIconCount() const; | 337 size_t GetIconCount() const; |
333 | 338 |
334 // Whether this container is in overflow mode (as opposed to in 'main' | 339 // Whether this container is in overflow mode (as opposed to in 'main' |
335 // mode). See class comments for details on the difference. | 340 // mode). See class comments for details on the difference. |
336 bool in_overflow_mode() const { return main_container_ != NULL; } | 341 bool in_overflow_mode() const { return main_container_ != NULL; } |
337 | 342 |
338 // Whether or not the container has been initialized. | 343 // Whether or not the container has been initialized. |
339 bool initialized_; | 344 bool initialized_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 377 |
373 // The painter used when we are highlighting a subset of extensions. | 378 // The painter used when we are highlighting a subset of extensions. |
374 scoped_ptr<views::Painter> highlight_painter_; | 379 scoped_ptr<views::Painter> highlight_painter_; |
375 | 380 |
376 // The animation that happens when the container snaps to place. | 381 // The animation that happens when the container snaps to place. |
377 scoped_ptr<gfx::SlideAnimation> resize_animation_; | 382 scoped_ptr<gfx::SlideAnimation> resize_animation_; |
378 | 383 |
379 // Don't show the chevron while animating. | 384 // Don't show the chevron while animating. |
380 bool suppress_chevron_; | 385 bool suppress_chevron_; |
381 | 386 |
| 387 // True if we should suppress animation. |
| 388 bool suppress_animation_; |
| 389 |
| 390 // True if we should suppress layout, such as when we are creating or |
| 391 // adjusting a lot of views. |
| 392 bool suppress_layout_; |
| 393 |
382 // This is used while the user is resizing (and when the animations are in | 394 // This is used while the user is resizing (and when the animations are in |
383 // progress) to know how wide the delta is between the current state and what | 395 // progress) to know how wide the delta is between the current state and what |
384 // we should draw. | 396 // we should draw. |
385 int resize_amount_; | 397 int resize_amount_; |
386 | 398 |
387 // Keeps track of the absolute pixel width the container should have when we | 399 // Keeps track of the absolute pixel width the container should have when we |
388 // are done animating. | 400 // are done animating. |
389 int animation_target_size_; | 401 int animation_target_size_; |
390 | 402 |
391 // The DropPosition for the current drag-and-drop operation, or NULL if there | 403 // The DropPosition for the current drag-and-drop operation, or NULL if there |
392 // is none. | 404 // is none. |
393 scoped_ptr<DropPosition> drop_position_; | 405 scoped_ptr<DropPosition> drop_position_; |
394 | 406 |
395 // The class that registers for keyboard shortcuts for extension commands. | 407 // The class that registers for keyboard shortcuts for extension commands. |
396 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 408 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
397 | 409 |
398 ObserverList<BrowserActionsContainerObserver> observers_; | 410 ObserverList<BrowserActionsContainerObserver> observers_; |
399 | 411 |
400 // The maximum number of icons to show per row when in overflow mode (showing | 412 // The maximum number of icons to show per row when in overflow mode (showing |
401 // icons in the application menu). | 413 // icons in the application menu). |
402 static int icons_per_overflow_menu_row_; | 414 static int icons_per_overflow_menu_row_; |
403 | 415 |
404 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 416 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
405 }; | 417 }; |
406 | 418 |
407 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 419 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |