| 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/image_loader.h" | 12 #include "chrome/browser/extensions/image_loader.h" |
| 13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 14 #import "chrome/browser/ui/cocoa/animatable_view.h" | 14 #import "chrome/browser/ui/cocoa/animatable_view.h" |
| 15 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" | 15 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" |
| 16 #include "chrome/browser/ui/cocoa/infobars/infobar.h" | 16 #include "chrome/browser/ui/cocoa/infobars/infobar.h" |
| 17 #import "chrome/browser/ui/cocoa/menu_button.h" | 17 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 18 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 18 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "chrome/common/extensions/extension_icon_set.h" | 21 #include "chrome/common/extensions/extension_icon_set.h" |
| 21 #include "chrome/common/extensions/extension_resource.h" | 22 #include "chrome/common/extensions/extension_resource.h" |
| 22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/browser/web_contents_view.h" | 24 #include "content/public/browser/web_contents_view.h" |
| 24 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
| 25 #include "skia/ext/skia_utils_mac.h" | 26 #include "skia/ext/skia_utils_mac.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 virtual ~InfobarBridge() { | 67 virtual ~InfobarBridge() { |
| 67 if (delegate_) | 68 if (delegate_) |
| 68 delegate_->set_observer(NULL); | 69 delegate_->set_observer(NULL); |
| 69 } | 70 } |
| 70 | 71 |
| 71 // Load the Extension's icon image. | 72 // Load the Extension's icon image. |
| 72 void LoadIcon() { | 73 void LoadIcon() { |
| 73 const extensions::Extension* extension = delegate_->extension_host()-> | 74 const extensions::Extension* extension = delegate_->extension_host()-> |
| 74 extension(); | 75 extension(); |
| 75 ExtensionResource icon_resource = | 76 ExtensionResource icon_resource = |
| 76 extension->GetIconResource(extension_misc::EXTENSION_ICON_BITTY, | 77 extensions::IconsInfo::GetIconResource( |
| 77 ExtensionIconSet::MATCH_EXACTLY); | 78 extension, |
| 79 extension_misc::EXTENSION_ICON_BITTY, |
| 80 ExtensionIconSet::MATCH_EXACTLY); |
| 78 extensions::ImageLoader* loader = | 81 extensions::ImageLoader* loader = |
| 79 extensions::ImageLoader::Get(delegate_->extension_host()->profile()); | 82 extensions::ImageLoader::Get(delegate_->extension_host()->profile()); |
| 80 loader->LoadImageAsync(extension, icon_resource, | 83 loader->LoadImageAsync(extension, icon_resource, |
| 81 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, | 84 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, |
| 82 extension_misc::EXTENSION_ICON_BITTY), | 85 extension_misc::EXTENSION_ICON_BITTY), |
| 83 base::Bind(&InfobarBridge::OnImageLoaded, | 86 base::Bind(&InfobarBridge::OnImageLoaded, |
| 84 weak_ptr_factory_.GetWeakPtr())); | 87 weak_ptr_factory_.GetWeakPtr())); |
| 85 } | 88 } |
| 86 | 89 |
| 87 // ImageLoader callback. | 90 // ImageLoader callback. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 277 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 275 NSWindow* window = | 278 NSWindow* window = |
| 276 [(NSView*)owner->GetWebContents()->GetView()->GetContentNativeView() | 279 [(NSView*)owner->GetWebContents()->GetView()->GetContentNativeView() |
| 277 window]; | 280 window]; |
| 278 ExtensionInfoBarController* controller = | 281 ExtensionInfoBarController* controller = |
| 279 [[ExtensionInfoBarController alloc] initWithDelegate:this | 282 [[ExtensionInfoBarController alloc] initWithDelegate:this |
| 280 owner:owner | 283 owner:owner |
| 281 window:window]; | 284 window:window]; |
| 282 return new InfoBar(controller, this); | 285 return new InfoBar(controller, this); |
| 283 } | 286 } |
| OLD | NEW |