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

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

Issue 2413223003: Views:: Make Labels support text selection. (Closed)
Patch Set: Cleanup. More tests. Created 4 years, 1 month 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) 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 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 // Mac has a different "pressed button" styling because it doesn't use 148 // Mac has a different "pressed button" styling because it doesn't use
149 // ripples. 149 // ripples.
150 case kColorId_ButtonPressedShade: 150 case kColorId_ButtonPressedShade:
151 return SkColorSetA(SK_ColorBLACK, 0x10); 151 return SkColorSetA(SK_ColorBLACK, 0x10);
152 152
153 // There's a system setting General > Highlight color which sets the 153 // There's a system setting General > Highlight color which sets the
154 // background color for text selections. We honor that setting. 154 // background color for text selections. We honor that setting.
155 // TODO(ellyjones): Listen for NSSystemColorsDidChangeNotification somewhere 155 // TODO(ellyjones): Listen for NSSystemColorsDidChangeNotification somewhere
156 // and propagate it to the View hierarchy. 156 // and propagate it to the View hierarchy.
157 case kColorId_LabelTextSelectionBackgroundFocused:
157 case kColorId_TextfieldSelectionBackgroundFocused: 158 case kColorId_TextfieldSelectionBackgroundFocused:
158 return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]); 159 return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]);
159 default: 160 default:
160 break; 161 break;
161 } 162 }
162 163
163 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 164 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
164 return ApplySystemControlTint(GetAuraColor(color_id, this)); 165 return ApplySystemControlTint(GetAuraColor(color_id, this));
165 166
166 // TODO(tapted): Add caching for these, and listen for 167 // TODO(tapted): Add caching for these, and listen for
(...skipping 19 matching lines...) Expand all
186 case kColorId_ButtonEnabledColor: 187 case kColorId_ButtonEnabledColor:
187 case kColorId_EnabledMenuButtonBorderColor: 188 case kColorId_EnabledMenuButtonBorderColor:
188 case kColorId_LabelEnabledColor: 189 case kColorId_LabelEnabledColor:
189 case kColorId_ProminentButtonColor: 190 case kColorId_ProminentButtonColor:
190 return NSSystemColorToSkColor([NSColor controlTextColor]); 191 return NSSystemColorToSkColor([NSColor controlTextColor]);
191 case kColorId_ButtonDisabledColor: 192 case kColorId_ButtonDisabledColor:
192 case kColorId_LabelDisabledColor: 193 case kColorId_LabelDisabledColor:
193 return NSSystemColorToSkColor([NSColor disabledControlTextColor]); 194 return NSSystemColorToSkColor([NSColor disabledControlTextColor]);
194 case kColorId_ButtonHoverColor: 195 case kColorId_ButtonHoverColor:
195 return NSSystemColorToSkColor([NSColor selectedControlTextColor]); 196 return NSSystemColorToSkColor([NSColor selectedControlTextColor]);
197 case kColorId_LabelTextSelectionColor:
198 return NSSystemColorToSkColor([NSColor selectedTextColor]);
196 199
197 // Link. 200 // Link.
198 case kColorId_LinkDisabled: 201 case kColorId_LinkDisabled:
199 return SK_ColorBLACK; 202 return SK_ColorBLACK;
200 case kColorId_LinkEnabled: 203 case kColorId_LinkEnabled:
201 return SK_ColorBLUE; 204 return SK_ColorBLUE;
202 case kColorId_LinkPressed: 205 case kColorId_LinkPressed:
203 return SK_ColorRED; 206 return SK_ColorRED;
204 207
205 // Text fields. 208 // Text fields.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 canvas->drawDRRect(outer_shape, shape, paint); 429 canvas->drawDRRect(outer_shape, shape, paint);
427 } 430 }
428 431
429 NativeThemeMac::NativeThemeMac() { 432 NativeThemeMac::NativeThemeMac() {
430 } 433 }
431 434
432 NativeThemeMac::~NativeThemeMac() { 435 NativeThemeMac::~NativeThemeMac() {
433 } 436 }
434 437
435 } // namespace ui 438 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698