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

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

Issue 404883002: Allow extension APIs to be called from WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compile Created 6 years, 5 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/extension_api_stub.cc » ('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
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 .is_available() || 296 .is_available() ||
297 IsAvailable( 297 IsAvailable(
298 name, extension, Feature::UNBLESSED_EXTENSION_CONTEXT, GURL()) 298 name, extension, Feature::UNBLESSED_EXTENSION_CONTEXT, GURL())
299 .is_available() || 299 .is_available() ||
300 IsAvailable(name, extension, Feature::BLESSED_WEB_PAGE_CONTEXT, GURL()) 300 IsAvailable(name, extension, Feature::BLESSED_WEB_PAGE_CONTEXT, GURL())
301 .is_available() || 301 .is_available() ||
302 IsAvailable(name, extension, Feature::WEB_PAGE_CONTEXT, GURL()) 302 IsAvailable(name, extension, Feature::WEB_PAGE_CONTEXT, GURL())
303 .is_available(); 303 .is_available();
304 } 304 }
305 305
306 bool ExtensionAPI::IsAvailableToWebUI(const std::string& name) {
307 return IsAvailable(name, NULL, Feature::WEBUI_CONTEXT, GURL()).is_available();
308 }
309
306 const base::DictionaryValue* ExtensionAPI::GetSchema( 310 const base::DictionaryValue* ExtensionAPI::GetSchema(
307 const std::string& full_name) { 311 const std::string& full_name) {
308 std::string child_name; 312 std::string child_name;
309 std::string api_name = GetAPINameFromFullName(full_name, &child_name); 313 std::string api_name = GetAPINameFromFullName(full_name, &child_name);
310 314
311 const base::DictionaryValue* result = NULL; 315 const base::DictionaryValue* result = NULL;
312 SchemaMap::iterator maybe_schema = schemas_.find(api_name); 316 SchemaMap::iterator maybe_schema = schemas_.find(api_name);
313 if (maybe_schema != schemas_.end()) { 317 if (maybe_schema != schemas_.end()) {
314 result = maybe_schema->second.get(); 318 result = maybe_schema->second.get();
315 } else { 319 } else {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 break; 391 break;
388 392
389 api_name_candidate = api_name_candidate.substr(0, last_dot_index); 393 api_name_candidate = api_name_candidate.substr(0, last_dot_index);
390 } 394 }
391 395
392 *child_name = ""; 396 *child_name = "";
393 return std::string(); 397 return std::string();
394 } 398 }
395 399
396 } // namespace extensions 400 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_api.h ('k') | extensions/common/extension_api_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698