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

Side by Side Diff: chrome/browser/ui/cocoa/web_intent_sheet_controller.mm

Issue 10933083: Remove deprecated gfx::Image::operator NSImage*(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments and merge Created 8 years, 3 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
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/web_intent_sheet_controller.h" 5 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h"
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 frame.size.height += 178 frame.size.height +=
179 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField: 179 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:
180 text_]; 180 text_];
181 [text_ setFrame:frame]; 181 [text_ setFrame:frame];
182 182
183 frame.origin.y += NSHeight(frame) + kVerticalSpacing; 183 frame.origin.y += NSHeight(frame) + kVerticalSpacing;
184 184
185 // The sprite image consists of all the animation frames put together in one 185 // The sprite image consists of all the animation frames put together in one
186 // horizontal/wide image. Each animation frame is square in shape within the 186 // horizontal/wide image. Each animation frame is square in shape within the
187 // sprite. 187 // sprite.
188 NSImage* iconImage = rb.GetNativeImageNamed(IDR_SPEECH_INPUT_SPINNER); 188 NSImage* iconImage =
189 rb.GetNativeImageNamed(IDR_SPEECH_INPUT_SPINNER).ToNSImage();
189 frame.size = [iconImage size]; 190 frame.size = [iconImage size];
190 frame.size.width = NSHeight(frame); 191 frame.size.width = NSHeight(frame);
191 frame.origin.x = (WebIntentPicker::kWindowWidth - NSWidth(frame))/2.0; 192 frame.origin.x = (WebIntentPicker::kWindowWidth - NSWidth(frame))/2.0;
192 throbber_.reset([ThrobberView filmstripThrobberViewWithFrame:frame 193 throbber_.reset([ThrobberView filmstripThrobberViewWithFrame:frame
193 image:iconImage]); 194 image:iconImage]);
194 195
195 frame.size = NSMakeSize(WebIntentPicker::kWindowWidth, 196 frame.size = NSMakeSize(WebIntentPicker::kWindowWidth,
196 NSMaxY(frame) + kTopMargin); 197 NSMaxY(frame) + kTopMargin);
197 frame.origin = NSMakePoint(0, 0); 198 frame.origin = NSMakePoint(0, 0);
198 [self setSubviews:@[throbber_, text_]]; 199 [self setSubviews:@[throbber_, text_]];
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 const int kStarSpacing = 1; // Spacing between stars in pixels. 345 const int kStarSpacing = 1; // Spacing between stars in pixels.
345 const CGFloat kStarSize = 16.0; // Size of the star in pixels. 346 const CGFloat kStarSize = 16.0; // Size of the star in pixels.
346 347
347 NSMutableArray* subviews = [NSMutableArray array]; 348 NSMutableArray* subviews = [NSMutableArray array];
348 349
349 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 350 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
350 NSRect imageFrame = NSMakeRect(0, 0, kStarSize, kStarSize); 351 NSRect imageFrame = NSMakeRect(0, 0, kStarSize, kStarSize);
351 352
352 for (int i = 0; i < 5; ++i) { 353 for (int i = 0; i < 5; ++i) {
353 NSImage* nsImage = rb.GetNativeImageNamed( 354 NSImage* nsImage = rb.GetNativeImageNamed(
354 WebIntentPicker::GetNthStarImageIdFromCWSRating(rating, i)); 355 WebIntentPicker::GetNthStarImageIdFromCWSRating(rating, i)).ToNSImage();
355 356
356 scoped_nsobject<DimmableImageView> imageView( 357 scoped_nsobject<DimmableImageView> imageView(
357 [[DimmableImageView alloc] initWithFrame:imageFrame]); 358 [[DimmableImageView alloc] initWithFrame:imageFrame]);
358 [imageView setImage:nsImage]; 359 [imageView setImage:nsImage];
359 [imageView setImageFrameStyle:NSImageFrameNone]; 360 [imageView setImageFrameStyle:NSImageFrameNone];
360 [imageView setFrame:imageFrame]; 361 [imageView setFrame:imageFrame];
361 [imageView setEnabled:YES]; 362 [imageView setEnabled:YES];
362 [subviews addObject:imageView]; 363 [subviews addObject:imageView];
363 imageFrame.origin.x += kStarSize + kStarSpacing; 364 imageFrame.origin.x += kStarSize + kStarSpacing;
364 } 365 }
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 - (void)stopThrobber { 1081 - (void)stopThrobber {
1081 [closeButton_ setEnabled:YES]; 1082 [closeButton_ setEnabled:YES];
1082 [intentView_ stopThrobber]; 1083 [intentView_ stopThrobber];
1083 } 1084 }
1084 1085
1085 - (void)closeSheet { 1086 - (void)closeSheet {
1086 [NSApp endSheet:[self window]]; 1087 [NSApp endSheet:[self window]];
1087 } 1088 }
1088 1089
1089 @end // WebIntentPickerSheetController 1090 @end // WebIntentPickerSheetController
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/throbber_view_unittest.mm ('k') | chrome/browser/ui/cocoa/website_settings_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698