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 a6ab0c53f09f1ab867d7696471e0fc3676606c53..7e64f5392f3f27ffbdf8f4e6de01a2d3ab3981ef 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| @@ -140,6 +140,11 @@ std::string GetNewTabBackgroundTilingCSS( |
| return ThemeProperties::TilingToString(repeat_mode); |
| } |
| +bool IsMDIncognitoTabEnabled() { |
| + return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableMaterialDesignIncognitoNTP); |
| +} |
| + |
| } // namespace |
| NTPResourceCache::NTPResourceCache(Profile* profile) |
| @@ -275,11 +280,28 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| base::DictionaryValue localized_strings; |
| localized_strings.SetString("title", |
| l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| - int new_tab_description_ids = IDS_NEW_TAB_OTR_DESCRIPTION; |
| - int new_tab_heading_ids = IDS_NEW_TAB_OTR_HEADING; |
| + |
| + int new_tab_heading_ids; |
| + int new_tab_description_ids; |
| + int new_tab_warning_ids; |
| + int new_tab_features_ids; |
| + int new_tab_html_idr; |
|
Dan Beam
2017/04/11 00:31:12
all these uninitialized ints make me a little nerv
msramek
2017/04/11 19:04:27
Done.
Me too, actually :) The current approach se
|
| + |
| + if (IsMDIncognitoTabEnabled() && !profile_->IsGuestSession()) { |
| + new_tab_description_ids = IDS_NEW_TAB_OTR_SUBTITLE; |
| + new_tab_heading_ids = IDS_NEW_TAB_OTR_TITLE; |
| + new_tab_warning_ids = IDS_NEW_TAB_OTR_VISIBLE; |
| + new_tab_features_ids = IDS_NEW_TAB_OTR_NOT_SAVED; |
| + new_tab_html_idr = IDR_MD_INCOGNITO_TAB_HTML; |
| + } else { |
| + new_tab_description_ids = IDS_NEW_TAB_OTR_DESCRIPTION; |
| + new_tab_heading_ids = IDS_NEW_TAB_OTR_HEADING; |
| + new_tab_warning_ids = IDS_NEW_TAB_OTR_MESSAGE_WARNING; |
| + // new_tab_features_ids is not used in the old version. |
|
Dan Beam
2017/04/11 00:31:12
new_tab_feature_ids is not initialized explicitly,
msramek
2017/04/11 19:04:27
Indeed, but its only usage is guarded by IsMDIncog
|
| + new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; |
| + } |
| + |
| int new_tab_link_ids = IDS_NEW_TAB_OTR_LEARN_MORE_LINK; |
| - int new_tab_warning_ids = IDS_NEW_TAB_OTR_MESSAGE_WARNING; |
| - int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; |
| const char* new_tab_link = kLearnMoreIncognitoUrl; |
| if (profile_->IsGuestSession()) { |
| @@ -292,6 +314,11 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| l10n_util::GetStringUTF16(new_tab_description_ids)); |
| localized_strings.SetString("incognitoTabHeading", |
| l10n_util::GetStringUTF16(new_tab_heading_ids)); |
| + if (IsMDIncognitoTabEnabled()) { |
| + localized_strings.SetString( |
| + "incognitoTabFeatures", |
| + l10n_util::GetStringUTF16(new_tab_features_ids)); |
| + } |
| localized_strings.SetString("incognitoTabWarning", |
| l10n_util::GetStringUTF16(new_tab_warning_ids)); |
| } |