| 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 /* | 5 /* |
| 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // | 107 // |
| 108 // An empty state is treated as a new navigation by WebKit, which would mean | 108 // An empty state is treated as a new navigation by WebKit, which would mean |
| 109 // losing the navigation entries and generating a new navigation entry after | 109 // losing the navigation entries and generating a new navigation entry after |
| 110 // this one. We don't want that. To avoid this we create a valid state which | 110 // this one. We don't want that. To avoid this we create a valid state which |
| 111 // WebKit will not treat as a new navigation. | 111 // WebKit will not treat as a new navigation. |
| 112 void SetPageStateIfEmpty(NavigationEntryImpl* entry) { | 112 void SetPageStateIfEmpty(NavigationEntryImpl* entry) { |
| 113 if (!entry->GetPageState().IsValid()) | 113 if (!entry->GetPageState().IsValid()) |
| 114 entry->SetPageState(PageState::CreateFromURL(entry->GetURL())); | 114 entry->SetPageState(PageState::CreateFromURL(entry->GetURL())); |
| 115 } | 115 } |
| 116 | 116 |
| 117 NavigationEntryImpl::RestoreType ControllerRestoreTypeToEntryType( | |
| 118 NavigationController::RestoreType type) { | |
| 119 switch (type) { | |
| 120 case NavigationController::RESTORE_CURRENT_SESSION: | |
| 121 return NavigationEntryImpl::RESTORE_CURRENT_SESSION; | |
| 122 case NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY: | |
| 123 return NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY; | |
| 124 case NavigationController::RESTORE_LAST_SESSION_CRASHED: | |
| 125 return NavigationEntryImpl::RESTORE_LAST_SESSION_CRASHED; | |
| 126 } | |
| 127 NOTREACHED(); | |
| 128 return NavigationEntryImpl::RESTORE_CURRENT_SESSION; | |
| 129 } | |
| 130 | |
| 131 // Configure all the NavigationEntries in entries for restore. This resets | 117 // Configure all the NavigationEntries in entries for restore. This resets |
| 132 // the transition type to reload and makes sure the content state isn't empty. | 118 // the transition type to reload and makes sure the content state isn't empty. |
| 133 void ConfigureEntriesForRestore( | 119 void ConfigureEntriesForRestore( |
| 134 std::vector<std::unique_ptr<NavigationEntryImpl>>* entries, | 120 std::vector<std::unique_ptr<NavigationEntryImpl>>* entries, |
| 135 NavigationController::RestoreType type) { | 121 RestoreType type) { |
| 136 for (size_t i = 0; i < entries->size(); ++i) { | 122 for (size_t i = 0; i < entries->size(); ++i) { |
| 137 // Use a transition type of reload so that we don't incorrectly increase | 123 // Use a transition type of reload so that we don't incorrectly increase |
| 138 // the typed count. | 124 // the typed count. |
| 139 (*entries)[i]->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); | 125 (*entries)[i]->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); |
| 140 (*entries)[i]->set_restore_type(ControllerRestoreTypeToEntryType(type)); | 126 (*entries)[i]->set_restore_type(type); |
| 141 // NOTE(darin): This code is only needed for backwards compat. | 127 // NOTE(darin): This code is only needed for backwards compat. |
| 142 SetPageStateIfEmpty((*entries)[i].get()); | 128 SetPageStateIfEmpty((*entries)[i].get()); |
| 143 } | 129 } |
| 144 } | 130 } |
| 145 | 131 |
| 146 // Determines whether or not we should be carrying over a user agent override | 132 // Determines whether or not we should be carrying over a user agent override |
| 147 // between two NavigationEntries. | 133 // between two NavigationEntries. |
| 148 bool ShouldKeepOverride(const NavigationEntry* last_entry) { | 134 bool ShouldKeepOverride(const NavigationEntry* last_entry) { |
| 149 return last_entry && last_entry->GetIsOverridingUserAgent(); | 135 return last_entry && last_entry->GetIsOverridingUserAgent(); |
| 150 } | 136 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 failed_pending_entry_id_(0), | 217 failed_pending_entry_id_(0), |
| 232 last_committed_entry_index_(-1), | 218 last_committed_entry_index_(-1), |
| 233 pending_entry_index_(-1), | 219 pending_entry_index_(-1), |
| 234 transient_entry_index_(-1), | 220 transient_entry_index_(-1), |
| 235 delegate_(delegate), | 221 delegate_(delegate), |
| 236 max_restored_page_id_(-1), | 222 max_restored_page_id_(-1), |
| 237 ssl_manager_(this), | 223 ssl_manager_(this), |
| 238 needs_reload_(false), | 224 needs_reload_(false), |
| 239 is_initial_navigation_(true), | 225 is_initial_navigation_(true), |
| 240 in_navigate_to_pending_entry_(false), | 226 in_navigate_to_pending_entry_(false), |
| 241 pending_reload_(NO_RELOAD), | 227 pending_reload_(ReloadType::NONE), |
| 242 get_timestamp_callback_(base::Bind(&base::Time::Now)), | 228 get_timestamp_callback_(base::Bind(&base::Time::Now)), |
| 243 screenshot_manager_(new NavigationEntryScreenshotManager(this)) { | 229 screenshot_manager_(new NavigationEntryScreenshotManager(this)) { |
| 244 DCHECK(browser_context_); | 230 DCHECK(browser_context_); |
| 245 } | 231 } |
| 246 | 232 |
| 247 NavigationControllerImpl::~NavigationControllerImpl() { | 233 NavigationControllerImpl::~NavigationControllerImpl() { |
| 248 DiscardNonCommittedEntriesInternal(); | 234 DiscardNonCommittedEntriesInternal(); |
| 249 } | 235 } |
| 250 | 236 |
| 251 WebContents* NavigationControllerImpl::GetWebContents() const { | 237 WebContents* NavigationControllerImpl::GetWebContents() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 273 | 259 |
| 274 // At this point, the |entries| is full of empty scoped_ptrs, so it can be | 260 // At this point, the |entries| is full of empty scoped_ptrs, so it can be |
| 275 // cleared out safely. | 261 // cleared out safely. |
| 276 entries->clear(); | 262 entries->clear(); |
| 277 | 263 |
| 278 // And finish the restore. | 264 // And finish the restore. |
| 279 FinishRestore(selected_navigation, type); | 265 FinishRestore(selected_navigation, type); |
| 280 } | 266 } |
| 281 | 267 |
| 282 void NavigationControllerImpl::Reload(bool check_for_repost) { | 268 void NavigationControllerImpl::Reload(bool check_for_repost) { |
| 283 ReloadType type = RELOAD; | 269 ReloadType type = ReloadType::NORMAL; |
| 284 if (base::FeatureList::IsEnabled( | 270 if (base::FeatureList::IsEnabled( |
| 285 features::kNonValidatingReloadOnNormalReload)) { | 271 features::kNonValidatingReloadOnNormalReload)) { |
| 286 type = RELOAD_MAIN_RESOURCE; | 272 type = ReloadType::MAIN_RESOURCE; |
| 287 } | 273 } |
| 288 ReloadInternal(check_for_repost, type); | 274 ReloadInternal(check_for_repost, type); |
| 289 } | 275 } |
| 290 void NavigationControllerImpl::ReloadToRefreshContent(bool check_for_repost) { | 276 void NavigationControllerImpl::ReloadToRefreshContent(bool check_for_repost) { |
| 291 ReloadType type = RELOAD; | 277 ReloadType type = ReloadType::NORMAL; |
| 292 if (base::FeatureList::IsEnabled( | 278 if (base::FeatureList::IsEnabled( |
| 293 features::kNonValidatingReloadOnRefreshContent)) { | 279 features::kNonValidatingReloadOnRefreshContent)) { |
| 294 type = RELOAD_MAIN_RESOURCE; | 280 type = ReloadType::MAIN_RESOURCE; |
| 295 } | 281 } |
| 296 ReloadInternal(check_for_repost, type); | 282 ReloadInternal(check_for_repost, type); |
| 297 } | 283 } |
| 298 void NavigationControllerImpl::ReloadBypassingCache(bool check_for_repost) { | 284 void NavigationControllerImpl::ReloadBypassingCache(bool check_for_repost) { |
| 299 ReloadInternal(check_for_repost, RELOAD_BYPASSING_CACHE); | 285 ReloadInternal(check_for_repost, ReloadType::BYPASSING_CACHE); |
| 300 } | 286 } |
| 301 void NavigationControllerImpl::ReloadOriginalRequestURL(bool check_for_repost) { | 287 void NavigationControllerImpl::ReloadOriginalRequestURL(bool check_for_repost) { |
| 302 ReloadInternal(check_for_repost, RELOAD_ORIGINAL_REQUEST_URL); | 288 ReloadInternal(check_for_repost, ReloadType::ORIGINAL_REQUEST_URL); |
| 303 } | 289 } |
| 304 void NavigationControllerImpl::ReloadDisableLoFi(bool check_for_repost) { | 290 void NavigationControllerImpl::ReloadDisableLoFi(bool check_for_repost) { |
| 305 ReloadInternal(check_for_repost, RELOAD_DISABLE_LOFI_MODE); | 291 ReloadInternal(check_for_repost, ReloadType::DISABLE_LOFI_MODE); |
| 306 } | 292 } |
| 307 | 293 |
| 308 void NavigationControllerImpl::ReloadInternal(bool check_for_repost, | 294 void NavigationControllerImpl::ReloadInternal(bool check_for_repost, |
| 309 ReloadType reload_type) { | 295 ReloadType reload_type) { |
| 310 if (transient_entry_index_ != -1) { | 296 if (transient_entry_index_ != -1) { |
| 311 // If an interstitial is showing, treat a reload as a navigation to the | 297 // If an interstitial is showing, treat a reload as a navigation to the |
| 312 // transient entry's URL. | 298 // transient entry's URL. |
| 313 NavigationEntryImpl* transient_entry = GetTransientEntry(); | 299 NavigationEntryImpl* transient_entry = GetTransientEntry(); |
| 314 if (!transient_entry) | 300 if (!transient_entry) |
| 315 return; | 301 return; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 site_instance->HasWrongProcessForURL(entry->GetURL())) { | 357 site_instance->HasWrongProcessForURL(entry->GetURL())) { |
| 372 // Create a navigation entry that resembles the current one, but do not | 358 // Create a navigation entry that resembles the current one, but do not |
| 373 // copy page id, site instance, content state, or timestamp. | 359 // copy page id, site instance, content state, or timestamp. |
| 374 NavigationEntryImpl* nav_entry = NavigationEntryImpl::FromNavigationEntry( | 360 NavigationEntryImpl* nav_entry = NavigationEntryImpl::FromNavigationEntry( |
| 375 CreateNavigationEntry( | 361 CreateNavigationEntry( |
| 376 entry->GetURL(), entry->GetReferrer(), entry->GetTransitionType(), | 362 entry->GetURL(), entry->GetReferrer(), entry->GetTransitionType(), |
| 377 false, entry->extra_headers(), browser_context_).release()); | 363 false, entry->extra_headers(), browser_context_).release()); |
| 378 | 364 |
| 379 // Mark the reload type as NO_RELOAD, so navigation will not be considered | 365 // Mark the reload type as NO_RELOAD, so navigation will not be considered |
| 380 // a reload in the renderer. | 366 // a reload in the renderer. |
| 381 reload_type = NavigationController::NO_RELOAD; | 367 reload_type = ReloadType::NONE; |
| 382 | 368 |
| 383 nav_entry->set_should_replace_entry(true); | 369 nav_entry->set_should_replace_entry(true); |
| 384 pending_entry_ = nav_entry; | 370 pending_entry_ = nav_entry; |
| 385 DCHECK_EQ(-1, pending_entry_index_); | 371 DCHECK_EQ(-1, pending_entry_index_); |
| 386 } else { | 372 } else { |
| 387 pending_entry_ = entry; | 373 pending_entry_ = entry; |
| 388 pending_entry_index_ = current_index; | 374 pending_entry_index_ = current_index; |
| 389 | 375 |
| 390 // The title of the page being reloaded might have been removed in the | 376 // The title of the page being reloaded might have been removed in the |
| 391 // meanwhile, so we need to revert to the default title upon reload and | 377 // meanwhile, so we need to revert to the default title upon reload and |
| 392 // invalidate the previously cached title (SetTitle will do both). | 378 // invalidate the previously cached title (SetTitle will do both). |
| 393 // See Chromium issue 96041. | 379 // See Chromium issue 96041. |
| 394 pending_entry_->SetTitle(base::string16()); | 380 pending_entry_->SetTitle(base::string16()); |
| 395 | 381 |
| 396 pending_entry_->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); | 382 pending_entry_->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); |
| 397 } | 383 } |
| 398 | 384 |
| 399 NavigateToPendingEntry(reload_type); | 385 NavigateToPendingEntry(reload_type); |
| 400 } | 386 } |
| 401 } | 387 } |
| 402 | 388 |
| 403 void NavigationControllerImpl::CancelPendingReload() { | 389 void NavigationControllerImpl::CancelPendingReload() { |
| 404 DCHECK(pending_reload_ != NO_RELOAD); | 390 DCHECK(pending_reload_ != ReloadType::NONE); |
| 405 pending_reload_ = NO_RELOAD; | 391 pending_reload_ = ReloadType::NONE; |
| 406 } | 392 } |
| 407 | 393 |
| 408 void NavigationControllerImpl::ContinuePendingReload() { | 394 void NavigationControllerImpl::ContinuePendingReload() { |
| 409 if (pending_reload_ == NO_RELOAD) { | 395 if (pending_reload_ == ReloadType::NONE) { |
| 410 NOTREACHED(); | 396 NOTREACHED(); |
| 411 } else { | 397 } else { |
| 412 ReloadInternal(false, pending_reload_); | 398 ReloadInternal(false, pending_reload_); |
| 413 pending_reload_ = NO_RELOAD; | 399 pending_reload_ = ReloadType::NONE; |
| 414 } | 400 } |
| 415 } | 401 } |
| 416 | 402 |
| 417 bool NavigationControllerImpl::IsInitialNavigation() const { | 403 bool NavigationControllerImpl::IsInitialNavigation() const { |
| 418 return is_initial_navigation_; | 404 return is_initial_navigation_; |
| 419 } | 405 } |
| 420 | 406 |
| 421 bool NavigationControllerImpl::IsInitialBlankNavigation() const { | 407 bool NavigationControllerImpl::IsInitialBlankNavigation() const { |
| 422 // TODO(creis): Once we create a NavigationEntry for the initial blank page, | 408 // TODO(creis): Once we create a NavigationEntry for the initial blank page, |
| 423 // we'll need to check for entry count 1 and restore_type RESTORE_NONE (to | 409 // we'll need to check for entry count 1 and restore_type NONE (to exclude |
| 424 // exclude the cloned tab case). | 410 // the cloned tab case). |
| 425 return IsInitialNavigation() && GetEntryCount() == 0; | 411 return IsInitialNavigation() && GetEntryCount() == 0; |
| 426 } | 412 } |
| 427 | 413 |
| 428 NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID( | 414 NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID( |
| 429 SiteInstance* instance, | 415 SiteInstance* instance, |
| 430 int32_t page_id) const { | 416 int32_t page_id) const { |
| 431 int index = GetEntryIndexWithPageID(instance, page_id); | 417 int index = GetEntryIndexWithPageID(instance, page_id); |
| 432 return (index != -1) ? entries_[index].get() : nullptr; | 418 return (index != -1) ? entries_[index].get() : nullptr; |
| 433 } | 419 } |
| 434 | 420 |
| 435 NavigationEntryImpl* | 421 NavigationEntryImpl* |
| 436 NavigationControllerImpl::GetEntryWithUniqueID(int nav_entry_id) const { | 422 NavigationControllerImpl::GetEntryWithUniqueID(int nav_entry_id) const { |
| 437 int index = GetEntryIndexWithUniqueID(nav_entry_id); | 423 int index = GetEntryIndexWithUniqueID(nav_entry_id); |
| 438 return (index != -1) ? entries_[index].get() : nullptr; | 424 return (index != -1) ? entries_[index].get() : nullptr; |
| 439 } | 425 } |
| 440 | 426 |
| 441 void NavigationControllerImpl::LoadEntry( | 427 void NavigationControllerImpl::LoadEntry( |
| 442 std::unique_ptr<NavigationEntryImpl> entry) { | 428 std::unique_ptr<NavigationEntryImpl> entry) { |
| 443 // When navigating to a new page, we don't know for sure if we will actually | 429 // When navigating to a new page, we don't know for sure if we will actually |
| 444 // end up leaving the current page. The new page load could for example | 430 // end up leaving the current page. The new page load could for example |
| 445 // result in a download or a 'no content' response (e.g., a mailto: URL). | 431 // result in a download or a 'no content' response (e.g., a mailto: URL). |
| 446 SetPendingEntry(std::move(entry)); | 432 SetPendingEntry(std::move(entry)); |
| 447 NavigateToPendingEntry(NO_RELOAD); | 433 NavigateToPendingEntry(ReloadType::NONE); |
| 448 } | 434 } |
| 449 | 435 |
| 450 void NavigationControllerImpl::SetPendingEntry( | 436 void NavigationControllerImpl::SetPendingEntry( |
| 451 std::unique_ptr<NavigationEntryImpl> entry) { | 437 std::unique_ptr<NavigationEntryImpl> entry) { |
| 452 DiscardNonCommittedEntriesInternal(); | 438 DiscardNonCommittedEntriesInternal(); |
| 453 pending_entry_ = entry.release(); | 439 pending_entry_ = entry.release(); |
| 454 NotificationService::current()->Notify( | 440 NotificationService::current()->Notify( |
| 455 NOTIFICATION_NAV_ENTRY_PENDING, | 441 NOTIFICATION_NAV_ENTRY_PENDING, |
| 456 Source<NavigationController>(this), | 442 Source<NavigationController>(this), |
| 457 Details<NavigationEntry>(pending_entry_)); | 443 Details<NavigationEntry>(pending_entry_)); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 } | 586 } |
| 601 } | 587 } |
| 602 | 588 |
| 603 DiscardNonCommittedEntries(); | 589 DiscardNonCommittedEntries(); |
| 604 | 590 |
| 605 pending_entry_index_ = index; | 591 pending_entry_index_ = index; |
| 606 entries_[pending_entry_index_]->SetTransitionType( | 592 entries_[pending_entry_index_]->SetTransitionType( |
| 607 ui::PageTransitionFromInt( | 593 ui::PageTransitionFromInt( |
| 608 entries_[pending_entry_index_]->GetTransitionType() | | 594 entries_[pending_entry_index_]->GetTransitionType() | |
| 609 ui::PAGE_TRANSITION_FORWARD_BACK)); | 595 ui::PAGE_TRANSITION_FORWARD_BACK)); |
| 610 NavigateToPendingEntry(NO_RELOAD); | 596 NavigateToPendingEntry(ReloadType::NONE); |
| 611 } | 597 } |
| 612 | 598 |
| 613 void NavigationControllerImpl::GoToOffset(int offset) { | 599 void NavigationControllerImpl::GoToOffset(int offset) { |
| 614 // Note: This is actually reached in unit tests. | 600 // Note: This is actually reached in unit tests. |
| 615 if (!CanGoToOffset(offset)) | 601 if (!CanGoToOffset(offset)) |
| 616 return; | 602 return; |
| 617 | 603 |
| 618 GoToIndex(GetIndexForOffset(offset)); | 604 GoToIndex(GetIndexForOffset(offset)); |
| 619 } | 605 } |
| 620 | 606 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (GetLastCommittedEntry()) { | 779 if (GetLastCommittedEntry()) { |
| 794 details->previous_url = GetLastCommittedEntry()->GetURL(); | 780 details->previous_url = GetLastCommittedEntry()->GetURL(); |
| 795 details->previous_entry_index = GetLastCommittedEntryIndex(); | 781 details->previous_entry_index = GetLastCommittedEntryIndex(); |
| 796 } else { | 782 } else { |
| 797 details->previous_url = GURL(); | 783 details->previous_url = GURL(); |
| 798 details->previous_entry_index = -1; | 784 details->previous_entry_index = -1; |
| 799 } | 785 } |
| 800 | 786 |
| 801 // If there is a pending entry at this point, it should have a SiteInstance, | 787 // If there is a pending entry at this point, it should have a SiteInstance, |
| 802 // except for restored entries. | 788 // except for restored entries. |
| 803 DCHECK(pending_entry_index_ == -1 || | 789 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance() || |
| 804 pending_entry_->site_instance() || | 790 pending_entry_->restore_type() != RestoreType::NONE); |
| 805 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE); | 791 if (pending_entry_ && pending_entry_->restore_type() != RestoreType::NONE) { |
| 806 if (pending_entry_ && | 792 pending_entry_->set_restore_type(RestoreType::NONE); |
| 807 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) | 793 } |
| 808 pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE); | |
| 809 | 794 |
| 810 // The renderer tells us whether the navigation replaces the current entry. | 795 // The renderer tells us whether the navigation replaces the current entry. |
| 811 details->did_replace_entry = params.should_replace_current_entry; | 796 details->did_replace_entry = params.should_replace_current_entry; |
| 812 | 797 |
| 813 // Do navigation-type specific actions. These will make and commit an entry. | 798 // Do navigation-type specific actions. These will make and commit an entry. |
| 814 details->type = ClassifyNavigation(rfh, params); | 799 details->type = ClassifyNavigation(rfh, params); |
| 815 | 800 |
| 816 // is_in_page must be computed before the entry gets committed. | 801 // is_in_page must be computed before the entry gets committed. |
| 817 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, | 802 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, |
| 818 params.was_within_same_page, rfh); | 803 params.was_within_same_page, rfh); |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 | 1458 |
| 1474 for (SessionStorageNamespaceMap::const_iterator it = | 1459 for (SessionStorageNamespaceMap::const_iterator it = |
| 1475 source.session_storage_namespace_map_.begin(); | 1460 source.session_storage_namespace_map_.begin(); |
| 1476 it != source.session_storage_namespace_map_.end(); | 1461 it != source.session_storage_namespace_map_.end(); |
| 1477 ++it) { | 1462 ++it) { |
| 1478 SessionStorageNamespaceImpl* source_namespace = | 1463 SessionStorageNamespaceImpl* source_namespace = |
| 1479 static_cast<SessionStorageNamespaceImpl*>(it->second.get()); | 1464 static_cast<SessionStorageNamespaceImpl*>(it->second.get()); |
| 1480 session_storage_namespace_map_[it->first] = source_namespace->Clone(); | 1465 session_storage_namespace_map_[it->first] = source_namespace->Clone(); |
| 1481 } | 1466 } |
| 1482 | 1467 |
| 1483 FinishRestore(source.last_committed_entry_index_, RESTORE_CURRENT_SESSION); | 1468 FinishRestore(source.last_committed_entry_index_, |
| 1469 RestoreType::CURRENT_SESSION); |
| 1484 | 1470 |
| 1485 // Copy the max page id map from the old tab to the new tab. This ensures | 1471 // Copy the max page id map from the old tab to the new tab. This ensures |
| 1486 // that new and existing navigations in the tab's current SiteInstances | 1472 // that new and existing navigations in the tab's current SiteInstances |
| 1487 // are identified properly. | 1473 // are identified properly. |
| 1488 delegate_->CopyMaxPageIDsFrom(source.delegate()->GetWebContents()); | 1474 delegate_->CopyMaxPageIDsFrom(source.delegate()->GetWebContents()); |
| 1489 } | 1475 } |
| 1490 | 1476 |
| 1491 void NavigationControllerImpl::CopyStateFromAndPrune( | 1477 void NavigationControllerImpl::CopyStateFromAndPrune( |
| 1492 NavigationController* temp, | 1478 NavigationController* temp, |
| 1493 bool replace_entry) { | 1479 bool replace_entry) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 needs_reload_ = false; | 1764 needs_reload_ = false; |
| 1779 | 1765 |
| 1780 // If we were navigating to a slow-to-commit page, and the user performs | 1766 // If we were navigating to a slow-to-commit page, and the user performs |
| 1781 // a session history navigation to the last committed page, RenderViewHost | 1767 // a session history navigation to the last committed page, RenderViewHost |
| 1782 // will force the throbber to start, but WebKit will essentially ignore the | 1768 // will force the throbber to start, but WebKit will essentially ignore the |
| 1783 // navigation, and won't send a message to stop the throbber. To prevent this | 1769 // navigation, and won't send a message to stop the throbber. To prevent this |
| 1784 // from happening, we drop the navigation here and stop the slow-to-commit | 1770 // from happening, we drop the navigation here and stop the slow-to-commit |
| 1785 // page from loading (which would normally happen during the navigation). | 1771 // page from loading (which would normally happen during the navigation). |
| 1786 if (pending_entry_index_ != -1 && | 1772 if (pending_entry_index_ != -1 && |
| 1787 pending_entry_index_ == last_committed_entry_index_ && | 1773 pending_entry_index_ == last_committed_entry_index_ && |
| 1788 (entries_[pending_entry_index_]->restore_type() == | 1774 (entries_[pending_entry_index_]->restore_type() == RestoreType::NONE) && |
| 1789 NavigationEntryImpl::RESTORE_NONE) && | |
| 1790 (entries_[pending_entry_index_]->GetTransitionType() & | 1775 (entries_[pending_entry_index_]->GetTransitionType() & |
| 1791 ui::PAGE_TRANSITION_FORWARD_BACK)) { | 1776 ui::PAGE_TRANSITION_FORWARD_BACK)) { |
| 1792 delegate_->Stop(); | 1777 delegate_->Stop(); |
| 1793 | 1778 |
| 1794 // If an interstitial page is showing, we want to close it to get back | 1779 // If an interstitial page is showing, we want to close it to get back |
| 1795 // to what was showing before. | 1780 // to what was showing before. |
| 1796 if (delegate_->GetInterstitialPage()) | 1781 if (delegate_->GetInterstitialPage()) |
| 1797 delegate_->GetInterstitialPage()->DontProceed(); | 1782 delegate_->GetInterstitialPage()->DontProceed(); |
| 1798 | 1783 |
| 1799 DiscardNonCommittedEntries(); | 1784 DiscardNonCommittedEntries(); |
| 1800 return; | 1785 return; |
| 1801 } | 1786 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 } | 1974 } |
| 1990 | 1975 |
| 1991 void NavigationControllerImpl::LoadIfNecessary() { | 1976 void NavigationControllerImpl::LoadIfNecessary() { |
| 1992 if (!needs_reload_) | 1977 if (!needs_reload_) |
| 1993 return; | 1978 return; |
| 1994 | 1979 |
| 1995 // Calling Reload() results in ignoring state, and not loading. | 1980 // Calling Reload() results in ignoring state, and not loading. |
| 1996 // Explicitly use NavigateToPendingEntry so that the renderer uses the | 1981 // Explicitly use NavigateToPendingEntry so that the renderer uses the |
| 1997 // cached state. | 1982 // cached state. |
| 1998 if (pending_entry_) { | 1983 if (pending_entry_) { |
| 1999 NavigateToPendingEntry(NO_RELOAD); | 1984 NavigateToPendingEntry(ReloadType::NONE); |
| 2000 } else if (last_committed_entry_index_ != -1) { | 1985 } else if (last_committed_entry_index_ != -1) { |
| 2001 pending_entry_index_ = last_committed_entry_index_; | 1986 pending_entry_index_ = last_committed_entry_index_; |
| 2002 NavigateToPendingEntry(NO_RELOAD); | 1987 NavigateToPendingEntry(ReloadType::NONE); |
| 2003 } else { | 1988 } else { |
| 2004 // If there is something to reload, the successful reload will clear the | 1989 // If there is something to reload, the successful reload will clear the |
| 2005 // |needs_reload_| flag. Otherwise, just do it here. | 1990 // |needs_reload_| flag. Otherwise, just do it here. |
| 2006 needs_reload_ = false; | 1991 needs_reload_ = false; |
| 2007 } | 1992 } |
| 2008 } | 1993 } |
| 2009 | 1994 |
| 2010 void NavigationControllerImpl::NotifyEntryChanged( | 1995 void NavigationControllerImpl::NotifyEntryChanged( |
| 2011 const NavigationEntry* entry) { | 1996 const NavigationEntry* entry) { |
| 2012 EntryChangedDetails det; | 1997 EntryChangedDetails det; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 } | 2101 } |
| 2117 } | 2102 } |
| 2118 } | 2103 } |
| 2119 | 2104 |
| 2120 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2105 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2121 const base::Callback<base::Time()>& get_timestamp_callback) { | 2106 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2122 get_timestamp_callback_ = get_timestamp_callback; | 2107 get_timestamp_callback_ = get_timestamp_callback; |
| 2123 } | 2108 } |
| 2124 | 2109 |
| 2125 } // namespace content | 2110 } // namespace content |
| OLD | NEW |