| 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/message_center/message_center_style.h" | 5 #include "ui/message_center/message_center_style.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 namespace message_center { | 9 namespace message_center { |
| 10 | 10 |
| 11 // Exported values ///////////////////////////////////////////////////////////// | 11 // Exported values ///////////////////////////////////////////////////////////// |
| 12 | 12 |
| 13 // Colors. | 13 // Colors. |
| 14 const SkColor kMessageCenterBorderColor = SkColorSetRGB(0xC7, 0xCA, 0xCE); | 14 const SkColor kMessageCenterBorderColor = SkColorSetRGB(0xC7, 0xCA, 0xCE); |
| 15 const SkColor kMessageCenterShadowColor = SkColorSetARGB(0.5 * 255, 0, 0, 0); | 15 const SkColor kMessageCenterShadowColor = SkColorSetARGB(0.5 * 255, 0, 0, 0); |
| 16 | 16 |
| 17 // Within a notification /////////////////////////////////////////////////////// | 17 // Within a notification /////////////////////////////////////////////////////// |
| 18 | 18 |
| 19 // Colors. | 19 // Colors. |
| 20 const SkColor kNotificationBackgroundColor = SkColorSetRGB(255, 255, 255); | 20 const SkColor kNotificationBackgroundColor = SkColorSetRGB(255, 255, 255); |
| 21 const SkColor kIconBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); | 21 const SkColor kIconBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); |
| 22 const SkColor kImageBackgroundColor = SkColorSetRGB(0x22, 0x22, 0x22); |
| 22 const SkColor kRegularTextColor = SkColorSetRGB(0x33, 0x33, 0x33); | 23 const SkColor kRegularTextColor = SkColorSetRGB(0x33, 0x33, 0x33); |
| 23 const SkColor kDimTextColor = SkColorSetRGB(0x7f, 0x7f, 0x7f); | 24 const SkColor kDimTextColor = SkColorSetRGB(0x7f, 0x7f, 0x7f); |
| 24 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250); | 25 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250); |
| 25 | 26 |
| 26 // Limits. | 27 // Limits. |
| 27 | 28 |
| 28 gfx::Size GetImageSizeForWidth(int width, const gfx::Size& image_size) { | 29 gfx::Size GetImageSizeForWidth(int width, const gfx::Size& image_size) { |
| 29 const int kNotificationMaximumImageHeight = | |
| 30 kNotificationWidth * kNotificationPreferredImageRatio; | |
| 31 | |
| 32 gfx::Size size = image_size; | 30 gfx::Size size = image_size; |
| 33 if (width > 0 && !size.IsEmpty()) { | 31 if (width > 0 && !size.IsEmpty()) { |
| 34 double proportion = size.height() / static_cast<double>(size.width()); | 32 double proportion = size.height() / static_cast<double>(size.width()); |
| 35 size.SetSize(width, std::max(0.5 + width * proportion, 1.0)); | 33 size.SetSize(width, std::max(0.5 + width * proportion, 1.0)); |
| 36 if (size.height() > kNotificationMaximumImageHeight) { | 34 if (size.height() > kNotificationPreferredImageHeight) { |
| 37 int height = kNotificationMaximumImageHeight; | 35 int height = kNotificationPreferredImageHeight; |
| 38 size.SetSize(std::max(0.5 + height / proportion, 1.0), height); | 36 size.SetSize(std::max(0.5 + height / proportion, 1.0), height); |
| 39 } | 37 } |
| 40 } | 38 } |
| 41 return size; | 39 return size; |
| 42 } | 40 } |
| 43 | 41 |
| 44 const size_t kNotificationMaximumItems = 5; | 42 const size_t kNotificationMaximumItems = 5; |
| 45 | 43 |
| 46 // Timing. | 44 // Timing. |
| 47 const int kAutocloseDefaultDelaySeconds = 8; | 45 const int kAutocloseDefaultDelaySeconds = 8; |
| 48 const int kAutocloseHighPriorityDelaySeconds = 25; | 46 const int kAutocloseHighPriorityDelaySeconds = 25; |
| 49 | 47 |
| 50 // Colors. | 48 // Colors. |
| 51 const SkColor kBackgroundLightColor = SkColorSetRGB(0xf1, 0xf1, 0xf1); | 49 const SkColor kBackgroundLightColor = SkColorSetRGB(0xf1, 0xf1, 0xf1); |
| 52 const SkColor kBackgroundDarkColor = SkColorSetRGB(0xe7, 0xe7, 0xe7); | 50 const SkColor kBackgroundDarkColor = SkColorSetRGB(0xe7, 0xe7, 0xe7); |
| 53 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0); | 51 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0); |
| 54 const SkColor kMessageCenterBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee); | 52 const SkColor kMessageCenterBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee); |
| 55 const SkColor kFooterDelimiterColor = SkColorSetRGB(0xcc, 0xcc, 0xcc); | 53 const SkColor kFooterDelimiterColor = SkColorSetRGB(0xcc, 0xcc, 0xcc); |
| 56 const SkColor kFooterTextColor = SkColorSetRGB(0x7b, 0x7b, 0x7b); | 54 const SkColor kFooterTextColor = SkColorSetRGB(0x7b, 0x7b, 0x7b); |
| 57 | 55 |
| 58 } // namespace message_center | 56 } // namespace message_center |
| OLD | NEW |