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

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

Issue 10453101: Convert most of the rest of chrome to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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/extensions/extension_install_dialog_controller. h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller. h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
(...skipping 12 matching lines...) Expand all
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/l10n/l10n_util_mac.h" 24 #include "ui/base/l10n/l10n_util_mac.h"
25 25
26 using content::OpenURLParams; 26 using content::OpenURLParams;
27 using content::Referrer; 27 using content::Referrer;
28 using extensions::BundleInstaller; 28 using extensions::BundleInstaller;
29 29
30 @interface ExtensionInstallDialogController () 30 @interface ExtensionInstallDialogController ()
31 - (BOOL)isBundleInstall; 31 - (BOOL)isBundleInstall;
32 - (BOOL)isInlineInstall; 32 - (BOOL)isInlineInstall;
33 - (void)appendRatingStar:(const SkBitmap*)skiaImage; 33 - (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage;
34 @end 34 @end
35 35
36 namespace { 36 namespace {
37 37
38 // Padding above the warnings separator, we must also subtract this when hiding 38 // Padding above the warnings separator, we must also subtract this when hiding
39 // it. 39 // it.
40 const CGFloat kWarningsSeparatorPadding = 14; 40 const CGFloat kWarningsSeparatorPadding = 14;
41 41
42 // Maximum height we will adjust controls to when trying to accomodate their 42 // Maximum height we will adjust controls to when trying to accomodate their
43 // contents. 43 // contents.
(...skipping 15 matching lines...) Expand all
59 currentRect.size.height + offset)]; 59 currentRect.size.height + offset)];
60 60
61 *totalOffset += offset; 61 *totalOffset += offset;
62 62
63 // Move the control vertically by the new total offset. 63 // Move the control vertically by the new total offset.
64 NSPoint origin = [control frame].origin; 64 NSPoint origin = [control frame].origin;
65 origin.y -= *totalOffset; 65 origin.y -= *totalOffset;
66 [control setFrameOrigin:origin]; 66 [control setFrameOrigin:origin];
67 } 67 }
68 68
69 void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { 69 void AppendRatingStarsShim(const gfx::ImageSkia* skiaImage, void* data) {
70 ExtensionInstallDialogController* controller = 70 ExtensionInstallDialogController* controller =
71 static_cast<ExtensionInstallDialogController*>(data); 71 static_cast<ExtensionInstallDialogController*>(data);
72 [controller appendRatingStar:skiaImage]; 72 [controller appendRatingStar:skiaImage];
73 } 73 }
74 74
75 } 75 }
76 76
77 @implementation ExtensionInstallDialogController 77 @implementation ExtensionInstallDialogController
78 78
79 @synthesize iconView = iconView_; 79 @synthesize iconView = iconView_;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 - (BOOL)isBundleInstall { 292 - (BOOL)isBundleInstall {
293 return prompt_->type() == ExtensionInstallUI::BUNDLE_INSTALL_PROMPT; 293 return prompt_->type() == ExtensionInstallUI::BUNDLE_INSTALL_PROMPT;
294 } 294 }
295 295
296 - (BOOL)isInlineInstall { 296 - (BOOL)isInlineInstall {
297 return prompt_->type() == ExtensionInstallUI::INLINE_INSTALL_PROMPT; 297 return prompt_->type() == ExtensionInstallUI::INLINE_INSTALL_PROMPT;
298 } 298 }
299 299
300 - (void)appendRatingStar:(const SkBitmap*)skiaImage { 300 - (void)appendRatingStar:(const gfx::ImageSkia*)skiaImage {
301 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( 301 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace(
302 *skiaImage, base::mac::GetSystemColorSpace()); 302 *skiaImage, base::mac::GetSystemColorSpace());
303 NSRect frame = NSMakeRect(0, 0, skiaImage->width(), skiaImage->height()); 303 NSRect frame = NSMakeRect(0, 0, skiaImage->width(), skiaImage->height());
304 scoped_nsobject<NSImageView> view([[NSImageView alloc] initWithFrame:frame]); 304 scoped_nsobject<NSImageView> view([[NSImageView alloc] initWithFrame:frame]);
305 [view setImage:image]; 305 [view setImage:image];
306 306
307 // Add this star after all the other ones 307 // Add this star after all the other ones
308 CGFloat maxStarRight = 0; 308 CGFloat maxStarRight = 0;
309 if ([[ratingStars_ subviews] count]) { 309 if ([[ratingStars_ subviews] count]) {
310 maxStarRight = NSMaxX([[[ratingStars_ subviews] lastObject] frame]); 310 maxStarRight = NSMaxX([[[ratingStars_ subviews] lastObject] frame]);
(...skipping 27 matching lines...) Expand all
338 ExtensionInstallDialogController* controller = 338 ExtensionInstallDialogController* controller =
339 [[ExtensionInstallDialogController alloc] 339 [[ExtensionInstallDialogController alloc]
340 initWithParentWindow:native_window 340 initWithParentWindow:native_window
341 profile:profile 341 profile:profile
342 delegate:delegate 342 delegate:delegate
343 prompt:prompt]; 343 prompt:prompt];
344 344
345 // TODO(mihaip): Switch this to be tab-modal (http://crbug.com/95455) 345 // TODO(mihaip): Switch this to be tab-modal (http://crbug.com/95455)
346 [controller runAsModalSheet]; 346 [controller runAsModalSheet];
347 } 347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698