| 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 "chrome/browser/themes/browser_theme_pack.h" | 10 #include "chrome/browser/themes/browser_theme_pack.h" |
| 11 #include "chrome/browser/themes/theme_properties.h" | 11 #include "chrome/browser/themes/theme_properties.h" |
| 12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 13 #include "skia/ext/skia_utils_mac.h" | 13 #include "skia/ext/skia_utils_mac.h" |
| 14 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h" | 14 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSColor+Luminance.h" |
| 15 #include "ui/base/material_design/material_design_controller.h" | 15 #include "ui/base/material_design/material_design_controller.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/gfx/color_utils.h" | 17 #include "ui/gfx/color_utils.h" |
| 18 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
| 19 | 19 |
| 20 @interface NSWorkspace (Redeclarations) |
| 21 |
| 22 @property(readonly) BOOL accessibilityDisplayShouldIncreaseContrast; |
| 23 |
| 24 @end |
| 25 |
| 20 NSString* const kBrowserThemeDidChangeNotification = | 26 NSString* const kBrowserThemeDidChangeNotification = |
| 21 @"BrowserThemeDidChangeNotification"; | 27 @"BrowserThemeDidChangeNotification"; |
| 22 | 28 |
| 23 typedef ThemeProperties Properties; | 29 typedef ThemeProperties Properties; |
| 24 | 30 |
| 25 const int kMaterialDesignIdOffset = 1000000; | 31 const int kMaterialDesignIdOffset = 1000000; |
| 26 | 32 |
| 27 namespace { | 33 namespace { |
| 28 | 34 |
| 29 void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { | 35 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_); | 404 return theme_service_.GetNSColor(id, incognito_); |
| 399 } | 405 } |
| 400 | 406 |
| 401 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const { | 407 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const { |
| 402 return theme_service_.GetNSColorTint(id); | 408 return theme_service_.GetNSColorTint(id); |
| 403 } | 409 } |
| 404 | 410 |
| 405 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const { | 411 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const { |
| 406 return theme_service_.GetNSGradient(id); | 412 return theme_service_.GetNSGradient(id); |
| 407 } | 413 } |
| 414 |
| 415 bool ThemeService::BrowserThemeProvider::ShouldIncreaseContrast() const { |
| 416 NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; |
| 417 if ([workspace |
| 418 respondsToSelector:@selector( |
| 419 accessibilityDisplayShouldIncreaseContrast)]) { |
| 420 return workspace.accessibilityDisplayShouldIncreaseContrast == YES; |
| 421 } |
| 422 return false; |
| 423 } |
| OLD | NEW |