| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 24 #include "skia/ext/skia_utils_mac.h" | 25 #include "skia/ext/skia_utils_mac.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 virtual ~InfobarBridge() { | 66 virtual ~InfobarBridge() { |
| 66 if (delegate_) | 67 if (delegate_) |
| 67 delegate_->set_observer(NULL); | 68 delegate_->set_observer(NULL); |
| 68 } | 69 } |
| 69 | 70 |
| 70 // Load the Extension's icon image. | 71 // Load the Extension's icon image. |
| 71 void LoadIcon() { | 72 void LoadIcon() { |
| 72 const extensions::Extension* extension = delegate_->extension_host()-> | 73 const extensions::Extension* extension = delegate_->extension_host()-> |
| 73 extension(); | 74 extension(); |
| 74 ExtensionResource icon_resource = | 75 ExtensionResource icon_resource = |
| 75 extension->GetIconResource(extension_misc::EXTENSION_ICON_BITTY, | 76 extensions::IconsInfo::GetIconResource( |
| 76 ExtensionIconSet::MATCH_EXACTLY); | 77 extension, |
| 78 extension_misc::EXTENSION_ICON_BITTY, |
| 79 ExtensionIconSet::MATCH_EXACTLY); |
| 77 extensions::ImageLoader* loader = | 80 extensions::ImageLoader* loader = |
| 78 extensions::ImageLoader::Get(delegate_->extension_host()->profile()); | 81 extensions::ImageLoader::Get(delegate_->extension_host()->profile()); |
| 79 loader->LoadImageAsync(extension, icon_resource, | 82 loader->LoadImageAsync(extension, icon_resource, |
| 80 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, | 83 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, |
| 81 extension_misc::EXTENSION_ICON_BITTY), | 84 extension_misc::EXTENSION_ICON_BITTY), |
| 82 base::Bind(&InfobarBridge::OnImageLoaded, | 85 base::Bind(&InfobarBridge::OnImageLoaded, |
| 83 weak_ptr_factory_.GetWeakPtr())); | 86 weak_ptr_factory_.GetWeakPtr())); |
| 84 } | 87 } |
| 85 | 88 |
| 86 // ImageLoadingTracker::Observer implementation. | 89 // ImageLoadingTracker::Observer implementation. |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 275 |
| 273 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 276 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 274 NSWindow* window = | 277 NSWindow* window = |
| 275 [(NSView*)owner->GetWebContents()->GetContentNativeView() window]; | 278 [(NSView*)owner->GetWebContents()->GetContentNativeView() window]; |
| 276 ExtensionInfoBarController* controller = | 279 ExtensionInfoBarController* controller = |
| 277 [[ExtensionInfoBarController alloc] initWithDelegate:this | 280 [[ExtensionInfoBarController alloc] initWithDelegate:this |
| 278 owner:owner | 281 owner:owner |
| 279 window:window]; | 282 window:window]; |
| 280 return new InfoBar(controller, this); | 283 return new InfoBar(controller, this); |
| 281 } | 284 } |
| OLD | NEW |