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

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

Issue 675023002: Make extensions that desire to act pop out if in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 an action's visibility may have changed. 293 // Called when an 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
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 toolbar actions (icons/image buttons for each action). 341 // The vector of toolbar actions (icons/image buttons for each action).
(...skipping 28 matching lines...) Expand all
366 370
367 // The painter used when we are highlighting a subset of extensions. 371 // The painter used when we are highlighting a subset of extensions.
368 scoped_ptr<views::Painter> highlight_painter_; 372 scoped_ptr<views::Painter> highlight_painter_;
369 373
370 // The animation that happens when the container snaps to place. 374 // The animation that happens when the container snaps to place.
371 scoped_ptr<gfx::SlideAnimation> resize_animation_; 375 scoped_ptr<gfx::SlideAnimation> resize_animation_;
372 376
373 // Don't show the chevron while animating. 377 // Don't show the chevron while animating.
374 bool suppress_chevron_; 378 bool suppress_chevron_;
375 379
380 // True if we should suppress animation; we typically do this e.g. when
381 // switching tabs changes the state of the icons.
382 bool suppress_animation_;
383
384 // True if we should suppress layout, such as when we are creating or
385 // adjusting a lot of views.
386 bool suppress_layout_;
387
376 // This is used while the user is resizing (and when the animations are in 388 // This is used while the user is resizing (and when the animations are in
377 // progress) to know how wide the delta is between the current state and what 389 // progress) to know how wide the delta is between the current state and what
378 // we should draw. 390 // we should draw.
379 int resize_amount_; 391 int resize_amount_;
380 392
381 // Keeps track of the absolute pixel width the container should have when we 393 // Keeps track of the absolute pixel width the container should have when we
382 // are done animating. 394 // are done animating.
383 int animation_target_size_; 395 int animation_target_size_;
384 396
385 // The DropPosition for the current drag-and-drop operation, or NULL if there 397 // The DropPosition for the current drag-and-drop operation, or NULL if there
386 // is none. 398 // is none.
387 scoped_ptr<DropPosition> drop_position_; 399 scoped_ptr<DropPosition> drop_position_;
388 400
389 // The class that registers for keyboard shortcuts for extension commands. 401 // The class that registers for keyboard shortcuts for extension commands.
390 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; 402 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
391 403
392 ObserverList<BrowserActionsContainerObserver> observers_; 404 ObserverList<BrowserActionsContainerObserver> observers_;
393 405
394 // The maximum number of icons to show per row when in overflow mode (showing 406 // The maximum number of icons to show per row when in overflow mode (showing
395 // icons in the application menu). 407 // icons in the application menu).
396 static int icons_per_overflow_menu_row_; 408 static int icons_per_overflow_menu_row_;
397 409
398 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 410 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
399 }; 411 };
400 412
401 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 413 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698