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