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

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, 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 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.
kinuko 2017/05/29 13:36:50 Can you also note that render_frame_id is used for
yzshen1 2017/05/31 00:30:01 Done.
24 explicit SafeBrowsingURLLoaderThrottle(
kinuko 2017/05/29 13:36:50 nit: no need of explicit
yzshen1 2017/05/31 00:30:01 Done.
25 chrome::mojom::SafeBrowsing* safe_browsing,
26 int render_frame_id);
27 ~SafeBrowsingURLLoaderThrottle() override;
28
29 // content::URLLoaderThrottle implementation.
30 void WillStartRequest(const GURL& url,
31 int load_flags,
32 content::ResourceType resource_type,
33 bool* defer) override;
34 void WillRedirectRequest(const net::RedirectInfo& redirect_info,
35 bool* defer) override;
36 void WillProcessResponse(bool* defer) override;
37
38 private:
39 void OnCheckUrlResult(bool result);
40
41 void OnConnectionError();
42
43 chrome::mojom::SafeBrowsing* safe_browsing_;
44 const int render_frame_id_;
45
46 chrome::mojom::SafeBrowsingUrlCheckerPtr url_checker_;
47
48 size_t pending_checks_ = 0;
49 bool blocked_ = false;
50
51 base::WeakPtrFactory<SafeBrowsingURLLoaderThrottle> weak_factory_;
52 };
53
54 } // namespace safe_browsing
55
56 #endif // CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698