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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 11419307: Garbage Collect the Storage directory on next profile start after an extension uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_notifier.h" 8 #include "base/prefs/pref_notifier.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Similar to kLastPingDay, but for "active" instead of "rollcall" pings. 110 // Similar to kLastPingDay, but for "active" instead of "rollcall" pings.
111 const char kLastActivePingDay[] = "last_active_pingday"; 111 const char kLastActivePingDay[] = "last_active_pingday";
112 112
113 // A bit we use to keep track of whether we need to do an "active" ping. 113 // A bit we use to keep track of whether we need to do an "active" ping.
114 const char kActiveBit[] = "active_bit"; 114 const char kActiveBit[] = "active_bit";
115 115
116 // Path for settings specific to blacklist update. 116 // Path for settings specific to blacklist update.
117 const char kExtensionsBlacklistUpdate[] = "extensions.blacklistupdate"; 117 const char kExtensionsBlacklistUpdate[] = "extensions.blacklistupdate";
118 118
119 // Path for the idle install info dictionary preference. 119 // Path for the delayed install info dictionary preference. The actual string
120 const char kIdleInstallInfo[] = "idle_install_info"; 120 // value is a legacy artifact for when delayed installs only pertained to
121 // updates that were waiting for idle.
122 const char kDelayedInstallInfo[] = "idle_install_info";
121 123
122 // Path for the suggested page ordinal of a delayed extension install. 124 // Path for the suggested page ordinal of a delayed extension install.
123 const char kPrefSuggestedPageOrdinal[] = "suggested_page_ordinal"; 125 const char kPrefSuggestedPageOrdinal[] = "suggested_page_ordinal";
126
127 // Path for the suggested page ordinal of a delayed extension install.
128 const char kPrefSuggestedPageOrdinal[] = "suggested_page_ordinal";
Charlie Reis 2012/12/11 02:15:56 Merge conflict here.
awong 2012/12/11 03:34:23 Done.
124 129
125 // A preference that, if true, will allow this extension to run in incognito 130 // A preference that, if true, will allow this extension to run in incognito
126 // mode. 131 // mode.
127 const char kPrefIncognitoEnabled[] = "incognito"; 132 const char kPrefIncognitoEnabled[] = "incognito";
128 133
129 // A preference to control whether an extension is allowed to inject script in 134 // A preference to control whether an extension is allowed to inject script in
130 // pages with file URLs. 135 // pages with file URLs.
131 const char kPrefAllowFileAccess[] = "newAllowFileAccess"; 136 const char kPrefAllowFileAccess[] = "newAllowFileAccess";
132 // TODO(jstritar): As part of fixing http://crbug.com/91577, we revoked all 137 // TODO(jstritar): As part of fixing http://crbug.com/91577, we revoked all
133 // extension file access by renaming the pref. We should eventually clean up 138 // extension file access by renaming the pref. We should eventually clean up
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 continue; 1673 continue;
1669 1674
1670 scoped_ptr<ExtensionInfo> info = GetInstalledExtensionInfo(*extension_id); 1675 scoped_ptr<ExtensionInfo> info = GetInstalledExtensionInfo(*extension_id);
1671 if (info) 1676 if (info)
1672 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); 1677 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
1673 } 1678 }
1674 1679
1675 return extensions_info.Pass(); 1680 return extensions_info.Pass();
1676 } 1681 }
1677 1682
1678 void ExtensionPrefs::SetIdleInstallInfo( 1683 void ExtensionPrefs::SetDelayedInstallInfo(
1679 const Extension* extension, 1684 const Extension* extension,
1680 Extension::State initial_state, 1685 Extension::State initial_state,
1681 const syncer::StringOrdinal& page_ordinal) { 1686 const syncer::StringOrdinal& page_ordinal) {
1682 DictionaryValue* extension_dict = new DictionaryValue(); 1687 DictionaryValue* extension_dict = new DictionaryValue();
1683 PopulateExtensionInfoPrefs(extension, time_provider_->GetCurrentTime(), 1688 PopulateExtensionInfoPrefs(extension, time_provider_->GetCurrentTime(),
1684 initial_state, extension_dict); 1689 initial_state, extension_dict);
1685 1690
1686 // Add transient data that is needed by FinishIdleInstallInfo(), but 1691 // Add transient data that is needed by FinishDelayedInstallInfo(), but
1687 // should not be in the final extension prefs. All entries here should have 1692 // should not be in the final extension prefs. All entries here should have
1688 // a corresponding Remove() call in FinishIdleInstallInfo(). 1693 // a corresponding Remove() call in FinishDelayedInstallInfo().
1689 if (extension->RequiresSortOrdinal()) { 1694 if (extension->RequiresSortOrdinal()) {
1690 extension_dict->SetString(kPrefSuggestedPageOrdinal, 1695 extension_dict->SetString(kPrefSuggestedPageOrdinal,
1691 page_ordinal.ToInternalValue()); 1696 page_ordinal.ToInternalValue());
1692 } 1697 }
1693 1698
1694 UpdateExtensionPref(extension->id(), kIdleInstallInfo, extension_dict); 1699 UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict);
1695 } 1700 }
1696 1701
1697 bool ExtensionPrefs::RemoveIdleInstallInfo(const std::string& extension_id) { 1702 bool ExtensionPrefs::RemoveDelayedInstallInfo(
1703 const std::string& extension_id) {
1698 if (!GetExtensionPref(extension_id)) 1704 if (!GetExtensionPref(extension_id))
1699 return false; 1705 return false;
1700 ScopedExtensionPrefUpdate update(prefs_, extension_id); 1706 ScopedExtensionPrefUpdate update(prefs_, extension_id);
1701 bool result = update->Remove(kIdleInstallInfo, NULL); 1707 bool result = update->Remove(kDelayedInstallInfo, NULL);
1702 return result; 1708 return result;
1703 } 1709 }
1704 1710
1705 bool ExtensionPrefs::FinishIdleInstallInfo(const std::string& extension_id) { 1711 bool ExtensionPrefs::FinishDelayedInstallInfo(
1712 const std::string& extension_id) {
1706 CHECK(Extension::IdIsValid(extension_id)); 1713 CHECK(Extension::IdIsValid(extension_id));
1707 ScopedExtensionPrefUpdate update(prefs_, extension_id); 1714 ScopedExtensionPrefUpdate update(prefs_, extension_id);
1708 DictionaryValue* extension_dict = update.Get(); 1715 DictionaryValue* extension_dict = update.Get();
1709 DictionaryValue* pending_install_dict = NULL; 1716 DictionaryValue* pending_install_dict = NULL;
1710 if (!extension_dict->GetDictionary(kIdleInstallInfo, &pending_install_dict)) 1717 if (!extension_dict->GetDictionary(kDelayedInstallInfo,
1718 &pending_install_dict)) {
1711 return false; 1719 return false;
1720 }
1712 1721
1713 // Retrieve and clear transient values populated by SetIdleInstallInfo(). Also 1722 // Retrieve and clear transient values populated by SetDelayedInstallInfo().
1714 // do any other data cleanup that makes sense. 1723 // Also do any other data cleanup that makes sense.
1715 std::string serialized_ordinal; 1724 std::string serialized_ordinal;
1716 syncer::StringOrdinal suggested_page_ordinal; 1725 syncer::StringOrdinal suggested_page_ordinal;
1717 bool needs_sort_ordinal = false; 1726 bool needs_sort_ordinal = false;
1718 if (pending_install_dict->GetString(kPrefSuggestedPageOrdinal, 1727 if (pending_install_dict->GetString(kPrefSuggestedPageOrdinal,
1719 &serialized_ordinal)) { 1728 &serialized_ordinal)) {
1720 suggested_page_ordinal = syncer::StringOrdinal(serialized_ordinal); 1729 suggested_page_ordinal = syncer::StringOrdinal(serialized_ordinal);
1721 needs_sort_ordinal = true; 1730 needs_sort_ordinal = true;
1722 pending_install_dict->Remove(kPrefSuggestedPageOrdinal, NULL); 1731 pending_install_dict->Remove(kPrefSuggestedPageOrdinal, NULL);
1723 } 1732 }
1724 1733
1725 const base::Time install_time = time_provider_->GetCurrentTime(); 1734 const base::Time install_time = time_provider_->GetCurrentTime();
1726 pending_install_dict->Set( 1735 pending_install_dict->Set(
1727 kPrefInstallTime, 1736 kPrefInstallTime,
1728 Value::CreateStringValue( 1737 Value::CreateStringValue(
1729 base::Int64ToString(install_time.ToInternalValue()))); 1738 base::Int64ToString(install_time.ToInternalValue())));
1730 1739
1731 // Commit the delayed install data. 1740 // Commit the delayed install data.
1732 extension_dict->MergeDictionary(pending_install_dict); 1741 extension_dict->MergeDictionary(pending_install_dict);
1733 FinishExtensionInfoPrefs(extension_id, install_time, needs_sort_ordinal, 1742 FinishExtensionInfoPrefs(extension_id, install_time, needs_sort_ordinal,
1734 suggested_page_ordinal, extension_dict); 1743 suggested_page_ordinal, extension_dict);
1735 return true; 1744 return true;
1736 } 1745 }
1737 1746
1738 scoped_ptr<ExtensionInfo> ExtensionPrefs::GetIdleInstallInfo( 1747 scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo(
1739 const std::string& extension_id) const { 1748 const std::string& extension_id) const {
1740 const DictionaryValue* extension_prefs = GetExtensionPref(extension_id); 1749 const DictionaryValue* extension_prefs = GetExtensionPref(extension_id);
1741 if (!extension_prefs) 1750 if (!extension_prefs)
1742 return scoped_ptr<ExtensionInfo>(); 1751 return scoped_ptr<ExtensionInfo>();
1743 1752
1744 const DictionaryValue* ext = NULL; 1753 const DictionaryValue* ext = NULL;
1745 if (!extension_prefs->GetDictionary(kIdleInstallInfo, &ext)) 1754 if (!extension_prefs->GetDictionary(kDelayedInstallInfo, &ext))
1746 return scoped_ptr<ExtensionInfo>(); 1755 return scoped_ptr<ExtensionInfo>();
1747 1756
1748 // TODO(mek): share code with GetInstalledExtensionInfo 1757 // TODO(mek): share code with GetInstalledExtensionInfo
1749 FilePath::StringType path; 1758 FilePath::StringType path;
1750 int location_value; 1759 int location_value;
1751 if (!ext->GetInteger(kPrefLocation, &location_value)) 1760 if (!ext->GetInteger(kPrefLocation, &location_value))
1752 return scoped_ptr<ExtensionInfo>(); 1761 return scoped_ptr<ExtensionInfo>();
1753 1762
1754 if (!ext->GetString(kPrefPath, &path)) 1763 if (!ext->GetString(kPrefPath, &path))
1755 return scoped_ptr<ExtensionInfo>(); 1764 return scoped_ptr<ExtensionInfo>();
(...skipping 22 matching lines...) Expand all
1778 !ext->GetDictionary(kPrefManifest, &manifest)) { 1787 !ext->GetDictionary(kPrefManifest, &manifest)) {
1779 LOG(WARNING) << "Missing manifest for extension " << extension_id; 1788 LOG(WARNING) << "Missing manifest for extension " << extension_id;
1780 // Just a warning for now. 1789 // Just a warning for now.
1781 } 1790 }
1782 1791
1783 return scoped_ptr<ExtensionInfo>( 1792 return scoped_ptr<ExtensionInfo>(
1784 new ExtensionInfo(manifest, extension_id, FilePath(path), location)); 1793 new ExtensionInfo(manifest, extension_id, FilePath(path), location));
1785 } 1794 }
1786 1795
1787 scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs:: 1796 scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs::
1788 GetAllIdleInstallInfo() const { 1797 GetAllDelayedInstallInfo() const {
1789 scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo); 1798 scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
1790 1799
1791 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref); 1800 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref);
1792 for (DictionaryValue::key_iterator extension_id = extensions->begin_keys(); 1801 for (DictionaryValue::key_iterator extension_id = extensions->begin_keys();
1793 extension_id != extensions->end_keys(); ++extension_id) { 1802 extension_id != extensions->end_keys(); ++extension_id) {
1794 if (!Extension::IdIsValid(*extension_id)) 1803 if (!Extension::IdIsValid(*extension_id))
1795 continue; 1804 continue;
1796 1805
1797 scoped_ptr<ExtensionInfo> info = GetIdleInstallInfo(*extension_id); 1806 scoped_ptr<ExtensionInfo> info = GetDelayedInstallInfo(*extension_id);
1798 if (info) 1807 if (info)
1799 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); 1808 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
1800 } 1809 }
1801 1810
1802 return extensions_info.Pass(); 1811 return extensions_info.Pass();
1803 } 1812 }
1804 1813
1805 bool ExtensionPrefs::GetWebStoreLogin(std::string* result) { 1814 bool ExtensionPrefs::GetWebStoreLogin(std::string* result) {
1806 if (prefs_->HasPrefPath(kWebStoreLogin)) { 1815 if (prefs_->HasPrefPath(kWebStoreLogin)) {
1807 *result = prefs_->GetString(kWebStoreLogin); 1816 *result = prefs_->GetString(kWebStoreLogin);
1808 return true; 1817 return true;
1809 } 1818 }
1810 return false; 1819 return false;
1811 } 1820 }
1812 1821
1813 void ExtensionPrefs::SetWebStoreLogin(const std::string& login) { 1822 void ExtensionPrefs::SetWebStoreLogin(const std::string& login) {
1814 prefs_->SetString(kWebStoreLogin, login); 1823 prefs_->SetString(kWebStoreLogin, login);
1815 } 1824 }
1816 1825
1817 bool ExtensionPrefs::GetSideloadWipeoutDone() const { 1826 bool ExtensionPrefs::GetSideloadWipeoutDone() const {
1818 return prefs_->GetBoolean(kSideloadWipeoutDone); 1827 return prefs_->GetBoolean(kSideloadWipeoutDone);
1819 } 1828 }
1820 1829
1821 void ExtensionPrefs::SetSideloadWipeoutDone() { 1830 void ExtensionPrefs::SetSideloadWipeoutDone() {
1822 return prefs_->SetBoolean(kSideloadWipeoutDone, true); 1831 prefs_->SetBoolean(kSideloadWipeoutDone, true);
1823 } 1832 }
1824 1833
1825 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) { 1834 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
1826 return ReadExtensionPrefBoolean(extension_id, kPrefUserDraggedApp); 1835 return ReadExtensionPrefBoolean(extension_id, kPrefUserDraggedApp);
1827 } 1836 }
1828 1837
1829 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) { 1838 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) {
1830 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, 1839 UpdateExtensionPref(extension_id, kPrefUserDraggedApp,
1831 Value::CreateBooleanValue(true)); 1840 Value::CreateBooleanValue(true));
1832 } 1841 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 } 2200 }
2192 2201
2193 void ExtensionPrefs::Init(bool extensions_disabled) { 2202 void ExtensionPrefs::Init(bool extensions_disabled) {
2194 MakePathsRelative(); 2203 MakePathsRelative();
2195 2204
2196 InitPrefStore(extensions_disabled); 2205 InitPrefStore(extensions_disabled);
2197 2206
2198 content_settings_store_->AddObserver(this); 2207 content_settings_store_->AddObserver(this);
2199 } 2208 }
2200 2209
2210 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) {
2211 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value);
2212 }
2213
2214 bool ExtensionPrefs::NeedsStorageGarbageCollection() {
2215 return prefs_->GetBoolean(prefs::kExtensionStorageGarbageCollect);
2216 }
2217
2201 // static 2218 // static
2202 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { 2219 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
2203 prefs->RegisterDictionaryPref(kExtensionsPref, PrefService::UNSYNCABLE_PREF); 2220 prefs->RegisterDictionaryPref(kExtensionsPref, PrefService::UNSYNCABLE_PREF);
2204 prefs->RegisterListPref(kExtensionToolbar, PrefService::UNSYNCABLE_PREF); 2221 prefs->RegisterListPref(kExtensionToolbar, PrefService::UNSYNCABLE_PREF);
2205 prefs->RegisterListPref(kExtensionActionBox, PrefService::UNSYNCABLE_PREF); 2222 prefs->RegisterListPref(kExtensionActionBox, PrefService::UNSYNCABLE_PREF);
2206 prefs->RegisterListPref(kExtensionActionBoxBar, PrefService::UNSYNCABLE_PREF); 2223 prefs->RegisterListPref(kExtensionActionBoxBar, PrefService::UNSYNCABLE_PREF);
2207 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, 2224 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize,
2208 -1, // default value 2225 -1, // default value
2209 PrefService::UNSYNCABLE_PREF); 2226 PrefService::UNSYNCABLE_PREF);
2210 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate, 2227 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate,
2211 PrefService::UNSYNCABLE_PREF); 2228 PrefService::UNSYNCABLE_PREF);
2212 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, 2229 prefs->RegisterListPref(prefs::kExtensionInstallAllowList,
2213 PrefService::UNSYNCABLE_PREF); 2230 PrefService::UNSYNCABLE_PREF);
2214 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, 2231 prefs->RegisterListPref(prefs::kExtensionInstallDenyList,
2215 PrefService::UNSYNCABLE_PREF); 2232 PrefService::UNSYNCABLE_PREF);
2216 prefs->RegisterListPref(prefs::kExtensionInstallForceList, 2233 prefs->RegisterListPref(prefs::kExtensionInstallForceList,
2217 PrefService::UNSYNCABLE_PREF); 2234 PrefService::UNSYNCABLE_PREF);
2218 prefs->RegisterStringPref(kWebStoreLogin, 2235 prefs->RegisterStringPref(kWebStoreLogin,
2219 std::string(), // default value 2236 std::string(), // default value
2220 PrefService::UNSYNCABLE_PREF); 2237 PrefService::UNSYNCABLE_PREF);
2221 prefs->RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion, 2238 prefs->RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion,
2222 "0", // default value 2239 "0", // default value
2223 PrefService::UNSYNCABLE_PREF); 2240 PrefService::UNSYNCABLE_PREF);
2241 prefs->RegisterBooleanPref(prefs::kExtensionStorageGarbageCollect,
2242 false, // default value
2243 PrefService::UNSYNCABLE_PREF);
2224 prefs->RegisterInt64Pref(prefs::kLastExtensionsUpdateCheck, 2244 prefs->RegisterInt64Pref(prefs::kLastExtensionsUpdateCheck,
2225 0, // default value 2245 0, // default value
2226 PrefService::UNSYNCABLE_PREF); 2246 PrefService::UNSYNCABLE_PREF);
2227 prefs->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck, 2247 prefs->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck,
2228 0, // default value 2248 0, // default value
2229 PrefService::UNSYNCABLE_PREF); 2249 PrefService::UNSYNCABLE_PREF);
2230 prefs->RegisterListPref(prefs::kExtensionAllowedInstallSites, 2250 prefs->RegisterListPref(prefs::kExtensionAllowedInstallSites,
2231 PrefService::UNSYNCABLE_PREF); 2251 PrefService::UNSYNCABLE_PREF);
2232 prefs->RegisterStringPref(kExtensionsLastChromeVersion, 2252 prefs->RegisterStringPref(kExtensionsLastChromeVersion,
2233 std::string(), // default value 2253 std::string(), // default value
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 DictionaryValue* extension_dict) { 2327 DictionaryValue* extension_dict) {
2308 // Reinitializes various preferences with empty dictionaries. 2328 // Reinitializes various preferences with empty dictionaries.
2309 extension_dict->Set(kPrefPreferences, new DictionaryValue()); 2329 extension_dict->Set(kPrefPreferences, new DictionaryValue());
2310 extension_dict->Set(kPrefIncognitoPreferences, new DictionaryValue()); 2330 extension_dict->Set(kPrefIncognitoPreferences, new DictionaryValue());
2311 extension_dict->Set(kPrefRegularOnlyPreferences, new DictionaryValue()); 2331 extension_dict->Set(kPrefRegularOnlyPreferences, new DictionaryValue());
2312 extension_dict->Set(kPrefContentSettings, new ListValue()); 2332 extension_dict->Set(kPrefContentSettings, new ListValue());
2313 extension_dict->Set(kPrefIncognitoContentSettings, new ListValue()); 2333 extension_dict->Set(kPrefIncognitoContentSettings, new ListValue());
2314 2334
2315 // If this point has been reached, any pending installs should be considered 2335 // If this point has been reached, any pending installs should be considered
2316 // out of date. 2336 // out of date.
2317 extension_dict->Remove(kIdleInstallInfo, NULL); 2337 extension_dict->Remove(kDelayedInstallInfo, NULL);
2318 2338
2319 // Clear state that may be registered from a previous install. 2339 // Clear state that may be registered from a previous install.
2320 extension_dict->Remove(kRegisteredEvents, NULL); 2340 extension_dict->Remove(kRegisteredEvents, NULL);
2321 2341
2322 // FYI, all code below here races on sudden shutdown because 2342 // FYI, all code below here races on sudden shutdown because
2323 // |extension_dict|, |extension_sorting_|, |extension_pref_value_map_|, 2343 // |extension_dict|, |extension_sorting_|, |extension_pref_value_map_|,
2324 // and |content_settings_store_| are updated non-transactionally. This is 2344 // and |content_settings_store_| are updated non-transactionally. This is
2325 // probably not fixable without nested transactional updates to pref 2345 // probably not fixable without nested transactional updates to pref
2326 // dictionaries. 2346 // dictionaries.
2327 if (needs_sort_ordinal) { 2347 if (needs_sort_ordinal) {
2328 extension_sorting_->EnsureValidOrdinals(extension_id, 2348 extension_sorting_->EnsureValidOrdinals(extension_id,
2329 suggested_page_ordinal); 2349 suggested_page_ordinal);
2330 } 2350 }
2331 2351
2332 bool is_enabled = false; 2352 bool is_enabled = false;
2333 int initial_state; 2353 int initial_state;
2334 if (extension_dict->GetInteger(kPrefState, &initial_state)) { 2354 if (extension_dict->GetInteger(kPrefState, &initial_state)) {
2335 is_enabled = initial_state == Extension::ENABLED; 2355 is_enabled = initial_state == Extension::ENABLED;
2336 } 2356 }
2337 2357
2338 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2358 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2339 is_enabled); 2359 is_enabled);
2340 content_settings_store_->RegisterExtension(extension_id, install_time, 2360 content_settings_store_->RegisterExtension(extension_id, install_time,
2341 is_enabled); 2361 is_enabled);
2342 } 2362 }
2343 2363
2344 } // namespace extensions 2364 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698