| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 ExtensionService::UninstallExtensionHelper( | 80 ExtensionService::UninstallExtensionHelper( |
| 81 profile->GetExtensionService(), | 81 profile->GetExtensionService(), |
| 82 extensions::id_util::GenerateId(name)); | 82 extensions::id_util::GenerateId(name)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( | 85 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( |
| 86 Profile* profile) const { | 86 Profile* profile) const { |
| 87 std::vector<std::string> names; | 87 std::vector<std::string> names; |
| 88 ExtensionService* extension_service = profile->GetExtensionService(); | 88 ExtensionService* extension_service = profile->GetExtensionService(); |
| 89 | 89 |
| 90 scoped_ptr<const ExtensionSet> extensions( | 90 scoped_ptr<const extensions::ExtensionSet> extensions( |
| 91 extension_service->GenerateInstalledExtensionsSet()); | 91 extension_service->GenerateInstalledExtensionsSet()); |
| 92 for (ExtensionSet::const_iterator it = extensions->begin(); | 92 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 93 it != extensions->end(); ++it) { | 93 it != extensions->end(); ++it) { |
| 94 names.push_back((*it)->name()); | 94 names.push_back((*it)->name()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 return names; | 97 return names; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void SyncExtensionHelper::EnableExtension(Profile* profile, | 100 void SyncExtensionHelper::EnableExtension(Profile* profile, |
| 101 const std::string& name) { | 101 const std::string& name) { |
| 102 profile->GetExtensionService()->EnableExtension( | 102 profile->GetExtensionService()->EnableExtension( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 SyncExtensionHelper::ExtensionStateMap | 183 SyncExtensionHelper::ExtensionStateMap |
| 184 SyncExtensionHelper::GetExtensionStates(Profile* profile) { | 184 SyncExtensionHelper::GetExtensionStates(Profile* profile) { |
| 185 const std::string& profile_debug_name = profile->GetDebugName(); | 185 const std::string& profile_debug_name = profile->GetDebugName(); |
| 186 | 186 |
| 187 ExtensionStateMap extension_state_map; | 187 ExtensionStateMap extension_state_map; |
| 188 | 188 |
| 189 ExtensionService* extension_service = profile->GetExtensionService(); | 189 ExtensionService* extension_service = profile->GetExtensionService(); |
| 190 | 190 |
| 191 scoped_ptr<const ExtensionSet> extensions( | 191 scoped_ptr<const extensions::ExtensionSet> extensions( |
| 192 extension_service->GenerateInstalledExtensionsSet()); | 192 extension_service->GenerateInstalledExtensionsSet()); |
| 193 for (ExtensionSet::const_iterator it = extensions->begin(); | 193 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 194 it != extensions->end(); ++it) { | 194 it != extensions->end(); ++it) { |
| 195 const std::string& id = (*it)->id(); | 195 const std::string& id = (*it)->id(); |
| 196 extension_state_map[id].enabled_state = | 196 extension_state_map[id].enabled_state = |
| 197 extension_service->IsExtensionEnabled(id) ? | 197 extension_service->IsExtensionEnabled(id) ? |
| 198 ExtensionState::ENABLED : | 198 ExtensionState::ENABLED : |
| 199 ExtensionState::DISABLED; | 199 ExtensionState::DISABLED; |
| 200 extension_state_map[id].incognito_enabled = | 200 extension_state_map[id].incognito_enabled = |
| 201 extension_util::IsIncognitoEnabled(id, extension_service); | 201 extension_util::IsIncognitoEnabled(id, extension_service); |
| 202 | 202 |
| 203 DVLOG(2) << "Extension " << (*it)->id() << " in profile " | 203 DVLOG(2) << "Extension " << (*it)->id() << " in profile " |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 EXPECT_EQ(expected_id, extension->id()); | 370 EXPECT_EQ(expected_id, extension->id()); |
| 371 return NULL; | 371 return NULL; |
| 372 } | 372 } |
| 373 DVLOG(2) << "created extension with name = " | 373 DVLOG(2) << "created extension with name = " |
| 374 << name << ", id = " << expected_id; | 374 << name << ", id = " << expected_id; |
| 375 (it->second)[name] = extension; | 375 (it->second)[name] = extension; |
| 376 id_to_name_[expected_id] = name; | 376 id_to_name_[expected_id] = name; |
| 377 id_to_type_[expected_id] = type; | 377 id_to_type_[expected_id] = type; |
| 378 return extension; | 378 return extension; |
| 379 } | 379 } |
| OLD | NEW |