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

Unified Diff: extensions/common/features/base_feature_provider.cc

Issue 850603003: Add a 'nocompile' option to Extension feature files, and annotate all Devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests Created 5 years, 11 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
« no previous file with comments | « chrome/test/data/extensions/api_test/bindings/nocompile/page.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/base_feature_provider.cc
diff --git a/extensions/common/features/base_feature_provider.cc b/extensions/common/features/base_feature_provider.cc
index 97f87bedb34f278dc732cb4b1fb6fdf8ff09b888..63ef5b611b71a68be254af8c30eb969e03c62ac6 100644
--- a/extensions/common/features/base_feature_provider.cc
+++ b/extensions/common/features/base_feature_provider.cc
@@ -17,6 +17,17 @@ namespace extensions {
namespace {
+bool IsNocompile(const base::Value& value) {
+ bool nocompile = false;
+ const base::DictionaryValue* as_dict = NULL;
Marijn Kruisselbrink 2015/01/13 01:06:10 nullptr is recommended over NULL for new code
not at google - send to devlin 2015/01/13 01:14:52 Done. It irritated me having one instance of nullp
+ if (value.GetAsDictionary(&as_dict)) {
+ as_dict->GetBoolean("nocompile", &nocompile);
Marijn Kruisselbrink 2015/01/13 01:06:10 Would it make sense to DCHECK for the situation wh
not at google - send to devlin 2015/01/13 01:14:52 Eh... it adds 2 lines of code, and we don't check
Marijn Kruisselbrink 2015/01/13 01:19:59 Okay, makes sense. Yeah, it seems a bit arbitrary
+ } else {
+ NOTREACHED() << "nocompile only supported for simple features";
+ }
+ return nocompile;
+}
+
bool ParseFeature(const base::DictionaryValue* value,
const std::string& name,
SimpleFeature* feature) {
@@ -34,6 +45,10 @@ BaseFeatureProvider::BaseFeatureProvider(const base::DictionaryValue& root,
: factory_(factory) {
for (base::DictionaryValue::Iterator iter(root); !iter.IsAtEnd();
iter.Advance()) {
+ if (IsNocompile(iter.value())) {
+ continue;
+ }
+
if (iter.value().GetType() == base::Value::TYPE_DICTIONARY) {
linked_ptr<SimpleFeature> feature((*factory_)());
« no previous file with comments | « chrome/test/data/extensions/api_test/bindings/nocompile/page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698