| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 Profile* profile, const std::string& name) { | 71 Profile* profile, const std::string& name) { |
| 72 ExtensionService::UninstallExtensionHelper(profile->GetExtensionService(), | 72 ExtensionService::UninstallExtensionHelper(profile->GetExtensionService(), |
| 73 NameToId(name)); | 73 NameToId(name)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( | 76 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( |
| 77 Profile* profile) const { | 77 Profile* profile) const { |
| 78 std::vector<std::string> names; | 78 std::vector<std::string> names; |
| 79 ExtensionService* extension_service = profile->GetExtensionService(); | 79 ExtensionService* extension_service = profile->GetExtensionService(); |
| 80 | 80 |
| 81 const ExtensionList* extensions = extension_service->extensions(); | 81 const ExtensionSet* extensions = extension_service->extensions(); |
| 82 for (ExtensionList::const_iterator it = extensions->begin(); | 82 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 83 it != extensions->end(); ++it) { | 83 it != extensions->end(); ++it) { |
| 84 names.push_back((*it)->name()); | 84 names.push_back((*it)->name()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 const ExtensionList* disabled_extensions = | 87 const ExtensionSet* disabled_extensions = |
| 88 extension_service->disabled_extensions(); | 88 extension_service->disabled_extensions(); |
| 89 for (ExtensionList::const_iterator it = disabled_extensions->begin(); | 89 for (ExtensionSet::const_iterator it = disabled_extensions->begin(); |
| 90 it != disabled_extensions->end(); ++it) { | 90 it != disabled_extensions->end(); ++it) { |
| 91 names.push_back((*it)->name()); | 91 names.push_back((*it)->name()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 const ExtensionList* terminated_extensions = | 94 const ExtensionSet* terminated_extensions = |
| 95 extension_service->terminated_extensions(); | 95 extension_service->terminated_extensions(); |
| 96 for (ExtensionList::const_iterator it = terminated_extensions->begin(); | 96 for (ExtensionSet::const_iterator it = terminated_extensions->begin(); |
| 97 it != terminated_extensions->end(); ++it) { | 97 it != terminated_extensions->end(); ++it) { |
| 98 names.push_back((*it)->name()); | 98 names.push_back((*it)->name()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 return names; | 101 return names; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void SyncExtensionHelper::EnableExtension(Profile* profile, | 104 void SyncExtensionHelper::EnableExtension(Profile* profile, |
| 105 const std::string& name) { | 105 const std::string& name) { |
| 106 profile->GetExtensionService()->EnableExtension(NameToId(name)); | 106 profile->GetExtensionService()->EnableExtension(NameToId(name)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 SyncExtensionHelper::ExtensionStateMap | 175 SyncExtensionHelper::ExtensionStateMap |
| 176 SyncExtensionHelper::GetExtensionStates(Profile* profile) { | 176 SyncExtensionHelper::GetExtensionStates(Profile* profile) { |
| 177 const std::string& profile_debug_name = profile->GetDebugName(); | 177 const std::string& profile_debug_name = profile->GetDebugName(); |
| 178 | 178 |
| 179 ExtensionStateMap extension_state_map; | 179 ExtensionStateMap extension_state_map; |
| 180 | 180 |
| 181 ExtensionService* extension_service = profile->GetExtensionService(); | 181 ExtensionService* extension_service = profile->GetExtensionService(); |
| 182 | 182 |
| 183 const ExtensionList* extensions = extension_service->extensions(); | 183 const ExtensionSet* extensions = extension_service->extensions(); |
| 184 for (ExtensionList::const_iterator it = extensions->begin(); | 184 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 185 it != extensions->end(); ++it) { | 185 it != extensions->end(); ++it) { |
| 186 const std::string& id = (*it)->id(); | 186 const std::string& id = (*it)->id(); |
| 187 extension_state_map[id].enabled_state = ExtensionState::ENABLED; | 187 extension_state_map[id].enabled_state = ExtensionState::ENABLED; |
| 188 extension_state_map[id].incognito_enabled = | 188 extension_state_map[id].incognito_enabled = |
| 189 extension_service->IsIncognitoEnabled(id); | 189 extension_service->IsIncognitoEnabled(id); |
| 190 DVLOG(2) << "Extension " << (*it)->id() << " in profile " | 190 DVLOG(2) << "Extension " << (*it)->id() << " in profile " |
| 191 << profile_debug_name << " is enabled"; | 191 << profile_debug_name << " is enabled"; |
| 192 } | 192 } |
| 193 | 193 |
| 194 const ExtensionList* disabled_extensions = | 194 const ExtensionSet* disabled_extensions = |
| 195 extension_service->disabled_extensions(); | 195 extension_service->disabled_extensions(); |
| 196 for (ExtensionList::const_iterator it = disabled_extensions->begin(); | 196 for (ExtensionSet::const_iterator it = disabled_extensions->begin(); |
| 197 it != disabled_extensions->end(); ++it) { | 197 it != disabled_extensions->end(); ++it) { |
| 198 const std::string& id = (*it)->id(); | 198 const std::string& id = (*it)->id(); |
| 199 extension_state_map[id].enabled_state = ExtensionState::DISABLED; | 199 extension_state_map[id].enabled_state = ExtensionState::DISABLED; |
| 200 extension_state_map[id].incognito_enabled = | 200 extension_state_map[id].incognito_enabled = |
| 201 extension_service->IsIncognitoEnabled(id); | 201 extension_service->IsIncognitoEnabled(id); |
| 202 DVLOG(2) << "Extension " << (*it)->id() << " in profile " | 202 DVLOG(2) << "Extension " << (*it)->id() << " in profile " |
| 203 << profile_debug_name << " is disabled"; | 203 << profile_debug_name << " is disabled"; |
| 204 } | 204 } |
| 205 | 205 |
| 206 const PendingExtensionManager* pending_extension_manager = | 206 const PendingExtensionManager* pending_extension_manager = |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 if (extension->id() != expected_id) { | 352 if (extension->id() != expected_id) { |
| 353 EXPECT_EQ(expected_id, extension->id()); | 353 EXPECT_EQ(expected_id, extension->id()); |
| 354 return NULL; | 354 return NULL; |
| 355 } | 355 } |
| 356 DVLOG(2) << "created extension with name = " | 356 DVLOG(2) << "created extension with name = " |
| 357 << name << ", id = " << expected_id; | 357 << name << ", id = " << expected_id; |
| 358 (it->second)[name] = extension; | 358 (it->second)[name] = extension; |
| 359 id_to_name_[expected_id] = name; | 359 id_to_name_[expected_id] = name; |
| 360 return extension; | 360 return extension; |
| 361 } | 361 } |
| OLD | NEW |