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

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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION); 97 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION);
98 else 98 else
99 icon = image.ToSkBitmap(); 99 icon = image.ToSkBitmap();
100 100
101 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); 101 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW);
102 102
103 const int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; 103 const int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY;
104 scoped_ptr<gfx::Canvas> canvas( 104 scoped_ptr<gfx::Canvas> canvas(
105 new gfx::Canvas( 105 new gfx::Canvas(
106 gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(), 106 gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(),
107 image_size), false)); 107 image_size), ui::SCALE_FACTOR_100P, false));
108 canvas->DrawImageInt(*icon, 108 canvas->DrawImageInt(*icon,
109 0, 0, icon->width(), icon->height(), 109 0, 0, icon->width(), icon->height(),
110 0, 0, image_size, image_size, 110 0, 0, image_size, image_size,
111 false); 111 false);
112 canvas->DrawImageInt(*drop_image, 112 canvas->DrawImageInt(*drop_image,
113 image_size + kDropArrowLeftMarginPx, 113 image_size + kDropArrowLeftMarginPx,
114 image_size / 2); 114 image_size / 2);
115 [owner_ setButtonImage:gfx::SkBitmapToNSImage(canvas->ExtractBitmap())]; 115 [owner_ setButtonImage:gfx::SkBitmapToNSImage(
116 canvas->ExtractImageRep().sk_bitmap())];
116 } 117 }
117 118
118 // Overridden from ExtensionInfoBarDelegate::DelegateObserver: 119 // Overridden from ExtensionInfoBarDelegate::DelegateObserver:
119 virtual void OnDelegateDeleted() { 120 virtual void OnDelegateDeleted() {
120 delegate_ = NULL; 121 delegate_ = NULL;
121 } 122 }
122 123
123 private: 124 private:
124 // Weak. Owns us. 125 // Weak. Owns us.
125 ExtensionInfoBarController* owner_; 126 ExtensionInfoBarController* owner_;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { 271 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) {
271 NSWindow* window = 272 NSWindow* window =
272 [(NSView*)owner->web_contents()->GetContentNativeView() window]; 273 [(NSView*)owner->web_contents()->GetContentNativeView() window];
273 ExtensionInfoBarController* controller = 274 ExtensionInfoBarController* controller =
274 [[ExtensionInfoBarController alloc] initWithDelegate:this 275 [[ExtensionInfoBarController alloc] initWithDelegate:this
275 owner:owner 276 owner:owner
276 window:window]; 277 window:window];
277 return new InfoBar(controller, this); 278 return new InfoBar(controller, this);
278 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698