| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/extensions/chrome_extensions_client.h" | 5 #include "chrome/common/extensions/chrome_extensions_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "extensions/common/extension_api.h" | 30 #include "extensions/common/extension_api.h" |
| 31 #include "extensions/common/extension_icon_set.h" | 31 #include "extensions/common/extension_icon_set.h" |
| 32 #include "extensions/common/extension_urls.h" | 32 #include "extensions/common/extension_urls.h" |
| 33 #include "extensions/common/features/api_feature.h" | 33 #include "extensions/common/features/api_feature.h" |
| 34 #include "extensions/common/features/base_feature_provider.h" | 34 #include "extensions/common/features/base_feature_provider.h" |
| 35 #include "extensions/common/features/feature_provider.h" | 35 #include "extensions/common/features/feature_provider.h" |
| 36 #include "extensions/common/features/json_feature_provider_source.h" | 36 #include "extensions/common/features/json_feature_provider_source.h" |
| 37 #include "extensions/common/features/manifest_feature.h" | 37 #include "extensions/common/features/manifest_feature.h" |
| 38 #include "extensions/common/features/permission_feature.h" | 38 #include "extensions/common/features/permission_feature.h" |
| 39 #include "extensions/common/features/simple_feature.h" | 39 #include "extensions/common/features/simple_feature.h" |
| 40 #include "extensions/common/features/switch_feature.h" |
| 40 #include "extensions/common/manifest_constants.h" | 41 #include "extensions/common/manifest_constants.h" |
| 41 #include "extensions/common/manifest_handler.h" | 42 #include "extensions/common/manifest_handler.h" |
| 42 #include "extensions/common/manifest_handlers/icons_handler.h" | 43 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 43 #include "extensions/common/permissions/api_permission_set.h" | 44 #include "extensions/common/permissions/api_permission_set.h" |
| 44 #include "extensions/common/permissions/permission_message.h" | 45 #include "extensions/common/permissions/permission_message.h" |
| 45 #include "extensions/common/permissions/permissions_info.h" | 46 #include "extensions/common/permissions/permissions_info.h" |
| 46 #include "extensions/common/url_pattern.h" | 47 #include "extensions/common/url_pattern.h" |
| 47 #include "extensions/common/url_pattern_set.h" | 48 #include "extensions/common/url_pattern_set.h" |
| 48 #include "extensions/grit/extensions_resources.h" | 49 #include "extensions/grit/extensions_resources.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 CreateFeatureProviderSource(name)); | 138 CreateFeatureProviderSource(name)); |
| 138 if (name == "api") { | 139 if (name == "api") { |
| 139 provider.reset(new BaseFeatureProvider(source->dictionary(), | 140 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 140 CreateFeature<APIFeature>)); | 141 CreateFeature<APIFeature>)); |
| 141 } else if (name == "manifest") { | 142 } else if (name == "manifest") { |
| 142 provider.reset(new BaseFeatureProvider(source->dictionary(), | 143 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 143 CreateFeature<ManifestFeature>)); | 144 CreateFeature<ManifestFeature>)); |
| 144 } else if (name == "permission") { | 145 } else if (name == "permission") { |
| 145 provider.reset(new BaseFeatureProvider(source->dictionary(), | 146 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 146 CreateFeature<PermissionFeature>)); | 147 CreateFeature<PermissionFeature>)); |
| 148 } else if (name == "switch") { |
| 149 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 150 CreateFeature<SwitchFeature>)); |
| 147 } else { | 151 } else { |
| 148 NOTREACHED(); | 152 NOTREACHED(); |
| 149 } | 153 } |
| 150 return provider.Pass(); | 154 return provider.Pass(); |
| 151 } | 155 } |
| 152 | 156 |
| 153 scoped_ptr<JSONFeatureProviderSource> | 157 scoped_ptr<JSONFeatureProviderSource> |
| 154 ChromeExtensionsClient::CreateFeatureProviderSource( | 158 ChromeExtensionsClient::CreateFeatureProviderSource( |
| 155 const std::string& name) const { | 159 const std::string& name) const { |
| 156 scoped_ptr<JSONFeatureProviderSource> source( | 160 scoped_ptr<JSONFeatureProviderSource> source( |
| 157 new JSONFeatureProviderSource(name)); | 161 new JSONFeatureProviderSource(name)); |
| 158 if (name == "api") { | 162 if (name == "api") { |
| 159 source->LoadJSON(IDR_EXTENSION_API_FEATURES); | 163 source->LoadJSON(IDR_EXTENSION_API_FEATURES); |
| 160 source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES); | 164 source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES); |
| 161 } else if (name == "manifest") { | 165 } else if (name == "manifest") { |
| 162 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); | 166 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); |
| 163 source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES); | 167 source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES); |
| 164 } else if (name == "permission") { | 168 } else if (name == "permission") { |
| 165 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); | 169 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); |
| 166 source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES); | 170 source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES); |
| 171 } else if (name == "switch") { |
| 172 source->LoadJSON(IDR_EXTENSION_SWITCH_FEATURES); |
| 167 } else { | 173 } else { |
| 168 NOTREACHED(); | 174 NOTREACHED(); |
| 169 source.reset(); | 175 source.reset(); |
| 170 } | 176 } |
| 171 return source.Pass(); | 177 return source.Pass(); |
| 172 } | 178 } |
| 173 | 179 |
| 174 void ChromeExtensionsClient::FilterHostPermissions( | 180 void ChromeExtensionsClient::FilterHostPermissions( |
| 175 const URLPatternSet& hosts, | 181 const URLPatternSet& hosts, |
| 176 URLPatternSet* new_hosts, | 182 URLPatternSet* new_hosts, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 357 |
| 352 return image_paths; | 358 return image_paths; |
| 353 } | 359 } |
| 354 | 360 |
| 355 // static | 361 // static |
| 356 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { | 362 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { |
| 357 return g_client.Pointer(); | 363 return g_client.Pointer(); |
| 358 } | 364 } |
| 359 | 365 |
| 360 } // namespace extensions | 366 } // namespace extensions |
| OLD | NEW |