Chromium Code Reviews| 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..3b964d5d270a136d4e5338fa167bb279627f9739 |
| --- /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 stay alive until WillStartRequest() (if it is called) |
| + // or the end of this object. |
| + // |render_frame_id| is used for displaying safe browsing UI when necessary. |
| + SafeBrowsingURLLoaderThrottle(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); |
|
Nathan Parker
2017/05/31 17:17:06
Naming: How about (here and elsewhere where releva
yzshen1
2017/05/31 23:34:44
Done. The meaning of this parameter is actually th
|
| + |
| + 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_ |