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

Side by Side Diff: ui/native_theme/native_theme_mac.mm

Issue 231883003: [stash] 20140404-crbug-312961-mac-views-bridge-C-wholegrid Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « ui/gl/gl_surface_mac.cc ('k') | ui/views/controls/menu/menu_item_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/native_theme/native_theme_mac.h" 5 #include "ui/native_theme/native_theme_mac.h"
6 6
7 #include <Cocoa/Cocoa.h>
8
7 #include "base/basictypes.h" 9 #include "base/basictypes.h"
8 #include "ui/native_theme/common_theme.h" 10 #include "ui/native_theme/common_theme.h"
11 #include "skia/ext/skia_utils_mac.h"
9 12
10 namespace { 13 namespace {
11 14
12 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); 15 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
13 const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251); 16 const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251);
14 17
18 // System colors use NSNamedColorSpace System.
19 SkColor SystemColor(NSColor* color) {
20 return gfx::NSDeviceColorToSkColor(
21 [color colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]]);
22 }
23
15 } // namespace 24 } // namespace
16 25
17 namespace ui { 26 namespace ui {
18 27
19 // static 28 // static
20 NativeTheme* NativeTheme::instance() { 29 NativeTheme* NativeTheme::instance() {
21 return NativeThemeMac::instance(); 30 return NativeThemeMac::instance();
22 } 31 }
23 32
24 // static 33 // static
25 NativeThemeMac* NativeThemeMac::instance() { 34 NativeThemeMac* NativeThemeMac::instance() {
26 CR_DEFINE_STATIC_LOCAL(NativeThemeMac, s_native_theme, ()); 35 CR_DEFINE_STATIC_LOCAL(NativeThemeMac, s_native_theme, ());
27 return &s_native_theme; 36 return &s_native_theme;
28 } 37 }
29 38
30 SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const { 39 SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const {
31 SkColor color; 40 SkColor color;
32 if (CommonThemeGetSystemColor(color_id, &color)) 41 if (CommonThemeGetSystemColor(color_id, &color))
33 return color; 42 return color;
34 43
35 switch (color_id) { 44 switch (color_id) {
36 case kColorId_DialogBackground: 45 case kColorId_DialogBackground:
37 return kDialogBackgroundColor; 46 return kDialogBackgroundColor;
47 case kColorId_LabelEnabledColor:
48 return SystemColor([NSColor controlTextColor]);
49 case kColorId_LabelDisabledColor:
50 return SystemColor([NSColor disabledControlTextColor]);
51 case kColorId_LabelBackgroundColor:
52 return SystemColor([NSColor textBackgroundColor]);
38 default: 53 default:
39 NOTREACHED() << "Invalid color_id: " << color_id; 54 NOTREACHED() << "Invalid color_id: " << color_id;
40 } 55 }
41 56
42 return kInvalidColorIdColor; 57 return kInvalidColorIdColor;
43 } 58 }
44 59
45 NativeThemeMac::NativeThemeMac() { 60 NativeThemeMac::NativeThemeMac() {
46 } 61 }
47 62
48 NativeThemeMac::~NativeThemeMac() { 63 NativeThemeMac::~NativeThemeMac() {
49 } 64 }
50 65
51 } // namespace ui 66 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_mac.cc ('k') | ui/views/controls/menu/menu_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698