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