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

Side by Side Diff: chrome/common/extensions/chrome_extensions_client.cc

Issue 789383002: Add the basic infrastructure for the Behavior feature type: BehaviorFeature and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flag-features
Patch Set: rebase 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 | « chrome/browser/extensions/extension_util.cc ('k') | extensions/common/BUILD.gn » ('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 "chrome/common/extensions/chrome_extensions_client.h" 5 #include "chrome/common/extensions/chrome_extensions_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
26 #include "extensions/common/api/generated_schemas.h" 26 #include "extensions/common/api/generated_schemas.h"
27 #include "extensions/common/common_manifest_handlers.h" 27 #include "extensions/common/common_manifest_handlers.h"
28 #include "extensions/common/constants.h" 28 #include "extensions/common/constants.h"
29 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
30 #include "extensions/common/extension_api.h" 30 #include "extensions/common/extension_api.h"
31 #include "extensions/common/extension_icon_set.h" 31 #include "extensions/common/extension_icon_set.h"
32 #include "extensions/common/extension_urls.h" 32 #include "extensions/common/extension_urls.h"
33 #include "extensions/common/features/api_feature.h" 33 #include "extensions/common/features/api_feature.h"
34 #include "extensions/common/features/base_feature_provider.h" 34 #include "extensions/common/features/base_feature_provider.h"
35 #include "extensions/common/features/behavior_feature.h"
35 #include "extensions/common/features/feature_provider.h" 36 #include "extensions/common/features/feature_provider.h"
36 #include "extensions/common/features/json_feature_provider_source.h" 37 #include "extensions/common/features/json_feature_provider_source.h"
37 #include "extensions/common/features/manifest_feature.h" 38 #include "extensions/common/features/manifest_feature.h"
38 #include "extensions/common/features/permission_feature.h" 39 #include "extensions/common/features/permission_feature.h"
39 #include "extensions/common/features/simple_feature.h" 40 #include "extensions/common/features/simple_feature.h"
40 #include "extensions/common/manifest_constants.h" 41 #include "extensions/common/manifest_constants.h"
41 #include "extensions/common/manifest_handler.h" 42 #include "extensions/common/manifest_handler.h"
42 #include "extensions/common/manifest_handlers/icons_handler.h" 43 #include "extensions/common/manifest_handlers/icons_handler.h"
43 #include "extensions/common/permissions/api_permission_set.h" 44 #include "extensions/common/permissions/api_permission_set.h"
44 #include "extensions/common/permissions/permission_message.h" 45 #include "extensions/common/permissions/permission_message.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 CreateFeatureProviderSource(name)); 138 CreateFeatureProviderSource(name));
138 if (name == "api") { 139 if (name == "api") {
139 provider.reset(new BaseFeatureProvider(source->dictionary(), 140 provider.reset(new BaseFeatureProvider(source->dictionary(),
140 CreateFeature<APIFeature>)); 141 CreateFeature<APIFeature>));
141 } else if (name == "manifest") { 142 } else if (name == "manifest") {
142 provider.reset(new BaseFeatureProvider(source->dictionary(), 143 provider.reset(new BaseFeatureProvider(source->dictionary(),
143 CreateFeature<ManifestFeature>)); 144 CreateFeature<ManifestFeature>));
144 } else if (name == "permission") { 145 } else if (name == "permission") {
145 provider.reset(new BaseFeatureProvider(source->dictionary(), 146 provider.reset(new BaseFeatureProvider(source->dictionary(),
146 CreateFeature<PermissionFeature>)); 147 CreateFeature<PermissionFeature>));
148 } else if (name == "behavior") {
149 provider.reset(new BaseFeatureProvider(source->dictionary(),
150 CreateFeature<BehaviorFeature>));
147 } else { 151 } else {
148 NOTREACHED(); 152 NOTREACHED();
149 } 153 }
150 return provider.Pass(); 154 return provider.Pass();
151 } 155 }
152 156
153 scoped_ptr<JSONFeatureProviderSource> 157 scoped_ptr<JSONFeatureProviderSource>
154 ChromeExtensionsClient::CreateFeatureProviderSource( 158 ChromeExtensionsClient::CreateFeatureProviderSource(
155 const std::string& name) const { 159 const std::string& name) const {
156 scoped_ptr<JSONFeatureProviderSource> source( 160 scoped_ptr<JSONFeatureProviderSource> source(
157 new JSONFeatureProviderSource(name)); 161 new JSONFeatureProviderSource(name));
158 if (name == "api") { 162 if (name == "api") {
159 source->LoadJSON(IDR_EXTENSION_API_FEATURES); 163 source->LoadJSON(IDR_EXTENSION_API_FEATURES);
160 source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES); 164 source->LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES);
161 } else if (name == "manifest") { 165 } else if (name == "manifest") {
162 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES); 166 source->LoadJSON(IDR_EXTENSION_MANIFEST_FEATURES);
163 source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES); 167 source->LoadJSON(IDR_CHROME_EXTENSION_MANIFEST_FEATURES);
164 } else if (name == "permission") { 168 } else if (name == "permission") {
165 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES); 169 source->LoadJSON(IDR_EXTENSION_PERMISSION_FEATURES);
166 source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES); 170 source->LoadJSON(IDR_CHROME_EXTENSION_PERMISSION_FEATURES);
171 } else if (name == "behavior") {
172 source->LoadJSON(IDR_EXTENSION_BEHAVIOR_FEATURES);
167 } else { 173 } else {
168 NOTREACHED(); 174 NOTREACHED();
169 source.reset(); 175 source.reset();
170 } 176 }
171 return source.Pass(); 177 return source.Pass();
172 } 178 }
173 179
174 void ChromeExtensionsClient::FilterHostPermissions( 180 void ChromeExtensionsClient::FilterHostPermissions(
175 const URLPatternSet& hosts, 181 const URLPatternSet& hosts,
176 URLPatternSet* new_hosts, 182 URLPatternSet* new_hosts,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 382
377 return image_paths; 383 return image_paths;
378 } 384 }
379 385
380 // static 386 // static
381 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { 387 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() {
382 return g_client.Pointer(); 388 return g_client.Pointer();
383 } 389 }
384 390
385 } // namespace extensions 391 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_util.cc ('k') | extensions/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698