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

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

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