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

Unified Diff: chrome/common/extensions/chrome_extensions_client.cc

Issue 2165023003: [Extensions] Use compiled feature files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/chrome_extensions_client.cc
diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc
index 4f85c1f07250bd4d0dd5e44076bb9c3440eb60a8..cba890a5fc8c21fa8589370e0886417f2d179668 100644
--- a/chrome/common/extensions/chrome_extensions_client.cc
+++ b/chrome/common/extensions/chrome_extensions_client.cc
@@ -12,8 +12,12 @@
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/api/api_features.h"
+#include "chrome/common/extensions/api/behavior_features.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "chrome/common/extensions/api/generated_schemas.h"
+#include "chrome/common/extensions/api/manifest_features.h"
+#include "chrome/common/extensions/api/permission_features.h"
#include "chrome/common/extensions/chrome_manifest_handlers.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_handlers/theme_handler.h"
@@ -140,20 +144,14 @@ const std::string ChromeExtensionsClient::GetProductName() {
std::unique_ptr<FeatureProvider> ChromeExtensionsClient::CreateFeatureProvider(
const std::string& name) const {
std::unique_ptr<FeatureProvider> provider;
- std::unique_ptr<JSONFeatureProviderSource> source(
- CreateFeatureProviderSource(name));
if (name == "api") {
- provider.reset(new JSONFeatureProvider(source->dictionary(),
- CreateFeature<APIFeature>));
+ provider.reset(new APIFeatureProvider());
} else if (name == "manifest") {
- provider.reset(new JSONFeatureProvider(source->dictionary(),
- CreateFeature<ManifestFeature>));
+ provider.reset(new ManifestFeatureProvider());
} else if (name == "permission") {
- provider.reset(new JSONFeatureProvider(source->dictionary(),
- CreateFeature<PermissionFeature>));
+ provider.reset(new PermissionFeatureProvider());
} else if (name == "behavior") {
- provider.reset(new JSONFeatureProvider(source->dictionary(),
- CreateFeature<BehaviorFeature>));
+ provider.reset(new BehaviorFeatureProvider());
} else {
NOTREACHED();
}
@@ -161,25 +159,11 @@ std::unique_ptr<FeatureProvider> ChromeExtensionsClient::CreateFeatureProvider(
}
std::unique_ptr<JSONFeatureProviderSource>
-ChromeExtensionsClient::CreateFeatureProviderSource(
- const std::string& name) const {
+ChromeExtensionsClient::CreateAPIFeatureSource() const {
std::unique_ptr<JSONFeatureProviderSource> source(
- new JSONFeatureProviderSource(name));
- if (name == "api") {
- source->LoadJSON(IDR_EXTENSION_API_FEATURES);
- source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES);
- } else if (name == "manifest") {
- source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES);
- source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES);
- } else if (name == "permission") {
- source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES);
- source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES);
- } else if (name == "behavior") {
- source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES);
- } else {
- NOTREACHED();
- source.reset();
- }
+ new JSONFeatureProviderSource("api"));
+ source->LoadJSON(IDR_EXTENSION_API_FEATURES);
+ source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES);
return source;
}

Powered by Google App Engine
This is Rietveld 408576698