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

Unified Diff: components/web_restrictions/browser/web_restrictions_resource_throttle.h

Issue 1684153002: Web restrictions component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use source_set for test_support Created 4 years, 10 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: components/web_restrictions/browser/web_restrictions_resource_throttle.h
diff --git a/components/web_restrictions/browser/web_restrictions_resource_throttle.h b/components/web_restrictions/browser/web_restrictions_resource_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2dfd374904b1e5f0a82fc24b4d3dda5b979aeda
--- /dev/null
+++ b/components/web_restrictions/browser/web_restrictions_resource_throttle.h
@@ -0,0 +1,50 @@
+// Copyright 2015 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 COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_RESOURCE_THROTTLE_H_
+#define COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_RESOURCE_THROTTLE_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/resource_throttle.h"
+#include "url/gurl.h"
+
+namespace net {
+class URLRequest;
+}
+
+namespace web_restrictions {
+
+class WebRestrictionsClient;
+
+class WebRestrictionsResourceThrottle : public content::ResourceThrottle {
+ public:
+ WebRestrictionsResourceThrottle(WebRestrictionsClient* provider,
+ const GURL& request_url,
+ bool is_main_frame);
+ ~WebRestrictionsResourceThrottle() override;
+
+ // content::ResourceThrottle implementation:
+ void WillStartRequest(bool* defer) override;
+ void WillRedirectRequest(const net::RedirectInfo& redirect_info,
+ bool* defer) override;
+ const char* GetNameForLogging() const override;
+
+ private:
+ bool ShouldDefer(const GURL& url);
+
+ void OnCheckResult(bool should_proceed);
+
+ WebRestrictionsClient* provider_; // Not owned.
+
+ const GURL request_url_;
+ bool is_main_frame_;
+ base::WeakPtrFactory<WebRestrictionsResourceThrottle> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebRestrictionsResourceThrottle);
+};
+
+} // namespace web_restrictions
+
+#endif // COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_RESOURCE_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698