Revert of Revert of [Telemetry] Add browser option that allows disabling crash servic...
[chromium-blink-merge.git] / ui / message_center / message_center_style.cc
blob3413149effbe0680678a1486cd948ec723165978
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
3 // found in the LICENSE file.
5 #include "ui/message_center/message_center_style.h"
7 #include <algorithm>
9 namespace message_center {
11 // Exported values /////////////////////////////////////////////////////////////
13 // Colors.
14 const SkColor kMessageCenterBorderColor = SkColorSetRGB(0xC7, 0xCA, 0xCE);
15 const SkColor kMessageCenterShadowColor = SkColorSetARGB(0.5 * 255, 0, 0, 0);
17 // Within a notification ///////////////////////////////////////////////////////
19 // Colors.
20 const SkColor kNotificationBackgroundColor = SkColorSetRGB(255, 255, 255);
21 const SkColor kIconBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5);
22 const SkColor kImageBackgroundColor = SkColorSetRGB(0x22, 0x22, 0x22);
23 const SkColor kRegularTextColor = SkColorSetRGB(0x33, 0x33, 0x33);
24 const SkColor kDimTextColor = SkColorSetRGB(0x7f, 0x7f, 0x7f);
25 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250);
26 const SkColor kSmallImageMaskForegroundColor = SK_ColorWHITE;
27 const SkColor kSmallImageMaskBackgroundColor = SkColorSetRGB(0xa3, 0xa3, 0xa3);
29 // Limits.
31 gfx::Size GetImageSizeForContainerSize(const gfx::Size& container_size,
32 const gfx::Size& image_size) {
33 if (container_size.IsEmpty() || image_size.IsEmpty())
34 return gfx::Size();
36 gfx::Size scaled_size = image_size;
37 double proportion =
38 scaled_size.height() / static_cast<double>(scaled_size.width());
39 // We never want to return an empty image given a non-empty container and
40 // image, so round the height to 1.
41 scaled_size.SetSize(container_size.width(),
42 std::max(0.5 + container_size.width() * proportion, 1.0));
43 if (scaled_size.height() > container_size.height()) {
44 scaled_size.SetSize(
45 std::max(0.5 + container_size.height() / proportion, 1.0),
46 container_size.height());
49 return scaled_size;
52 const size_t kNotificationMaximumItems = 5;
54 // Timing.
55 const int kAutocloseDefaultDelaySeconds = 8;
56 const int kAutocloseHighPriorityDelaySeconds = 25;
58 // Colors.
59 const SkColor kBackgroundLightColor = SkColorSetRGB(0xf1, 0xf1, 0xf1);
60 const SkColor kBackgroundDarkColor = SkColorSetRGB(0xe7, 0xe7, 0xe7);
61 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0);
62 const SkColor kMessageCenterBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee);
63 const SkColor kFooterDelimiterColor = SkColorSetRGB(0xcc, 0xcc, 0xcc);
64 const SkColor kFooterTextColor = SkColorSetRGB(0x7b, 0x7b, 0x7b);
66 } // namespace message_center