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 #import "ios/web/public/web_state/web_state_policy_decider.h" | 5 #import "ios/web/public/web_state/web_state_policy_decider.h" |
6 | 6 |
7 #import "ios/web/public/web_state/web_state.h" | 7 #import "ios/web/public/web_state/web_state.h" |
8 #import "ios/web/web_state/web_state_impl.h" | 8 #import "ios/web/web_state/web_state_impl.h" |
9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
10 namespace web { | 14 namespace web { |
11 | 15 |
12 WebStatePolicyDecider::WebStatePolicyDecider(WebState* web_state) | 16 WebStatePolicyDecider::WebStatePolicyDecider(WebState* web_state) |
13 : web_state_(web_state) { | 17 : web_state_(web_state) { |
14 DCHECK(web_state_); | 18 DCHECK(web_state_); |
15 web_state_->AddPolicyDecider(this); | 19 web_state_->AddPolicyDecider(this); |
16 } | 20 } |
17 | 21 |
18 WebStatePolicyDecider::~WebStatePolicyDecider() { | 22 WebStatePolicyDecider::~WebStatePolicyDecider() { |
19 if (web_state_) { | 23 if (web_state_) { |
20 web_state_->RemovePolicyDecider(this); | 24 web_state_->RemovePolicyDecider(this); |
21 } | 25 } |
22 } | 26 } |
23 | 27 |
24 bool WebStatePolicyDecider::ShouldAllowRequest(NSURLRequest* request) { | 28 bool WebStatePolicyDecider::ShouldAllowRequest(NSURLRequest* request) { |
25 return true; | 29 return true; |
26 } | 30 } |
27 | 31 |
28 bool WebStatePolicyDecider::ShouldAllowResponse(NSURLResponse* response) { | 32 bool WebStatePolicyDecider::ShouldAllowResponse(NSURLResponse* response) { |
29 return true; | 33 return true; |
30 } | 34 } |
31 | 35 |
32 void WebStatePolicyDecider::ResetWebState() { | 36 void WebStatePolicyDecider::ResetWebState() { |
33 web_state_->RemovePolicyDecider(this); | 37 web_state_->RemovePolicyDecider(this); |
34 web_state_ = nullptr; | 38 web_state_ = nullptr; |
35 } | 39 } |
36 | 40 |
37 } // namespace web | 41 } // namespace web |
OLD | NEW |