OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" | 5 #include "components/web_restrictions/browser/web_restrictions_resource_throttle
.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "components/web_restrictions/browser/web_restrictions_client.h" | 8 #include "components/web_restrictions/browser/web_restrictions_client.h" |
9 #include "content/public/browser/resource_controller.h" | |
10 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
11 #include "net/url_request/redirect_info.h" | 10 #include "net/url_request/redirect_info.h" |
12 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
13 | 12 |
14 namespace web_restrictions { | 13 namespace web_restrictions { |
15 | 14 |
16 WebRestrictionsResourceThrottle::WebRestrictionsResourceThrottle( | 15 WebRestrictionsResourceThrottle::WebRestrictionsResourceThrottle( |
17 WebRestrictionsClient* provider, | 16 WebRestrictionsClient* provider, |
18 const GURL& request_url, | 17 const GURL& request_url, |
19 bool is_main_frame) | 18 bool is_main_frame) |
(...skipping 26 matching lines...) Expand all Loading... |
46 is_main_frame_, url.spec(), | 45 is_main_frame_, url.spec(), |
47 base::Bind(&WebRestrictionsResourceThrottle::OnCheckResult, | 46 base::Bind(&WebRestrictionsResourceThrottle::OnCheckResult, |
48 weak_ptr_factory_.GetWeakPtr())); | 47 weak_ptr_factory_.GetWeakPtr())); |
49 if (access == DISALLOW) | 48 if (access == DISALLOW) |
50 OnCheckResult(false); | 49 OnCheckResult(false); |
51 return access == PENDING; | 50 return access == PENDING; |
52 } | 51 } |
53 | 52 |
54 void WebRestrictionsResourceThrottle::OnCheckResult(const bool should_proceed) { | 53 void WebRestrictionsResourceThrottle::OnCheckResult(const bool should_proceed) { |
55 if (should_proceed) { | 54 if (should_proceed) { |
56 controller()->Resume(); | 55 Resume(); |
57 } else { | 56 } else { |
58 controller()->CancelWithError(net::ERR_BLOCKED_BY_ADMINISTRATOR); | 57 CancelWithError(net::ERR_BLOCKED_BY_ADMINISTRATOR); |
59 } | 58 } |
60 } | 59 } |
61 | 60 |
62 } // namespace web_restrictions | 61 } // namespace web_restrictions |
OLD | NEW |