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

Unified Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 337011: NTP: Allow hiding tips and bookmark sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/dom_ui/new_tab_ui.h ('k') | chrome/browser/dom_ui/new_tab_ui_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/new_tab_ui.cc
===================================================================
--- chrome/browser/dom_ui/new_tab_ui.cc (revision 30390)
+++ chrome/browser/dom_ui/new_tab_ui.cc (working copy)
@@ -624,13 +624,35 @@
// static
void NewTabUI::RegisterUserPrefs(PrefService* prefs) {
+ prefs->RegisterIntegerPref(prefs::kNTPPrefVersion, 0);
+
MostVisitedHandler::RegisterUserPrefs(prefs);
ShownSectionsHandler::RegisterUserPrefs(prefs);
if (NewTabUI::WebResourcesEnabled())
TipsHandler::RegisterUserPrefs(prefs);
+
+ UpdateUserPrefsVersion(prefs);
}
// static
+bool NewTabUI::UpdateUserPrefsVersion(PrefService* prefs) {
+ const int old_pref_version = prefs->GetInteger(prefs::kNTPPrefVersion);
+ if (old_pref_version != current_pref_version()) {
+ MigrateUserPrefs(prefs, old_pref_version, current_pref_version());
+ prefs->SetInteger(prefs::kNTPPrefVersion, current_pref_version());
+ return true;
+ }
+ return false;
+}
+
+// static
+void NewTabUI::MigrateUserPrefs(PrefService* prefs, int old_pref_version,
+ int new_pref_version) {
+ ShownSectionsHandler::MigrateUserPrefs(prefs, old_pref_version,
+ current_pref_version());
+}
+
+// static
bool NewTabUI::WebResourcesEnabled() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
return !command_line->HasSwitch(switches::kDisableWebResources);
@@ -849,6 +871,11 @@
l10n_util::GetString(IDS_NEW_TAB_MAKE_THIS_HOMEPAGE));
localized_strings.SetString(L"themelink",
l10n_util::GetString(IDS_THEMES_GALLERY_URL));
+ localized_strings.SetString(L"tips",
+ l10n_util::GetString(IDS_NEW_TAB_TIPS));
+ localized_strings.SetString(L"sync",
+ l10n_util::GetString(IDS_NEW_TAB_SHOW_HIDE_BOOKMARK_SYNC));
+
// Don't initiate the sync related message passing with the page if the sync
// code is not present.
if (profile_->GetProfileSyncService())
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.h ('k') | chrome/browser/dom_ui/new_tab_ui_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698