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

Unified Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 10332169: Enable Shadow DOM and scoped stylesheet for extensions and Web UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enable the API only if the experimental permission is given Created 8 years, 6 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/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/chrome_render_view_observer.cc
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index 03658b5c08c3e8220956be20e09e5957f485a1ae..f54caa277e37cf984376557eddcdd881825a739c 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -58,6 +58,7 @@
using WebKit::WebAccessibilityObject;
using WebKit::WebCString;
using WebKit::WebDataSource;
+using WebKit::WebDocument;
using WebKit::WebFrame;
using WebKit::WebIconURL;
using WebKit::WebRect;
@@ -482,6 +483,32 @@ bool ChromeRenderViewObserver::allowWriteToClipboard(WebFrame* frame,
return allowed;
}
+bool ChromeRenderViewObserver::IsExperimentalWebFeatureAllowed(
+ const WebDocument& document) {
+ // Experimental Web API is enabled when
+ // - The specific API is allowed from command line flag, or
+ // - If the document is running extensions or apps which
+ // has the "experimental" permission, or
+ // - The document is running Web UI.
+ WebSecurityOrigin origin = document.securityOrigin();
+ if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme))
+ return true;
+ const extensions::Extension* extension =
+ extension_dispatcher_->extensions()->GetExtensionOrAppByURL(
+ ExtensionURLInfo(origin, document.url()));
Mihai Parparita -not on Chrome 2012/06/20 19:47:01 This doesn't seem to quite work. For windows creat
+ if (!extension)
+ return false;
+ return (extension_dispatcher_->IsExtensionActive(extension->id()) &&
+ extension->HasAPIPermission(ExtensionAPIPermission::kExperimental));
+}
+
+bool ChromeRenderViewObserver::allowWebComponents(const WebDocument& document,
+ bool defaultValue) {
+ if (defaultValue)
+ return true;
+ return IsExperimentalWebFeatureAllowed(document);
+}
+
static void SendInsecureContentSignal(int signal) {
UMA_HISTOGRAM_ENUMERATION("SSL.InsecureContent", signal,
INSECURE_CONTENT_NUM_EVENTS);
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698