Index: chrome/browser/extensions/chrome_app_sorting.cc |
diff --git a/chrome/browser/extensions/chrome_app_sorting.cc b/chrome/browser/extensions/chrome_app_sorting.cc |
index 6d7ddf6a65baf9bbfd7e83c59e367cd3ef6afc0a..9ce25bf7b2d18785ba9511184b2c6ed29aa946be 100644 |
--- a/chrome/browser/extensions/chrome_app_sorting.cc |
+++ b/chrome/browser/extensions/chrome_app_sorting.cc |
@@ -51,25 +51,15 @@ ChromeAppSorting::AppOrdinals::~AppOrdinals() {} |
// ChromeAppSorting |
ChromeAppSorting::ChromeAppSorting(content::BrowserContext* browser_context) |
- : extension_scoped_prefs_(NULL), |
- browser_context_(browser_context), |
+ : browser_context_(browser_context), |
default_ordinals_created_(false) { |
} |
ChromeAppSorting::~ChromeAppSorting() { |
} |
-void ChromeAppSorting::SetExtensionScopedPrefs(ExtensionScopedPrefs* prefs) { |
- extension_scoped_prefs_ = prefs; |
-} |
- |
-void ChromeAppSorting::CheckExtensionScopedPrefs() const { |
- CHECK(extension_scoped_prefs_); |
-} |
- |
void ChromeAppSorting::Initialize( |
const extensions::ExtensionIdList& extension_ids) { |
- CHECK(extension_scoped_prefs_); |
InitializePageOrdinalMap(extension_ids); |
MigrateAppIndex(extension_ids); |
@@ -104,7 +94,7 @@ void ChromeAppSorting::MigrateAppIndex( |
extension_ids.begin(); ext_id != extension_ids.end(); ++ext_id) { |
int old_page_index = 0; |
syncer::StringOrdinal page = GetPageOrdinal(*ext_id); |
- if (extension_scoped_prefs_->ReadPrefAsInteger( |
+ if (ExtensionPrefs::Get(browser_context_)->ReadPrefAsInteger( |
not at google - send to devlin
2015/07/29 18:22:03
I would hold onto a reference to this at the start
Marc Treib
2015/07/30 14:04:12
Done.
|
*ext_id, |
kPrefPageIndexDeprecated, |
&old_page_index)) { |
@@ -121,12 +111,12 @@ void ChromeAppSorting::MigrateAppIndex( |
page = PageIntegerAsStringOrdinal(old_page_index); |
SetPageOrdinal(*ext_id, page); |
- extension_scoped_prefs_->UpdateExtensionPref( |
+ ExtensionPrefs::Get(browser_context_)->UpdateExtensionPref( |
*ext_id, kPrefPageIndexDeprecated, NULL); |
} |
int old_app_launch_index = 0; |
- if (extension_scoped_prefs_->ReadPrefAsInteger( |
+ if (ExtensionPrefs::Get(browser_context_)->ReadPrefAsInteger( |
*ext_id, |
kPrefAppLaunchIndexDeprecated, |
&old_app_launch_index)) { |
@@ -138,7 +128,7 @@ void ChromeAppSorting::MigrateAppIndex( |
if (page.IsValid()) |
app_launches_to_convert[page][old_app_launch_index] = &*ext_id; |
- extension_scoped_prefs_->UpdateExtensionPref( |
+ ExtensionPrefs::Get(browser_context_)->UpdateExtensionPref( |
*ext_id, kPrefAppLaunchIndexDeprecated, NULL); |
} |
} |
@@ -297,7 +287,7 @@ syncer::StringOrdinal ChromeAppSorting::GetAppLaunchOrdinal( |
// If the preference read fails then raw_value will still be unset and we |
// will return an invalid StringOrdinal to signal that no app launch ordinal |
// was found. |
- extension_scoped_prefs_->ReadPrefAsString( |
+ ExtensionPrefs::Get(browser_context_)->ReadPrefAsString( |
extension_id, kPrefAppLaunchOrdinal, &raw_value); |
return syncer::StringOrdinal(raw_value); |
} |
@@ -320,7 +310,7 @@ void ChromeAppSorting::SetAppLaunchOrdinal( |
new base::StringValue(new_app_launch_ordinal.ToInternalValue()) : |
NULL; |
- extension_scoped_prefs_->UpdateExtensionPref( |
+ ExtensionPrefs::Get(browser_context_)->UpdateExtensionPref( |
extension_id, |
kPrefAppLaunchOrdinal, |
new_value); |
@@ -378,7 +368,7 @@ syncer::StringOrdinal ChromeAppSorting::GetPageOrdinal( |
std::string raw_data; |
// If the preference read fails then raw_data will still be unset and we will |
// return an invalid StringOrdinal to signal that no page ordinal was found. |
- extension_scoped_prefs_->ReadPrefAsString( |
+ ExtensionPrefs::Get(browser_context_)->ReadPrefAsString( |
extension_id, kPrefPageOrdinal, &raw_data); |
return syncer::StringOrdinal(raw_data); |
} |
@@ -399,7 +389,7 @@ void ChromeAppSorting::SetPageOrdinal( |
new base::StringValue(new_page_ordinal.ToInternalValue()) : |
NULL; |
- extension_scoped_prefs_->UpdateExtensionPref( |
+ ExtensionPrefs::Get(browser_context_)->UpdateExtensionPref( |
extension_id, |
kPrefPageOrdinal, |
new_value); |
@@ -411,9 +401,9 @@ void ChromeAppSorting::ClearOrdinals(const std::string& extension_id) { |
GetPageOrdinal(extension_id), |
GetAppLaunchOrdinal(extension_id)); |
- extension_scoped_prefs_->UpdateExtensionPref( |
+ ExtensionPrefs::Get(browser_context_)->UpdateExtensionPref( |
not at google - send to devlin
2015/07/29 18:22:03
Here as well.
Marc Treib
2015/07/30 14:04:12
Done.
|
extension_id, kPrefPageOrdinal, NULL); |
- extension_scoped_prefs_->UpdateExtensionPref( |
+ ExtensionPrefs::Get(browser_context_)->UpdateExtensionPref( |
extension_id, kPrefAppLaunchOrdinal, NULL); |
} |
@@ -473,9 +463,6 @@ syncer::StringOrdinal ChromeAppSorting::GetMinOrMaxAppLaunchOrdinalsOnPage( |
void ChromeAppSorting::InitializePageOrdinalMap( |
const extensions::ExtensionIdList& extension_ids) { |
- // TODO(mgiuca): Added this CHECK to try and diagnose http://crbug.com/476648. |
- // Remove it after the investigation is concluded. |
- CHECK(extension_scoped_prefs_); |
for (extensions::ExtensionIdList::const_iterator ext_it = |
extension_ids.begin(); ext_it != extension_ids.end(); ++ext_it) { |
AddOrdinalMapping(*ext_it, |