| Index: chrome/browser/tab_contents/navigation_controller.cc
|
| diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
|
| index 85eaa1d756c18c712b5f6726fb7907b477e79cad..a31b9bf80759d6eb746b3b03b767e84f1452ecc3 100644
|
| --- a/chrome/browser/tab_contents/navigation_controller.cc
|
| +++ b/chrome/browser/tab_contents/navigation_controller.cc
|
| @@ -146,7 +146,8 @@ NavigationController::NavigationController(TabContents* contents,
|
| needs_reload_(false),
|
| user_gesture_observed_(false),
|
| session_storage_namespace_id_(profile->GetWebKitContext()->
|
| - dom_storage_context()->AllocateSessionStorageNamespaceId()) {
|
| + dom_storage_context()->AllocateSessionStorageNamespaceId()),
|
| + pending_reload_(NO_RELOAD) {
|
| DCHECK(profile_);
|
| }
|
|
|
| @@ -195,22 +196,25 @@ void NavigationController::ReloadInternal(bool check_for_repost,
|
|
|
| DiscardNonCommittedEntriesInternal();
|
| int current_index = GetCurrentEntryIndex();
|
| - if (check_for_repost_ && check_for_repost && current_index != -1 &&
|
| + // If we are no where, then we can't reload. TODO(darin): We should add a
|
| + // CanReload method.
|
| + if (current_index == -1) {
|
| + return;
|
| + }
|
| +
|
| + NotificationService::current()->Notify(NotificationType::RELOADING,
|
| + Source<NavigationController>(this),
|
| + NotificationService::NoDetails());
|
| +
|
| + if (check_for_repost_ && check_for_repost &&
|
| GetEntryAtIndex(current_index)->has_post_data()) {
|
| // The user is asking to reload a page with POST data. Prompt to make sure
|
| // they really want to do this. If they do, the dialog will call us back
|
| // with check_for_repost = false.
|
| + pending_reload_ = reload_type;
|
| tab_contents_->Activate();
|
| tab_contents_->delegate()->ShowRepostFormWarningDialog(tab_contents_);
|
| } else {
|
| - // Base the navigation on where we are now...
|
| - int current_index = GetCurrentEntryIndex();
|
| -
|
| - // If we are no where, then we can't reload. TODO(darin): We should add a
|
| - // CanReload method.
|
| - if (current_index == -1)
|
| - return;
|
| -
|
| DiscardNonCommittedEntriesInternal();
|
|
|
| pending_entry_index_ = current_index;
|
| @@ -219,6 +223,20 @@ void NavigationController::ReloadInternal(bool check_for_repost,
|
| }
|
| }
|
|
|
| +void NavigationController::CancelPendingReload() {
|
| + DCHECK(pending_reload_ != NO_RELOAD);
|
| + pending_reload_ = NO_RELOAD;
|
| +}
|
| +
|
| +void NavigationController::ContinuePendingReload() {
|
| + if (pending_reload_ == NO_RELOAD) {
|
| + NOTREACHED();
|
| + } else {
|
| + ReloadInternal(false, pending_reload_);
|
| + CancelPendingReload();
|
| + }
|
| +}
|
| +
|
| NavigationEntry* NavigationController::GetEntryWithPageID(
|
| SiteInstance* instance, int32 page_id) const {
|
| int index = GetEntryIndexWithPageID(instance, page_id);
|
|
|