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

Side by Side Diff: chrome/browser/themes/theme_service_mac.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/themes/browser_theme_pack.h" 10 #include "chrome/browser/themes/browser_theme_pack.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return nsimage_iter->second; 44 return nsimage_iter->second;
45 45
46 // Why don't we load the file directly into the image instead of the whole 46 // Why don't we load the file directly into the image instead of the whole
47 // gfx::Image > native conversion? 47 // gfx::Image > native conversion?
48 // - For consistency with other platforms. 48 // - For consistency with other platforms.
49 // - To get the generated tinted images. 49 // - To get the generated tinted images.
50 NSImage* nsimage = nil; 50 NSImage* nsimage = nil;
51 if (theme_pack_.get()) { 51 if (theme_pack_.get()) {
52 const gfx::Image* image = theme_pack_->GetImageNamed(id); 52 const gfx::Image* image = theme_pack_->GetImageNamed(id);
53 if (image) 53 if (image)
54 nsimage = *image; 54 nsimage = image->ToNSImage();
55 } 55 }
56 56
57 // If the theme didn't override this image then load it from the resource 57 // If the theme didn't override this image then load it from the resource
58 // bundle. 58 // bundle.
59 if (!nsimage) { 59 if (!nsimage) {
60 nsimage = rb_.GetNativeImageNamed(id); 60 nsimage = rb_.GetNativeImageNamed(id).ToNSImage();
61 } 61 }
62 62
63 // We loaded successfully. Cache the image. 63 // We loaded successfully. Cache the image.
64 if (nsimage) { 64 if (nsimage) {
65 nsimage_cache_[id] = [nsimage retain]; 65 nsimage_cache_[id] = [nsimage retain];
66 return nsimage; 66 return nsimage;
67 } 67 }
68 68
69 // We failed to retrieve the bitmap, show a debugging red square. 69 // We failed to retrieve the bitmap, show a debugging red square.
70 LOG(WARNING) << "Unable to load NSImage with id " << id; 70 LOG(WARNING) << "Unable to load NSImage with id " << id;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 313 }
314 nscolor_cache_.clear(); 314 nscolor_cache_.clear();
315 315
316 // Free gradients. 316 // Free gradients.
317 for (NSGradientMap::iterator i = nsgradient_cache_.begin(); 317 for (NSGradientMap::iterator i = nsgradient_cache_.begin();
318 i != nsgradient_cache_.end(); i++) { 318 i != nsgradient_cache_.end(); i++) {
319 [i->second release]; 319 [i->second release];
320 } 320 }
321 nsgradient_cache_.clear(); 321 nsgradient_cache_.clear();
322 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698