Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: extensions/common/extension_api.cc

Issue 293943002: Clean up TestFeaturesNativeHandler to use the ExtensionsClient's JSON feature sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « extensions/common/extension_api.h ('k') | extensions/common/extensions_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/permissions/permission_set.h" 23 #include "extensions/common/permissions/permission_set.h"
24 #include "extensions/common/permissions/permissions_data.h" 24 #include "extensions/common/permissions/permissions_data.h"
25 #include "grit/common_resources.h"
26 #include "grit/extensions_api_resources.h" 25 #include "grit/extensions_api_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",
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 258
260 default_configuration_initialized_ = true; 259 default_configuration_initialized_ = true;
261 } 260 }
262 261
263 void ExtensionAPI::RegisterSchemaResource(const std::string& name, 262 void ExtensionAPI::RegisterSchemaResource(const std::string& name,
264 int resource_id) { 263 int resource_id) {
265 unloaded_schemas_[name] = resource_id; 264 unloaded_schemas_[name] = resource_id;
266 } 265 }
267 266
268 void ExtensionAPI::RegisterDependencyProvider(const std::string& name, 267 void ExtensionAPI::RegisterDependencyProvider(const std::string& name,
269 FeatureProvider* provider) { 268 const FeatureProvider* provider) {
270 dependency_providers_[name] = provider; 269 dependency_providers_[name] = provider;
271 } 270 }
272 271
273 bool ExtensionAPI::IsAnyFeatureAvailableToContext(const Feature& api, 272 bool ExtensionAPI::IsAnyFeatureAvailableToContext(const Feature& api,
274 const Extension* extension, 273 const Extension* extension,
275 Feature::Context context, 274 Feature::Context context,
276 const GURL& url) { 275 const GURL& url) {
277 FeatureProviderMap::iterator provider = dependency_providers_.find("api"); 276 FeatureProviderMap::iterator provider = dependency_providers_.find("api");
278 CHECK(provider != dependency_providers_.end()); 277 CHECK(provider != dependency_providers_.end());
279 if (IsAvailable(api, extension, context, url).is_available()) 278 if (IsAvailable(api, extension, context, url).is_available())
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 break; 412 break;
414 413
415 api_name_candidate = api_name_candidate.substr(0, last_dot_index); 414 api_name_candidate = api_name_candidate.substr(0, last_dot_index);
416 } 415 }
417 416
418 *child_name = ""; 417 *child_name = "";
419 return std::string(); 418 return std::string();
420 } 419 }
421 420
422 } // namespace extensions 421 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_api.h ('k') | extensions/common/extensions_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698