Index: chrome/browser/dom_ui/new_tab_ui.h |
=================================================================== |
--- chrome/browser/dom_ui/new_tab_ui.h (revision 30053) |
+++ chrome/browser/dom_ui/new_tab_ui.h (working copy) |
@@ -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 @@ |
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 @@ |
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 @@ |
}; |
private: |
+ FRIEND_TEST(NewTabUITest, UpdateUserPrefsVersion); |
+ |
void Observe(NotificationType type, |
const NotificationSource& source, |
const NotificationDetails& details); |
@@ -109,6 +117,10 @@ |
// 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 @@ |
// 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); |
}; |