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