diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 12:48:09 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 12:48:09 +0000 |
commit | 2c6e3b04ca361d052f1e8fdc70983bcc7c379dba (patch) | |
tree | bd66104e12f20722fc475c400714efa9a74fbc81 /extensions/common/features | |
parent | 21a73e99ae6db69d2204d16d9a1e03a54ab98584 (diff) | |
download | chromium_src-2c6e3b04ca361d052f1e8fdc70983bcc7c379dba.zip chromium_src-2c6e3b04ca361d052f1e8fdc70983bcc7c379dba.tar.gz chromium_src-2c6e3b04ca361d052f1e8fdc70983bcc7c379dba.tar.bz2 |
Allow extension APIs to be called from WebUI. The only API currently
available is chrome.test, but the internal APIs used for <webview>
and <extensionoptions> will be next. It also provides an alternative to
chrome.send in theory.
BUG=391944
R=rockot@chromium.org, jam@chromium.org
Review URL: https://codereview.chromium.org/404883002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/common/features')
-rw-r--r-- | extensions/common/features/feature.h | 3 | ||||
-rw-r--r-- | extensions/common/features/simple_feature.cc | 3 | ||||
-rw-r--r-- | extensions/common/features/simple_feature_unittest.cc | 3 |
3 files changed, 8 insertions, 1 deletions
diff --git a/extensions/common/features/feature.h b/extensions/common/features/feature.h index 37387d7..4efa3bf 100644 --- a/extensions/common/features/feature.h +++ b/extensions/common/features/feature.h @@ -44,6 +44,9 @@ class Feature { // will be via the installation of a hosted app, so this may host an // extension. This is not affected by the URL matching pattern. BLESSED_WEB_PAGE_CONTEXT, + + // A page within webui. + WEBUI_CONTEXT, }; // The platforms the feature is supported in. diff --git a/extensions/common/features/simple_feature.cc b/extensions/common/features/simple_feature.cc index 155e764..b06be9f 100644 --- a/extensions/common/features/simple_feature.cc +++ b/extensions/common/features/simple_feature.cc @@ -56,6 +56,7 @@ struct Mappings { contexts["content_script"] = Feature::CONTENT_SCRIPT_CONTEXT; contexts["web_page"] = Feature::WEB_PAGE_CONTEXT; contexts["blessed_web_page"] = Feature::BLESSED_WEB_PAGE_CONTEXT; + contexts["webui"] = Feature::WEBUI_CONTEXT; locations["component"] = SimpleFeature::COMPONENT_LOCATION; locations["policy"] = SimpleFeature::POLICY_LOCATION; @@ -212,6 +213,8 @@ std::string GetDisplayName(Feature::Context context) { return "web page"; case Feature::BLESSED_WEB_PAGE_CONTEXT: return "hosted app"; + case Feature::WEBUI_CONTEXT: + return "webui"; } NOTREACHED(); return ""; diff --git a/extensions/common/features/simple_feature_unittest.cc b/extensions/common/features/simple_feature_unittest.cc index 92d2f4d..725dec9 100644 --- a/extensions/common/features/simple_feature_unittest.cc +++ b/extensions/common/features/simple_feature_unittest.cc @@ -551,10 +551,11 @@ TEST_F(ExtensionSimpleFeatureTest, ParseContexts) { contexts->Append(new base::StringValue("content_script")); contexts->Append(new base::StringValue("web_page")); contexts->Append(new base::StringValue("blessed_web_page")); + contexts->Append(new base::StringValue("webui")); value->Set("contexts", contexts); scoped_ptr<SimpleFeature> feature(new SimpleFeature()); feature->Parse(value.get()); - EXPECT_EQ(5u, feature->contexts()->size()); + EXPECT_EQ(6u, feature->contexts()->size()); EXPECT_TRUE(feature->contexts()->count(Feature::BLESSED_EXTENSION_CONTEXT)); EXPECT_TRUE(feature->contexts()->count(Feature::UNBLESSED_EXTENSION_CONTEXT)); EXPECT_TRUE(feature->contexts()->count(Feature::CONTENT_SCRIPT_CONTEXT)); |