| 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/api/infobars/infobar_service.h" | 9 #include "chrome/browser/api/infobars/infobar_service.h" |
| 10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| 11 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 11 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| 12 #include "chrome/browser/extensions/extension_view.h" |
| 12 #include "chrome/browser/extensions/image_loading_tracker.h" | 13 #include "chrome/browser/extensions/image_loading_tracker.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.h" | 16 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" |
| 16 #include "chrome/browser/ui/cocoa/infobars/infobar.h" | 17 #include "chrome/browser/ui/cocoa/infobars/infobar.h" |
| 17 #import "chrome/browser/ui/cocoa/menu_button.h" | 18 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 19 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_constants.h" | 21 #include "chrome/common/extensions/extension_constants.h" |
| 21 #include "chrome/common/extensions/extension_icon_set.h" | 22 #include "chrome/common/extensions/extension_icon_set.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 171 |
| 171 - (void)dealloc { | 172 - (void)dealloc { |
| 172 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 173 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 173 [super dealloc]; | 174 [super dealloc]; |
| 174 } | 175 } |
| 175 | 176 |
| 176 - (void)addAdditionalControls { | 177 - (void)addAdditionalControls { |
| 177 [self removeButtons]; | 178 [self removeButtons]; |
| 178 | 179 |
| 179 extensionView_ = delegate_->AsExtensionInfoBarDelegate()->extension_host()-> | 180 extensionView_ = delegate_->AsExtensionInfoBarDelegate()->extension_host()-> |
| 180 view()->native_view(); | 181 GetExtensionView()->GetNativeView(); |
| 181 | 182 |
| 182 // Add the extension's RenderWidgetHostView to the view hierarchy of the | 183 // Add the extension's RenderWidgetHostView to the view hierarchy of the |
| 183 // InfoBar and make sure to place it below the Close button. | 184 // InfoBar and make sure to place it below the Close button. |
| 184 [infoBarView_ addSubview:extensionView_ | 185 [infoBarView_ addSubview:extensionView_ |
| 185 positioned:NSWindowBelow | 186 positioned:NSWindowBelow |
| 186 relativeTo:(NSView*)closeButton_]; | 187 relativeTo:(NSView*)closeButton_]; |
| 187 | 188 |
| 188 // Add the context menu button to the hierarchy. | 189 // Add the context menu button to the hierarchy. |
| 189 [dropdownButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 190 [dropdownButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
| 190 CGFloat buttonY = | 191 CGFloat buttonY = |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 275 |
| 275 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 276 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 276 NSWindow* window = | 277 NSWindow* window = |
| 277 [(NSView*)owner->GetWebContents()->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:owner |
| 281 window:window]; | 282 window:window]; |
| 282 return new InfoBar(controller, this); | 283 return new InfoBar(controller, this); |
| 283 } | 284 } |
| OLD | NEW |