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

Unified 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: Finnurs + RTL fix Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar/browser_actions_container.h
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.h b/chrome/browser/ui/views/toolbar/browser_actions_container.h
index 51a03ef087d0004cf9a7da4227eae1574f677fa9..ec08d4895637703d33b799ffd60cfd2d6e3e9fd8 100644
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.h
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.h
@@ -291,6 +291,9 @@ class BrowserActionsContainer
friend class BrowserActionView; // So it can access IconWidth().
friend class ShowFolderMenuTask;
+ // A struct representing the position at which an action will be dropped.
+ struct DropPosition;
+
typedef std::vector<BrowserActionView*> BrowserActionViews;
// Returns the width of an icon, optionally with its padding.
@@ -330,7 +333,10 @@ class BrowserActionsContainer
// Sets the drop indicator position (and schedules paint if the position has
// changed).
- void SetDropIndicator(int x_pos);
+ void SetDropPosition(size_t row, size_t icon_in_row);
+
+ // Resets the drop position to NULL (removing the indicator).
+ void ResetDropPosition();
// Given a number of |icons| and whether to |display_chevron|, returns the
// amount of pixels needed to draw the entire container. For convenience,
@@ -367,6 +373,9 @@ class BrowserActionsContainer
ExtensionPopup::ShowAction show_action,
bool grant_tab_permissions);
+ // Return the index of the first visible icon.
+ size_t GetFirstVisibleIconIndex() const;
+
// Whether this container is in overflow mode (as opposed to in 'main'
// mode). See class comments for details on the difference.
bool in_overflow_mode() const { return main_container_ != NULL; }
@@ -431,8 +440,9 @@ class BrowserActionsContainer
// are done animating.
int animation_target_size_;
- // The x position for where to draw the drop indicator. -1 if no indicator.
- int drop_indicator_position_;
+ // The DropPosition for the current drag-and-drop operation, or NULL if there
+ // is none.
+ scoped_ptr<DropPosition> drop_position_;
Peter Kasting 2014/07/21 20:24:09 I wonder if instead of using NULL to mean "none",
Devlin 2014/07/22 17:30:47 I personally prefer the scoped ptr approach, becau
Peter Kasting 2014/07/22 18:21:11 Let me back up for a second. You start by saying
Devlin 2014/07/22 20:29:33 But, if we define a constructor (default or otherw
Peter Kasting 2014/07/22 21:10:00 Oof, I didn't recall that. It's funny too, we're
Devlin 2014/07/22 22:13:20 Aggregate initialization isn't too bad, but we can
// The class that registers for keyboard shortcuts for extension commands.
scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;

Powered by Google App Engine
This is Rietveld 408576698