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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 scoped_ptr<const ExtensionSet> extensions( | 90 scoped_ptr<const ExtensionSet> extensions( |
91 extension_service->GenerateInstalledExtensionsSet()); | 91 extension_service->GenerateInstalledExtensionsSet()); |
92 for (ExtensionSet::const_iterator it = extensions->begin(); | 92 for (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, |
| 101 const std::string& name) { |
| 102 profile->GetExtensionService()->EnableExtension( |
| 103 extensions::id_util::GenerateId(name)); |
| 104 } |
| 105 |
| 106 void SyncExtensionHelper::DisableExtension(Profile* profile, |
| 107 const std::string& name) { |
| 108 profile->GetExtensionService()->DisableExtension( |
| 109 extensions::id_util::GenerateId(name), Extension::DISABLE_USER_ACTION); |
| 110 } |
| 111 |
100 bool SyncExtensionHelper::IsExtensionEnabled( | 112 bool SyncExtensionHelper::IsExtensionEnabled( |
101 Profile* profile, const std::string& name) const { | 113 Profile* profile, const std::string& name) const { |
102 return profile->GetExtensionService()->IsExtensionEnabled( | 114 return profile->GetExtensionService()->IsExtensionEnabled( |
103 extensions::id_util::GenerateId(name)); | 115 extensions::id_util::GenerateId(name)); |
104 } | 116 } |
105 | 117 |
106 void SyncExtensionHelper::IncognitoEnableExtension( | 118 void SyncExtensionHelper::IncognitoEnableExtension( |
107 Profile* profile, const std::string& name) { | 119 Profile* profile, const std::string& name) { |
108 extension_util::SetIsIncognitoEnabled(extensions::id_util::GenerateId(name), | 120 extension_util::SetIsIncognitoEnabled(extensions::id_util::GenerateId(name), |
109 profile->GetExtensionService(), true); | 121 profile->GetExtensionService(), true); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 EXPECT_EQ(expected_id, extension->id()); | 370 EXPECT_EQ(expected_id, extension->id()); |
359 return NULL; | 371 return NULL; |
360 } | 372 } |
361 DVLOG(2) << "created extension with name = " | 373 DVLOG(2) << "created extension with name = " |
362 << name << ", id = " << expected_id; | 374 << name << ", id = " << expected_id; |
363 (it->second)[name] = extension; | 375 (it->second)[name] = extension; |
364 id_to_name_[expected_id] = name; | 376 id_to_name_[expected_id] = name; |
365 id_to_type_[expected_id] = type; | 377 id_to_type_[expected_id] = type; |
366 return extension; | 378 return extension; |
367 } | 379 } |
OLD | NEW |