OLD | NEW |
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 owner:(InfoBarTabHelper*)owner | 142 owner:(InfoBarTabHelper*)owner |
143 window:(NSWindow*)window { | 143 window:(NSWindow*)window { |
144 if ((self = [super initWithDelegate:delegate owner:owner])) { | 144 if ((self = [super initWithDelegate:delegate owner:owner])) { |
145 window_ = window; | 145 window_ = window; |
146 dropdownButton_.reset([[MenuButton alloc] init]); | 146 dropdownButton_.reset([[MenuButton alloc] init]); |
147 [dropdownButton_ setOpenMenuOnClick:YES]; | 147 [dropdownButton_ setOpenMenuOnClick:YES]; |
148 | 148 |
149 extensions::ExtensionHost* extensionHost = | 149 extensions::ExtensionHost* extensionHost = |
150 delegate_->AsExtensionInfoBarDelegate()->extension_host(); | 150 delegate_->AsExtensionInfoBarDelegate()->extension_host(); |
151 Browser* browser = | 151 Browser* browser = |
152 browser::FindBrowserWithWebContents(owner->web_contents()); | 152 browser::FindBrowserWithWebContents(owner->GetWebContents()); |
153 contextMenu_.reset([[ExtensionActionContextMenu alloc] | 153 contextMenu_.reset([[ExtensionActionContextMenu alloc] |
154 initWithExtension:extensionHost->extension() | 154 initWithExtension:extensionHost->extension() |
155 browser:browser | 155 browser:browser |
156 extensionAction:NULL]); | 156 extensionAction:NULL]); |
157 // See menu_button.h for documentation on why this is needed. | 157 // See menu_button.h for documentation on why this is needed. |
158 NSMenuItem* dummyItem = | 158 NSMenuItem* dummyItem = |
159 [[[NSMenuItem alloc] initWithTitle:@"" | 159 [[[NSMenuItem alloc] initWithTitle:@"" |
160 action:nil | 160 action:nil |
161 keyEquivalent:@""] autorelease]; | 161 keyEquivalent:@""] autorelease]; |
162 [contextMenu_ insertItem:dummyItem atIndex:0]; | 162 [contextMenu_ insertItem:dummyItem atIndex:0]; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 [extensionView_ setFrameSize:extensionViewSize]; | 264 [extensionView_ setFrameSize:extensionViewSize]; |
265 [extensionView_ setPostsFrameChangedNotifications:YES]; | 265 [extensionView_ setPostsFrameChangedNotifications:YES]; |
266 } | 266 } |
267 | 267 |
268 - (void)setButtonImage:(NSImage*)image { | 268 - (void)setButtonImage:(NSImage*)image { |
269 [dropdownButton_ setImage:image]; | 269 [dropdownButton_ setImage:image]; |
270 } | 270 } |
271 | 271 |
272 @end | 272 @end |
273 | 273 |
274 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 274 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { |
| 275 InfoBarTabHelper* helper = (InfoBarTabHelper*)owner; |
275 NSWindow* window = | 276 NSWindow* window = |
276 [(NSView*)owner->web_contents()->GetContentNativeView() window]; | 277 [(NSView*)owner->GetWebContents()->GetContentNativeView() window]; |
277 ExtensionInfoBarController* controller = | 278 ExtensionInfoBarController* controller = |
278 [[ExtensionInfoBarController alloc] initWithDelegate:this | 279 [[ExtensionInfoBarController alloc] initWithDelegate:this |
279 owner:owner | 280 owner:helper |
280 window:window]; | 281 window:window]; |
281 return new InfoBar(controller, this); | 282 return new InfoBar(controller, this); |
282 } | 283 } |
OLD | NEW |