| OLD | NEW |
| 1 // Copyright (c) 2012 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 "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 Loading... |
| 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 | |
| 93 // Geometry constants | 74 // Geometry constants |
| 94 | 75 |
| 95 const int kBorderCornerRadius = 3; | 76 const int kBorderCornerRadius = 3; |
| 96 | 77 |
| 97 const int kRadioIndicatorSize = 7; | 78 const int kRadioIndicatorSize = 7; |
| 98 | 79 |
| 99 const int kSliderThumbWidth = 16; | 80 const int kSliderThumbWidth = 16; |
| 100 const int kSliderThumbHeight = 16; | 81 const int kSliderThumbHeight = 16; |
| 101 const int kSliderTrackSize = 6; | 82 const int kSliderTrackSize = 6; |
| 102 | 83 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 height = kSliderThumbHeight; | 297 height = kSliderThumbHeight; |
| 317 break; | 298 break; |
| 318 case kInnerSpinButton: | 299 case kInnerSpinButton: |
| 319 return gfx::Size(kScrollbarWidth, 0); | 300 return gfx::Size(kScrollbarWidth, 0); |
| 320 default: | 301 default: |
| 321 return NativeThemeBase::GetPartSize(part, state, extra); | 302 return NativeThemeBase::GetPartSize(part, state, extra); |
| 322 } | 303 } |
| 323 return gfx::Size(width, height); | 304 return gfx::Size(width, height); |
| 324 } | 305 } |
| 325 | 306 |
| 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 default: | |
| 361 NOTREACHED() << "Invalid color_id: " << color_id; | |
| 362 break; | |
| 363 } | |
| 364 | |
| 365 // Return InvalidColor | |
| 366 return kInvalidColorIdColor; | |
| 367 } | |
| 368 | |
| 369 void NativeThemeChromeos::PaintScrollbarTrack( | 307 void NativeThemeChromeos::PaintScrollbarTrack( |
| 370 SkCanvas* canvas, | 308 SkCanvas* canvas, |
| 371 Part part, | 309 Part part, |
| 372 State state, | 310 State state, |
| 373 const ScrollbarTrackExtraParams& extra_params, | 311 const ScrollbarTrackExtraParams& extra_params, |
| 374 const gfx::Rect& rect) const { | 312 const gfx::Rect& rect) const { |
| 375 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 313 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 376 if (part == kScrollbarVerticalTrack) { | 314 if (part == kScrollbarVerticalTrack) { |
| 377 SkBitmap* background = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND); | 315 SkBitmap* background = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND); |
| 378 SkBitmap* border_up = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND_BORDER_UP); | 316 SkBitmap* border_up = rb.GetBitmapNamed(IDR_SCROLL_BACKGROUND_BORDER_UP); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 753 |
| 816 if (stroke_border) { | 754 if (stroke_border) { |
| 817 SkPaint stroke_paint; | 755 SkPaint stroke_paint; |
| 818 GetStrokePaint(state, &stroke_paint); | 756 GetStrokePaint(state, &stroke_paint); |
| 819 canvas->drawPath(border, stroke_paint); | 757 canvas->drawPath(border, stroke_paint); |
| 820 } | 758 } |
| 821 } | 759 } |
| 822 | 760 |
| 823 } // namespace gfx | 761 } // namespace gfx |
| 824 | 762 |
| OLD | NEW |