Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/mac/mac_util.h" | |
| 10 #include "chrome/browser/themes/browser_theme_pack.h" | 11 #include "chrome/browser/themes/browser_theme_pack.h" |
| 11 #include "chrome/browser/themes/theme_properties.h" | 12 #include "chrome/browser/themes/theme_properties.h" |
| 12 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 13 #include "skia/ext/skia_utils_mac.h" | 14 #include "skia/ext/skia_utils_mac.h" |
| 14 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h" | 15 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h" |
| 15 #include "ui/base/material_design/material_design_controller.h" | 16 #include "ui/base/material_design/material_design_controller.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/gfx/color_utils.h" | 18 #include "ui/gfx/color_utils.h" |
| 18 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 19 | 20 |
| 21 @interface NSWorkspace (Redeclarations) | |
| 22 | |
| 23 @property(readonly) BOOL accessibilityDisplayShouldIncreaseContrast; | |
| 24 | |
| 25 @end | |
| 26 | |
| 20 NSString* const kBrowserThemeDidChangeNotification = | 27 NSString* const kBrowserThemeDidChangeNotification = |
| 21 @"BrowserThemeDidChangeNotification"; | 28 @"BrowserThemeDidChangeNotification"; |
| 22 | 29 |
| 23 typedef ThemeProperties Properties; | 30 typedef ThemeProperties Properties; |
| 24 | 31 |
| 25 const int kMaterialDesignIdOffset = 1000000; | 32 const int kMaterialDesignIdOffset = 1000000; |
| 26 | 33 |
| 27 namespace { | 34 namespace { |
| 28 | 35 |
| 29 void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { | 36 void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 return theme_service_.GetNSColor(id, incognito_); | 405 return theme_service_.GetNSColor(id, incognito_); |
| 399 } | 406 } |
| 400 | 407 |
| 401 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const { | 408 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const { |
| 402 return theme_service_.GetNSColorTint(id); | 409 return theme_service_.GetNSColorTint(id); |
| 403 } | 410 } |
| 404 | 411 |
| 405 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const { | 412 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const { |
| 406 return theme_service_.GetNSGradient(id); | 413 return theme_service_.GetNSGradient(id); |
| 407 } | 414 } |
| 415 | |
| 416 bool ThemeService::BrowserThemeProvider::ShouldIncreaseContrast() const { | |
| 417 NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; | |
| 418 if (base::mac::IsOSYosemiteOrLater()) | |
|
Mark Mentovai
2016/06/21 19:58:54
Wouldn’t our usual style be to use -respondsToSele
Elly Fong-Jones
2016/06/21 20:25:36
Done.
| |
| 419 return workspace.accessibilityDisplayShouldIncreaseContrast == YES; | |
| 420 return false; | |
| 421 } | |
| OLD | NEW |