Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: License year update Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_loading_tracker.h" 12 #include "chrome/browser/extensions/image_loading_tracker.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 tracker_.LoadImage(extension, icon_resource, 81 tracker_.LoadImage(extension, icon_resource,
79 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, 82 gfx::Size(extension_misc::EXTENSION_ICON_BITTY,
80 extension_misc::EXTENSION_ICON_BITTY), 83 extension_misc::EXTENSION_ICON_BITTY),
81 ImageLoadingTracker::DONT_CACHE); 84 ImageLoadingTracker::DONT_CACHE);
82 } 85 }
83 86
84 // ImageLoadingTracker::Observer implementation. 87 // ImageLoadingTracker::Observer implementation.
85 // TODO(andybons): The infobar view implementations share a lot of the same 88 // TODO(andybons): The infobar view implementations share a lot of the same
86 // code. Come up with a strategy to share amongst them. 89 // code. Come up with a strategy to share amongst them.
87 virtual void OnImageLoaded(const gfx::Image& image, 90 virtual void OnImageLoaded(const gfx::Image& image,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 276
274 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { 277 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
275 NSWindow* window = 278 NSWindow* window =
276 [(NSView*)owner->GetWebContents()->GetContentNativeView() window]; 279 [(NSView*)owner->GetWebContents()->GetContentNativeView() window];
277 ExtensionInfoBarController* controller = 280 ExtensionInfoBarController* controller =
278 [[ExtensionInfoBarController alloc] initWithDelegate:this 281 [[ExtensionInfoBarController alloc] initWithDelegate:this
279 owner:owner 282 owner:owner
280 window:window]; 283 window:window];
281 return new InfoBar(controller, this); 284 return new InfoBar(controller, this);
282 } 285 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698