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