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); |