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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm

Issue 10834382: mac: Remove implicit conversion from ImageSkia to SkBitmap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/extension_uninstall_dialog_cocoa.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/extension_install_dialog_controller. h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller. h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "base/memory/scoped_nsobject.h" 11 #include "base/memory/scoped_nsobject.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/sys_string_conversions.h" 13 #include "base/sys_string_conversions.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/extensions/bundle_installer.h" 15 #include "chrome/browser/extensions/bundle_installer.h"
16 #include "chrome/browser/extensions/extension_install_dialog.h" 16 #include "chrome/browser/extensions/extension_install_dialog.h"
17 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
18 #include "content/public/browser/page_navigator.h" 18 #include "content/public/browser/page_navigator.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "skia/ext/skia_utils_mac.h" 20 #include "skia/ext/skia_utils_mac.h"
21 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 21 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/l10n/l10n_util_mac.h" 23 #include "ui/base/l10n/l10n_util_mac.h"
24 #include "ui/gfx/image/image_skia_util_mac.h"
24 25
25 using content::OpenURLParams; 26 using content::OpenURLParams;
26 using content::Referrer; 27 using content::Referrer;
27 using extensions::BundleInstaller; 28 using extensions::BundleInstaller;
28 29
29 @interface ExtensionInstallDialogController () 30 @interface ExtensionInstallDialogController ()
30 - (BOOL)isBundleInstall; 31 - (BOOL)isBundleInstall;
31 - (BOOL)isInlineInstall; 32 - (BOOL)isInlineInstall;
32 - (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage; 33 - (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage;
33 - (void)onOutlineViewRowCountDidChange; 34 - (void)onOutlineViewRowCountDidChange;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 316
316 - (BOOL)isBundleInstall { 317 - (BOOL)isBundleInstall {
317 return prompt_->type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT; 318 return prompt_->type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT;
318 } 319 }
319 320
320 - (BOOL)isInlineInstall { 321 - (BOOL)isInlineInstall {
321 return prompt_->type() == ExtensionInstallPrompt::INLINE_INSTALL_PROMPT; 322 return prompt_->type() == ExtensionInstallPrompt::INLINE_INSTALL_PROMPT;
322 } 323 }
323 324
324 - (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage { 325 - (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage {
325 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( 326 NSImage* image = gfx::NSImageFromImageSkiaWithColorSpace(
326 *skiaImage, base::mac::GetSystemColorSpace()); 327 *skiaImage, base::mac::GetSystemColorSpace());
327 NSRect frame = NSMakeRect(0, 0, skiaImage->width(), skiaImage->height()); 328 NSRect frame = NSMakeRect(0, 0, skiaImage->width(), skiaImage->height());
328 scoped_nsobject<NSImageView> view([[NSImageView alloc] initWithFrame:frame]); 329 scoped_nsobject<NSImageView> view([[NSImageView alloc] initWithFrame:frame]);
329 [view setImage:image]; 330 [view setImage:image];
330 331
331 // Add this star after all the other ones 332 // Add this star after all the other ones
332 CGFloat maxStarRight = 0; 333 CGFloat maxStarRight = 0;
333 if ([[ratingStars_ subviews] count]) { 334 if ([[ratingStars_ subviews] count]) {
334 maxStarRight = NSMaxX([[[ratingStars_ subviews] lastObject] frame]); 335 maxStarRight = NSMaxX([[[ratingStars_ subviews] lastObject] frame]);
335 } 336 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 ExtensionInstallDialogController* controller = 542 ExtensionInstallDialogController* controller =
542 [[ExtensionInstallDialogController alloc] 543 [[ExtensionInstallDialogController alloc]
543 initWithParentWindow:parent 544 initWithParentWindow:parent
544 navigator:navigator 545 navigator:navigator
545 delegate:delegate 546 delegate:delegate
546 prompt:prompt]; 547 prompt:prompt];
547 548
548 // TODO(mihaip): Switch this to be tab-modal (http://crbug.com/95455) 549 // TODO(mihaip): Switch this to be tab-modal (http://crbug.com/95455)
549 [controller runAsModalSheet]; 550 [controller runAsModalSheet];
550 } 551 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/extension_uninstall_dialog_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698