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 void OnResize(int resize_amount, bool done_resizing) override; | 231 void OnResize(int resize_amount, bool done_resizing) override; |
232 | 232 |
233 // Overridden from gfx::AnimationDelegate: | 233 // Overridden from gfx::AnimationDelegate: |
234 void AnimationProgressed(const gfx::Animation* animation) override; | 234 void AnimationProgressed(const gfx::Animation* animation) override; |
235 void AnimationEnded(const gfx::Animation* animation) override; | 235 void AnimationEnded(const gfx::Animation* animation) override; |
236 | 236 |
237 // Overridden from BrowserActionView::Delegate: | 237 // Overridden from BrowserActionView::Delegate: |
238 content::WebContents* GetCurrentWebContents() override; | 238 content::WebContents* GetCurrentWebContents() const override; |
239 bool ShownInsideMenu() const override; | 239 bool ShownInsideMenu() const override; |
240 void OnBrowserActionViewDragDone() override; | 240 void OnBrowserActionViewDragDone() override; |
241 views::MenuButton* GetOverflowReferenceView() override; | 241 views::MenuButton* GetOverflowReferenceView() override; |
242 void SetPopupOwner(BrowserActionView* popup_owner) override; | 242 void SetPopupOwner(BrowserActionView* popup_owner) override; |
243 void HideActivePopup() override; | 243 void HideActivePopup() override; |
244 BrowserActionView* GetMainViewForAction(BrowserActionView* view) override; | 244 BrowserActionView* GetMainViewForAction(BrowserActionView* view) override; |
245 | 245 |
246 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: | 246 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: |
247 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() | 247 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() |
248 override; | 248 override; |
(...skipping 29 matching lines...) Expand all 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 ToolbarReorderNecessary(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 18 matching lines...) Expand all Loading... | |
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 // Animate to the target size (unless testing, in which case we go straight to |
323 // the target size). | 324 // 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 // Reorder the views to match the toolbar model for the active tab. | |
Peter Kasting
2014/10/30 22:06:00
Nit: "Reorders"
Devlin
2014/10/31 17:44:09
Done.
| |
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 GetVisibleIconCount 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_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after 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. | |
Peter Kasting
2014/10/30 22:06:00
Nit: Does this need a note about when/why we might
Devlin
2014/10/31 17:44:09
Done.
| |
383 bool suppress_animation_; | |
384 | |
385 // True if we should suppress layout, such as when we are creating or | |
386 // adjusting a lot of views. | |
387 bool suppress_layout_; | |
388 | |
378 // This is used while the user is resizing (and when the animations are in | 389 // 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 | 390 // progress) to know how wide the delta is between the current state and what |
380 // we should draw. | 391 // we should draw. |
381 int resize_amount_; | 392 int resize_amount_; |
382 | 393 |
383 // Keeps track of the absolute pixel width the container should have when we | 394 // Keeps track of the absolute pixel width the container should have when we |
384 // are done animating. | 395 // are done animating. |
385 int animation_target_size_; | 396 int animation_target_size_; |
386 | 397 |
387 // The DropPosition for the current drag-and-drop operation, or NULL if there | 398 // The DropPosition for the current drag-and-drop operation, or NULL if there |
388 // is none. | 399 // is none. |
389 scoped_ptr<DropPosition> drop_position_; | 400 scoped_ptr<DropPosition> drop_position_; |
390 | 401 |
391 // The class that registers for keyboard shortcuts for extension commands. | 402 // The class that registers for keyboard shortcuts for extension commands. |
392 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 403 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
393 | 404 |
394 ObserverList<BrowserActionsContainerObserver> observers_; | 405 ObserverList<BrowserActionsContainerObserver> observers_; |
395 | 406 |
396 // The maximum number of icons to show per row when in overflow mode (showing | 407 // The maximum number of icons to show per row when in overflow mode (showing |
397 // icons in the application menu). | 408 // icons in the application menu). |
398 static int icons_per_overflow_menu_row_; | 409 static int icons_per_overflow_menu_row_; |
399 | 410 |
400 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 411 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
401 }; | 412 }; |
402 | 413 |
403 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 414 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |