OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_RESOURCE_THROTTLE_H_ |
| 6 #define COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_RESOURCE_THROTTLE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/public/browser/resource_throttle.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace net { |
| 14 class URLRequest; |
| 15 } |
| 16 |
| 17 namespace web_restriction { |
| 18 |
| 19 class WebRestrictionProvider; |
| 20 |
| 21 class WebRestrictionResourceThrottle : public content::ResourceThrottle { |
| 22 public: |
| 23 WebRestrictionResourceThrottle(WebRestrictionProvider* provider, |
| 24 const GURL& request_url, |
| 25 bool is_main_frame); |
| 26 ~WebRestrictionResourceThrottle() override; |
| 27 |
| 28 // content::ResourceThrottle implementation: |
| 29 void WillStartRequest(bool* defer) override; |
| 30 void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
| 31 bool* defer) override; |
| 32 const char* GetNameForLogging() const override; |
| 33 |
| 34 private: |
| 35 bool ShouldDefer(const GURL& url); |
| 36 |
| 37 void OnCheckResult(bool should_proceed); |
| 38 |
| 39 WebRestrictionProvider* provider_; // Not owned. |
| 40 |
| 41 const GURL request_url_; |
| 42 bool is_main_frame_; |
| 43 base::WeakPtrFactory<WebRestrictionResourceThrottle> weak_ptr_factory_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(WebRestrictionResourceThrottle); |
| 46 }; |
| 47 |
| 48 } // namespace web_restriction |
| 49 |
| 50 #endif // COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_RESOURCE_THROTTLE_H_ |
OLD | NEW |