| 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 "extensions/common/extension_api.h" | 5 #include "extensions/common/extension_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
| 20 #include "extensions/common/extensions_client.h" | 20 #include "extensions/common/extensions_client.h" |
| 21 #include "extensions/common/features/feature.h" | 21 #include "extensions/common/features/feature.h" |
| 22 #include "extensions/common/features/feature_provider.h" | 22 #include "extensions/common/features/feature_provider.h" |
| 23 #include "extensions/common/features/simple_feature.h" | 23 #include "extensions/common/features/simple_feature.h" |
| 24 #include "extensions/common/permissions/permission_set.h" | 24 #include "extensions/common/permissions/permission_set.h" |
| 25 #include "extensions/common/permissions/permissions_data.h" | 25 #include "extensions/common/permissions/permissions_data.h" |
| 26 #include "extensions/grit/extensions_resources.h" | |
| 27 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 29 | 28 |
| 30 namespace extensions { | 29 namespace extensions { |
| 31 | 30 |
| 32 namespace { | 31 namespace { |
| 33 | 32 |
| 34 const char* kChildKinds[] = { | 33 const char* kChildKinds[] = { |
| 35 "functions", | 34 "functions", |
| 36 "events" | 35 "events" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 ExtensionAPI::~ExtensionAPI() { | 236 ExtensionAPI::~ExtensionAPI() { |
| 238 } | 237 } |
| 239 | 238 |
| 240 void ExtensionAPI::InitDefaultConfiguration() { | 239 void ExtensionAPI::InitDefaultConfiguration() { |
| 241 const char* names[] = {"api", "manifest", "permission"}; | 240 const char* names[] = {"api", "manifest", "permission"}; |
| 242 for (size_t i = 0; i < arraysize(names); ++i) | 241 for (size_t i = 0; i < arraysize(names); ++i) |
| 243 RegisterDependencyProvider(names[i], FeatureProvider::GetByName(names[i])); | 242 RegisterDependencyProvider(names[i], FeatureProvider::GetByName(names[i])); |
| 244 | 243 |
| 245 ExtensionsClient::Get()->RegisterAPISchemaResources(this); | 244 ExtensionsClient::Get()->RegisterAPISchemaResources(this); |
| 246 | 245 |
| 247 RegisterSchemaResource("declarativeWebRequest", | |
| 248 IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST); | |
| 249 RegisterSchemaResource("webViewRequest", | |
| 250 IDR_EXTENSION_API_JSON_WEB_VIEW_REQUEST); | |
| 251 | |
| 252 default_configuration_initialized_ = true; | 246 default_configuration_initialized_ = true; |
| 253 } | 247 } |
| 254 | 248 |
| 255 void ExtensionAPI::RegisterSchemaResource(const std::string& name, | 249 void ExtensionAPI::RegisterSchemaResource(const std::string& name, |
| 256 int resource_id) { | 250 int resource_id) { |
| 257 unloaded_schemas_[name] = resource_id; | 251 unloaded_schemas_[name] = resource_id; |
| 258 } | 252 } |
| 259 | 253 |
| 260 void ExtensionAPI::RegisterDependencyProvider(const std::string& name, | 254 void ExtensionAPI::RegisterDependencyProvider(const std::string& name, |
| 261 const FeatureProvider* provider) { | 255 const FeatureProvider* provider) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 break; | 392 break; |
| 399 | 393 |
| 400 api_name_candidate = api_name_candidate.substr(0, last_dot_index); | 394 api_name_candidate = api_name_candidate.substr(0, last_dot_index); |
| 401 } | 395 } |
| 402 | 396 |
| 403 *child_name = ""; | 397 *child_name = ""; |
| 404 return std::string(); | 398 return std::string(); |
| 405 } | 399 } |
| 406 | 400 |
| 407 } // namespace extensions | 401 } // namespace extensions |
| OLD | NEW |