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

Unified Diff: chrome/common/extensions/api/extension_api.h

Issue 15091002: Lazily load API schemas from resource files and convert all APIs to features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: optimize and "parent" property Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/extension_api.h
diff --git a/chrome/common/extensions/api/extension_api.h b/chrome/common/extensions/api/extension_api.h
index b1aa0cb14a8add24e204e7446f430fd13906d20e..1f64c4c7a11cc0511078113965122541d1228941 100644
--- a/chrome/common/extensions/api/extension_api.h
+++ b/chrome/common/extensions/api/extension_api.h
@@ -6,7 +6,6 @@
#define CHROME_COMMON_EXTENSIONS_API_EXTENSION_API_H_
#include <map>
-#include <set>
#include <string>
#include "base/basictypes.h"
@@ -61,8 +60,7 @@ class ExtensionAPI {
ExtensionAPI();
virtual ~ExtensionAPI();
- void RegisterSchema(const std::string& api_name,
- const base::StringPiece& source);
+ void RegisterSchemaResource(const std::string& api_name, int resource_id);
void RegisterDependencyProvider(const std::string& name,
FeatureProvider* provider);
@@ -92,8 +90,6 @@ class ExtensionAPI {
// Ownership remains with this object.
const base::DictionaryValue* GetSchema(const std::string& full_name);
- std::set<std::string> GetAllAPINames();
-
// Splits a full name from the extension API into its API and child name
// parts. Some examples:
//
@@ -106,59 +102,28 @@ class ExtensionAPI {
std::string GetAPINameFromFullName(const std::string& full_name,
std::string* child_name);
+ private:
+ friend struct DefaultSingletonTraits<ExtensionAPI>;
+ friend class ExtensionAPITest;
cduvall 2013/05/22 03:19:57 For some reason this still didn't allow ExtensionA
not at google - send to devlin 2013/05/23 00:09:40 I don't know gtest that well, but maybe they need
cduvall 2013/05/24 03:13:49 Ah figured it out with gtest docs.
+
void InitDefaultConfiguration();
// Gets a feature from any dependency provider registered with ExtensionAPI.
// Returns NULL if the feature could not be found.
Feature* GetFeatureDependency(const std::string& dependency_name);
- private:
- friend struct DefaultSingletonTraits<ExtensionAPI>;
-
// Loads a schema.
void LoadSchema(const std::string& name, const base::StringPiece& schema);
- // Returns true if the function or event under |namespace_node| with
- // the specified |child_name| is privileged, or false otherwise. If the name
- // is not found, defaults to privileged.
- bool IsChildNamePrivileged(const base::DictionaryValue* namespace_node,
- const std::string& child_name);
-
- // NOTE: This IsAPIAllowed() and IsNonFeatureAPIAvailable only work for
- // non-feature-controlled APIs.
- // TODO(aa): Remove these when all APIs are converted to the feature system.
-
- // Checks if API |name| is allowed.
- bool IsAPIAllowed(const std::string& name, const Extension* extension);
-
- // Check if an API is available to |context| given an |extension| and |url|.
- // The extension or URL may not be relevant to all contexts, and may be left
- // NULL/empty.
- bool IsNonFeatureAPIAvailable(const std::string& name,
- Feature::Context context,
- const Extension* extension,
- const GURL& url);
-
- // Checks if an API is *entirely* privileged. This won't include APIs such as
- // "storage" which is entirely unprivileged, nor "extension" which has
- // unprivileged components.
- bool IsPrivilegedAPI(const std::string& name);
-
// Map from each API that hasn't been loaded yet to the schema which defines
// it. Note that there may be multiple APIs per schema.
- typedef std::map<std::string, base::StringPiece> UnloadedSchemaMap;
+ typedef std::map<std::string, int> UnloadedSchemaMap;
UnloadedSchemaMap unloaded_schemas_;
// Schemas for each namespace.
typedef std::map<std::string, linked_ptr<const DictionaryValue> > SchemaMap;
SchemaMap schemas_;
- // APIs that are entirely unprivileged.
- std::set<std::string> completely_unprivileged_apis_;
-
- // APIs that are not entirely unprivileged, but have unprivileged components.
- std::set<std::string> partially_unprivileged_apis_;
-
// FeatureProviders used for resolving dependencies.
typedef std::map<std::string, FeatureProvider*> FeatureProviderMap;
FeatureProviderMap dependency_providers_;

Powered by Google App Engine
This is Rietveld 408576698