| 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/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 namespace web { | 32 namespace web { |
| 33 | 33 |
| 34 WebStateImpl::WebStateImpl(BrowserState* browser_state) | 34 WebStateImpl::WebStateImpl(BrowserState* browser_state) |
| 35 : is_loading_(false), | 35 : is_loading_(false), |
| 36 is_being_destroyed_(false), | 36 is_being_destroyed_(false), |
| 37 facade_delegate_(nullptr), | 37 facade_delegate_(nullptr), |
| 38 web_controller_(nil), | 38 web_controller_(nil), |
| 39 navigation_manager_(this, browser_state), | 39 navigation_manager_(this, browser_state), |
| 40 interstitial_(nullptr), | 40 interstitial_(nullptr), |
| 41 cache_mode_(net::RequestTracker::CACHE_NORMAL), | |
| 42 weak_factory_(this) { | 41 weak_factory_(this) { |
| 43 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this); | 42 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this); |
| 44 } | 43 } |
| 45 | 44 |
| 46 WebStateImpl::~WebStateImpl() { | 45 WebStateImpl::~WebStateImpl() { |
| 47 is_being_destroyed_ = true; | 46 is_being_destroyed_ = true; |
| 48 | 47 |
| 49 // WebUI depends on web state so it must be destroyed first in case any WebUI | 48 // WebUI depends on web state so it must be destroyed first in case any WebUI |
| 50 // implementations depends on accessing web state during destruction. | 49 // implementations depends on accessing web state during destruction. |
| 51 ClearWebUI(); | 50 ClearWebUI(); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 void WebStateImpl::CloseRequestTracker() { | 431 void WebStateImpl::CloseRequestTracker() { |
| 433 request_tracker_->Close(); | 432 request_tracker_->Close(); |
| 434 request_tracker_ = NULL; | 433 request_tracker_ = NULL; |
| 435 } | 434 } |
| 436 | 435 |
| 437 RequestTrackerImpl* WebStateImpl::GetRequestTracker() { | 436 RequestTrackerImpl* WebStateImpl::GetRequestTracker() { |
| 438 DCHECK(request_tracker_.get()); | 437 DCHECK(request_tracker_.get()); |
| 439 return request_tracker_.get(); | 438 return request_tracker_.get(); |
| 440 } | 439 } |
| 441 | 440 |
| 442 net::RequestTracker::CacheMode WebStateImpl::GetCacheMode() { | |
| 443 return cache_mode_; | |
| 444 } | |
| 445 | |
| 446 void WebStateImpl::SetCacheMode(net::RequestTracker::CacheMode mode) { | |
| 447 cache_mode_ = mode; | |
| 448 } | |
| 449 | |
| 450 NSString* WebStateImpl::GetRequestGroupID() { | 441 NSString* WebStateImpl::GetRequestGroupID() { |
| 451 if (request_group_id_.get() == nil) | 442 if (request_group_id_.get() == nil) |
| 452 request_group_id_.reset([GenerateNewRequestGroupID() copy]); | 443 request_group_id_.reset([GenerateNewRequestGroupID() copy]); |
| 453 | 444 |
| 454 return request_group_id_; | 445 return request_group_id_; |
| 455 } | 446 } |
| 456 | 447 |
| 457 int WebStateImpl::DownloadImage( | 448 int WebStateImpl::DownloadImage( |
| 458 const GURL& url, | 449 const GURL& url, |
| 459 bool is_favicon, | 450 bool is_favicon, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 const LoadCommittedDetails& load_details) { | 565 const LoadCommittedDetails& load_details) { |
| 575 FOR_EACH_OBSERVER(WebStateObserver, observers_, | 566 FOR_EACH_OBSERVER(WebStateObserver, observers_, |
| 576 NavigationItemCommitted(load_details)); | 567 NavigationItemCommitted(load_details)); |
| 577 } | 568 } |
| 578 | 569 |
| 579 WebState* WebStateImpl::GetWebState() { | 570 WebState* WebStateImpl::GetWebState() { |
| 580 return this; | 571 return this; |
| 581 } | 572 } |
| 582 | 573 |
| 583 } // namespace web | 574 } // namespace web |
| OLD | NEW |