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

Unified Diff: components/safe_browsing/renderer/websocket_sb_handshake_throttle.h

Issue 2952583002: SafeBrowsing support for WebSocket (post-network-servicification) (Closed)
Patch Set: Remove useless DCHECKs Created 3 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
Index: components/safe_browsing/renderer/websocket_sb_handshake_throttle.h
diff --git a/components/safe_browsing/renderer/websocket_sb_handshake_throttle.h b/components/safe_browsing/renderer/websocket_sb_handshake_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..8bb27f956064495bbc57f87f1fe24f51c0d0667f
--- /dev/null
+++ b/components/safe_browsing/renderer/websocket_sb_handshake_throttle.h
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Implementation of SafeBrowsing for WebSockets. This code runs inside the
+// render process, calling the interface defined in safe_browsing.mojom to
+// communicate with the SafeBrowsing service.
+
+#ifndef COMPONENTS_SAFE_BROWSING_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_
+#define COMPONENTS_SAFE_BROWSING_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "components/safe_browsing/common/safe_browsing.mojom.h"
+#include "third_party/WebKit/public/platform/WebCallbacks.h"
+#include "third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h"
+#include "url/gurl.h"
+
+namespace safe_browsing {
+
+class WebSocketSBHandshakeThrottle : public blink::WebSocketHandshakeThrottle {
+ public:
+ explicit WebSocketSBHandshakeThrottle(mojom::SafeBrowsing* safe_browsing);
+ ~WebSocketSBHandshakeThrottle() override;
+
+ void ThrottleHandshake(
+ const blink::WebURL& url,
+ blink::WebLocalFrame* web_local_frame,
+ blink::WebCallbacks<void, const blink::WebString&>* callbacks) override;
+
+ private:
+ void OnCheckResult(bool safe);
+
+ GURL url_;
+ blink::WebCallbacks<void, const blink::WebString&>* callbacks_;
+ mojom::SafeBrowsingUrlCheckerPtr url_checker_;
+ mojom::SafeBrowsing* safe_browsing_;
+
+ base::WeakPtrFactory<WebSocketSBHandshakeThrottle> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebSocketSBHandshakeThrottle);
+};
+
+} // namespace safe_browsing
+
+#endif // COMPONENTS_SAFE_BROWSING_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_
« no previous file with comments | « components/safe_browsing/renderer/DEPS ('k') | components/safe_browsing/renderer/websocket_sb_handshake_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698