Chromium Code Reviews| Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| index 0410f2868b3ce6697c161f58f3a93baaadb6ecff..7a92e8dd0e6cb66756605edbe290980084a3faab 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| @@ -7,7 +7,7 @@ |
| #include <string> |
| #include <vector> |
| -#include "base/command_line.h" |
| +#include "base/feature_list.h" |
| #include "base/memory/ref_counted_memory.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/string_number_conversions.h" |
| @@ -32,6 +32,7 @@ |
| #include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
| #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| +#include "chrome/common/chrome_features.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/features.h" |
| #include "chrome/common/pref_names.h" |
| @@ -140,6 +141,10 @@ std::string GetNewTabBackgroundTilingCSS( |
| return ThemeProperties::TilingToString(repeat_mode); |
| } |
| +bool IsMDIncognitoTabEnabled() { |
| + return base::FeatureList::IsEnabled(features::kMaterialDesignIncognitoNTP); |
| +} |
| + |
| } // namespace |
| NTPResourceCache::NTPResourceCache(Profile* profile) |
| @@ -279,14 +284,28 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| profile_->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar) |
| ? "true" |
| : "false"; |
| - replacements["incognitoTabDescription"] = |
| - l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_DESCRIPTION); |
| - replacements["incognitoTabHeading"] = |
| - l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_HEADING); |
| - replacements["incognitoTabWarning"] = |
| - l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_MESSAGE_WARNING); |
| - replacements["learnMore"] = |
| - l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_LEARN_MORE_LINK); |
| + |
| + if (IsMDIncognitoTabEnabled()) { |
|
Dan Beam
2017/04/20 18:27:51
nit: because only CreateNewTabIncognitoHTML() uses
msramek
2017/04/21 12:20:36
Done.
|
| + replacements["incognitoTabDescription"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_SUBTITLE); |
| + replacements["incognitoTabHeading"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_TITLE); |
| + replacements["incognitoTabWarning"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_VISIBLE); |
| + replacements["learnMore"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_LEARN_MORE_LINK); |
| + replacements["incognitoTabFeatures"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_NOT_SAVED); |
| + } else { |
| + replacements["incognitoTabDescription"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_DESCRIPTION); |
| + replacements["incognitoTabHeading"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_HEADING); |
| + replacements["incognitoTabWarning"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_MESSAGE_WARNING); |
| + replacements["learnMore"] = |
| + l10n_util::GetStringUTF8(IDS_NEW_TAB_OTR_LEARN_MORE_LINK); |
| + } |
| replacements["learnMoreLink"] = kLearnMoreIncognitoUrl; |
| replacements["title"] = l10n_util::GetStringUTF8(IDS_NEW_TAB_TITLE); |
| @@ -300,7 +319,8 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| static const base::StringPiece incognito_tab_html( |
| ResourceBundle::GetSharedInstance().GetRawDataResource( |
| - IDR_INCOGNITO_TAB_HTML)); |
| + IsMDIncognitoTabEnabled() ? IDR_MD_INCOGNITO_TAB_HTML |
| + : IDR_INCOGNITO_TAB_HTML)); |
| std::string full_html = |
| ui::ReplaceTemplateExpressions(incognito_tab_html, replacements); |