| 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/extensions_helper.h" | 5 #include "chrome/browser/sync/test/integration/extensions_helper.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 for (std::vector<std::string>::const_iterator it = names.begin(); | 74 for (std::vector<std::string>::const_iterator it = names.begin(); |
| 75 it != names.end(); ++it) { | 75 it != names.end(); ++it) { |
| 76 int index; | 76 int index; |
| 77 if (ExtensionNameToIndex(*it, &index)) { | 77 if (ExtensionNameToIndex(*it, &index)) { |
| 78 indices.push_back(index); | 78 indices.push_back(index); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 return indices; | 81 return indices; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void EnableExtension(Profile* profile, int index) { |
| 85 return SyncExtensionHelper::GetInstance()->EnableExtension( |
| 86 profile, CreateFakeExtensionName(index)); |
| 87 } |
| 88 |
| 89 void DisableExtension(Profile* profile, int index) { |
| 90 return SyncExtensionHelper::GetInstance()->DisableExtension( |
| 91 profile, CreateFakeExtensionName(index)); |
| 92 } |
| 93 |
| 84 bool IsExtensionEnabled(Profile* profile, int index) { | 94 bool IsExtensionEnabled(Profile* profile, int index) { |
| 85 return SyncExtensionHelper::GetInstance()->IsExtensionEnabled( | 95 return SyncExtensionHelper::GetInstance()->IsExtensionEnabled( |
| 86 profile, CreateFakeExtensionName(index)); | 96 profile, CreateFakeExtensionName(index)); |
| 87 } | 97 } |
| 88 | 98 |
| 89 void IncognitoEnableExtension(Profile* profile, int index) { | 99 void IncognitoEnableExtension(Profile* profile, int index) { |
| 90 return SyncExtensionHelper::GetInstance()->IncognitoEnableExtension( | 100 return SyncExtensionHelper::GetInstance()->IncognitoEnableExtension( |
| 91 profile, CreateFakeExtensionName(index)); | 101 profile, CreateFakeExtensionName(index)); |
| 92 } | 102 } |
| 93 | 103 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 113 if (!StartsWithASCII(name, extension_name_prefix, true) || | 123 if (!StartsWithASCII(name, extension_name_prefix, true) || |
| 114 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { | 124 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { |
| 115 LOG(WARNING) << "Unable to convert extension name \"" << name | 125 LOG(WARNING) << "Unable to convert extension name \"" << name |
| 116 << "\" to index"; | 126 << "\" to index"; |
| 117 return false; | 127 return false; |
| 118 } | 128 } |
| 119 return true; | 129 return true; |
| 120 } | 130 } |
| 121 | 131 |
| 122 } // namespace extensions_helper | 132 } // namespace extensions_helper |
| OLD | NEW |