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

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

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments Created 8 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 | Annotate | Revision Log
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_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_infobar_delegate.h" 10 #include "chrome/browser/extensions/extension_infobar_delegate.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 owner:(InfoBarTabHelper*)owner 143 owner:(InfoBarTabHelper*)owner
144 window:(NSWindow*)window { 144 window:(NSWindow*)window {
145 if ((self = [super initWithDelegate:delegate owner:owner])) { 145 if ((self = [super initWithDelegate:delegate owner:owner])) {
146 window_ = window; 146 window_ = window;
147 dropdownButton_.reset([[MenuButton alloc] init]); 147 dropdownButton_.reset([[MenuButton alloc] init]);
148 [dropdownButton_ setOpenMenuOnClick:YES]; 148 [dropdownButton_ setOpenMenuOnClick:YES];
149 149
150 extensions::ExtensionHost* extensionHost = 150 extensions::ExtensionHost* extensionHost =
151 delegate_->AsExtensionInfoBarDelegate()->extension_host(); 151 delegate_->AsExtensionInfoBarDelegate()->extension_host();
152 Browser* browser = 152 Browser* browser =
153 browser::FindBrowserWithWebContents(owner->web_contents()); 153 browser::FindBrowserWithWebContents(owner->GetWebContents());
154 contextMenu_.reset([[ExtensionActionContextMenu alloc] 154 contextMenu_.reset([[ExtensionActionContextMenu alloc]
155 initWithExtension:extensionHost->extension() 155 initWithExtension:extensionHost->extension()
156 browser:browser 156 browser:browser
157 extensionAction:NULL]); 157 extensionAction:NULL]);
158 // See menu_button.h for documentation on why this is needed. 158 // See menu_button.h for documentation on why this is needed.
159 NSMenuItem* dummyItem = 159 NSMenuItem* dummyItem =
160 [[[NSMenuItem alloc] initWithTitle:@"" 160 [[[NSMenuItem alloc] initWithTitle:@""
161 action:nil 161 action:nil
162 keyEquivalent:@""] autorelease]; 162 keyEquivalent:@""] autorelease];
163 [contextMenu_ insertItem:dummyItem atIndex:0]; 163 [contextMenu_ insertItem:dummyItem atIndex:0];
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 [extensionView_ setFrameSize:extensionViewSize]; 265 [extensionView_ setFrameSize:extensionViewSize];
266 [extensionView_ setPostsFrameChangedNotifications:YES]; 266 [extensionView_ setPostsFrameChangedNotifications:YES];
267 } 267 }
268 268
269 - (void)setButtonImage:(NSImage*)image { 269 - (void)setButtonImage:(NSImage*)image {
270 [dropdownButton_ setImage:image]; 270 [dropdownButton_ setImage:image];
271 } 271 }
272 272
273 @end 273 @end
274 274
275 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { 275 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) {
276 InfoBarTabHelper* helper = (InfoBarTabHelper*)owner;
276 NSWindow* window = 277 NSWindow* window =
277 [(NSView*)owner->web_contents()->GetContentNativeView() window]; 278 [(NSView*)owner->GetWebContents()->GetContentNativeView() window];
278 ExtensionInfoBarController* controller = 279 ExtensionInfoBarController* controller =
279 [[ExtensionInfoBarController alloc] initWithDelegate:this 280 [[ExtensionInfoBarController alloc] initWithDelegate:this
280 owner:owner 281 owner:helper
281 window:window]; 282 window:window];
282 return new InfoBar(controller, this); 283 return new InfoBar(controller, this);
283 } 284 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698