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