Index: android_webview/renderer/aw_content_renderer_client.cc |
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc |
index 2d6c2679f07d7e90c665bc82c4bfb7002cfda3ef..85a780dc68e9fd17367f6b15099ba899831b1b08 100644 |
--- a/android_webview/renderer/aw_content_renderer_client.cc |
+++ b/android_webview/renderer/aw_content_renderer_client.cc |
@@ -26,13 +26,16 @@ |
#include "components/autofill/content/renderer/autofill_agent.h" |
#include "components/autofill/content/renderer/password_autofill_agent.h" |
#include "components/printing/renderer/print_web_view_helper.h" |
+#include "components/safe_browsing/renderer/websocket_sb_handshake_throttle.h" |
#include "components/spellcheck/spellcheck_build_features.h" |
#include "components/supervised_user_error_page/gin_wrapper.h" |
#include "components/supervised_user_error_page/supervised_user_error_page_android.h" |
#include "components/visitedlink/renderer/visitedlink_slave.h" |
#include "components/web_restrictions/interfaces/web_restrictions.mojom.h" |
#include "content/public/child/child_thread.h" |
+#include "content/public/common/content_switches.h" |
#include "content/public/common/service_manager_connection.h" |
+#include "content/public/common/service_names.mojom.h" |
#include "content/public/common/simple_connection_filter.h" |
#include "content/public/common/url_constants.h" |
#include "content/public/renderer/document_state.h" |
@@ -43,6 +46,7 @@ |
#include "net/base/escape.h" |
#include "net/base/net_errors.h" |
#include "services/service_manager/public/cpp/binder_registry.h" |
+#include "services/service_manager/public/cpp/connector.h" |
#include "services/service_manager/public/cpp/interface_provider.h" |
#include "third_party/WebKit/public/platform/WebString.h" |
#include "third_party/WebKit/public/platform/WebURL.h" |
@@ -297,6 +301,14 @@ void AwContentRendererClient::AddSupportedKeySystems( |
AwAddKeySystems(key_systems); |
} |
+std::unique_ptr<blink::WebSocketHandshakeThrottle> |
+AwContentRendererClient::CreateWebSocketHandshakeThrottle() { |
+ if (!UsingSafeBrowsingMojoService()) |
+ return nullptr; |
+ return base::MakeUnique<safe_browsing::WebSocketSBHandshakeThrottle>( |
+ safe_browsing_.get()); |
+} |
+ |
bool AwContentRendererClient::ShouldUseMediaPlayerForURL(const GURL& url) { |
// Android WebView needs to support codecs that Chrome does not, for these |
// cases we must force the usage of Android MediaPlayer instead of Chrome's |
@@ -320,4 +332,16 @@ bool AwContentRendererClient::ShouldUseMediaPlayerForURL(const GURL& url) { |
return false; |
} |
+bool AwContentRendererClient::UsingSafeBrowsingMojoService() { |
+ if (safe_browsing_) |
+ return true; |
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableNetworkService)) { |
+ return false; |
+ } |
+ RenderThread::Get()->GetConnector()->BindInterface( |
+ content::mojom::kBrowserServiceName, &safe_browsing_); |
+ return true; |
+} |
+ |
} // namespace android_webview |