Index: chrome/common/extensions/api/extension_api.cc |
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc |
index 66f07d1d07c126ca57114b686c896020c134a9ef..e6e912b31dbd3762fcf2cbf5d1dd3ed805e67428 100644 |
--- a/chrome/common/extensions/api/extension_api.cc |
+++ b/chrome/common/extensions/api/extension_api.cc |
@@ -585,7 +585,7 @@ void RemoveDisallowedAPIs(const Extension& extension, |
} // namespace |
-scoped_ptr<std::set<std::string> > ExtensionAPI::GetAPIsForContext( |
+std::set<std::string> ExtensionAPI::GetAPIsForContext( |
Feature::Context context, const Extension* extension, const GURL& url) { |
// We're forced to load all schemas now because we need to know the metadata |
// about every API -- and the metadata is stored in the schemas themselves. |
@@ -630,6 +630,13 @@ scoped_ptr<std::set<std::string> > ExtensionAPI::GetAPIsForContext( |
// some unprivileged APIs may have unrealised dependencies. Too bad! |
ResolveDependencies(&temp_result); |
RemovePrivilegedAPIs(&temp_result); |
+ // TODO(cduvall): In DevTools.js:71777, there is a check if chrome has |
+ // a getter for devtools. This is true, and then |
+ // chrome.devtools.inspectedWindow is used. If devtools is not |
+ // available, it is true that chrome has a getter for devtools, but the |
+ // getter will return undefined in content scripts. This makes sure |
+ // chrome.devtools is available everywhere. |
not at google - send to devlin
2013/02/13 01:45:49
... but even for extensions that don't have the de
cduvall
2013/02/15 00:40:28
Took this out, because it works with a change in W
|
+ temp_result.insert("devtools"); |
} |
break; |
@@ -643,17 +650,28 @@ scoped_ptr<std::set<std::string> > ExtensionAPI::GetAPIsForContext( |
// Filter out all non-API features and remove the feature type part of the |
// name. |
- scoped_ptr<std::set<std::string> > result(new std::set<std::string>()); |
+ std::set<std::string> result; |
for (std::set<std::string>::iterator iter = temp_result.begin(); |
iter != temp_result.end(); ++iter) { |
std::string feature_type; |
std::string feature_name; |
SplitDependencyName(*iter, &feature_type, &feature_name); |
if (feature_type == "api") |
- result->insert(feature_name); |
+ result.insert(feature_name); |
} |
- return result.Pass(); |
+ return result; |
+} |
+ |
+std::set<std::string> ExtensionAPI::GetAllAPINames() { |
+ std::set<std::string> result; |
+ for (SchemaMap::iterator i = schemas_.begin(); i != schemas_.end(); ++i) |
+ result.insert(i->first); |
+ for (UnloadedSchemaMap::iterator i = unloaded_schemas_.begin(); |
+ i != unloaded_schemas_.end(); ++i) { |
+ result.insert(i->first); |
+ } |
+ return result; |
} |
Feature* ExtensionAPI::GetFeature(const std::string& full_name) { |