| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ios/web/web_state/web_state_impl.h" | 5 #include "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 delete web_ui; | 469 delete web_ui; |
| 470 return NULL; | 470 return NULL; |
| 471 } | 471 } |
| 472 | 472 |
| 473 void WebStateImpl::SetContentsMimeType(const std::string& mime_type) { | 473 void WebStateImpl::SetContentsMimeType(const std::string& mime_type) { |
| 474 mime_type_ = mime_type; | 474 mime_type_ = mime_type; |
| 475 } | 475 } |
| 476 | 476 |
| 477 bool WebStateImpl::ShouldAllowRequest(NSURLRequest* request) { | 477 bool WebStateImpl::ShouldAllowRequest(NSURLRequest* request) { |
| 478 base::ObserverListBase<WebStatePolicyDecider>::Iterator it(&policy_deciders_); | 478 for (auto& policy_decider : policy_deciders_) { |
| 479 WebStatePolicyDecider* policy_decider = nullptr; | 479 if (!policy_decider.ShouldAllowRequest(request)) |
| 480 while ((policy_decider = it.GetNext()) != nullptr) { | |
| 481 if (!policy_decider->ShouldAllowRequest(request)) | |
| 482 return false; | 480 return false; |
| 483 } | 481 } |
| 484 return true; | 482 return true; |
| 485 } | 483 } |
| 486 | 484 |
| 487 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { | 485 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { |
| 488 base::ObserverListBase<WebStatePolicyDecider>::Iterator it(&policy_deciders_); | 486 for (auto& policy_decider : policy_deciders_) { |
| 489 WebStatePolicyDecider* policy_decider = nullptr; | 487 if (!policy_decider.ShouldAllowResponse(response)) |
| 490 while ((policy_decider = it.GetNext()) != nullptr) { | |
| 491 if (!policy_decider->ShouldAllowResponse(response)) | |
| 492 return false; | 488 return false; |
| 493 } | 489 } |
| 494 return true; | 490 return true; |
| 495 } | 491 } |
| 496 | 492 |
| 497 #pragma mark - RequestTracker management | 493 #pragma mark - RequestTracker management |
| 498 | 494 |
| 499 void WebStateImpl::InitializeRequestTracker( | 495 void WebStateImpl::InitializeRequestTracker( |
| 500 id<CRWRequestTrackerDelegate> delegate) { | 496 id<CRWRequestTrackerDelegate> delegate) { |
| 501 BrowserState* browser_state = navigation_manager_.GetBrowserState(); | 497 BrowserState* browser_state = navigation_manager_.GetBrowserState(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 const LoadCommittedDetails& load_details) { | 690 const LoadCommittedDetails& load_details) { |
| 695 FOR_EACH_OBSERVER(WebStateObserver, observers_, | 691 FOR_EACH_OBSERVER(WebStateObserver, observers_, |
| 696 NavigationItemCommitted(load_details)); | 692 NavigationItemCommitted(load_details)); |
| 697 } | 693 } |
| 698 | 694 |
| 699 WebState* WebStateImpl::GetWebState() { | 695 WebState* WebStateImpl::GetWebState() { |
| 700 return this; | 696 return this; |
| 701 } | 697 } |
| 702 | 698 |
| 703 } // namespace web | 699 } // namespace web |
| OLD | NEW |