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

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

Issue 802653003: Convert EventRouter to use ProcessMap::GetMostLikelyContextType rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete some code! Created 6 years 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
« no previous file with comments | « extensions/common/extension_api.h ('k') | no next file » | 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 Feature::Context context, 289 Feature::Context context,
290 const GURL& url) { 290 const GURL& url) {
291 Feature* feature = GetFeatureDependency(full_name); 291 Feature* feature = GetFeatureDependency(full_name);
292 if (!feature) { 292 if (!feature) {
293 return Feature::CreateAvailability(Feature::NOT_PRESENT, 293 return Feature::CreateAvailability(Feature::NOT_PRESENT,
294 std::string("Unknown feature: ") + full_name); 294 std::string("Unknown feature: ") + full_name);
295 } 295 }
296 return feature->IsAvailableToContext(extension, context, url); 296 return feature->IsAvailableToContext(extension, context, url);
297 } 297 }
298 298
299 bool ExtensionAPI::IsAvailableInUntrustedContext(const std::string& name,
300 const Extension* extension) {
301 return IsAvailable(name, extension, Feature::CONTENT_SCRIPT_CONTEXT, GURL())
302 .is_available() ||
303 IsAvailable(
304 name, extension, Feature::UNBLESSED_EXTENSION_CONTEXT, GURL())
305 .is_available() ||
306 IsAvailable(name, extension, Feature::BLESSED_WEB_PAGE_CONTEXT, GURL())
307 .is_available() ||
308 IsAvailable(name, extension, Feature::WEB_PAGE_CONTEXT, GURL())
309 .is_available();
310 }
311
312 bool ExtensionAPI::IsAvailableToWebUI(const std::string& name, 299 bool ExtensionAPI::IsAvailableToWebUI(const std::string& name,
313 const GURL& url) { 300 const GURL& url) {
314 return IsAvailable(name, NULL, Feature::WEBUI_CONTEXT, url).is_available(); 301 return IsAvailable(name, NULL, Feature::WEBUI_CONTEXT, url).is_available();
315 } 302 }
316 303
317 const base::DictionaryValue* ExtensionAPI::GetSchema( 304 const base::DictionaryValue* ExtensionAPI::GetSchema(
318 const std::string& full_name) { 305 const std::string& full_name) {
319 std::string child_name; 306 std::string child_name;
320 std::string api_name = GetAPINameFromFullName(full_name, &child_name); 307 std::string api_name = GetAPINameFromFullName(full_name, &child_name);
321 308
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 break; 385 break;
399 386
400 api_name_candidate = api_name_candidate.substr(0, last_dot_index); 387 api_name_candidate = api_name_candidate.substr(0, last_dot_index);
401 } 388 }
402 389
403 *child_name = ""; 390 *child_name = "";
404 return std::string(); 391 return std::string();
405 } 392 }
406 393
407 } // namespace extensions 394 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698