Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_actions_container.h

Issue 476873002: Make hiding an extension action cause it to go to the overflow menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // in the calculation.) 332 // in the calculation.)
333 size_t WidthToIconCount(int pixels) const; 333 size_t WidthToIconCount(int pixels) const;
334 334
335 // Returns the absolute minimum size you can shrink the container down to and 335 // Returns the absolute minimum size you can shrink the container down to and
336 // still show it. This assumes a visible chevron because the only way we 336 // still show it. This assumes a visible chevron because the only way we
337 // would not have a chevron when shrinking down this far is if there were no 337 // would not have a chevron when shrinking down this far is if there were no
338 // icons, in which case the container wouldn't be shown at all. 338 // icons, in which case the container wouldn't be shown at all.
339 int MinimumNonemptyWidth() const; 339 int MinimumNonemptyWidth() const;
340 340
341 // Animate to the target size (unless testing, in which case we go straight to 341 // Animate to the target size (unless testing, in which case we go straight to
342 // the target size). This also saves the target number of visible icons in 342 // the target size).
343 // the pref if we're not incognito. 343 void Animate(gfx::Tween::Type type, size_t num_visible_icons);
344 void SaveDesiredSizeAndAnimate(gfx::Tween::Type type,
345 size_t num_visible_icons);
346 344
347 // Returns true if this extension should be shown in this toolbar. This can 345 // Returns true if this extension should be shown in this toolbar. This can
348 // return false if we are in an incognito window and the extension is disabled 346 // return false if we are in an incognito window and the extension is disabled
349 // for incognito. 347 // for incognito.
350 bool ShouldDisplayBrowserAction(const extensions::Extension* extension); 348 bool ShouldDisplayBrowserAction(const extensions::Extension* extension) const;
351 349
352 // Return the index of the first visible icon. 350 // Return the index of the first visible icon.
353 size_t GetFirstVisibleIconIndex() const; 351 size_t GetFirstVisibleIconIndex() const;
354 352
355 // Returns the BrowserActionView* associated with the given |extension|, or 353 // Returns the BrowserActionView* associated with the given |extension|, or
356 // NULL if none exists. 354 // NULL if none exists.
357 BrowserActionView* GetViewForExtension( 355 BrowserActionView* GetViewForExtension(
358 const extensions::Extension* extension); 356 const extensions::Extension* extension);
359 357
358 // Returns the number of icons that this container should draw. This differs
359 // from the model's GetVisibleIconCount if this container is for the overflow.
360 size_t GetIconCount() const;
361
360 // Whether this container is in overflow mode (as opposed to in 'main' 362 // Whether this container is in overflow mode (as opposed to in 'main'
361 // mode). See class comments for details on the difference. 363 // mode). See class comments for details on the difference.
362 bool in_overflow_mode() const { return main_container_ != NULL; } 364 bool in_overflow_mode() const { return main_container_ != NULL; }
363 365
364 // The vector of browser actions (icons/image buttons for each action). Note 366 // The vector of browser actions (icons/image buttons for each action). Note
365 // that not every BrowserAction in the ToolbarModel will necessarily be in 367 // that not every BrowserAction in the ToolbarModel will necessarily be in
366 // this collection. Some extensions may be disabled in incognito windows. 368 // this collection. Some extensions may be disabled in incognito windows.
367 BrowserActionViews browser_action_views_; 369 BrowserActionViews browser_action_views_;
368 370
369 Profile* profile_; 371 Profile* profile_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 431
430 // Handles delayed showing of the overflow menu when hovering. 432 // Handles delayed showing of the overflow menu when hovering.
431 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; 433 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_;
432 434
433 ObserverList<BrowserActionsContainerObserver> observers_; 435 ObserverList<BrowserActionsContainerObserver> observers_;
434 436
435 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 437 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
436 }; 438 };
437 439
438 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 440 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698