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/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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 icon = rb.GetImageSkiaNamed(IDR_EXTENSIONS_SECTION); | 102 icon = rb.GetImageSkiaNamed(IDR_EXTENSIONS_SECTION); |
103 else | 103 else |
104 icon = image.ToImageSkia(); | 104 icon = image.ToImageSkia(); |
105 | 105 |
106 gfx::ImageSkia* drop_image = rb.GetImageSkiaNamed(IDR_APP_DROPARROW); | 106 gfx::ImageSkia* drop_image = rb.GetImageSkiaNamed(IDR_APP_DROPARROW); |
107 | 107 |
108 const int image_size = extension_misc::EXTENSION_ICON_BITTY; | 108 const int image_size = extension_misc::EXTENSION_ICON_BITTY; |
109 scoped_ptr<gfx::Canvas> canvas( | 109 scoped_ptr<gfx::Canvas> canvas( |
110 new gfx::Canvas( | 110 new gfx::Canvas( |
111 gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(), | 111 gfx::Size(image_size + kDropArrowLeftMarginPx + drop_image->width(), |
112 image_size), ui::SCALE_FACTOR_100P, false)); | 112 image_size), 1.0f, false)); |
113 canvas->DrawImageInt(*icon, | 113 canvas->DrawImageInt(*icon, |
114 0, 0, icon->width(), icon->height(), | 114 0, 0, icon->width(), icon->height(), |
115 0, 0, image_size, image_size, | 115 0, 0, image_size, image_size, |
116 false); | 116 false); |
117 canvas->DrawImageInt(*drop_image, | 117 canvas->DrawImageInt(*drop_image, |
118 image_size + kDropArrowLeftMarginPx, | 118 image_size + kDropArrowLeftMarginPx, |
119 image_size / 2); | 119 image_size / 2); |
120 [owner_ setButtonImage:gfx::SkBitmapToNSImage( | 120 [owner_ setButtonImage:gfx::SkBitmapToNSImage( |
121 canvas->ExtractImageRep().sk_bitmap())]; | 121 canvas->ExtractImageRep().sk_bitmap())]; |
122 } | 122 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(owner, this)); | 269 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(owner, this)); |
270 NSWindow* window = | 270 NSWindow* window = |
271 [(NSView*)owner->web_contents()->GetView()->GetContentNativeView() | 271 [(NSView*)owner->web_contents()->GetView()->GetContentNativeView() |
272 window]; | 272 window]; |
273 base::scoped_nsobject<ExtensionInfoBarController> controller( | 273 base::scoped_nsobject<ExtensionInfoBarController> controller( |
274 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get() | 274 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get() |
275 window:window]); | 275 window:window]); |
276 infobar->set_controller(controller); | 276 infobar->set_controller(controller); |
277 return infobar.release(); | 277 return infobar.release(); |
278 } | 278 } |
OLD | NEW |