Add URL origin checks for Service Worker (un)registration
[chromium-blink-merge.git] / ui / message_center / message_center_style.cc
blob793649a9514acc900a2f4176f74d6e6a0d7c5451
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);
27 // Limits.
29 gfx::Size GetImageSizeForContainerSize(const gfx::Size& container_size,
30 const gfx::Size& image_size) {
31 if (container_size.IsEmpty() || image_size.IsEmpty())
32 return gfx::Size();
34 gfx::Size scaled_size = image_size;
35 double proportion =
36 scaled_size.height() / static_cast<double>(scaled_size.width());
37 // We never want to return an empty image given a non-empty container and
38 // image, so round the height to 1.
39 scaled_size.SetSize(container_size.width(),
40 std::max(0.5 + container_size.width() * proportion, 1.0));
41 if (scaled_size.height() > container_size.height()) {
42 scaled_size.SetSize(
43 std::max(0.5 + container_size.height() / proportion, 1.0),
44 container_size.height());
47 return scaled_size;
50 const size_t kNotificationMaximumItems = 5;
52 // Timing.
53 const int kAutocloseDefaultDelaySeconds = 8;
54 const int kAutocloseHighPriorityDelaySeconds = 25;
56 // Colors.
57 const SkColor kBackgroundLightColor = SkColorSetRGB(0xf1, 0xf1, 0xf1);
58 const SkColor kBackgroundDarkColor = SkColorSetRGB(0xe7, 0xe7, 0xe7);
59 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0);
60 const SkColor kMessageCenterBackgroundColor = SkColorSetRGB(0xee, 0xee, 0xee);
61 const SkColor kFooterDelimiterColor = SkColorSetRGB(0xcc, 0xcc, 0xcc);
62 const SkColor kFooterTextColor = SkColorSetRGB(0x7b, 0x7b, 0x7b);
64 } // namespace message_center