- add sources.
[platform/framework/web/crosswalk.git] / src / ui / message_center / message_center_style.cc
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.
4
5 #include "ui/message_center/message_center_style.h"
6
7 #include <algorithm>
8
9 namespace message_center {
10
11 // Exported values /////////////////////////////////////////////////////////////
12
13 // Square image sizes in pixels.
14 const int kNotificationButtonIconSize = 16;
15 const int kNotificationIconSize = 80;
16 // Same as kNotificationWidth.
17 const int kNotificationPreferredImageSize = 360;
18 const float kNotificationPreferredImageRatio = 1.5;
19 const int kSettingsIconSize = 16;
20
21 // Limits.
22 const size_t kMaxVisibleMessageCenterNotifications = 100;
23 const size_t kMaxVisiblePopupNotifications = 3;
24
25 // Colors.
26 const SkColor kMessageCenterBorderColor = SkColorSetRGB(0xC7, 0xCA, 0xCE);
27 const SkColor kMessageCenterShadowColor = SkColorSetARGB(0.5 * 255, 0, 0, 0);
28
29 // Within a notification ///////////////////////////////////////////////////////
30
31 // Pixel dimensions.
32 const int kControlButtonSize = 29;
33 const int kNotificationWidth = 360;
34 const int kIconToTextPadding = 16;
35 const int kTextTopPadding = 12;
36 const int kIconBottomPadding = 16;
37
38 // Text sizes.
39 const int kTitleFontSize = 14;
40 const int kTitleLineHeight = 20;
41 const int kMessageFontSize = 12;
42 const int kMessageLineHeight = 18;
43
44 // Colors.
45 const SkColor kNotificationBackgroundColor = SkColorSetRGB(255, 255, 255);
46 const SkColor kIconBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5);
47 const SkColor kRegularTextColor = SkColorSetRGB(0x33, 0x33, 0x33);
48 const SkColor kDimTextColor = SkColorSetRGB(0x7f, 0x7f, 0x7f);
49 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250);
50
51 // Limits.
52
53 gfx::Size GetImageSizeForWidth(int width, const gfx::Size& image_size) {
54   const int kNotificationMaximumImageHeight =
55       kNotificationWidth * kNotificationPreferredImageRatio;
56
57   gfx::Size size = image_size;
58   if (width > 0 && !size.IsEmpty()) {
59     double proportion = size.height() / static_cast<double>(size.width());
60     size.SetSize(width, std::max(0.5 + width * proportion, 1.0));
61     if (size.height() > kNotificationMaximumImageHeight) {
62       int height = kNotificationMaximumImageHeight;
63       size.SetSize(std::max(0.5 + height / proportion, 1.0), height);
64     }
65   }
66   return size;
67 }
68
69 const size_t kNotificationMaximumItems = 5;
70
71 // Timing.
72 const int kAutocloseDefaultDelaySeconds = 8;
73 const int kAutocloseHighPriorityDelaySeconds = 25;
74
75 // Around notifications ////////////////////////////////////////////////////////
76
77 // Pixel dimensions.
78 const int kMarginBetweenItems = 10;
79
80 // Colors.
81 const SkColor kBackgroundLightColor = SkColorSetRGB(0xf1, 0xf1, 0xf1);
82 const SkColor kBackgroundDarkColor = SkColorSetRGB(0xe7, 0xe7, 0xe7);
83 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0);
84 const SkColor kMessageCenterBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee);
85 const SkColor kFooterDelimiterColor = SkColorSetRGB(0xcc, 0xcc, 0xcc);
86 const SkColor kFooterTextColor = SkColorSetRGB(0x7b, 0x7b, 0x7b);
87
88 }  // namespace message_center