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

Unified Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm

Issue 766263003: [Extension Toolbar] Refactor and finish pop out logic for actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sky's + OWNERS Created 6 years 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/wrench_menu/wrench_menu_controller.mm
diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
index 8754bb1ed657650ee65c2ffd27cf8a0101a30c9d..8877a169d53b99cc3702630481e02fbfd7541e32 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
@@ -17,6 +17,7 @@
#import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
+#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
@@ -137,11 +138,22 @@ class ZoomLevelObserver {
BrowserActionsContainerView* containerView =
[buttonViewController_ overflowActionsContainerView];
+ // The overflow browser actions container can't function properly without
+ // a main counterpart, so if the browser window hasn't initialized, abort.
+ // (This is fine because we re-populate the wrench menu each time before
+ // we show it.)
+ if (!browser_->window())
+ break;
+
+ BrowserActionsController* mainController =
+ [[[BrowserWindowController browserWindowControllerForWindow:browser_->
+ window()->GetNativeWindow()] toolbarController]
+ browserActionsController];
browserActionsController_.reset(
[[BrowserActionsController alloc]
initWithBrowser:browser_
containerView:containerView
- isOverflow:YES]);
+ mainController:mainController]);
// Set the origins and preferred size for the container.
gfx::Size preferredSize = [browserActionsController_ preferredSize];

Powered by Google App Engine
This is Rietveld 408576698