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

Unified 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: Rebase 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/themes/theme_properties.cc
diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc
index f32530f28d53452f5f7b5f88a0fd00753d329b2b..7d1f17d43324c49963148f6ce14ee0a688e12b87 100644
--- a/chrome/browser/themes/theme_properties.cc
+++ b/chrome/browser/themes/theme_properties.cc
@@ -9,6 +9,7 @@
#include "base/strings/string_util.h"
#include "chrome/browser/themes/browser_theme_pack.h"
#include "grit/theme_resources.h"
+#include "ui/base/resource/material_design/material_design_controller.h"
#include "ui/resources/grit/ui_resources.h"
namespace {
@@ -96,6 +97,23 @@ const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163);
#endif
// ----------------------------------------------------------------------------
+// Defaults for layout properties which are not stored in the browser theme
+// pack. The array indices here are the values of
+// ui::MaterialDesignController::Mode, see
+// ui/base/resource/material_design/material_design_controller.h
+
+// The edge graphics have some built-in spacing/shadowing, so we have to adjust
+// our spacing to make it match.
+const int kToolbarViewLeftEdgeSpacing[] = {3, 4, 8};
+const int kToolbarViewRightEdgeSpacing[] = {2, 4, 8};
+
+// Ash doesn't use a rounded content area and its top edge has an extra shadow.
+const int kToolbarViewContentShadowHeightAsh[] = {2, 0, 0};
+
+// Non-ash uses a rounded content area with no shadow in the assets.
+const int kToolbarViewContentShadowHeight[] = {0, 0, 0};
+
+// ----------------------------------------------------------------------------
// Strings used in alignment properties.
const char kAlignmentCenter[] = "center";
@@ -299,14 +317,23 @@ SkColor ThemeProperties::GetDefaultColor(int id) {
// static
int ThemeProperties::GetDefaultDisplayProperty(int id) {
+ int mode = ui::MaterialDesignController::GetMode();
switch (id) {
- case NTP_BACKGROUND_ALIGNMENT:
+ case ThemeProperties::NTP_BACKGROUND_ALIGNMENT:
return kDefaultDisplayPropertyNTPAlignment;
- case NTP_BACKGROUND_TILING:
+ case ThemeProperties::NTP_BACKGROUND_TILING:
return kDefaultDisplayPropertyNTPTiling;
- case NTP_LOGO_ALTERNATE:
+ case ThemeProperties::NTP_LOGO_ALTERNATE:
return kDefaultDisplayPropertyNTPAlternateLogo;
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING:
+ return kToolbarViewLeftEdgeSpacing[mode];
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING:
+ return kToolbarViewRightEdgeSpacing[mode];
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH:
+ return kToolbarViewContentShadowHeightAsh[mode];
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT:
+ return kToolbarViewContentShadowHeight[mode];
+ default:
+ return -1;
}
-
- return -1;
}
« 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