OLD | NEW |
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 Loading... |
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"; |
124 | 126 |
125 // A preference that, if true, will allow this extension to run in incognito | 127 // A preference that, if true, will allow this extension to run in incognito |
126 // mode. | 128 // mode. |
127 const char kPrefIncognitoEnabled[] = "incognito"; | 129 const char kPrefIncognitoEnabled[] = "incognito"; |
128 | 130 |
129 // A preference to control whether an extension is allowed to inject script in | 131 // A preference to control whether an extension is allowed to inject script in |
130 // pages with file URLs. | 132 // pages with file URLs. |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 continue; | 1670 continue; |
1669 | 1671 |
1670 scoped_ptr<ExtensionInfo> info = GetInstalledExtensionInfo(*extension_id); | 1672 scoped_ptr<ExtensionInfo> info = GetInstalledExtensionInfo(*extension_id); |
1671 if (info) | 1673 if (info) |
1672 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); | 1674 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); |
1673 } | 1675 } |
1674 | 1676 |
1675 return extensions_info.Pass(); | 1677 return extensions_info.Pass(); |
1676 } | 1678 } |
1677 | 1679 |
1678 void ExtensionPrefs::SetIdleInstallInfo( | 1680 void ExtensionPrefs::SetDelayedInstallInfo( |
1679 const Extension* extension, | 1681 const Extension* extension, |
1680 Extension::State initial_state, | 1682 Extension::State initial_state, |
1681 const syncer::StringOrdinal& page_ordinal) { | 1683 const syncer::StringOrdinal& page_ordinal) { |
1682 DictionaryValue* extension_dict = new DictionaryValue(); | 1684 DictionaryValue* extension_dict = new DictionaryValue(); |
1683 PopulateExtensionInfoPrefs(extension, time_provider_->GetCurrentTime(), | 1685 PopulateExtensionInfoPrefs(extension, time_provider_->GetCurrentTime(), |
1684 initial_state, extension_dict); | 1686 initial_state, extension_dict); |
1685 | 1687 |
1686 // Add transient data that is needed by FinishIdleInstallInfo(), but | 1688 // Add transient data that is needed by FinishDelayedInstallInfo(), but |
1687 // should not be in the final extension prefs. All entries here should have | 1689 // should not be in the final extension prefs. All entries here should have |
1688 // a corresponding Remove() call in FinishIdleInstallInfo(). | 1690 // a corresponding Remove() call in FinishDelayedInstallInfo(). |
1689 if (extension->RequiresSortOrdinal()) { | 1691 if (extension->RequiresSortOrdinal()) { |
1690 extension_dict->SetString(kPrefSuggestedPageOrdinal, | 1692 extension_dict->SetString(kPrefSuggestedPageOrdinal, |
1691 page_ordinal.ToInternalValue()); | 1693 page_ordinal.ToInternalValue()); |
1692 } | 1694 } |
1693 | 1695 |
1694 UpdateExtensionPref(extension->id(), kIdleInstallInfo, extension_dict); | 1696 UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict); |
1695 } | 1697 } |
1696 | 1698 |
1697 bool ExtensionPrefs::RemoveIdleInstallInfo(const std::string& extension_id) { | 1699 bool ExtensionPrefs::RemoveDelayedInstallInfo( |
| 1700 const std::string& extension_id) { |
1698 if (!GetExtensionPref(extension_id)) | 1701 if (!GetExtensionPref(extension_id)) |
1699 return false; | 1702 return false; |
1700 ScopedExtensionPrefUpdate update(prefs_, extension_id); | 1703 ScopedExtensionPrefUpdate update(prefs_, extension_id); |
1701 bool result = update->Remove(kIdleInstallInfo, NULL); | 1704 bool result = update->Remove(kDelayedInstallInfo, NULL); |
1702 return result; | 1705 return result; |
1703 } | 1706 } |
1704 | 1707 |
1705 bool ExtensionPrefs::FinishIdleInstallInfo(const std::string& extension_id) { | 1708 bool ExtensionPrefs::FinishDelayedInstallInfo( |
| 1709 const std::string& extension_id) { |
1706 CHECK(Extension::IdIsValid(extension_id)); | 1710 CHECK(Extension::IdIsValid(extension_id)); |
1707 ScopedExtensionPrefUpdate update(prefs_, extension_id); | 1711 ScopedExtensionPrefUpdate update(prefs_, extension_id); |
1708 DictionaryValue* extension_dict = update.Get(); | 1712 DictionaryValue* extension_dict = update.Get(); |
1709 DictionaryValue* pending_install_dict = NULL; | 1713 DictionaryValue* pending_install_dict = NULL; |
1710 if (!extension_dict->GetDictionary(kIdleInstallInfo, &pending_install_dict)) | 1714 if (!extension_dict->GetDictionary(kDelayedInstallInfo, |
| 1715 &pending_install_dict)) { |
1711 return false; | 1716 return false; |
| 1717 } |
1712 | 1718 |
1713 // Retrieve and clear transient values populated by SetIdleInstallInfo(). Also | 1719 // Retrieve and clear transient values populated by SetDelayedInstallInfo(). |
1714 // do any other data cleanup that makes sense. | 1720 // Also do any other data cleanup that makes sense. |
1715 std::string serialized_ordinal; | 1721 std::string serialized_ordinal; |
1716 syncer::StringOrdinal suggested_page_ordinal; | 1722 syncer::StringOrdinal suggested_page_ordinal; |
1717 bool needs_sort_ordinal = false; | 1723 bool needs_sort_ordinal = false; |
1718 if (pending_install_dict->GetString(kPrefSuggestedPageOrdinal, | 1724 if (pending_install_dict->GetString(kPrefSuggestedPageOrdinal, |
1719 &serialized_ordinal)) { | 1725 &serialized_ordinal)) { |
1720 suggested_page_ordinal = syncer::StringOrdinal(serialized_ordinal); | 1726 suggested_page_ordinal = syncer::StringOrdinal(serialized_ordinal); |
1721 needs_sort_ordinal = true; | 1727 needs_sort_ordinal = true; |
1722 pending_install_dict->Remove(kPrefSuggestedPageOrdinal, NULL); | 1728 pending_install_dict->Remove(kPrefSuggestedPageOrdinal, NULL); |
1723 } | 1729 } |
1724 | 1730 |
1725 const base::Time install_time = time_provider_->GetCurrentTime(); | 1731 const base::Time install_time = time_provider_->GetCurrentTime(); |
1726 pending_install_dict->Set( | 1732 pending_install_dict->Set( |
1727 kPrefInstallTime, | 1733 kPrefInstallTime, |
1728 Value::CreateStringValue( | 1734 Value::CreateStringValue( |
1729 base::Int64ToString(install_time.ToInternalValue()))); | 1735 base::Int64ToString(install_time.ToInternalValue()))); |
1730 | 1736 |
1731 // Commit the delayed install data. | 1737 // Commit the delayed install data. |
1732 extension_dict->MergeDictionary(pending_install_dict); | 1738 extension_dict->MergeDictionary(pending_install_dict); |
1733 FinishExtensionInfoPrefs(extension_id, install_time, needs_sort_ordinal, | 1739 FinishExtensionInfoPrefs(extension_id, install_time, needs_sort_ordinal, |
1734 suggested_page_ordinal, extension_dict); | 1740 suggested_page_ordinal, extension_dict); |
1735 return true; | 1741 return true; |
1736 } | 1742 } |
1737 | 1743 |
1738 scoped_ptr<ExtensionInfo> ExtensionPrefs::GetIdleInstallInfo( | 1744 scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo( |
1739 const std::string& extension_id) const { | 1745 const std::string& extension_id) const { |
1740 const DictionaryValue* extension_prefs = GetExtensionPref(extension_id); | 1746 const DictionaryValue* extension_prefs = GetExtensionPref(extension_id); |
1741 if (!extension_prefs) | 1747 if (!extension_prefs) |
1742 return scoped_ptr<ExtensionInfo>(); | 1748 return scoped_ptr<ExtensionInfo>(); |
1743 | 1749 |
1744 const DictionaryValue* ext = NULL; | 1750 const DictionaryValue* ext = NULL; |
1745 if (!extension_prefs->GetDictionary(kIdleInstallInfo, &ext)) | 1751 if (!extension_prefs->GetDictionary(kDelayedInstallInfo, &ext)) |
1746 return scoped_ptr<ExtensionInfo>(); | 1752 return scoped_ptr<ExtensionInfo>(); |
1747 | 1753 |
1748 // TODO(mek): share code with GetInstalledExtensionInfo | 1754 // TODO(mek): share code with GetInstalledExtensionInfo |
1749 FilePath::StringType path; | 1755 FilePath::StringType path; |
1750 int location_value; | 1756 int location_value; |
1751 if (!ext->GetInteger(kPrefLocation, &location_value)) | 1757 if (!ext->GetInteger(kPrefLocation, &location_value)) |
1752 return scoped_ptr<ExtensionInfo>(); | 1758 return scoped_ptr<ExtensionInfo>(); |
1753 | 1759 |
1754 if (!ext->GetString(kPrefPath, &path)) | 1760 if (!ext->GetString(kPrefPath, &path)) |
1755 return scoped_ptr<ExtensionInfo>(); | 1761 return scoped_ptr<ExtensionInfo>(); |
(...skipping 22 matching lines...) Expand all Loading... |
1778 !ext->GetDictionary(kPrefManifest, &manifest)) { | 1784 !ext->GetDictionary(kPrefManifest, &manifest)) { |
1779 LOG(WARNING) << "Missing manifest for extension " << extension_id; | 1785 LOG(WARNING) << "Missing manifest for extension " << extension_id; |
1780 // Just a warning for now. | 1786 // Just a warning for now. |
1781 } | 1787 } |
1782 | 1788 |
1783 return scoped_ptr<ExtensionInfo>( | 1789 return scoped_ptr<ExtensionInfo>( |
1784 new ExtensionInfo(manifest, extension_id, FilePath(path), location)); | 1790 new ExtensionInfo(manifest, extension_id, FilePath(path), location)); |
1785 } | 1791 } |
1786 | 1792 |
1787 scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs:: | 1793 scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs:: |
1788 GetAllIdleInstallInfo() const { | 1794 GetAllDelayedInstallInfo() const { |
1789 scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo); | 1795 scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo); |
1790 | 1796 |
1791 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref); | 1797 const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref); |
1792 for (DictionaryValue::key_iterator extension_id = extensions->begin_keys(); | 1798 for (DictionaryValue::key_iterator extension_id = extensions->begin_keys(); |
1793 extension_id != extensions->end_keys(); ++extension_id) { | 1799 extension_id != extensions->end_keys(); ++extension_id) { |
1794 if (!Extension::IdIsValid(*extension_id)) | 1800 if (!Extension::IdIsValid(*extension_id)) |
1795 continue; | 1801 continue; |
1796 | 1802 |
1797 scoped_ptr<ExtensionInfo> info = GetIdleInstallInfo(*extension_id); | 1803 scoped_ptr<ExtensionInfo> info = GetDelayedInstallInfo(*extension_id); |
1798 if (info) | 1804 if (info) |
1799 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); | 1805 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); |
1800 } | 1806 } |
1801 | 1807 |
1802 return extensions_info.Pass(); | 1808 return extensions_info.Pass(); |
1803 } | 1809 } |
1804 | 1810 |
1805 bool ExtensionPrefs::GetWebStoreLogin(std::string* result) { | 1811 bool ExtensionPrefs::GetWebStoreLogin(std::string* result) { |
1806 if (prefs_->HasPrefPath(kWebStoreLogin)) { | 1812 if (prefs_->HasPrefPath(kWebStoreLogin)) { |
1807 *result = prefs_->GetString(kWebStoreLogin); | 1813 *result = prefs_->GetString(kWebStoreLogin); |
1808 return true; | 1814 return true; |
1809 } | 1815 } |
1810 return false; | 1816 return false; |
1811 } | 1817 } |
1812 | 1818 |
1813 void ExtensionPrefs::SetWebStoreLogin(const std::string& login) { | 1819 void ExtensionPrefs::SetWebStoreLogin(const std::string& login) { |
1814 prefs_->SetString(kWebStoreLogin, login); | 1820 prefs_->SetString(kWebStoreLogin, login); |
1815 } | 1821 } |
1816 | 1822 |
1817 bool ExtensionPrefs::GetSideloadWipeoutDone() const { | 1823 bool ExtensionPrefs::GetSideloadWipeoutDone() const { |
1818 return prefs_->GetBoolean(kSideloadWipeoutDone); | 1824 return prefs_->GetBoolean(kSideloadWipeoutDone); |
1819 } | 1825 } |
1820 | 1826 |
1821 void ExtensionPrefs::SetSideloadWipeoutDone() { | 1827 void ExtensionPrefs::SetSideloadWipeoutDone() { |
1822 return prefs_->SetBoolean(kSideloadWipeoutDone, true); | 1828 prefs_->SetBoolean(kSideloadWipeoutDone, true); |
1823 } | 1829 } |
1824 | 1830 |
1825 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) { | 1831 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) { |
1826 return ReadExtensionPrefBoolean(extension_id, kPrefUserDraggedApp); | 1832 return ReadExtensionPrefBoolean(extension_id, kPrefUserDraggedApp); |
1827 } | 1833 } |
1828 | 1834 |
1829 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) { | 1835 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) { |
1830 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, | 1836 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, |
1831 Value::CreateBooleanValue(true)); | 1837 Value::CreateBooleanValue(true)); |
1832 } | 1838 } |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 } | 2197 } |
2192 | 2198 |
2193 void ExtensionPrefs::Init(bool extensions_disabled) { | 2199 void ExtensionPrefs::Init(bool extensions_disabled) { |
2194 MakePathsRelative(); | 2200 MakePathsRelative(); |
2195 | 2201 |
2196 InitPrefStore(extensions_disabled); | 2202 InitPrefStore(extensions_disabled); |
2197 | 2203 |
2198 content_settings_store_->AddObserver(this); | 2204 content_settings_store_->AddObserver(this); |
2199 } | 2205 } |
2200 | 2206 |
| 2207 void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) { |
| 2208 prefs_->SetBoolean(prefs::kExtensionStorageGarbageCollect, value); |
| 2209 } |
| 2210 |
| 2211 bool ExtensionPrefs::NeedsStorageGarbageCollection() { |
| 2212 return prefs_->GetBoolean(prefs::kExtensionStorageGarbageCollect); |
| 2213 } |
| 2214 |
2201 // static | 2215 // static |
2202 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 2216 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
2203 prefs->RegisterDictionaryPref(kExtensionsPref, PrefService::UNSYNCABLE_PREF); | 2217 prefs->RegisterDictionaryPref(kExtensionsPref, PrefService::UNSYNCABLE_PREF); |
2204 prefs->RegisterListPref(kExtensionToolbar, PrefService::UNSYNCABLE_PREF); | 2218 prefs->RegisterListPref(kExtensionToolbar, PrefService::UNSYNCABLE_PREF); |
2205 prefs->RegisterListPref(kExtensionActionBox, PrefService::UNSYNCABLE_PREF); | 2219 prefs->RegisterListPref(kExtensionActionBox, PrefService::UNSYNCABLE_PREF); |
2206 prefs->RegisterListPref(kExtensionActionBoxBar, PrefService::UNSYNCABLE_PREF); | 2220 prefs->RegisterListPref(kExtensionActionBoxBar, PrefService::UNSYNCABLE_PREF); |
2207 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, | 2221 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, |
2208 -1, // default value | 2222 -1, // default value |
2209 PrefService::UNSYNCABLE_PREF); | 2223 PrefService::UNSYNCABLE_PREF); |
2210 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate, | 2224 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate, |
2211 PrefService::UNSYNCABLE_PREF); | 2225 PrefService::UNSYNCABLE_PREF); |
2212 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, | 2226 prefs->RegisterListPref(prefs::kExtensionInstallAllowList, |
2213 PrefService::UNSYNCABLE_PREF); | 2227 PrefService::UNSYNCABLE_PREF); |
2214 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, | 2228 prefs->RegisterListPref(prefs::kExtensionInstallDenyList, |
2215 PrefService::UNSYNCABLE_PREF); | 2229 PrefService::UNSYNCABLE_PREF); |
2216 prefs->RegisterListPref(prefs::kExtensionInstallForceList, | 2230 prefs->RegisterListPref(prefs::kExtensionInstallForceList, |
2217 PrefService::UNSYNCABLE_PREF); | 2231 PrefService::UNSYNCABLE_PREF); |
2218 prefs->RegisterStringPref(kWebStoreLogin, | 2232 prefs->RegisterStringPref(kWebStoreLogin, |
2219 std::string(), // default value | 2233 std::string(), // default value |
2220 PrefService::UNSYNCABLE_PREF); | 2234 PrefService::UNSYNCABLE_PREF); |
2221 prefs->RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion, | 2235 prefs->RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion, |
2222 "0", // default value | 2236 "0", // default value |
2223 PrefService::UNSYNCABLE_PREF); | 2237 PrefService::UNSYNCABLE_PREF); |
| 2238 prefs->RegisterBooleanPref(prefs::kExtensionStorageGarbageCollect, |
| 2239 false, // default value |
| 2240 PrefService::UNSYNCABLE_PREF); |
2224 prefs->RegisterInt64Pref(prefs::kLastExtensionsUpdateCheck, | 2241 prefs->RegisterInt64Pref(prefs::kLastExtensionsUpdateCheck, |
2225 0, // default value | 2242 0, // default value |
2226 PrefService::UNSYNCABLE_PREF); | 2243 PrefService::UNSYNCABLE_PREF); |
2227 prefs->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck, | 2244 prefs->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck, |
2228 0, // default value | 2245 0, // default value |
2229 PrefService::UNSYNCABLE_PREF); | 2246 PrefService::UNSYNCABLE_PREF); |
2230 prefs->RegisterListPref(prefs::kExtensionAllowedInstallSites, | 2247 prefs->RegisterListPref(prefs::kExtensionAllowedInstallSites, |
2231 PrefService::UNSYNCABLE_PREF); | 2248 PrefService::UNSYNCABLE_PREF); |
2232 prefs->RegisterStringPref(kExtensionsLastChromeVersion, | 2249 prefs->RegisterStringPref(kExtensionsLastChromeVersion, |
2233 std::string(), // default value | 2250 std::string(), // default value |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 DictionaryValue* extension_dict) { | 2324 DictionaryValue* extension_dict) { |
2308 // Reinitializes various preferences with empty dictionaries. | 2325 // Reinitializes various preferences with empty dictionaries. |
2309 extension_dict->Set(kPrefPreferences, new DictionaryValue()); | 2326 extension_dict->Set(kPrefPreferences, new DictionaryValue()); |
2310 extension_dict->Set(kPrefIncognitoPreferences, new DictionaryValue()); | 2327 extension_dict->Set(kPrefIncognitoPreferences, new DictionaryValue()); |
2311 extension_dict->Set(kPrefRegularOnlyPreferences, new DictionaryValue()); | 2328 extension_dict->Set(kPrefRegularOnlyPreferences, new DictionaryValue()); |
2312 extension_dict->Set(kPrefContentSettings, new ListValue()); | 2329 extension_dict->Set(kPrefContentSettings, new ListValue()); |
2313 extension_dict->Set(kPrefIncognitoContentSettings, new ListValue()); | 2330 extension_dict->Set(kPrefIncognitoContentSettings, new ListValue()); |
2314 | 2331 |
2315 // If this point has been reached, any pending installs should be considered | 2332 // If this point has been reached, any pending installs should be considered |
2316 // out of date. | 2333 // out of date. |
2317 extension_dict->Remove(kIdleInstallInfo, NULL); | 2334 extension_dict->Remove(kDelayedInstallInfo, NULL); |
2318 | 2335 |
2319 // Clear state that may be registered from a previous install. | 2336 // Clear state that may be registered from a previous install. |
2320 extension_dict->Remove(kRegisteredEvents, NULL); | 2337 extension_dict->Remove(kRegisteredEvents, NULL); |
2321 | 2338 |
2322 // FYI, all code below here races on sudden shutdown because | 2339 // FYI, all code below here races on sudden shutdown because |
2323 // |extension_dict|, |extension_sorting_|, |extension_pref_value_map_|, | 2340 // |extension_dict|, |extension_sorting_|, |extension_pref_value_map_|, |
2324 // and |content_settings_store_| are updated non-transactionally. This is | 2341 // and |content_settings_store_| are updated non-transactionally. This is |
2325 // probably not fixable without nested transactional updates to pref | 2342 // probably not fixable without nested transactional updates to pref |
2326 // dictionaries. | 2343 // dictionaries. |
2327 if (needs_sort_ordinal) { | 2344 if (needs_sort_ordinal) { |
2328 extension_sorting_->EnsureValidOrdinals(extension_id, | 2345 extension_sorting_->EnsureValidOrdinals(extension_id, |
2329 suggested_page_ordinal); | 2346 suggested_page_ordinal); |
2330 } | 2347 } |
2331 | 2348 |
2332 bool is_enabled = false; | 2349 bool is_enabled = false; |
2333 int initial_state; | 2350 int initial_state; |
2334 if (extension_dict->GetInteger(kPrefState, &initial_state)) { | 2351 if (extension_dict->GetInteger(kPrefState, &initial_state)) { |
2335 is_enabled = initial_state == Extension::ENABLED; | 2352 is_enabled = initial_state == Extension::ENABLED; |
2336 } | 2353 } |
2337 | 2354 |
2338 extension_pref_value_map_->RegisterExtension(extension_id, install_time, | 2355 extension_pref_value_map_->RegisterExtension(extension_id, install_time, |
2339 is_enabled); | 2356 is_enabled); |
2340 content_settings_store_->RegisterExtension(extension_id, install_time, | 2357 content_settings_store_->RegisterExtension(extension_id, install_time, |
2341 is_enabled); | 2358 is_enabled); |
2342 } | 2359 } |
2343 | 2360 |
2344 } // namespace extensions | 2361 } // namespace extensions |
OLD | NEW |