OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 #include "ui/gfx/size.h" | 51 #include "ui/gfx/size.h" |
52 #include "ui/gfx/skbitmap_operations.h" | 52 #include "ui/gfx/skbitmap_operations.h" |
53 #include "webkit/glue/image_decoder.h" | 53 #include "webkit/glue/image_decoder.h" |
54 #include "webkit/glue/image_resource_fetcher.h" | 54 #include "webkit/glue/image_resource_fetcher.h" |
55 #include "webkit/glue/webkit_glue.h" | 55 #include "webkit/glue/webkit_glue.h" |
56 #include "v8/include/v8-testing.h" | 56 #include "v8/include/v8-testing.h" |
57 | 57 |
58 using WebKit::WebAccessibilityObject; | 58 using WebKit::WebAccessibilityObject; |
59 using WebKit::WebCString; | 59 using WebKit::WebCString; |
60 using WebKit::WebDataSource; | 60 using WebKit::WebDataSource; |
61 using WebKit::WebDocument; | |
61 using WebKit::WebFrame; | 62 using WebKit::WebFrame; |
62 using WebKit::WebIconURL; | 63 using WebKit::WebIconURL; |
63 using WebKit::WebRect; | 64 using WebKit::WebRect; |
64 using WebKit::WebSecurityOrigin; | 65 using WebKit::WebSecurityOrigin; |
65 using WebKit::WebSize; | 66 using WebKit::WebSize; |
66 using WebKit::WebString; | 67 using WebKit::WebString; |
67 using WebKit::WebTouchEvent; | 68 using WebKit::WebTouchEvent; |
68 using WebKit::WebURL; | 69 using WebKit::WebURL; |
69 using WebKit::WebURLRequest; | 70 using WebKit::WebURLRequest; |
70 using WebKit::WebView; | 71 using WebKit::WebView; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 | 476 |
476 bool ChromeRenderViewObserver::allowWriteToClipboard(WebFrame* frame, | 477 bool ChromeRenderViewObserver::allowWriteToClipboard(WebFrame* frame, |
477 bool default_value) { | 478 bool default_value) { |
478 bool allowed = false; | 479 bool allowed = false; |
479 Send(new ChromeViewHostMsg_CanTriggerClipboardWrite( | 480 Send(new ChromeViewHostMsg_CanTriggerClipboardWrite( |
480 routing_id(), GURL(frame->document().securityOrigin().toString().utf8()), | 481 routing_id(), GURL(frame->document().securityOrigin().toString().utf8()), |
481 &allowed)); | 482 &allowed)); |
482 return allowed; | 483 return allowed; |
483 } | 484 } |
484 | 485 |
486 bool ChromeRenderViewObserver::IsExperimentalWebFeatureAllowed( | |
487 const WebDocument& document) { | |
488 // Experimental Web API is enabled when | |
489 // - The specific API is allowed from command line flag, or | |
490 // - If the document is running extensions or apps which | |
491 // has the "experimental" permission, or | |
492 // - The document is running Web UI. | |
493 WebSecurityOrigin origin = document.securityOrigin(); | |
494 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | |
495 return true; | |
496 const extensions::Extension* extension = | |
497 extension_dispatcher_->extensions()->GetExtensionOrAppByURL( | |
498 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
| |
499 if (!extension) | |
500 return false; | |
501 return (extension_dispatcher_->IsExtensionActive(extension->id()) && | |
502 extension->HasAPIPermission(ExtensionAPIPermission::kExperimental)); | |
503 } | |
504 | |
505 bool ChromeRenderViewObserver::allowWebComponents(const WebDocument& document, | |
506 bool defaultValue) { | |
507 if (defaultValue) | |
508 return true; | |
509 return IsExperimentalWebFeatureAllowed(document); | |
510 } | |
511 | |
485 static void SendInsecureContentSignal(int signal) { | 512 static void SendInsecureContentSignal(int signal) { |
486 UMA_HISTOGRAM_ENUMERATION("SSL.InsecureContent", signal, | 513 UMA_HISTOGRAM_ENUMERATION("SSL.InsecureContent", signal, |
487 INSECURE_CONTENT_NUM_EVENTS); | 514 INSECURE_CONTENT_NUM_EVENTS); |
488 } | 515 } |
489 | 516 |
490 bool ChromeRenderViewObserver::allowDisplayingInsecureContent( | 517 bool ChromeRenderViewObserver::allowDisplayingInsecureContent( |
491 WebKit::WebFrame* frame, | 518 WebKit::WebFrame* frame, |
492 bool allowed_per_settings, | 519 bool allowed_per_settings, |
493 const WebKit::WebSecurityOrigin& origin, | 520 const WebKit::WebSecurityOrigin& origin, |
494 const WebKit::WebURL& resource_url) { | 521 const WebKit::WebURL& resource_url) { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 reinterpret_cast<const unsigned char*>(&data[0]); | 1075 reinterpret_cast<const unsigned char*>(&data[0]); |
1049 | 1076 |
1050 return decoder.Decode(src_data, data.size()); | 1077 return decoder.Decode(src_data, data.size()); |
1051 } | 1078 } |
1052 return SkBitmap(); | 1079 return SkBitmap(); |
1053 } | 1080 } |
1054 | 1081 |
1055 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { | 1082 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { |
1056 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); | 1083 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); |
1057 } | 1084 } |
OLD | NEW |