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_infobar_delegate.h" | 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| 10 #include "chrome/browser/extensions/extension_view.h" |
10 #include "chrome/browser/extensions/extension_view_host.h" | 11 #include "chrome/browser/extensions/extension_view_host.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
14 #import "chrome/browser/ui/cocoa/animatable_view.h" | 15 #import "chrome/browser/ui/cocoa/animatable_view.h" |
15 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu_contro
ller.h" | 16 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu_contro
ller.h" |
16 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" | 17 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" |
17 #import "chrome/browser/ui/cocoa/menu_button.h" | 18 #import "chrome/browser/ui/cocoa/menu_button.h" |
18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
19 #include "extensions/browser/image_loader.h" | 20 #include "extensions/browser/image_loader.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 - (void)dealloc { | 148 - (void)dealloc { |
148 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 149 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
149 [super dealloc]; | 150 [super dealloc]; |
150 } | 151 } |
151 | 152 |
152 - (void)addAdditionalControls { | 153 - (void)addAdditionalControls { |
153 [self removeButtons]; | 154 [self removeButtons]; |
154 | 155 |
155 extensionView_ = [self delegate]->AsExtensionInfoBarDelegate() | 156 extensionView_ = [self delegate]->AsExtensionInfoBarDelegate() |
156 ->extension_view_host()->view()->native_view(); | 157 ->extension_view_host()->view()->GetNativeView(); |
157 | 158 |
158 // Add the extension's RenderWidgetHostView to the view hierarchy of the | 159 // Add the extension's RenderWidgetHostView to the view hierarchy of the |
159 // InfoBar and make sure to place it below the Close button. | 160 // InfoBar and make sure to place it below the Close button. |
160 [infoBarView_ addSubview:extensionView_ | 161 [infoBarView_ addSubview:extensionView_ |
161 positioned:NSWindowBelow | 162 positioned:NSWindowBelow |
162 relativeTo:(NSView*)closeButton_]; | 163 relativeTo:(NSView*)closeButton_]; |
163 | 164 |
164 // Add the context menu button to the hierarchy. | 165 // Add the context menu button to the hierarchy. |
165 [dropdownButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 166 [dropdownButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
166 CGFloat buttonY = | 167 CGFloat buttonY = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // static | 262 // static |
262 scoped_ptr<infobars::InfoBar> ExtensionInfoBarDelegate::CreateInfoBar( | 263 scoped_ptr<infobars::InfoBar> ExtensionInfoBarDelegate::CreateInfoBar( |
263 scoped_ptr<ExtensionInfoBarDelegate> delegate) { | 264 scoped_ptr<ExtensionInfoBarDelegate> delegate) { |
264 scoped_ptr<InfoBarCocoa> infobar( | 265 scoped_ptr<InfoBarCocoa> infobar( |
265 new InfoBarCocoa(delegate.PassAs<infobars::InfoBarDelegate>())); | 266 new InfoBarCocoa(delegate.PassAs<infobars::InfoBarDelegate>())); |
266 base::scoped_nsobject<ExtensionInfoBarController> controller( | 267 base::scoped_nsobject<ExtensionInfoBarController> controller( |
267 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get()]); | 268 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get()]); |
268 infobar->set_controller(controller); | 269 infobar->set_controller(controller); |
269 return infobar.PassAs<infobars::InfoBar>(); | 270 return infobar.PassAs<infobars::InfoBar>(); |
270 } | 271 } |
OLD | NEW |