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.
5 #include "ios/web/public/web_state/web_state_policy_decider.h"
7 #import "ios/web/public/web_state/web_state.h"
8 #import "ios/web/web_state/web_state_impl.h"
12 WebStatePolicyDecider::WebStatePolicyDecider(WebState* web_state)
13 : web_state_(web_state) {
15 web_state_->AddPolicyDecider(this);
18 WebStatePolicyDecider::~WebStatePolicyDecider() {
20 web_state_->RemovePolicyDecider(this);
24 bool WebStatePolicyDecider::ShouldAllowRequest(NSURLRequest* request) {
28 bool WebStatePolicyDecider::ShouldAllowResponse(NSURLResponse* response) {
32 void WebStatePolicyDecider::ResetWebState() {
33 // The policy decider is not removed from |web_state_| here as removing while
34 // iterating is not supported. |web_state_| will take care of removing its
35 // policy deciders when being destroyed.