| 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/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 CreateFeature<ManifestFeature>)); | 155 CreateFeature<ManifestFeature>)); |
| 156 } else if (name == "permission") { | 156 } else if (name == "permission") { |
| 157 provider.reset(new BaseFeatureProvider(source->dictionary(), | 157 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 158 CreateFeature<PermissionFeature>)); | 158 CreateFeature<PermissionFeature>)); |
| 159 } else if (name == "behavior") { | 159 } else if (name == "behavior") { |
| 160 provider.reset(new BaseFeatureProvider(source->dictionary(), | 160 provider.reset(new BaseFeatureProvider(source->dictionary(), |
| 161 CreateFeature<BehaviorFeature>)); | 161 CreateFeature<BehaviorFeature>)); |
| 162 } else { | 162 } else { |
| 163 NOTREACHED(); | 163 NOTREACHED(); |
| 164 } | 164 } |
| 165 return provider.Pass(); | 165 return provider; |
| 166 } | 166 } |
| 167 | 167 |
| 168 scoped_ptr<JSONFeatureProviderSource> | 168 scoped_ptr<JSONFeatureProviderSource> |
| 169 ChromeExtensionsClient::CreateFeatureProviderSource( | 169 ChromeExtensionsClient::CreateFeatureProviderSource( |
| 170 const std::string& name) const { | 170 const std::string& name) const { |
| 171 scoped_ptr<JSONFeatureProviderSource> source( | 171 scoped_ptr<JSONFeatureProviderSource> source( |
| 172 new JSONFeatureProviderSource(name)); | 172 new JSONFeatureProviderSource(name)); |
| 173 if (name == "api") { | 173 if (name == "api") { |
| 174 source->LoadJSON(IDR_EXTENSION_API_FEATURES); | 174 source->LoadJSON(IDR_EXTENSION_API_FEATURES); |
| 175 source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES); | 175 source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES); |
| 176 } else if (name == "manifest") { | 176 } else if (name == "manifest") { |
| 177 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); | 177 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); |
| 178 source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES); | 178 source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES); |
| 179 } else if (name == "permission") { | 179 } else if (name == "permission") { |
| 180 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); | 180 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); |
| 181 source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES); | 181 source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES); |
| 182 } else if (name == "behavior") { | 182 } else if (name == "behavior") { |
| 183 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES); | 183 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES); |
| 184 } else { | 184 } else { |
| 185 NOTREACHED(); | 185 NOTREACHED(); |
| 186 source.reset(); | 186 source.reset(); |
| 187 } | 187 } |
| 188 return source.Pass(); | 188 return source; |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ChromeExtensionsClient::FilterHostPermissions( | 191 void ChromeExtensionsClient::FilterHostPermissions( |
| 192 const URLPatternSet& hosts, | 192 const URLPatternSet& hosts, |
| 193 URLPatternSet* new_hosts, | 193 URLPatternSet* new_hosts, |
| 194 PermissionIDSet* permissions) const { | 194 PermissionIDSet* permissions) const { |
| 195 // When editing this function, be sure to add the same functionality to | 195 // When editing this function, be sure to add the same functionality to |
| 196 // FilterHostPermissions() above. | 196 // FilterHostPermissions() above. |
| 197 for (URLPatternSet::const_iterator i = hosts.begin(); i != hosts.end(); ++i) { | 197 for (URLPatternSet::const_iterator i = hosts.begin(); i != hosts.end(); ++i) { |
| 198 // Filters out every URL pattern that matches chrome:// scheme. | 198 // Filters out every URL pattern that matches chrome:// scheme. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 return image_paths; | 377 return image_paths; |
| 378 } | 378 } |
| 379 | 379 |
| 380 // static | 380 // static |
| 381 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { | 381 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { |
| 382 return g_client.Pointer(); | 382 return g_client.Pointer(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace extensions | 385 } // namespace extensions |
| OLD | NEW |