OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Implementation of SafeBrowsing for WebSockets. This code runs inside the |
| 6 // render process, calling the interface defined in safe_browsing.mojom to |
| 7 // communicate with the SafeBrowsing service. |
| 8 |
| 9 #ifndef COMPONENTS_SAFE_BROWSING_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_ |
| 10 #define COMPONENTS_SAFE_BROWSING_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_ |
| 11 |
| 12 #include <memory> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "components/safe_browsing/common/safe_browsing.mojom.h" |
| 16 #include "third_party/WebKit/public/platform/WebCallbacks.h" |
| 17 #include "third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h" |
| 18 #include "url/gurl.h" |
| 19 |
| 20 namespace safe_browsing { |
| 21 |
| 22 class WebSocketSBHandshakeThrottle : public blink::WebSocketHandshakeThrottle { |
| 23 public: |
| 24 explicit WebSocketSBHandshakeThrottle(mojom::SafeBrowsing* safe_browsing); |
| 25 ~WebSocketSBHandshakeThrottle() override; |
| 26 |
| 27 void ThrottleHandshake( |
| 28 const blink::WebURL& url, |
| 29 blink::WebLocalFrame* web_local_frame, |
| 30 blink::WebCallbacks<void, const blink::WebString&>* callbacks) override; |
| 31 |
| 32 private: |
| 33 void OnCheckResult(bool safe); |
| 34 |
| 35 GURL url_; |
| 36 blink::WebCallbacks<void, const blink::WebString&>* callbacks_; |
| 37 mojom::SafeBrowsingUrlCheckerPtr url_checker_; |
| 38 mojom::SafeBrowsing* safe_browsing_; |
| 39 |
| 40 base::WeakPtrFactory<WebSocketSBHandshakeThrottle> weak_factory_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(WebSocketSBHandshakeThrottle); |
| 43 }; |
| 44 |
| 45 } // namespace safe_browsing |
| 46 |
| 47 #endif // COMPONENTS_SAFE_BROWSING_RENDERER_WEBSOCKET_SB_HANDSHAKE_THROTTLE_H_ |
OLD | NEW |