| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/test/test_extensions_client.h" | 5 #include "extensions/test/test_extensions_client.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "extensions/common/api/generated_schemas.h" | 8 #include "extensions/common/api/generated_schemas.h" |
| 9 #include "extensions/common/common_manifest_handlers.h" | 9 #include "extensions/common/common_manifest_handlers.h" |
| 10 #include "extensions/common/extension_urls.h" | 10 #include "extensions/common/extension_urls.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const PermissionMessageProvider& | 65 const PermissionMessageProvider& |
| 66 TestExtensionsClient::GetPermissionMessageProvider() const { | 66 TestExtensionsClient::GetPermissionMessageProvider() const { |
| 67 static TestPermissionMessageProvider provider; | 67 static TestPermissionMessageProvider provider; |
| 68 return provider; | 68 return provider; |
| 69 } | 69 } |
| 70 | 70 |
| 71 const std::string TestExtensionsClient::GetProductName() { | 71 const std::string TestExtensionsClient::GetProductName() { |
| 72 return "extensions_test"; | 72 return "extensions_test"; |
| 73 } | 73 } |
| 74 | 74 |
| 75 scoped_ptr<FeatureProvider> TestExtensionsClient::CreateFeatureProvider( | 75 std::unique_ptr<FeatureProvider> TestExtensionsClient::CreateFeatureProvider( |
| 76 const std::string& name) const { | 76 const std::string& name) const { |
| 77 scoped_ptr<FeatureProvider> provider; | 77 std::unique_ptr<FeatureProvider> provider; |
| 78 scoped_ptr<JSONFeatureProviderSource> source( | 78 std::unique_ptr<JSONFeatureProviderSource> source( |
| 79 CreateFeatureProviderSource(name)); | 79 CreateFeatureProviderSource(name)); |
| 80 if (name == "api") { | 80 if (name == "api") { |
| 81 provider.reset(new BaseFeatureProvider(source->dictionary(), | 81 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 82 CreateFeature<APIFeature>)); | 82 CreateFeature<APIFeature>)); |
| 83 } else if (name == "manifest") { | 83 } else if (name == "manifest") { |
| 84 provider.reset(new BaseFeatureProvider(source->dictionary(), | 84 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 85 CreateFeature<ManifestFeature>)); | 85 CreateFeature<ManifestFeature>)); |
| 86 } else if (name == "permission") { | 86 } else if (name == "permission") { |
| 87 provider.reset(new BaseFeatureProvider(source->dictionary(), | 87 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 88 CreateFeature<PermissionFeature>)); | 88 CreateFeature<PermissionFeature>)); |
| 89 } else if (name == "behavior") { | 89 } else if (name == "behavior") { |
| 90 provider.reset(new BaseFeatureProvider(source->dictionary(), | 90 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 91 CreateFeature<BehaviorFeature>)); | 91 CreateFeature<BehaviorFeature>)); |
| 92 } else { | 92 } else { |
| 93 NOTREACHED(); | 93 NOTREACHED(); |
| 94 } | 94 } |
| 95 return provider; | 95 return provider; |
| 96 } | 96 } |
| 97 | 97 |
| 98 scoped_ptr<JSONFeatureProviderSource> | 98 std::unique_ptr<JSONFeatureProviderSource> |
| 99 TestExtensionsClient::CreateFeatureProviderSource( | 99 TestExtensionsClient::CreateFeatureProviderSource( |
| 100 const std::string& name) const { | 100 const std::string& name) const { |
| 101 scoped_ptr<JSONFeatureProviderSource> source( | 101 std::unique_ptr<JSONFeatureProviderSource> source( |
| 102 new JSONFeatureProviderSource(name)); | 102 new JSONFeatureProviderSource(name)); |
| 103 if (name == "api") { | 103 if (name == "api") { |
| 104 source->LoadJSON(IDR_EXTENSION_API_FEATURES); | 104 source->LoadJSON(IDR_EXTENSION_API_FEATURES); |
| 105 } else if (name == "manifest") { | 105 } else if (name == "manifest") { |
| 106 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); | 106 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); |
| 107 } else if (name == "permission") { | 107 } else if (name == "permission") { |
| 108 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); | 108 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); |
| 109 } else if (name == "behavior") { | 109 } else if (name == "behavior") { |
| 110 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES); | 110 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES); |
| 111 } else { | 111 } else { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 std::set<base::FilePath> TestExtensionsClient::GetBrowserImagePaths( | 178 std::set<base::FilePath> TestExtensionsClient::GetBrowserImagePaths( |
| 179 const Extension* extension) { | 179 const Extension* extension) { |
| 180 std::set<base::FilePath> result = | 180 std::set<base::FilePath> result = |
| 181 ExtensionsClient::GetBrowserImagePaths(extension); | 181 ExtensionsClient::GetBrowserImagePaths(extension); |
| 182 for (auto filter : browser_image_filters_) | 182 for (auto filter : browser_image_filters_) |
| 183 filter->Filter(extension, &result); | 183 filter->Filter(extension, &result); |
| 184 return result; | 184 return result; |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace extensions | 187 } // namespace extensions |
| OLD | NEW |