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

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: Created 5 years, 6 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 8e184c0fd456d0c340cf02f7e51963819435734b..ad2ccb6f8a957978428d217ead95b61551e0abb9 100644
--- a/chrome/browser/themes/theme_properties.cc
+++ b/chrome/browser/themes/theme_properties.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/themes/theme_properties.h"
+#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "chrome/browser/themes/browser_theme_pack.h"
+#include "chrome/common/chrome_switches.h"
#include "grit/theme_resources.h"
#include "ui/resources/grit/ui_resources.h"
@@ -96,6 +98,28 @@ const SkColor kDefaultColorToolbarStrokeInactive = SkColorSetRGB(163, 163, 163);
#endif
// ----------------------------------------------------------------------------
+// Defaults for layout properties, which are not stored in the browser theme
+// pack.
+
+// The edge graphics have some built-in spacing/shadowing, so we have to adjust
+// our spacing to make it match.
+const int kToolbarViewLeftEdgeSpacing = 3;
+const int kToolbarViewRightEdgeSpacing = 2;
+
+// Ash doesn't use a rounded content area and its top edge has an extra shadow.
+const int kToolbarViewContentShadowHeightAsh = 2;
+
+// Non-ash uses a rounded content area with no shadow in the assets.
+const int kToolbarViewContentShadowHeight = 0;
+
+#if defined(ENABLE_TOPCHROME_MD)
+const int kToolbarViewLeftEdgeSpacingMD = 8;
tdanderson 2015/06/09 15:32:38 For readability and accounting purposes, I'm tempt
jonross 2015/06/10 14:09:03 I personally prefer the compiler check. It acts as
+const int kToolbarViewRightEdgeSpacingMD = 4;
+const int kToolbarViewContentShadowHeightAshMD = 0;
+const int kToolbarViewContentShadowHeightMD = 0;
+#endif
+
+// ----------------------------------------------------------------------------
// Strings used in alignment properties.
const char kAlignmentCenter[] = "center";
@@ -135,6 +159,23 @@ SkColor TintForUnderline(SkColor input) {
return SkColorSetA(input, SkColorGetA(input) / 3);
}
+#if defined(ENABLE_TOPCHROME_MD)
+int GetMaterialDefaultDisplayProperty(int id) {
+ switch (id) {
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING:
+ return kToolbarViewLeftEdgeSpacingMD;
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING:
+ return kToolbarViewRightEdgeSpacingMD;
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH:
+ return kToolbarViewContentShadowHeightAshMD;
+ case ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT:
+ return kToolbarViewContentShadowHeightMD;
+ }
+
+ return -1;
tdanderson 2015/06/09 15:32:38 This will be a problem if any of our constants are
tdanderson 2015/06/09 17:50:07 An example of a negative layout constant is kTabHo
jonross 2015/06/10 14:09:03 I've moved away from this. I've pulled the old pa
+}
+#endif
+
} // namespace
// static
@@ -299,6 +340,17 @@ SkColor ThemeProperties::GetDefaultColor(int id) {
// static
int ThemeProperties::GetDefaultDisplayProperty(int id) {
+#if defined(ENABLE_TOPCHROME_MD)
+ bool material_design_enabled =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kTopChromeMDEnabled);
+ if (material_design_enabled) {
+ int property = GetMaterialDefaultDisplayProperty(id);
+ if (property != -1)
+ return property;
+ }
+#endif
+
switch (id) {
case NTP_BACKGROUND_ALIGNMENT:
return kDefaultDisplayPropertyNTPAlignment;
@@ -306,6 +358,14 @@ int ThemeProperties::GetDefaultDisplayProperty(int id) {
return kDefaultDisplayPropertyNTPTiling;
case NTP_LOGO_ALTERNATE:
return kDefaultDisplayPropertyNTPAlternateLogo;
+ case PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING:
+ return kToolbarViewLeftEdgeSpacing;
+ case PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING:
+ return kToolbarViewRightEdgeSpacing;
+ case PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH:
+ return kToolbarViewContentShadowHeightAsh;
+ case PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT:
+ return kToolbarViewContentShadowHeight;
}
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