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

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

Issue 399173004: Adjust BrowserActionsContainer drag and drop to work for overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // Overridden from views::View: 284 // Overridden from views::View:
285 virtual void ViewHierarchyChanged( 285 virtual void ViewHierarchyChanged(
286 const ViewHierarchyChangedDetails& details) OVERRIDE; 286 const ViewHierarchyChangedDetails& details) OVERRIDE;
287 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 287 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
288 virtual void OnThemeChanged() OVERRIDE; 288 virtual void OnThemeChanged() OVERRIDE;
289 289
290 private: 290 private:
291 friend class BrowserActionView; // So it can access IconWidth(). 291 friend class BrowserActionView; // So it can access IconWidth().
292 friend class ShowFolderMenuTask; 292 friend class ShowFolderMenuTask;
293 293
294 // A struct representing the position at which an action will be dropped.
295 struct DropPosition;
296
294 typedef std::vector<BrowserActionView*> BrowserActionViews; 297 typedef std::vector<BrowserActionView*> BrowserActionViews;
295 298
296 // Returns the width of an icon, optionally with its padding. 299 // Returns the width of an icon, optionally with its padding.
297 static int IconWidth(bool include_padding); 300 static int IconWidth(bool include_padding);
298 301
299 // Returns the height of an icon. 302 // Returns the height of an icon.
300 static int IconHeight(); 303 static int IconHeight();
301 304
302 // extensions::ExtensionToolbarModel::Observer implementation. 305 // extensions::ExtensionToolbarModel::Observer implementation.
303 virtual void BrowserActionAdded(const extensions::Extension* extension, 306 virtual void BrowserActionAdded(const extensions::Extension* extension,
(...skipping 17 matching lines...) Expand all
321 324
322 // Cancels the timer for showing the drop down menu. 325 // Cancels the timer for showing the drop down menu.
323 void StopShowFolderDropMenuTimer(); 326 void StopShowFolderDropMenuTimer();
324 327
325 // Show the drop down folder after a slight delay. 328 // Show the drop down folder after a slight delay.
326 void StartShowFolderDropMenuTimer(); 329 void StartShowFolderDropMenuTimer();
327 330
328 // Show the overflow menu. 331 // Show the overflow menu.
329 void ShowDropFolder(); 332 void ShowDropFolder();
330 333
331 // Sets the drop indicator position (and schedules paint if the position has
332 // changed).
333 void SetDropIndicator(int x_pos);
334
335 // Given a number of |icons| and whether to |display_chevron|, returns the 334 // Given a number of |icons| and whether to |display_chevron|, returns the
336 // amount of pixels needed to draw the entire container. For convenience, 335 // amount of pixels needed to draw the entire container. For convenience,
337 // callers can set |icons| to -1 to mean "all icons". 336 // callers can set |icons| to -1 to mean "all icons".
338 int IconCountToWidth(int icons, bool display_chevron) const; 337 int IconCountToWidth(int icons, bool display_chevron) const;
339 338
340 // Given a pixel width, returns the number of icons that fit. (This 339 // Given a pixel width, returns the number of icons that fit. (This
341 // automatically determines whether a chevron will be needed and includes it 340 // automatically determines whether a chevron will be needed and includes it
342 // in the calculation.) 341 // in the calculation.)
343 size_t WidthToIconCount(int pixels) const; 342 size_t WidthToIconCount(int pixels) const;
344 343
(...skipping 15 matching lines...) Expand all
360 bool ShouldDisplayBrowserAction(const extensions::Extension* extension); 359 bool ShouldDisplayBrowserAction(const extensions::Extension* extension);
361 360
362 // Show a popup. Returns true if a new popup was shown. Showing the popup will 361 // Show a popup. Returns true if a new popup was shown. Showing the popup will
363 // grant tab permissions if |grant_tab_permissions| is true. Only pass true 362 // grant tab permissions if |grant_tab_permissions| is true. Only pass true
364 // for this argument for popups triggered interactively, not popups triggered 363 // for this argument for popups triggered interactively, not popups triggered
365 // by an API. 364 // by an API.
366 bool ShowPopup(BrowserActionButton* button, 365 bool ShowPopup(BrowserActionButton* button,
367 ExtensionPopup::ShowAction show_action, 366 ExtensionPopup::ShowAction show_action,
368 bool grant_tab_permissions); 367 bool grant_tab_permissions);
369 368
369 // Return the index of the first visible icon.
370 size_t GetFirstVisibleIconIndex() const;
371
370 // Whether this container is in overflow mode (as opposed to in 'main' 372 // Whether this container is in overflow mode (as opposed to in 'main'
371 // mode). See class comments for details on the difference. 373 // mode). See class comments for details on the difference.
372 bool in_overflow_mode() const { return main_container_ != NULL; } 374 bool in_overflow_mode() const { return main_container_ != NULL; }
373 375
374 // The vector of browser actions (icons/image buttons for each action). Note 376 // The vector of browser actions (icons/image buttons for each action). Note
375 // that not every BrowserAction in the ToolbarModel will necessarily be in 377 // that not every BrowserAction in the ToolbarModel will necessarily be in
376 // this collection. Some extensions may be disabled in incognito windows. 378 // this collection. Some extensions may be disabled in incognito windows.
377 BrowserActionViews browser_action_views_; 379 BrowserActionViews browser_action_views_;
378 380
379 Profile* profile_; 381 Profile* profile_;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 426
425 // This is used while the user is resizing (and when the animations are in 427 // This is used while the user is resizing (and when the animations are in
426 // progress) to know how wide the delta is between the current state and what 428 // progress) to know how wide the delta is between the current state and what
427 // we should draw. 429 // we should draw.
428 int resize_amount_; 430 int resize_amount_;
429 431
430 // Keeps track of the absolute pixel width the container should have when we 432 // Keeps track of the absolute pixel width the container should have when we
431 // are done animating. 433 // are done animating.
432 int animation_target_size_; 434 int animation_target_size_;
433 435
434 // The x position for where to draw the drop indicator. -1 if no indicator. 436 // The DropPosition for the current drag-and-drop operation, or NULL if there
435 int drop_indicator_position_; 437 // is none.
438 scoped_ptr<DropPosition> drop_position_;
436 439
437 // The class that registers for keyboard shortcuts for extension commands. 440 // The class that registers for keyboard shortcuts for extension commands.
438 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; 441 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
439 442
440 base::WeakPtrFactory<BrowserActionsContainer> task_factory_; 443 base::WeakPtrFactory<BrowserActionsContainer> task_factory_;
441 444
442 // Handles delayed showing of the overflow menu when hovering. 445 // Handles delayed showing of the overflow menu when hovering.
443 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; 446 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_;
444 447
445 ObserverList<BrowserActionsContainerObserver> observers_; 448 ObserverList<BrowserActionsContainerObserver> observers_;
446 449
447 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 450 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
448 }; 451 };
449 452
450 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 453 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698