| 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/shell/common/shell_extensions_client.h" | 5 #include "extensions/shell/common/shell_extensions_client.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "extensions/common/api/generated_schemas.h" | 10 #include "extensions/common/api/generated_schemas.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 const PermissionMessageProvider& | 89 const PermissionMessageProvider& |
| 90 ShellExtensionsClient::GetPermissionMessageProvider() const { | 90 ShellExtensionsClient::GetPermissionMessageProvider() const { |
| 91 NOTIMPLEMENTED(); | 91 NOTIMPLEMENTED(); |
| 92 return g_permission_message_provider.Get(); | 92 return g_permission_message_provider.Get(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 const std::string ShellExtensionsClient::GetProductName() { | 95 const std::string ShellExtensionsClient::GetProductName() { |
| 96 return "app_shell"; | 96 return "app_shell"; |
| 97 } | 97 } |
| 98 | 98 |
| 99 scoped_ptr<FeatureProvider> ShellExtensionsClient::CreateFeatureProvider( | 99 std::unique_ptr<FeatureProvider> ShellExtensionsClient::CreateFeatureProvider( |
| 100 const std::string& name) const { | 100 const std::string& name) const { |
| 101 scoped_ptr<FeatureProvider> provider; | 101 std::unique_ptr<FeatureProvider> provider; |
| 102 scoped_ptr<JSONFeatureProviderSource> source( | 102 std::unique_ptr<JSONFeatureProviderSource> source( |
| 103 CreateFeatureProviderSource(name)); | 103 CreateFeatureProviderSource(name)); |
| 104 if (name == "api") { | 104 if (name == "api") { |
| 105 provider.reset(new BaseFeatureProvider(source->dictionary(), | 105 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 106 CreateFeature<APIFeature>)); | 106 CreateFeature<APIFeature>)); |
| 107 } else if (name == "manifest") { | 107 } else if (name == "manifest") { |
| 108 provider.reset(new BaseFeatureProvider(source->dictionary(), | 108 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 109 CreateFeature<ManifestFeature>)); | 109 CreateFeature<ManifestFeature>)); |
| 110 } else if (name == "permission") { | 110 } else if (name == "permission") { |
| 111 provider.reset(new BaseFeatureProvider(source->dictionary(), | 111 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 112 CreateFeature<PermissionFeature>)); | 112 CreateFeature<PermissionFeature>)); |
| 113 } else if (name == "behavior") { | 113 } else if (name == "behavior") { |
| 114 provider.reset(new BaseFeatureProvider(source->dictionary(), | 114 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 115 CreateFeature<BehaviorFeature>)); | 115 CreateFeature<BehaviorFeature>)); |
| 116 } else { | 116 } else { |
| 117 NOTREACHED(); | 117 NOTREACHED(); |
| 118 } | 118 } |
| 119 return provider; | 119 return provider; |
| 120 } | 120 } |
| 121 | 121 |
| 122 scoped_ptr<JSONFeatureProviderSource> | 122 std::unique_ptr<JSONFeatureProviderSource> |
| 123 ShellExtensionsClient::CreateFeatureProviderSource( | 123 ShellExtensionsClient::CreateFeatureProviderSource( |
| 124 const std::string& name) const { | 124 const std::string& name) const { |
| 125 scoped_ptr<JSONFeatureProviderSource> source( | 125 std::unique_ptr<JSONFeatureProviderSource> source( |
| 126 new JSONFeatureProviderSource(name)); | 126 new JSONFeatureProviderSource(name)); |
| 127 if (name == "api") { | 127 if (name == "api") { |
| 128 source->LoadJSON(IDR_EXTENSION_API_FEATURES); | 128 source->LoadJSON(IDR_EXTENSION_API_FEATURES); |
| 129 source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES); | 129 source->LoadJSON(IDR_SHELL_EXTENSION_API_FEATURES); |
| 130 } else if (name == "manifest") { | 130 } else if (name == "manifest") { |
| 131 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); | 131 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); |
| 132 } else if (name == "permission") { | 132 } else if (name == "permission") { |
| 133 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); | 133 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); |
| 134 } else if (name == "behavior") { | 134 } else if (name == "behavior") { |
| 135 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES); | 135 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return extension_urls::kChromeWebstoreUpdateURL; | 206 return extension_urls::kChromeWebstoreUpdateURL; |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool ShellExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const { | 209 bool ShellExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const { |
| 210 // TODO(rockot): Maybe we want to do something else here. For now we accept | 210 // TODO(rockot): Maybe we want to do something else here. For now we accept |
| 211 // any URL as a blacklist URL because we don't really care. | 211 // any URL as a blacklist URL because we don't really care. |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace extensions | 215 } // namespace extensions |
| OLD | NEW |