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

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

Issue 10701063: Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_infobar_delegate.h" 10 #include "chrome/browser/extensions/extension_infobar_delegate.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION); 98 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION);
99 else 99 else
100 icon = image.ToSkBitmap(); 100 icon = image.ToSkBitmap();
101 101
102 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); 102 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW);
103 103
104 const int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; 104 const int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY;
105 scoped_ptr<gfx::Canvas> canvas( 105 scoped_ptr<gfx::Canvas> canvas(
106 new gfx::Canvas( 106 new gfx::Canvas(
107 gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(), 107 gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(),
108 image_size), false)); 108 image_size), ui::SCALE_FACTOR_100P, false));
109 canvas->DrawImageInt(*icon, 109 canvas->DrawImageInt(*icon,
110 0, 0, icon->width(), icon->height(), 110 0, 0, icon->width(), icon->height(),
111 0, 0, image_size, image_size, 111 0, 0, image_size, image_size,
112 false); 112 false);
113 canvas->DrawImageInt(*drop_image, 113 canvas->DrawImageInt(*drop_image,
114 image_size + kDropArrowLeftMarginPx, 114 image_size + kDropArrowLeftMarginPx,
115 image_size / 2); 115 image_size / 2);
116 [owner_ setButtonImage:gfx::SkBitmapToNSImage(canvas->ExtractBitmap())]; 116 [owner_ setButtonImage:gfx::SkBitmapToNSImage(
117 canvas->ExtractImageRep().sk_bitmap())];
117 } 118 }
118 119
119 // Overridden from ExtensionInfoBarDelegate::DelegateObserver: 120 // Overridden from ExtensionInfoBarDelegate::DelegateObserver:
120 virtual void OnDelegateDeleted() { 121 virtual void OnDelegateDeleted() {
121 delegate_ = NULL; 122 delegate_ = NULL;
122 } 123 }
123 124
124 private: 125 private:
125 // Weak. Owns us. 126 // Weak. Owns us.
126 ExtensionInfoBarController* owner_; 127 ExtensionInfoBarController* owner_;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 273
273 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { 274 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) {
274 NSWindow* window = 275 NSWindow* window =
275 [(NSView*)owner->web_contents()->GetContentNativeView() window]; 276 [(NSView*)owner->web_contents()->GetContentNativeView() window];
276 ExtensionInfoBarController* controller = 277 ExtensionInfoBarController* controller =
277 [[ExtensionInfoBarController alloc] initWithDelegate:this 278 [[ExtensionInfoBarController alloc] initWithDelegate:this
278 owner:owner 279 owner:owner
279 window:window]; 280 window:window];
280 return new InfoBar(controller, this); 281 return new InfoBar(controller, this);
281 } 282 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/browser/ui/gtk/avatar_menu_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698