 Chromium Code Reviews
 Chromium Code Reviews Issue 2900563002:
  Network service: Safe browsing check for sub-resources from renderer.  (Closed)
    
  
    Issue 2900563002:
  Network service: Safe browsing check for sub-resources from renderer.  (Closed) 
  | Index: chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h | 
| diff --git a/chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h b/chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..1db121b68df828776f5362cc5e20c89584e585f7 | 
| --- /dev/null | 
| +++ b/chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h | 
| @@ -0,0 +1,56 @@ | 
| +// 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. | 
| + | 
| +#ifndef CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_ | 
| +#define CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_ | 
| + | 
| +#include "base/memory/weak_ptr.h" | 
| +#include "chrome/common/safe_browsing.mojom.h" | 
| +#include "content/public/child/url_loader_throttle.h" | 
| + | 
| +namespace chrome { | 
| +namespace mojom { | 
| +class SafeBrowsing; | 
| +} | 
| +} | 
| + | 
| +namespace safe_browsing { | 
| + | 
| +class SafeBrowsingURLLoaderThrottle : public content::URLLoaderThrottle { | 
| + public: | 
| + // |safe_browsing| must live until WillStartRequest() or the end of this | 
| + // 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.
 | 
| + explicit SafeBrowsingURLLoaderThrottle( | 
| 
kinuko
2017/05/29 13:36:50
nit: no need of explicit
 
yzshen1
2017/05/31 00:30:01
Done.
 | 
| + chrome::mojom::SafeBrowsing* safe_browsing, | 
| + int render_frame_id); | 
| + ~SafeBrowsingURLLoaderThrottle() override; | 
| + | 
| + // content::URLLoaderThrottle implementation. | 
| + void WillStartRequest(const GURL& url, | 
| + int load_flags, | 
| + content::ResourceType resource_type, | 
| + bool* defer) override; | 
| + void WillRedirectRequest(const net::RedirectInfo& redirect_info, | 
| + bool* defer) override; | 
| + void WillProcessResponse(bool* defer) override; | 
| + | 
| + private: | 
| + void OnCheckUrlResult(bool result); | 
| + | 
| + void OnConnectionError(); | 
| + | 
| + chrome::mojom::SafeBrowsing* safe_browsing_; | 
| + const int render_frame_id_; | 
| + | 
| + chrome::mojom::SafeBrowsingUrlCheckerPtr url_checker_; | 
| + | 
| + size_t pending_checks_ = 0; | 
| + bool blocked_ = false; | 
| + | 
| + base::WeakPtrFactory<SafeBrowsingURLLoaderThrottle> weak_factory_; | 
| +}; | 
| + | 
| +} // namespace safe_browsing | 
| + | 
| +#endif // CHROME_RENDERER_SAFE_BROWSING_SAFE_BROWSING_URL_LOADER_THROTTLE_H_ |