| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_prefs.h" | 5 #include "extensions/browser/extension_prefs.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 const base::DictionaryValue* extensions = | 1274 const base::DictionaryValue* extensions = |
| 1275 prefs_->GetDictionary(pref_names::kExtensions); | 1275 prefs_->GetDictionary(pref_names::kExtensions); |
| 1276 for (base::DictionaryValue::Iterator extension_id(*extensions); | 1276 for (base::DictionaryValue::Iterator extension_id(*extensions); |
| 1277 !extension_id.IsAtEnd(); extension_id.Advance()) { | 1277 !extension_id.IsAtEnd(); extension_id.Advance()) { |
| 1278 if (!crx_file::id_util::IdIsValid(extension_id.key())) | 1278 if (!crx_file::id_util::IdIsValid(extension_id.key())) |
| 1279 continue; | 1279 continue; |
| 1280 | 1280 |
| 1281 std::unique_ptr<ExtensionInfo> info = | 1281 std::unique_ptr<ExtensionInfo> info = |
| 1282 GetInstalledExtensionInfo(extension_id.key()); | 1282 GetInstalledExtensionInfo(extension_id.key()); |
| 1283 if (info) | 1283 if (info) |
| 1284 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); | 1284 extensions_info->push_back(std::move(info)); |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 return extensions_info; | 1287 return extensions_info; |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 std::unique_ptr<ExtensionPrefs::ExtensionsInfo> | 1290 std::unique_ptr<ExtensionPrefs::ExtensionsInfo> |
| 1291 ExtensionPrefs::GetUninstalledExtensionsInfo() const { | 1291 ExtensionPrefs::GetUninstalledExtensionsInfo() const { |
| 1292 std::unique_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo); | 1292 std::unique_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo); |
| 1293 | 1293 |
| 1294 const base::DictionaryValue* extensions = | 1294 const base::DictionaryValue* extensions = |
| 1295 prefs_->GetDictionary(pref_names::kExtensions); | 1295 prefs_->GetDictionary(pref_names::kExtensions); |
| 1296 for (base::DictionaryValue::Iterator extension_id(*extensions); | 1296 for (base::DictionaryValue::Iterator extension_id(*extensions); |
| 1297 !extension_id.IsAtEnd(); extension_id.Advance()) { | 1297 !extension_id.IsAtEnd(); extension_id.Advance()) { |
| 1298 const base::DictionaryValue* ext = NULL; | 1298 const base::DictionaryValue* ext = NULL; |
| 1299 if (!crx_file::id_util::IdIsValid(extension_id.key()) || | 1299 if (!crx_file::id_util::IdIsValid(extension_id.key()) || |
| 1300 !IsExternalExtensionUninstalled(extension_id.key()) || | 1300 !IsExternalExtensionUninstalled(extension_id.key()) || |
| 1301 !extension_id.value().GetAsDictionary(&ext)) | 1301 !extension_id.value().GetAsDictionary(&ext)) |
| 1302 continue; | 1302 continue; |
| 1303 | 1303 |
| 1304 std::unique_ptr<ExtensionInfo> info = | 1304 std::unique_ptr<ExtensionInfo> info = |
| 1305 GetInstalledInfoHelper(extension_id.key(), ext); | 1305 GetInstalledInfoHelper(extension_id.key(), ext); |
| 1306 if (info) | 1306 if (info) |
| 1307 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); | 1307 extensions_info->push_back(std::move(info)); |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 return extensions_info; | 1310 return extensions_info; |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 void ExtensionPrefs::SetDelayedInstallInfo( | 1313 void ExtensionPrefs::SetDelayedInstallInfo( |
| 1314 const Extension* extension, | 1314 const Extension* extension, |
| 1315 Extension::State initial_state, | 1315 Extension::State initial_state, |
| 1316 int install_flags, | 1316 int install_flags, |
| 1317 DelayReason delay_reason, | 1317 DelayReason delay_reason, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 const base::DictionaryValue* extensions = | 1428 const base::DictionaryValue* extensions = |
| 1429 prefs_->GetDictionary(pref_names::kExtensions); | 1429 prefs_->GetDictionary(pref_names::kExtensions); |
| 1430 for (base::DictionaryValue::Iterator extension_id(*extensions); | 1430 for (base::DictionaryValue::Iterator extension_id(*extensions); |
| 1431 !extension_id.IsAtEnd(); extension_id.Advance()) { | 1431 !extension_id.IsAtEnd(); extension_id.Advance()) { |
| 1432 if (!crx_file::id_util::IdIsValid(extension_id.key())) | 1432 if (!crx_file::id_util::IdIsValid(extension_id.key())) |
| 1433 continue; | 1433 continue; |
| 1434 | 1434 |
| 1435 std::unique_ptr<ExtensionInfo> info = | 1435 std::unique_ptr<ExtensionInfo> info = |
| 1436 GetDelayedInstallInfo(extension_id.key()); | 1436 GetDelayedInstallInfo(extension_id.key()); |
| 1437 if (info) | 1437 if (info) |
| 1438 extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); | 1438 extensions_info->push_back(std::move(info)); |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 return extensions_info; | 1441 return extensions_info; |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 bool ExtensionPrefs::WasAppDraggedByUser( | 1444 bool ExtensionPrefs::WasAppDraggedByUser( |
| 1445 const std::string& extension_id) const { | 1445 const std::string& extension_id) const { |
| 1446 return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp); | 1446 return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 extension_pref_value_map_->RegisterExtension( | 1985 extension_pref_value_map_->RegisterExtension( |
| 1986 extension_id, install_time, is_enabled, is_incognito_enabled); | 1986 extension_id, install_time, is_enabled, is_incognito_enabled); |
| 1987 | 1987 |
| 1988 FOR_EACH_OBSERVER( | 1988 FOR_EACH_OBSERVER( |
| 1989 ExtensionPrefsObserver, | 1989 ExtensionPrefsObserver, |
| 1990 observer_list_, | 1990 observer_list_, |
| 1991 OnExtensionRegistered(extension_id, install_time, is_enabled)); | 1991 OnExtensionRegistered(extension_id, install_time, is_enabled)); |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 } // namespace extensions | 1994 } // namespace extensions |
| OLD | NEW |