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

Unified Diff: content/public/child/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 side-by-side diff with in-line comments
Download patch
Index: content/public/child/url_loader_throttle.h
diff --git a/content/public/child/url_loader_throttle.h b/content/public/child/url_loader_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..be4a1d7fffe444cb38b56bcc98380eea2612b18a
--- /dev/null
+++ b/content/public/child/url_loader_throttle.h
@@ -0,0 +1,66 @@
+// 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 CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_
+#define CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_
+
+#include <memory>
+
+#include "content/common/content_export.h"
+#include "content/public/common/resource_response.h"
+#include "content/public/common/resource_type.h"
+
+class GURL;
+
+namespace net {
+struct RedirectInfo;
+}
+
+namespace content {
+
+class CONTENT_EXPORT URLLoaderThrottle {
jam 2017/05/25 15:45:51 nit: please document
yzshen1 2017/05/26 20:43:52 Done.
+ public:
+ // An interface to get notified when the throttle implementation considers
+ // it's ready to resume or cancel the deferred resource load.
+ class CONTENT_EXPORT Delegate {
jam 2017/05/25 15:45:51 nit: export not needed since it's not copyable
yzshen1 2017/05/26 20:43:52 Done.
+ public:
+ // Cancels the resource load with the specified error code.
+ virtual void CancelWithError(int error_code) = 0;
+ // Resumes the deferred resource load. It is a no-op if the resource load is
jam 2017/05/25 15:45:51 nit: blank line above
yzshen1 2017/05/26 20:43:52 Done.
+ // not deferred or has already been canceled.
+ virtual void Resume() = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ virtual ~URLLoaderThrottle() {}
+
+ // Called before the resource request is started.
+ virtual void WillStartRequest(const GURL& url,
+ int load_flags,
+ ResourceType resource_type,
+ bool* defer) {}
+
+ // Called when the request was redirected. |redirect_info| contains the
+ // redirect responses's HTTP status code and some information about the new
+ // request that will be sent if the redirect is followed, including the new
+ // URL and new method.
+ virtual void WillRedirectRequest(const net::RedirectInfo& redirect_info,
+ bool* defer) {}
+
+ // Called when the response headers and meta data are available.
+ virtual void WillProcessResponse(bool* defer) {}
+
+ void set_delegate(Delegate* delegate) { delegate_ = delegate; }
+
+ protected:
+ URLLoaderThrottle() = default;
+
+ Delegate* delegate_ = nullptr;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_RENDERER_URL_LOADER_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698