| 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..2f5d071e0d13b479faefa9e150072a9aea21f57a
|
| --- /dev/null
|
| +++ b/chrome/renderer/safe_browsing/safe_browsing_url_loader_throttle.h
|
| @@ -0,0 +1,53 @@
|
| +// 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.
|
| + explicit SafeBrowsingURLLoaderThrottle(
|
| + chrome::mojom::SafeBrowsing* safe_browsing);
|
| + ~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_;
|
| + 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_
|
|
|