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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 using WebKit::WebIconURL; | 63 using WebKit::WebIconURL; |
64 using WebKit::WebRect; | 64 using WebKit::WebRect; |
65 using WebKit::WebSecurityOrigin; | 65 using WebKit::WebSecurityOrigin; |
66 using WebKit::WebSize; | 66 using WebKit::WebSize; |
67 using WebKit::WebString; | 67 using WebKit::WebString; |
68 using WebKit::WebTouchEvent; | 68 using WebKit::WebTouchEvent; |
69 using WebKit::WebURL; | 69 using WebKit::WebURL; |
70 using WebKit::WebURLRequest; | 70 using WebKit::WebURLRequest; |
71 using WebKit::WebView; | 71 using WebKit::WebView; |
72 using WebKit::WebVector; | 72 using WebKit::WebVector; |
| 73 using extensions::APIPermission; |
73 using webkit_glue::ImageResourceFetcher; | 74 using webkit_glue::ImageResourceFetcher; |
74 | 75 |
75 // Delay in milliseconds that we'll wait before capturing the page contents | 76 // Delay in milliseconds that we'll wait before capturing the page contents |
76 // and thumbnail. | 77 // and thumbnail. |
77 static const int kDelayForCaptureMs = 500; | 78 static const int kDelayForCaptureMs = 500; |
78 | 79 |
79 // Typically, we capture the page data once the page is loaded. | 80 // Typically, we capture the page data once the page is loaded. |
80 // Sometimes, the page never finishes to load, preventing the page capture | 81 // Sometimes, the page never finishes to load, preventing the page capture |
81 // To workaround this problem, we always perform a capture after the following | 82 // To workaround this problem, we always perform a capture after the following |
82 // delay. | 83 // delay. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 // - The document is running Web UI. | 492 // - The document is running Web UI. |
492 WebSecurityOrigin origin = document.securityOrigin(); | 493 WebSecurityOrigin origin = document.securityOrigin(); |
493 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) | 494 if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) |
494 return true; | 495 return true; |
495 const extensions::Extension* extension = | 496 const extensions::Extension* extension = |
496 extension_dispatcher_->extensions()->GetExtensionOrAppByURL( | 497 extension_dispatcher_->extensions()->GetExtensionOrAppByURL( |
497 ExtensionURLInfo(origin, document.url())); | 498 ExtensionURLInfo(origin, document.url())); |
498 if (!extension) | 499 if (!extension) |
499 return false; | 500 return false; |
500 return (extension_dispatcher_->IsExtensionActive(extension->id()) && | 501 return (extension_dispatcher_->IsExtensionActive(extension->id()) && |
501 extension->HasAPIPermission(ExtensionAPIPermission::kExperimental)); | 502 extension->HasAPIPermission(APIPermission::kExperimental)); |
502 } | 503 } |
503 | 504 |
504 bool ChromeRenderViewObserver::allowWebComponents(const WebDocument& document, | 505 bool ChromeRenderViewObserver::allowWebComponents(const WebDocument& document, |
505 bool defaultValue) { | 506 bool defaultValue) { |
506 if (defaultValue) | 507 if (defaultValue) |
507 return true; | 508 return true; |
508 return IsExperimentalWebFeatureAllowed(document); | 509 return IsExperimentalWebFeatureAllowed(document); |
509 } | 510 } |
510 | 511 |
511 static void SendInsecureContentSignal(int signal) { | 512 static void SendInsecureContentSignal(int signal) { |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 reinterpret_cast<const unsigned char*>(&data[0]); | 1073 reinterpret_cast<const unsigned char*>(&data[0]); |
1073 | 1074 |
1074 return decoder.Decode(src_data, data.size()); | 1075 return decoder.Decode(src_data, data.size()); |
1075 } | 1076 } |
1076 return SkBitmap(); | 1077 return SkBitmap(); |
1077 } | 1078 } |
1078 | 1079 |
1079 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { | 1080 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { |
1080 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); | 1081 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); |
1081 } | 1082 } |
OLD | NEW |