summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/new_tab_ui.h
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 19:52:31 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 19:52:31 +0000
commitd44e998f1bd4adf7b4cfa513fa4e8f5972056ab0 (patch)
tree4a702c7c880531cbdac99f17ffd93c6865b89462 /chrome/browser/dom_ui/new_tab_ui.h
parent2c1d273765f1cc433555e68b129f03e8575d3f16 (diff)
downloadchromium_src-d44e998f1bd4adf7b4cfa513fa4e8f5972056ab0.zip
chromium_src-d44e998f1bd4adf7b4cfa513fa4e8f5972056ab0.tar.gz
chromium_src-d44e998f1bd4adf7b4cfa513fa4e8f5972056ab0.tar.bz2
NTP: Allow hiding tips and bookmark sync.
This change adds 2 new menu items to the option menu. There is pref migration code to make tips and sync visible by default. BUG=24319 TEST=Hide and show the different sections and reload to make sure it is persisted across instances of NTP. Review URL: http://codereview.chromium.org/337011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/new_tab_ui.h')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h
index 5aed7c5..e4b494c 100644
--- a/chrome/browser/dom_ui/new_tab_ui.h
+++ b/chrome/browser/dom_ui/new_tab_ui.h
@@ -10,6 +10,7 @@
#include "chrome/browser/dom_ui/dom_ui.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/common/notification_registrar.h"
+#include "testing/gtest/include/gtest/gtest_prod.h"
class GURL;
class MessageLoop;
@@ -29,6 +30,8 @@ class NewTabUI : public DOMUI,
virtual void RenderViewReused(RenderViewHost* render_view_host);
static void RegisterUserPrefs(PrefService* prefs);
+ static void MigrateUserPrefs(PrefService* prefs, int old_pref_version,
+ int new_pref_version);
// Whether we should disable the web resources backend service
static bool WebResourcesEnabled();
@@ -43,6 +46,9 @@ class NewTabUI : public DOMUI,
const string16& title,
const GURL& gurl);
+ // The current preference version.
+ static const int current_pref_version() { return current_pref_version_; }
+
class NewTabHTMLSource : public ChromeURLDataManager::DataSource {
public:
explicit NewTabHTMLSource(Profile* profile);
@@ -102,6 +108,8 @@ class NewTabUI : public DOMUI,
};
private:
+ FRIEND_TEST(NewTabUITest, UpdateUserPrefsVersion);
+
void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -109,6 +117,10 @@ class NewTabUI : public DOMUI,
// Reset the CSS caches.
void InitializeCSSCaches();
+ // Updates the user prefs version and calls |MigrateUserPrefs| if needed.
+ // Returns true if the version was updated.
+ static bool UpdateUserPrefsVersion(PrefService* prefs);
+
NotificationRegistrar registrar_;
// The message id that should be displayed in this NewTabUIContents
@@ -119,6 +131,9 @@ class NewTabUI : public DOMUI,
// what HTML to load.
bool incognito_;
+ // The preference version. This used for migrating prefs of the NTP.
+ static const int current_pref_version_ = 1;
+
DISALLOW_COPY_AND_ASSIGN(NewTabUI);
};