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

Side by Side Diff: ui/gfx/native_theme_chromeos.cc

Issue 9101004: Factor more colors into NativeTheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/native_theme_chromeos.h ('k') | ui/gfx/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gfx/native_theme_chromeos.h" 5 #include "ui/gfx/native_theme_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "grit/gfx_resources.h" 9 #include "grit/gfx_resources.h"
10 #include "third_party/skia/include/effects/SkGradientShader.h" 10 #include "third_party/skia/include/effects/SkGradientShader.h"
11 #include "third_party/skia/include/core/SkPaint.h" 11 #include "third_party/skia/include/core/SkPaint.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 const SkColor kProgressBarIndicatorStroke = SkColorSetRGB(0x4A, 0x4A, 0x4A); 65 const SkColor kProgressBarIndicatorStroke = SkColorSetRGB(0x4A, 0x4A, 0x4A);
66 const SkColor kProgressBarIndicatorDisabledStroke = 66 const SkColor kProgressBarIndicatorDisabledStroke =
67 SkColorSetARGB(0x80, 0x4A, 0x4A, 0x4A); 67 SkColorSetARGB(0x80, 0x4A, 0x4A, 0x4A);
68 68
69 const SkColor kProgressBarIndicatorInnerStroke = 69 const SkColor kProgressBarIndicatorInnerStroke =
70 SkColorSetARGB(0x3F, 0xFF, 0xFF, 0xFF); // 0.25 white 70 SkColorSetARGB(0x3F, 0xFF, 0xFF, 0xFF); // 0.25 white
71 const SkColor kProgressBarIndicatorInnerShadow = 71 const SkColor kProgressBarIndicatorInnerShadow =
72 SkColorSetARGB(0x54, 0xFF, 0xFF, 0xFF); // 0.33 white 72 SkColorSetARGB(0x54, 0xFF, 0xFF, 0xFF); // 0.33 white
73 73
74 // Theme colors returned by GetSystemColor().
75 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
76 // Dialogs:
77 const SkColor kDialogBackgroundColor = SkColorSetRGB(200, 200, 200);
78 // FocusableBorder:
79 const SkColor kFocusedBorderColor= SkColorSetRGB(0x4D, 0x90, 0xFE);
80 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9);
81 // TextButton:
82 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xDE, 0xDE, 0xDE);
83 const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117);
84 const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146);
85 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255);
86 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor;
87 // MenuItem:
88 const SkColor kEnabledMenuItemForegroundColor = SK_ColorBLACK;
89 const SkColor kDisabledMenuItemForegroundColor =
90 SkColorSetRGB(0x80, 0x80, 0x80);
91 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(0xDC, 0xE4, 0xFA);
92
74 // Geometry constants 93 // Geometry constants
75 94
76 const int kBorderCornerRadius = 3; 95 const int kBorderCornerRadius = 3;
77 96
78 const int kRadioIndicatorSize = 7; 97 const int kRadioIndicatorSize = 7;
79 98
80 const int kSliderThumbWidth = 16; 99 const int kSliderThumbWidth = 16;
81 const int kSliderThumbHeight = 16; 100 const int kSliderThumbHeight = 16;
82 const int kSliderTrackSize = 6; 101 const int kSliderTrackSize = 6;
83 102
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 height = kSliderThumbHeight; 316 height = kSliderThumbHeight;
298 break; 317 break;
299 case kInnerSpinButton: 318 case kInnerSpinButton:
300 return gfx::Size(kScrollbarWidth, 0); 319 return gfx::Size(kScrollbarWidth, 0);
301 default: 320 default:
302 return NativeThemeBase::GetPartSize(part, state, extra); 321 return NativeThemeBase::GetPartSize(part, state, extra);
303 } 322 }
304 return gfx::Size(width, height); 323 return gfx::Size(width, height);
305 } 324 }
306 325
326 SkColor NativeThemeChromeos::GetSystemColor(ColorId color_id) const {
327 // Return hard coded values for ChromeOS.
328 // TODO(saintlou) : Remove this module after switch to Aura.
329 switch (color_id) {
330
331 // Dialogs
332 case kColorId_DialogBackground:
333 return kDialogBackgroundColor;
334
335 // FocusableBorder
336 case kColorId_FocusedBorderColor:
337 return kFocusedBorderColor;
338 case kColorId_UnfocusedBorderColor:
339 return kUnfocusedBorderColor;
340
341 // TextButton
342 case kColorId_TextButtonBackgroundColor:
343 return kTextButtonBackgroundColor;
344 case kColorId_TextButtonEnabledColor:
345 return kTextButtonEnabledColor;
346 case kColorId_TextButtonDisabledColor:
347 return kTextButtonDisabledColor;
348 case kColorId_TextButtonHighlightColor:
349 return kTextButtonHighlightColor;
350 case kColorId_TextButtonHoverColor:
351 return kTextButtonHoverColor;
352
353 // MenuItem
354 case kColorId_EnabledMenuItemForegroundColor:
355 return kEnabledMenuItemForegroundColor;
356 case kColorId_DisabledMenuItemForegroundColor:
357 return kDisabledMenuItemForegroundColor;
358 case kColorId_FocusedMenuItemBackgroundColor:
359 return kFocusedMenuItemBackgroundColor;
360
361 default:
362 NOTREACHED() << "Invalid color_id: " << color_id;
363 break;
364 }
365
366 // Return InvalidColor
367 return kInvalidColorIdColor;
368 }
369
307 void NativeThemeChromeos::PaintScrollbarTrack( 370 void NativeThemeChromeos::PaintScrollbarTrack(
308 SkCanvas* canvas, 371 SkCanvas* canvas,
309 Part part, 372 Part part,
310 State state, 373 State state,
311 const ScrollbarTrackExtraParams& extra_params, 374 const ScrollbarTrackExtraParams& extra_params,
312 const gfx::Rect& rect) const { 375 const gfx::Rect& rect) const {
313 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 376 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
314 if (part == kScrollbarVerticalTrack) { 377 if (part == kScrollbarVerticalTrack) {
315 SkBitmap* background = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND); 378 SkBitmap* background = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND);
316 SkBitmap* border_up = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND_BORDER_UP); 379 SkBitmap* border_up = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND_BORDER_UP);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 816
754 if (stroke_border) { 817 if (stroke_border) {
755 SkPaint stroke_paint; 818 SkPaint stroke_paint;
756 GetStrokePaint(state, &stroke_paint); 819 GetStrokePaint(state, &stroke_paint);
757 canvas->drawPath(border, stroke_paint); 820 canvas->drawPath(border, stroke_paint);
758 } 821 }
759 } 822 }
760 823
761 } // namespace gfx 824 } // namespace gfx
762 825
OLDNEW
« no previous file with comments | « ui/gfx/native_theme_chromeos.h ('k') | ui/gfx/native_theme_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698