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

Side by Side Diff: chrome/browser/themes/theme_service_mac.mm

Issue 2403853002: cocoa browser: remove remaining non-MD code (Closed)
Patch Set: git cl format Created 4 years, 2 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Check to see if we already have the gradient in the cache. 249 // Check to see if we already have the gradient in the cache.
250 NSGradientMap::const_iterator nsgradient_iter = nsgradient_cache_.find(id); 250 NSGradientMap::const_iterator nsgradient_iter = nsgradient_cache_.find(id);
251 if (nsgradient_iter != nsgradient_cache_.end()) 251 if (nsgradient_iter != nsgradient_cache_.end())
252 return nsgradient_iter->second; 252 return nsgradient_iter->second;
253 253
254 NSGradient* gradient = nil; 254 NSGradient* gradient = nil;
255 255
256 // Note that we are not leaking when we assign a retained object to 256 // Note that we are not leaking when we assign a retained object to
257 // |gradient|; in all cases we cache it before we return. 257 // |gradient|; in all cases we cache it before we return.
258 switch (id) { 258 switch (id) {
259 case Properties::GRADIENT_FRAME_INCOGNITO:
260 case Properties::GRADIENT_FRAME_INCOGNITO_INACTIVE: {
261 // TODO(avi): can we simplify this?
262 BOOL active = id == Properties::GRADIENT_FRAME_INCOGNITO;
263 NSColor* base_color = [NSColor colorWithCalibratedRed:83/255.0
264 green:108.0/255.0
265 blue:140/255.0
266 alpha:1.0];
267
268 NSColor *start_color =
269 [base_color gtm_colorAdjustedFor:GTMColorationBaseMidtone
270 faded:!active];
271 NSColor *end_color =
272 [base_color gtm_colorAdjustedFor:GTMColorationBaseShadow
273 faded:!active];
274
275 if (!active) {
276 start_color = [start_color gtm_colorByAdjustingLuminance:0.1
277 saturation:0.5];
278 end_color = [end_color gtm_colorByAdjustingLuminance:0.1
279 saturation:0.5];
280 }
281
282 gradient = [[NSGradient alloc] initWithStartingColor:start_color
283 endingColor:end_color];
284 break;
285 }
286
287 case Properties::GRADIENT_TOOLBAR: 259 case Properties::GRADIENT_TOOLBAR:
288 case Properties::GRADIENT_TOOLBAR_INACTIVE: { 260 case Properties::GRADIENT_TOOLBAR_INACTIVE: {
289 NSColor* base_color = [NSColor colorWithCalibratedWhite:0.2 alpha:1.0]; 261 NSColor* base_color = [NSColor colorWithCalibratedWhite:0.2 alpha:1.0];
290 BOOL faded = (id == Properties::GRADIENT_TOOLBAR_INACTIVE ) || 262 BOOL faded = (id == Properties::GRADIENT_TOOLBAR_INACTIVE ) ||
291 (id == Properties::GRADIENT_TOOLBAR_BUTTON_INACTIVE); 263 (id == Properties::GRADIENT_TOOLBAR_BUTTON_INACTIVE);
292 NSColor* start_color = 264 NSColor* start_color =
293 [base_color gtm_colorAdjustedFor:GTMColorationLightHighlight 265 [base_color gtm_colorAdjustedFor:GTMColorationLightHighlight
294 faded:faded]; 266 faded:faded];
295 NSColor* mid_color = 267 NSColor* mid_color =
296 [base_color gtm_colorAdjustedFor:GTMColorationLightMidtone 268 [base_color gtm_colorAdjustedFor:GTMColorationLightMidtone
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 386
415 bool ThemeService::BrowserThemeProvider::ShouldIncreaseContrast() const { 387 bool ThemeService::BrowserThemeProvider::ShouldIncreaseContrast() const {
416 NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; 388 NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
417 if ([workspace 389 if ([workspace
418 respondsToSelector:@selector( 390 respondsToSelector:@selector(
419 accessibilityDisplayShouldIncreaseContrast)]) { 391 accessibilityDisplayShouldIncreaseContrast)]) {
420 return workspace.accessibilityDisplayShouldIncreaseContrast == YES; 392 return workspace.accessibilityDisplayShouldIncreaseContrast == YES;
421 } 393 }
422 return false; 394 return false;
423 } 395 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_properties.h ('k') | chrome/browser/ui/cocoa/background_gradient_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698