Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/browser/themes/theme_properties.cc

Issue 1164333002: ToolbarView MaterialDesign in ThemeProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/themes/theme_properties.h" 5 #include "chrome/browser/themes/theme_properties.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/themes/browser_theme_pack.h" 10 #include "chrome/browser/themes/browser_theme_pack.h"
11 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
12 #include "ui/base/resource/material_design/material_design_controller.h"
12 #include "ui/resources/grit/ui_resources.h" 13 #include "ui/resources/grit/ui_resources.h"
13 14
14 namespace { 15 namespace {
15 16
16 // ---------------------------------------------------------------------------- 17 // ----------------------------------------------------------------------------
17 // Defaults for properties which are stored in the browser theme pack. If you 18 // Defaults for properties which are stored in the browser theme pack. If you
18 // change these defaults, you must increment the version number in 19 // change these defaults, you must increment the version number in
19 // browser_theme_pack.h 20 // browser_theme_pack.h
20 21
21 // Default colors. 22 // Default colors.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #if defined(OS_MACOSX) 90 #if defined(OS_MACOSX)
90 const SkColor kDefaultColorToolbarButtonStroke = SkColorSetARGB(75, 81, 81, 81); 91 const SkColor kDefaultColorToolbarButtonStroke = SkColorSetARGB(75, 81, 81, 81);
91 const SkColor kDefaultColorToolbarButtonStrokeInactive = 92 const SkColor kDefaultColorToolbarButtonStrokeInactive =
92 SkColorSetARGB(75, 99, 99, 99); 93 SkColorSetARGB(75, 99, 99, 99);
93 const SkColor kDefaultColorToolbarBezel = SkColorSetRGB(204, 204, 204); 94 const SkColor kDefaultColorToolbarBezel = SkColorSetRGB(204, 204, 204);
94 const SkColor kDefaultColorToolbarStroke = SkColorSetRGB(103, 103, 103); 95 const SkColor kDefaultColorToolbarStroke = SkColorSetRGB(103, 103, 103);
95 const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163); 96 const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163);
96 #endif 97 #endif
97 98
98 // ---------------------------------------------------------------------------- 99 // ----------------------------------------------------------------------------
100 // Defaults for layout properties which are not stored in the browser theme
101 // pack. The array indices here are the values of
102 // ui::MaterialDesignController::Mode, see
103 // ui/base/resource/material_design/material_design_controller.h
104 COMPILE_ASSERT(
Peter Kasting 2015/07/08 21:18:42 I think these compile asserts are more big and ugl
jonross 2015/07/08 22:30:43 Done.
105 static_cast<int>(ui::MaterialDesignController::Mode::NON_MATERIAL) == 0,
106 material_design_mode_order_changed);
107 COMPILE_ASSERT(static_cast<int>(ui::MaterialDesignController::Mode::MATERIAL) ==
108 1,
109 material_design_mode_order_changed);
110 COMPILE_ASSERT(
111 static_cast<int>(ui::MaterialDesignController::Mode::MATERIAL_HYBRID) == 2,
112 material_design_mode_order_changed);
113
114 // The edge graphics have some built-in spacing/shadowing, so we have to adjust
115 // our spacing to make it match.
116 const int kToolbarViewLeftEdgeSpacing[] = {3, 4, 8};
117 const int kToolbarViewRightEdgeSpacing[] = {2, 4, 8};
118
119 // Ash doesn't use a rounded content area and its top edge has an extra shadow.
120 const int kToolbarViewContentShadowHeightAsh[] = {2, 0, 0};
121
122 // Non-ash uses a rounded content area with no shadow in the assets.
123 const int kToolbarViewContentShadowHeight[] = {0, 0, 0};
124
125 // ----------------------------------------------------------------------------
99 126
100 // Strings used in alignment properties. 127 // Strings used in alignment properties.
101 const char kAlignmentCenter[] = "center"; 128 const char kAlignmentCenter[] = "center";
102 const char kAlignmentTop[] = "top"; 129 const char kAlignmentTop[] = "top";
103 const char kAlignmentBottom[] = "bottom"; 130 const char kAlignmentBottom[] = "bottom";
104 const char kAlignmentLeft[] = "left"; 131 const char kAlignmentLeft[] = "left";
105 const char kAlignmentRight[] = "right"; 132 const char kAlignmentRight[] = "right";
106 133
107 // Strings used in background tiling repetition properties. 134 // Strings used in background tiling repetition properties.
108 const char kTilingNoRepeat[] = "no-repeat"; 135 const char kTilingNoRepeat[] = "no-repeat";
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return kDefaultColorToolbarStrokeInactive; 319 return kDefaultColorToolbarStrokeInactive;
293 #endif 320 #endif
294 default: 321 default:
295 // Return a debugging red color. 322 // Return a debugging red color.
296 return SK_ColorRED; 323 return SK_ColorRED;
297 } 324 }
298 } 325 }
299 326
300 // static 327 // static
301 int ThemeProperties::GetDefaultDisplayProperty(int id) { 328 int ThemeProperties::GetDefaultDisplayProperty(int id) {
329 int mode = static_cast<int>(ui::MaterialDesignController::GetMode());
302 switch (id) { 330 switch (id) {
303 case NTP_BACKGROUND_ALIGNMENT: 331 case ThemeProperties::NTP_BACKGROUND_ALIGNMENT:
304 return kDefaultDisplayPropertyNTPAlignment; 332 return kDefaultDisplayPropertyNTPAlignment;
305 case NTP_BACKGROUND_TILING: 333 case ThemeProperties::NTP_BACKGROUND_TILING:
306 return kDefaultDisplayPropertyNTPTiling; 334 return kDefaultDisplayPropertyNTPTiling;
307 case NTP_LOGO_ALTERNATE: 335 case ThemeProperties::NTP_LOGO_ALTERNATE:
308 return kDefaultDisplayPropertyNTPAlternateLogo; 336 return kDefaultDisplayPropertyNTPAlternateLogo;
337 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING:
338 return kToolbarViewLeftEdgeSpacing[mode];
339 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING:
340 return kToolbarViewRightEdgeSpacing[mode];
341 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH:
342 return kToolbarViewContentShadowHeightAsh[mode];
343 case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT:
344 return kToolbarViewContentShadowHeight[mode];
345 default:
346 return -1;
309 } 347 }
310
311 return -1;
312 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_properties.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698