| OLD | NEW |
| 1 // Copyright (c) 2012 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/native_theme/common_theme.h" | 5 #include "ui/native_theme/common_theme.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "ui/base/resource/material_design/material_design_controller.h" | 9 #include "ui/base/resource/material_design/material_design_controller.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const NativeTheme* base_theme) { | 22 const NativeTheme* base_theme) { |
| 23 // Shared colors. | 23 // Shared colors. |
| 24 static const SkColor kTextfieldDefaultBackground = SK_ColorWHITE; | 24 static const SkColor kTextfieldDefaultBackground = SK_ColorWHITE; |
| 25 static const SkColor kTextfieldSelectionBackgroundFocused = | 25 static const SkColor kTextfieldSelectionBackgroundFocused = |
| 26 SkColorSetARGB(0x54, 0x60, 0xA8, 0xEB); | 26 SkColorSetARGB(0x54, 0x60, 0xA8, 0xEB); |
| 27 | 27 |
| 28 // MD colors. | 28 // MD colors. |
| 29 if (ui::MaterialDesignController::IsModeMaterial()) { | 29 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 30 // Dialogs: | 30 // Dialogs: |
| 31 static const SkColor kDialogBackgroundColorMd = SK_ColorWHITE; | 31 static const SkColor kDialogBackgroundColorMd = SK_ColorWHITE; |
| 32 // Button: |
| 33 static const SkColor kTextButtonEnabledColorMd = |
| 34 SkColorSetRGB(0x64, 0x64, 0x64); |
| 35 static const SkColor kTextButtonDisabledColorMd = |
| 36 SkColorSetA(kTextButtonEnabledColorMd, 0x80); |
| 32 // MenuItem: | 37 // MenuItem: |
| 33 const SkColor kMenuHighlightBackgroundColorMd = | 38 static const SkColor kMenuHighlightBackgroundColorMd = |
| 34 SkColorSetARGB(0x14, 0x00, 0x00, 0x00); | 39 SkColorSetARGB(0x14, 0x00, 0x00, 0x00); |
| 35 const SkColor kSelectedMenuItemForegroundColorMd = SK_ColorBLACK; | 40 static const SkColor kSelectedMenuItemForegroundColorMd = SK_ColorBLACK; |
| 36 // Link: | 41 // Link: |
| 37 const SkColor kLinkDisabledColorMd = SK_ColorBLACK; | 42 static const SkColor kLinkDisabledColorMd = SK_ColorBLACK; |
| 38 const SkColor kLinkEnabledColorMd = gfx::kGoogleBlue700; | 43 static const SkColor kLinkEnabledColorMd = gfx::kGoogleBlue700; |
| 39 // Results tables: | 44 // Results tables: |
| 40 static const SkColor kResultsTableTextMd = SK_ColorBLACK; | 45 static const SkColor kResultsTableTextMd = SK_ColorBLACK; |
| 41 static const SkColor kResultsTableDimmedTextMd = | 46 static const SkColor kResultsTableDimmedTextMd = |
| 42 SkColorSetRGB(0x64, 0x64, 0x64); | 47 SkColorSetRGB(0x64, 0x64, 0x64); |
| 43 static const SkColor kPositiveTextColorMd = SkColorSetRGB(0x0b, 0x80, 0x43); | 48 static const SkColor kPositiveTextColorMd = SkColorSetRGB(0x0b, 0x80, 0x43); |
| 44 static const SkColor kNegativeTextColorMd = SkColorSetRGB(0xc5, 0x39, 0x29); | 49 static const SkColor kNegativeTextColorMd = SkColorSetRGB(0xc5, 0x39, 0x29); |
| 45 | 50 |
| 46 switch (color_id) { | 51 switch (color_id) { |
| 47 // Dialogs | 52 // Dialogs |
| 48 case NativeTheme::kColorId_DialogBackground: | 53 case NativeTheme::kColorId_DialogBackground: |
| 49 case NativeTheme::kColorId_BubbleBackground: | 54 case NativeTheme::kColorId_BubbleBackground: |
| 50 return kDialogBackgroundColorMd; | 55 return kDialogBackgroundColorMd; |
| 51 | 56 |
| 57 // Button |
| 58 case NativeTheme::kColorId_MdTextButtonEnabledColor: |
| 59 return kTextButtonEnabledColorMd; |
| 60 case NativeTheme::kColorId_MdTextButtonDisabledColor: |
| 61 return kTextButtonDisabledColorMd; |
| 62 |
| 52 // MenuItem | 63 // MenuItem |
| 53 case NativeTheme::kColorId_FocusedMenuItemBackgroundColor: | 64 case NativeTheme::kColorId_FocusedMenuItemBackgroundColor: |
| 54 return kMenuHighlightBackgroundColorMd; | 65 return kMenuHighlightBackgroundColorMd; |
| 55 case NativeTheme::kColorId_SelectedMenuItemForegroundColor: | 66 case NativeTheme::kColorId_SelectedMenuItemForegroundColor: |
| 56 return kSelectedMenuItemForegroundColorMd; | 67 return kSelectedMenuItemForegroundColorMd; |
| 57 // Link | 68 // Link |
| 58 case NativeTheme::kColorId_LinkDisabled: | 69 case NativeTheme::kColorId_LinkDisabled: |
| 59 return kLinkDisabledColorMd; | 70 return kLinkDisabledColorMd; |
| 60 case NativeTheme::kColorId_LinkEnabled: | 71 case NativeTheme::kColorId_LinkEnabled: |
| 61 case NativeTheme::kColorId_LinkPressed: | 72 case NativeTheme::kColorId_LinkPressed: |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 return kResultsTableNegativeSelectedText; | 398 return kResultsTableNegativeSelectedText; |
| 388 | 399 |
| 389 // Material spinner/throbber | 400 // Material spinner/throbber |
| 390 case NativeTheme::kColorId_ThrobberSpinningColor: | 401 case NativeTheme::kColorId_ThrobberSpinningColor: |
| 391 return kThrobberSpinningColor; | 402 return kThrobberSpinningColor; |
| 392 case NativeTheme::kColorId_ThrobberWaitingColor: | 403 case NativeTheme::kColorId_ThrobberWaitingColor: |
| 393 return kThrobberWaitingColor; | 404 return kThrobberWaitingColor; |
| 394 case NativeTheme::kColorId_ThrobberLightColor: | 405 case NativeTheme::kColorId_ThrobberLightColor: |
| 395 return kThrobberLightColor; | 406 return kThrobberLightColor; |
| 396 | 407 |
| 408 case NativeTheme::kColorId_MdTextButtonEnabledColor: |
| 409 case NativeTheme::kColorId_MdTextButtonDisabledColor: |
| 397 case NativeTheme::kColorId_NumColors: | 410 case NativeTheme::kColorId_NumColors: |
| 398 break; | 411 break; |
| 399 } | 412 } |
| 400 | 413 |
| 401 NOTREACHED(); | 414 NOTREACHED(); |
| 402 return gfx::kPlaceholderColor; | 415 return gfx::kPlaceholderColor; |
| 403 } | 416 } |
| 404 | 417 |
| 405 gfx::Size CommonThemeGetPartSize(NativeTheme::Part part, | 418 gfx::Size CommonThemeGetPartSize(NativeTheme::Part part, |
| 406 NativeTheme::State state, | 419 NativeTheme::State state, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // static | 491 // static |
| 479 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) { | 492 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) { |
| 480 // TODO(pkotwicz): Do something better and don't infer device | 493 // TODO(pkotwicz): Do something better and don't infer device |
| 481 // scale factor from canvas scale. | 494 // scale factor from canvas scale. |
| 482 SkMatrix m = sk_canvas->getTotalMatrix(); | 495 SkMatrix m = sk_canvas->getTotalMatrix(); |
| 483 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX())); | 496 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX())); |
| 484 return make_scoped_ptr(new gfx::Canvas(sk_canvas, device_scale)); | 497 return make_scoped_ptr(new gfx::Canvas(sk_canvas, device_scale)); |
| 485 } | 498 } |
| 486 | 499 |
| 487 } // namespace ui | 500 } // namespace ui |
| OLD | NEW |