| 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/sync/test/integration/sync_extension_helper.h" | 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ExtensionService::UninstallExtensionHelper( | 96 ExtensionService::UninstallExtensionHelper( |
| 97 extensions::ExtensionSystem::Get(profile)->extension_service(), | 97 extensions::ExtensionSystem::Get(profile)->extension_service(), |
| 98 crx_file::id_util::GenerateId(name), | 98 crx_file::id_util::GenerateId(name), |
| 99 extensions::UNINSTALL_REASON_SYNC); | 99 extensions::UNINSTALL_REASON_SYNC); |
| 100 } | 100 } |
| 101 | 101 |
| 102 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( | 102 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( |
| 103 Profile* profile) const { | 103 Profile* profile) const { |
| 104 std::vector<std::string> names; | 104 std::vector<std::string> names; |
| 105 | 105 |
| 106 scoped_ptr<const extensions::ExtensionSet> extensions( | 106 std::unique_ptr<const extensions::ExtensionSet> extensions( |
| 107 extensions::ExtensionRegistry::Get(profile) | 107 extensions::ExtensionRegistry::Get(profile) |
| 108 ->GenerateInstalledExtensionsSet()); | 108 ->GenerateInstalledExtensionsSet()); |
| 109 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 109 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 110 it != extensions->end(); ++it) { | 110 it != extensions->end(); ++it) { |
| 111 names.push_back((*it)->name()); | 111 names.push_back((*it)->name()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 return names; | 114 return names; |
| 115 } | 115 } |
| 116 | 116 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 InstallExtension(profile, iter2->second, iter3->second); | 204 InstallExtension(profile, iter2->second, iter3->second); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 SyncExtensionHelper::ExtensionStateMap | 208 SyncExtensionHelper::ExtensionStateMap |
| 209 SyncExtensionHelper::GetExtensionStates(Profile* profile) { | 209 SyncExtensionHelper::GetExtensionStates(Profile* profile) { |
| 210 const std::string& profile_debug_name = profile->GetDebugName(); | 210 const std::string& profile_debug_name = profile->GetDebugName(); |
| 211 | 211 |
| 212 ExtensionStateMap extension_state_map; | 212 ExtensionStateMap extension_state_map; |
| 213 | 213 |
| 214 scoped_ptr<const extensions::ExtensionSet> extensions( | 214 std::unique_ptr<const extensions::ExtensionSet> extensions( |
| 215 extensions::ExtensionRegistry::Get(profile) | 215 extensions::ExtensionRegistry::Get(profile) |
| 216 ->GenerateInstalledExtensionsSet()); | 216 ->GenerateInstalledExtensionsSet()); |
| 217 | 217 |
| 218 ExtensionService* extension_service = | 218 ExtensionService* extension_service = |
| 219 extensions::ExtensionSystem::Get(profile)->extension_service(); | 219 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 220 for (const scoped_refptr<const Extension>& extension : *extensions) { | 220 for (const scoped_refptr<const Extension>& extension : *extensions) { |
| 221 const std::string& id = extension->id(); | 221 const std::string& id = extension->id(); |
| 222 // When doing Chrome account sign in though the Gaia extension, the Gaia | 222 // When doing Chrome account sign in though the Gaia extension, the Gaia |
| 223 // extensions gets installed once and used by multiple profiles. This will | 223 // extensions gets installed once and used by multiple profiles. This will |
| 224 // cause extension list of profiles to not match. | 224 // cause extension list of profiles to not match. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 EXPECT_EQ(expected_id, extension->id()); | 425 EXPECT_EQ(expected_id, extension->id()); |
| 426 return NULL; | 426 return NULL; |
| 427 } | 427 } |
| 428 DVLOG(2) << "created extension with name = " | 428 DVLOG(2) << "created extension with name = " |
| 429 << name << ", id = " << expected_id; | 429 << name << ", id = " << expected_id; |
| 430 (it->second)[name] = extension; | 430 (it->second)[name] = extension; |
| 431 id_to_name_[expected_id] = name; | 431 id_to_name_[expected_id] = name; |
| 432 id_to_type_[expected_id] = type; | 432 id_to_type_[expected_id] = type; |
| 433 return extension; | 433 return extension; |
| 434 } | 434 } |
| OLD | NEW |