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

Unified Diff: chrome/browser/extensions/extension_prefs.h

Issue 8198003: Convert app_launch_index and page_index from int to StringOrdinal. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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
Index: chrome/browser/extensions/extension_prefs.h
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index e791e8c840af8127f7c13339092c689513430ec6..9b94ab55944ae1fbf15e237321cb7cd87c37bbf1 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -106,11 +106,12 @@ class ExtensionPrefs : public ExtensionContentSettingsStore::Observer {
void SetToolbarOrder(const std::vector<std::string>& extension_ids);
// Called when an extension is installed, so that prefs get created.
- // If |page_index| is -1, and the then a page will be found for the App.
+ // If |page_index| is kUnsetIndex, and the then a page will be found
+ // for the App.
void OnExtensionInstalled(const Extension* extension,
Extension::State initial_state,
bool from_webstore,
- int page_index);
+ std::string page_index);
// Called when an extension is uninstalled, so that prefs get cleaned up.
void OnExtensionUninstalled(const std::string& extension_id,
@@ -273,30 +274,32 @@ class ExtensionPrefs : public ExtensionContentSettingsStore::Observer {
// Get the application launch index for an extension with |extension_id|. This
// determines the order of which the applications appear on the New Tab Page.
// A value of 0 generally indicates top left. If the extension has no launch
- // index a -1 value is returned.
- int GetAppLaunchIndex(const std::string& extension_id);
+ // index a kUnsetIndex value is returned.
+ std::string GetAppLaunchIndex(const std::string& extension_id);
// Sets a specific launch index for an extension with |extension_id|.
- void SetAppLaunchIndex(const std::string& extension_id, int index);
+ void SetAppLaunchIndex(const std::string& extension_id,
+ const std::string& index);
// Gets the next available application launch index. This is 1 higher than the
// highest current application launch index found for the page |on_page|.
- int GetNextAppLaunchIndex(int on_page);
+ std::string GetNextAppLaunchIndex(std::string on_page);
// Gets the page a new app should install to. Starts on page 0, and if there
// are N or more apps on it, tries to install on the next page.
- int GetNaturalAppPageIndex();
+ std::string GetNaturalAppPageIndex();
// Sets the order the apps should be displayed in the app launcher.
void SetAppLauncherOrder(const std::vector<std::string>& extension_ids);
// Get the application page index for an extension with |extension_id|. This
// determines which page an app will appear on in page-based NTPs. If
- // the app has no page specified, -1 is returned.
- int GetPageIndex(const std::string& extension_id);
+ // the app has no page specified, kUnsetIndex is returned.
+ std::string GetPageIndex(const std::string& extension_id);
// Sets a specific page index for an extension with |extension_id|.
- void SetPageIndex(const std::string& extension_id, int index);
+ void SetPageIndex(const std::string& extension_id,
+ const std::string& index);
// Returns true if the user repositioned the app on the app launcher via drag
// and drop.
@@ -420,6 +423,11 @@ class ExtensionPrefs : public ExtensionContentSettingsStore::Observer {
const std::string& pref_key,
const base::ListValue** out_value);
+ // Reads a string pref |pref_key| from extension with id |extension_id|
+ bool ReadExtensionPrefString(const std::string& extension_id,
+ const std::string& pref_key,
+ std::string* out_value);
+
// Interprets the list pref, |pref_key| in |extension_id|'s preferences, as a
// URLPatternSet. The |valid_schemes| specify how to parse the URLPatterns.
bool ReadExtensionPrefURLPatternSet(const std::string& extension_id,
@@ -477,6 +485,9 @@ class ExtensionPrefs : public ExtensionContentSettingsStore::Observer {
// Migrates the permissions data in the pref store.
void MigratePermissions(const ExtensionIdSet& extension_ids);
+ // Migrates the app launcher and page index values.
+ void MigrateAppIndex(const ExtensionIdSet& extension_ids);
+
// Checks whether there is a state pref for the extension and if so, whether
// it matches |check_state|.
bool DoesExtensionHaveState(const std::string& id,

Powered by Google App Engine
This is Rietveld 408576698