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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 2804823002: Revamp the Incognito NTP on Desktop (Closed)
Patch Set: Addressed comments. Created 3 years, 8 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
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..5e2422b52a6d10b5005bb4ef6f2c62eece30f001 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"
@@ -272,6 +273,9 @@ void NTPResourceCache::Invalidate() {
}
void NTPResourceCache::CreateNewTabIncognitoHTML() {
+ const bool is_md_incognito_ntp_enabled =
+ base::FeatureList::IsEnabled(features::kMaterialDesignIncognitoNTP);
+
ui::TemplateReplacements replacements;
// Note: there's specific rules in CSS that look for this attribute's content
// being equal to "true" as a string.
@@ -279,14 +283,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 (is_md_incognito_ntp_enabled) {
+ 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 +318,8 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() {
static const base::StringPiece incognito_tab_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_INCOGNITO_TAB_HTML));
+ is_md_incognito_ntp_enabled ? IDR_MD_INCOGNITO_TAB_HTML
+ : IDR_INCOGNITO_TAB_HTML));
std::string full_html =
ui::ReplaceTemplateExpressions(incognito_tab_html, replacements);

Powered by Google App Engine
This is Rietveld 408576698