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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/infobars/extension_infobar_controller.h" 5 #import "chrome/browser/ui/cocoa/infobars/extension_infobar_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" 9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/extensions/extension_view_host.h" 10 #include "chrome/browser/extensions/extension_view_host.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 [dropdownButton_ setImage:image]; 239 [dropdownButton_ setImage:image];
240 } 240 }
241 241
242 - (void)menuNeedsUpdate:(NSMenu*)menu { 242 - (void)menuNeedsUpdate:(NSMenu*)menu {
243 DCHECK([self isOwned]); 243 DCHECK([self isOwned]);
244 244
245 if (!contextMenuController_) { 245 if (!contextMenuController_) {
246 extensions::ExtensionViewHost* extensionViewHost = 246 extensions::ExtensionViewHost* extensionViewHost =
247 [self delegate]->AsExtensionInfoBarDelegate()->extension_view_host(); 247 [self delegate]->AsExtensionInfoBarDelegate()->extension_view_host();
248 Browser* browser = chrome::FindBrowserWithWebContents( 248 Browser* browser = chrome::FindBrowserWithWebContents(
249 [self infobar]->OwnerCocoa()->web_contents()); 249 [self delegate]->AsExtensionInfoBarDelegate()->web_contents());
250 contextMenuController_.reset([[ExtensionActionContextMenuController alloc] 250 contextMenuController_.reset([[ExtensionActionContextMenuController alloc]
251 initWithExtension:extensionViewHost->extension() 251 initWithExtension:extensionViewHost->extension()
252 browser:browser 252 browser:browser
253 extensionAction:NULL]); 253 extensionAction:NULL]);
254 } 254 }
255 255
256 [menu removeAllItems]; 256 [menu removeAllItems];
257 [contextMenuController_ populateMenu:menu]; 257 [contextMenuController_ populateMenu:menu];
258 } 258 }
259 259
260 @end 260 @end
261 261
262 // static 262 // static
263 scoped_ptr<InfoBar> ExtensionInfoBarDelegate::CreateInfoBar( 263 scoped_ptr<InfoBar> ExtensionInfoBarDelegate::CreateInfoBar(
264 scoped_ptr<ExtensionInfoBarDelegate> delegate) { 264 scoped_ptr<ExtensionInfoBarDelegate> delegate) {
265 scoped_ptr<InfoBarCocoa> infobar( 265 scoped_ptr<InfoBarCocoa> infobar(
266 new InfoBarCocoa(delegate.PassAs<InfoBarDelegate>())); 266 new InfoBarCocoa(delegate.PassAs<InfoBarDelegate>()));
267 base::scoped_nsobject<ExtensionInfoBarController> controller( 267 base::scoped_nsobject<ExtensionInfoBarController> controller(
268 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get()]); 268 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get()]);
269 infobar->set_controller(controller); 269 infobar->set_controller(controller);
270 return infobar.PassAs<InfoBar>(); 270 return infobar.PassAs<InfoBar>();
271 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698