Commit f3f1e81e authored by mathp@chromium.org's avatar mathp@chromium.org

[Local NTP] Modify config.js to contain a specifier for ntp design.

If MD is enabled, add a value to the config dictionary passed to the page.

BUG=400332
TEST=manual

Review URL: https://codereview.chromium.org/447033002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287934 0039d316-1c4b-4281-b951-d872f2087c98
parent 277bb8c5
...@@ -35,8 +35,8 @@ namespace { ...@@ -35,8 +35,8 @@ namespace {
const char kMaterialDesignNTPFieldTrialName[] = "MaterialDesignNTP"; const char kMaterialDesignNTPFieldTrialName[] = "MaterialDesignNTP";
const char kMaterialDesignNTPFieldTrialEnabledPrefix[] = "Enabled"; const char kMaterialDesignNTPFieldTrialEnabledPrefix[] = "Enabled";
// Class name to be used for the new design in local resources. // Name to be used for the new design in local resources.
const char kMaterialDesignNTPClassName[] = "md"; const char kMaterialDesignNTPName[] = "md";
// Signifies a locally constructed resource, i.e. not from grit/. // Signifies a locally constructed resource, i.e. not from grit/.
const int kLocalResource = -1; const int kLocalResource = -1;
...@@ -127,6 +127,11 @@ std::string GetConfigData(Profile* profile) { ...@@ -127,6 +127,11 @@ std::string GetConfigData(Profile* profile) {
config_data.SetBoolean("isGooglePage", config_data.SetBoolean("isGooglePage",
DefaultSearchProviderIsGoogle(profile) && DefaultSearchProviderIsGoogle(profile) &&
chrome::ShouldShowGoogleLocalNTP()); chrome::ShouldShowGoogleLocalNTP());
if (IsMaterialDesignEnabled()) {
scoped_ptr<base::Value> design_value(
new base::StringValue(kMaterialDesignNTPName));
config_data.Set("ntpDesignName", design_value.release());
}
// Serialize the dictionary. // Serialize the dictionary.
std::string js_text; std::string js_text;
...@@ -171,7 +176,7 @@ void LocalNtpSource::StartDataRequest( ...@@ -171,7 +176,7 @@ void LocalNtpSource::StartDataRequest(
if (stripped_path == kLocalNTPFilename) { if (stripped_path == kLocalNTPFilename) {
SendResourceWithClass( SendResourceWithClass(
IDR_LOCAL_NTP_HTML, IDR_LOCAL_NTP_HTML,
IsMaterialDesignEnabled() ? kMaterialDesignNTPClassName : "", IsMaterialDesignEnabled() ? kMaterialDesignNTPName : "",
callback); callback);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment