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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 1105713002: [Extension Toolbar] Slide out overflowed actions for popups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 8 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/cocoa/extensions/browser_actions_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
index 4b5e33d9fc4c8e91cbaec29903d79802aadd6b2c..f814b13b321ee07058f6da7ea1d1411fa28f76f7 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
@@ -99,6 +99,10 @@ const CGFloat kBrowserActionBubbleYOffset = 3.0;
// Shows the toolbar info bubble, if it should be displayed.
- (void)containerMouseEntered:(NSNotification*)notification;
+// Notifies the controlling ToolbarActionsBar that any running animation has
+// ended.
+- (void)containerAnimationEnded:(NSNotification*)notification;
+
// Adjusts the position of the surrounding action buttons depending on where the
// button is within the container.
- (void)actionButtonDragging:(NSNotification*)notification;
@@ -323,6 +327,11 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble(
selector:@selector(containerDragFinished:)
name:kBrowserActionGrippyDragFinishedNotification
object:containerView_];
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(containerAnimationEnded:)
+ name:kBrowserActionsContainerAnimationEnded
+ object:containerView_];
// Listen for a finished drag from any button to make sure each open window
// stays in sync.
[[NSNotificationCenter defaultCenter]
@@ -443,6 +452,10 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble(
return [mainController buttonForId:id];
}
+- (ToolbarActionsBar*)toolbarActionsBar {
+ return toolbarActionsBar_.get();
+}
+
#pragma mark -
#pragma mark NSMenuDelegate
@@ -504,7 +517,7 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble(
[containerView_ setIsHighlighting:toolbarActionsBar_->is_highlighting()];
std::vector<ToolbarActionViewController*> toolbar_actions =
- toolbarActionsBar_->toolbar_actions();
+ toolbarActionsBar_->GetActions();
for (NSUInteger i = 0; i < [buttons_ count]; ++i) {
auto controller = static_cast<ToolbarActionViewController*>(
[[buttons_ objectAtIndex:i] viewController]);
@@ -691,6 +704,11 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble(
[self resizeContainerToWidth:toolbarActionsBar_->GetPreferredSize().width()];
}
+- (void)containerAnimationEnded:(NSNotification*)notification {
+ if (![containerView_ isAnimating])
+ toolbarActionsBar_->OnAnimationEnded();
+}
+
- (void)containerMouseEntered:(NSNotification*)notification {
if (!activeBubble_ && // only show one bubble at a time
ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
@@ -941,8 +959,4 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble(
return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil;
}
-- (ToolbarActionsBar*)toolbarActionsBar {
- return toolbarActionsBar_.get();
-}
-
@end

Powered by Google App Engine
This is Rietveld 408576698