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

Side by Side Diff: chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h

Issue 2900563002: Network service: Safe browsing check for sub-resources from renderer. (Closed)
Patch Set: . Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(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 #ifndef CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_
6 #define CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "chrome/common/safe_browsing.mojom.h"
10 #include "content/public/child/url_loader_throttle.h"
11
12 namespace chrome {
13 namespace mojom {
14 class SafeBrowsing;
15 }
16 }
17
18 namespace safe_browsing {
19
20 class SafeBrowsingURLLoaderThrottle : public content::URLLoaderThrottle {
21 public:
22 // |safe_browsing| must live until WillStartRequest() or the end of this
23 // object, whichever happens earlier.
24 explicit SafeBrowsingURLLoaderThrottle(
25 chrome::mojom::SafeBrowsing* safe_browsing);
26 ~SafeBrowsingURLLoaderThrottle() override;
27
28 // content::URLLoaderThrottle implementation.
29 void WillStartRequest(const GURL& url,
30 int load_flags,
31 content::ResourceType resource_type,
32 bool* defer) override;
33 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
34 bool* defer) override;
35 void WillProcessResponse(bool* defer) override;
36
37 private:
38 void OnCheckUrlResult(bool result);
39
40 void OnConnectionError();
41
42 chrome::mojom::SafeBrowsing* safe_browsing_;
43 chrome::mojom::SafeBrowsingUrlCheckerPtr url_checker_;
44
45 size_t pending_checks_ = 0;
46 bool blocked_ = false;
47
48 base::WeakPtrFactory<SafeBrowsingURLLoaderThrottle> weak_factory_;
49 };
50
51 } // namespace safe_browsing
52
53 #endif // CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698