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

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

Issue 6117006: Mac: Explicitly set the colorspace on SkBitmap -> CGImageRef conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 11 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/tabpose_window.mm » ('j') | skia/ext/skia_utils_mac.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
11 11
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "app/mac/nsimage_cache.h" 13 #include "app/mac/nsimage_cache.h"
14 #include "app/resource_bundle.h" 14 #include "app/resource_bundle.h"
15 #include "base/mac/mac_util.h"
15 #include "base/sys_string_conversions.h" 16 #include "base/sys_string_conversions.h"
16 #include "chrome/app/chrome_command_ids.h" 17 #include "chrome/app/chrome_command_ids.h"
17 #include "chrome/browser/autocomplete/autocomplete.h" 18 #include "chrome/browser/autocomplete/autocomplete.h"
18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 19 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
19 #include "chrome/browser/autocomplete/autocomplete_match.h" 20 #include "chrome/browser/autocomplete/autocomplete_match.h"
20 #include "chrome/browser/metrics/user_metrics.h" 21 #include "chrome/browser/metrics/user_metrics.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/debugger/devtools_window.h" 23 #include "chrome/browser/debugger/devtools_window.h"
23 #include "chrome/browser/net/url_fixer_upper.h" 24 #include "chrome/browser/net/url_fixer_upper.h"
24 #include "chrome/browser/sidebar/sidebar_container.h" 25 #include "chrome/browser/sidebar/sidebar_container.h"
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 object:self]; 1203 object:self];
1203 1204
1204 [delegate_ onTabDetachedWithContents:contents->tab_contents()]; 1205 [delegate_ onTabDetachedWithContents:contents->tab_contents()];
1205 } 1206 }
1206 1207
1207 // A helper routine for creating an NSImageView to hold the fav icon or app icon 1208 // A helper routine for creating an NSImageView to hold the fav icon or app icon
1208 // for |contents|. 1209 // for |contents|.
1209 - (NSImageView*)iconImageViewForContents:(TabContents*)contents { 1210 - (NSImageView*)iconImageViewForContents:(TabContents*)contents {
1210 BOOL isApp = contents->is_app(); 1211 BOOL isApp = contents->is_app();
1211 NSImage* image = nil; 1212 NSImage* image = nil;
1213 // Favicons come from the renderer, and the renderer draws everything in the
1214 // system color space.
1215 CGColorSpaceRef colorSpace = base::mac::GetSystemColorSpace();
1212 if (isApp) { 1216 if (isApp) {
1213 SkBitmap* icon = contents->GetExtensionAppIcon(); 1217 SkBitmap* icon = contents->GetExtensionAppIcon();
1214 if (icon) 1218 if (icon)
1215 image = gfx::SkBitmapToNSImage(*icon); 1219 image = gfx::SkBitmapToNSImageWithColorSpace(*icon, colorSpace);
1216 } else { 1220 } else {
1217 image = gfx::SkBitmapToNSImage(contents->GetFavIcon()); 1221 image = gfx::SkBitmapToNSImageWithColorSpace(contents->GetFavIcon(),
1222 colorSpace);
1218 } 1223 }
1219 1224
1220 // Either we don't have a valid favicon or there was some issue converting it 1225 // Either we don't have a valid favicon or there was some issue converting it
1221 // from an SkBitmap. Either way, just show the default. 1226 // from an SkBitmap. Either way, just show the default.
1222 if (!image) 1227 if (!image)
1223 image = defaultFavIcon_.get(); 1228 image = defaultFavIcon_.get();
1224 NSRect frame = NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); 1229 NSRect frame = NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight);
1225 NSImageView* view = [[[NSImageView alloc] initWithFrame:frame] autorelease]; 1230 NSImageView* view = [[[NSImageView alloc] initWithFrame:frame] autorelease];
1226 [view setImage:image]; 1231 [view setImage:image];
1227 return view; 1232 return view;
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 NSInteger index = [self indexFromModelIndex:modelIndex]; 1895 NSInteger index = [self indexFromModelIndex:modelIndex];
1891 BrowserWindowController* controller = 1896 BrowserWindowController* controller =
1892 (BrowserWindowController*)[[switchView_ window] windowController]; 1897 (BrowserWindowController*)[[switchView_ window] windowController];
1893 DCHECK(index >= 0); 1898 DCHECK(index >= 0);
1894 if (index >= 0) { 1899 if (index >= 0) {
1895 [controller setTab:[self viewAtIndex:index] isDraggable:YES]; 1900 [controller setTab:[self viewAtIndex:index] isDraggable:YES];
1896 } 1901 }
1897 } 1902 }
1898 1903
1899 @end 1904 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabpose_window.mm » ('j') | skia/ext/skia_utils_mac.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698