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

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

Issue 2413223003: Views:: Make Labels support text selection. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « ui/native_theme/native_theme_dark_aura.cc ('k') | ui/native_theme/native_theme_win.cc » ('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 #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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Mac has a different "pressed button" styling because it doesn't use 153 // Mac has a different "pressed button" styling because it doesn't use
154 // ripples. 154 // ripples.
155 case kColorId_ButtonPressedShade: 155 case kColorId_ButtonPressedShade:
156 return SkColorSetA(SK_ColorBLACK, 0x10); 156 return SkColorSetA(SK_ColorBLACK, 0x10);
157 157
158 // There's a system setting General > Highlight color which sets the 158 // There's a system setting General > Highlight color which sets the
159 // background color for text selections. We honor that setting. 159 // background color for text selections. We honor that setting.
160 // TODO(ellyjones): Listen for NSSystemColorsDidChangeNotification somewhere 160 // TODO(ellyjones): Listen for NSSystemColorsDidChangeNotification somewhere
161 // and propagate it to the View hierarchy. 161 // and propagate it to the View hierarchy.
162 case kColorId_LabelTextSelectionBackgroundFocused:
162 case kColorId_TextfieldSelectionBackgroundFocused: 163 case kColorId_TextfieldSelectionBackgroundFocused:
163 return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]); 164 return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]);
164 default: 165 default:
165 break; 166 break;
166 } 167 }
167 168
168 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 169 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
169 return ApplySystemControlTint(GetAuraColor(color_id, this)); 170 return ApplySystemControlTint(GetAuraColor(color_id, this));
170 171
171 // TODO(tapted): Add caching for these, and listen for 172 // TODO(tapted): Add caching for these, and listen for
(...skipping 19 matching lines...) Expand all
191 case kColorId_ButtonEnabledColor: 192 case kColorId_ButtonEnabledColor:
192 case kColorId_EnabledMenuButtonBorderColor: 193 case kColorId_EnabledMenuButtonBorderColor:
193 case kColorId_LabelEnabledColor: 194 case kColorId_LabelEnabledColor:
194 case kColorId_ProminentButtonColor: 195 case kColorId_ProminentButtonColor:
195 return NSSystemColorToSkColor([NSColor controlTextColor]); 196 return NSSystemColorToSkColor([NSColor controlTextColor]);
196 case kColorId_ButtonDisabledColor: 197 case kColorId_ButtonDisabledColor:
197 case kColorId_LabelDisabledColor: 198 case kColorId_LabelDisabledColor:
198 return NSSystemColorToSkColor([NSColor disabledControlTextColor]); 199 return NSSystemColorToSkColor([NSColor disabledControlTextColor]);
199 case kColorId_ButtonHoverColor: 200 case kColorId_ButtonHoverColor:
200 return NSSystemColorToSkColor([NSColor selectedControlTextColor]); 201 return NSSystemColorToSkColor([NSColor selectedControlTextColor]);
202 case kColorId_LabelTextSelectionColor:
203 return NSSystemColorToSkColor([NSColor selectedTextColor]);
201 204
202 // Link. 205 // Link.
203 case kColorId_LinkDisabled: 206 case kColorId_LinkDisabled:
204 return SK_ColorBLACK; 207 return SK_ColorBLACK;
205 case kColorId_LinkEnabled: 208 case kColorId_LinkEnabled:
206 return SK_ColorBLUE; 209 return SK_ColorBLUE;
207 case kColorId_LinkPressed: 210 case kColorId_LinkPressed:
208 return SK_ColorRED; 211 return SK_ColorRED;
209 212
210 // Text fields. 213 // Text fields.
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 canvas->drawDRRect(outer_shape, shape, paint); 434 canvas->drawDRRect(outer_shape, shape, paint);
432 } 435 }
433 436
434 NativeThemeMac::NativeThemeMac() { 437 NativeThemeMac::NativeThemeMac() {
435 } 438 }
436 439
437 NativeThemeMac::~NativeThemeMac() { 440 NativeThemeMac::~NativeThemeMac() {
438 } 441 }
439 442
440 } // namespace ui 443 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_dark_aura.cc ('k') | ui/native_theme/native_theme_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698