| 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 "extensions/common/api/generated_schemas.h" | 7 #include "extensions/common/api/generated_schemas.h" |
| 8 #include "extensions/common/common_manifest_handlers.h" | 8 #include "extensions/common/common_manifest_handlers.h" |
| 9 #include "extensions/common/extension_urls.h" | 9 #include "extensions/common/extension_urls.h" |
| 10 #include "extensions/common/features/api_feature.h" | 10 #include "extensions/common/features/api_feature.h" |
| 11 #include "extensions/common/features/base_feature_provider.h" | 11 #include "extensions/common/features/base_feature_provider.h" |
| 12 #include "extensions/common/features/feature_provider.h" | 12 #include "extensions/common/features/feature_provider.h" |
| 13 #include "extensions/common/features/json_feature_provider_source.h" | 13 #include "extensions/common/features/json_feature_provider_source.h" |
| 14 #include "extensions/common/features/manifest_feature.h" | 14 #include "extensions/common/features/manifest_feature.h" |
| 15 #include "extensions/common/features/permission_feature.h" | 15 #include "extensions/common/features/permission_feature.h" |
| 16 #include "extensions/common/features/switch_feature.h" |
| 16 #include "extensions/common/manifest_handler.h" | 17 #include "extensions/common/manifest_handler.h" |
| 17 #include "extensions/common/permissions/extensions_api_permissions.h" | 18 #include "extensions/common/permissions/extensions_api_permissions.h" |
| 18 #include "extensions/common/permissions/permissions_info.h" | 19 #include "extensions/common/permissions/permissions_info.h" |
| 19 #include "extensions/common/url_pattern_set.h" | 20 #include "extensions/common/url_pattern_set.h" |
| 20 #include "extensions/test/test_permission_message_provider.h" | 21 #include "extensions/test/test_permission_message_provider.h" |
| 21 #include "grit/extensions_resources.h" | 22 #include "grit/extensions_resources.h" |
| 22 | 23 |
| 23 namespace extensions { | 24 namespace extensions { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 CreateFeatureProviderSource(name)); | 68 CreateFeatureProviderSource(name)); |
| 68 if (name == "api") { | 69 if (name == "api") { |
| 69 provider.reset(new BaseFeatureProvider(source->dictionary(), | 70 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 70 CreateFeature<APIFeature>)); | 71 CreateFeature<APIFeature>)); |
| 71 } else if (name == "manifest") { | 72 } else if (name == "manifest") { |
| 72 provider.reset(new BaseFeatureProvider(source->dictionary(), | 73 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 73 CreateFeature<ManifestFeature>)); | 74 CreateFeature<ManifestFeature>)); |
| 74 } else if (name == "permission") { | 75 } else if (name == "permission") { |
| 75 provider.reset(new BaseFeatureProvider(source->dictionary(), | 76 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 76 CreateFeature<PermissionFeature>)); | 77 CreateFeature<PermissionFeature>)); |
| 78 } else if (name == "switch") { |
| 79 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 80 CreateFeature<SwitchFeature>)); |
| 77 } else { | 81 } else { |
| 78 NOTREACHED(); | 82 NOTREACHED(); |
| 79 } | 83 } |
| 80 return provider.Pass(); | 84 return provider.Pass(); |
| 81 } | 85 } |
| 82 | 86 |
| 83 scoped_ptr<JSONFeatureProviderSource> | 87 scoped_ptr<JSONFeatureProviderSource> |
| 84 TestExtensionsClient::CreateFeatureProviderSource( | 88 TestExtensionsClient::CreateFeatureProviderSource( |
| 85 const std::string& name) const { | 89 const std::string& name) const { |
| 86 scoped_ptr<JSONFeatureProviderSource> source( | 90 scoped_ptr<JSONFeatureProviderSource> source( |
| 87 new JSONFeatureProviderSource(name)); | 91 new JSONFeatureProviderSource(name)); |
| 88 if (name == "api") { | 92 if (name == "api") { |
| 89 source->LoadJSON(IDR_EXTENSION_API_FEATURES); | 93 source->LoadJSON(IDR_EXTENSION_API_FEATURES); |
| 90 } else if (name == "manifest") { | 94 } else if (name == "manifest") { |
| 91 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); | 95 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); |
| 92 } else if (name == "permission") { | 96 } else if (name == "permission") { |
| 93 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); | 97 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); |
| 98 } else if (name == "switch") { |
| 99 source->LoadJSON(IDR_EXTENSION_SWITCH_FEATURES); |
| 94 } else { | 100 } else { |
| 95 NOTREACHED(); | 101 NOTREACHED(); |
| 96 source.reset(); | 102 source.reset(); |
| 97 } | 103 } |
| 98 return source.Pass(); | 104 return source.Pass(); |
| 99 } | 105 } |
| 100 | 106 |
| 101 void TestExtensionsClient::FilterHostPermissions( | 107 void TestExtensionsClient::FilterHostPermissions( |
| 102 const URLPatternSet& hosts, | 108 const URLPatternSet& hosts, |
| 103 URLPatternSet* new_hosts, | 109 URLPatternSet* new_hosts, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 bool TestExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const { | 160 bool TestExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const { |
| 155 return true; | 161 return true; |
| 156 } | 162 } |
| 157 | 163 |
| 158 std::set<base::FilePath> TestExtensionsClient::GetBrowserImagePaths( | 164 std::set<base::FilePath> TestExtensionsClient::GetBrowserImagePaths( |
| 159 const Extension* extension) { | 165 const Extension* extension) { |
| 160 return std::set<base::FilePath>(); | 166 return std::set<base::FilePath>(); |
| 161 } | 167 } |
| 162 | 168 |
| 163 } // namespace extensions | 169 } // namespace extensions |
| OLD | NEW |