| Index: ios/web/web_state/web_state_impl.mm
|
| diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
|
| index 2071eae1de642f73e36b409c2dde3e61b4026f2f..17e4a547e043d5033101724aa4243cfe295b844e 100644
|
| --- a/ios/web/web_state/web_state_impl.mm
|
| +++ b/ios/web/web_state/web_state_impl.mm
|
| @@ -28,12 +28,20 @@
|
| namespace web {
|
|
|
| WebStateImpl::WebStateImpl(BrowserState* browser_state)
|
| + : WebStateImpl(browser_state, nullptr) {}
|
| +
|
| +WebStateImpl::WebStateImpl(BrowserState* browser_state,
|
| + scoped_ptr<NavigationManagerImpl> navigation_manager)
|
| : is_loading_(false),
|
| facade_delegate_(nullptr),
|
| web_controller_(nil),
|
| - navigation_manager_(this, browser_state),
|
| + navigation_manager_(navigation_manager.Pass()),
|
| interstitial_(nullptr),
|
| cache_mode_(net::RequestTracker::CACHE_NORMAL) {
|
| + if (!navigation_manager_)
|
| + navigation_manager_.reset(new NavigationManagerImpl());
|
| + navigation_manager_->SetDelegate(this);
|
| + navigation_manager_->SetBrowserState(browser_state);
|
| }
|
|
|
| WebStateImpl::~WebStateImpl() {
|
| @@ -98,10 +106,9 @@ void WebStateImpl::SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate) {
|
| facade_delegate_ = facade_delegate;
|
| }
|
|
|
| -WebStateImpl* WebStateImpl::CopyForSessionWindow() {
|
| - WebStateImpl* copy = new WebStateImpl(GetBrowserState());
|
| - copy->GetNavigationManagerImpl().CopyState(&navigation_manager_);
|
| - return copy;
|
| +scoped_ptr<WebStateImpl> WebStateImpl::CopyForSerialization() const {
|
| + return scoped_ptr<WebStateImpl>(new WebStateImpl(
|
| + GetBrowserState(), navigation_manager_->CopyForSerialization()));
|
| }
|
|
|
| void WebStateImpl::OnUrlHashChanged() {
|
| @@ -224,11 +231,11 @@ void WebStateImpl::OnDocumentSubmitted(const std::string& form_name,
|
| }
|
|
|
| NavigationManagerImpl& WebStateImpl::GetNavigationManagerImpl() {
|
| - return navigation_manager_;
|
| + return *navigation_manager_;
|
| }
|
|
|
| const NavigationManagerImpl& WebStateImpl::GetNavigationManagerImpl() const {
|
| - return navigation_manager_;
|
| + return *navigation_manager_;
|
| }
|
|
|
| // There are currently two kinds of WebUI: those that have been adapted to
|
| @@ -271,7 +278,7 @@ const base::string16& WebStateImpl::GetTitle() const {
|
| // TODO(stuartmorgan): Implement the NavigationManager logic necessary to
|
| // match the WebContents implementation of this method.
|
| DCHECK(Configured());
|
| - web::NavigationItem* item = navigation_manager_.GetLastCommittedItem();
|
| + web::NavigationItem* item = navigation_manager_->GetLastCommittedItem();
|
| if (item) {
|
| return item->GetTitleForDisplay(
|
| web::GetWebClient()->GetAcceptLangs(GetBrowserState()));
|
| @@ -352,7 +359,7 @@ void WebStateImpl::ShowWebInterstitial(WebInterstitialImpl* interstitial) {
|
| void WebStateImpl::ClearTransientContentView() {
|
| if (interstitial_) {
|
| CRWSessionController* sessionController =
|
| - navigation_manager_.GetSessionController();
|
| + navigation_manager_->GetSessionController();
|
| web::NavigationItem* currentItem =
|
| [sessionController.currentEntry navigationItem];
|
| if (currentItem->IsUnsafe()) {
|
| @@ -424,7 +431,7 @@ bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) {
|
|
|
| void WebStateImpl::InitializeRequestTracker(
|
| id<CRWRequestTrackerDelegate> delegate) {
|
| - BrowserState* browser_state = navigation_manager_.GetBrowserState();
|
| + BrowserState* browser_state = navigation_manager_->GetBrowserState();
|
| request_tracker_ = RequestTrackerImpl::CreateTrackerForRequestGroupID(
|
| GetRequestGroupID(), browser_state, browser_state->GetRequestContext(),
|
| delegate);
|
| @@ -481,7 +488,7 @@ WebViewType WebStateImpl::GetWebViewType() const {
|
| }
|
|
|
| BrowserState* WebStateImpl::GetBrowserState() const {
|
| - return navigation_manager_.GetBrowserState();
|
| + return navigation_manager_->GetBrowserState();
|
| }
|
|
|
| void WebStateImpl::OpenURL(const WebState::OpenURLParams& params) {
|
| @@ -511,12 +518,12 @@ bool WebStateImpl::ContentIsHTML() const {
|
| }
|
|
|
| const GURL& WebStateImpl::GetVisibleURL() const {
|
| - web::NavigationItem* item = navigation_manager_.GetVisibleItem();
|
| + web::NavigationItem* item = navigation_manager_->GetVisibleItem();
|
| return item ? item->GetVirtualURL() : GURL::EmptyGURL();
|
| }
|
|
|
| const GURL& WebStateImpl::GetLastCommittedURL() const {
|
| - web::NavigationItem* item = navigation_manager_.GetLastCommittedItem();
|
| + web::NavigationItem* item = navigation_manager_->GetLastCommittedItem();
|
| return item ? item->GetVirtualURL() : GURL::EmptyGURL();
|
| }
|
|
|
|
|