Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1189413005: Fix race when reloading original URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if (current_index != -1) { 319 if (current_index != -1) {
320 entry = GetEntryAtIndex(current_index); 320 entry = GetEntryAtIndex(current_index);
321 } 321 }
322 } 322 }
323 323
324 // If we are no where, then we can't reload. TODO(darin): We should add a 324 // If we are no where, then we can't reload. TODO(darin): We should add a
325 // CanReload method. 325 // CanReload method.
326 if (!entry) 326 if (!entry)
327 return; 327 return;
328 328
329 if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL &&
330 entry->GetOriginalRequestURL().is_valid() && !entry->GetHasPostData()) {
331 // We may have been redirected when navigating to the current URL.
332 // Use the URL the user originally intended to visit, if it's valid and if a
333 // POST wasn't involved; the latter case avoids issues with sending data to
334 // the wrong page.
335 entry->SetURL(entry->GetOriginalRequestURL());
336 entry->SetReferrer(Referrer());
337 }
338
339 if (g_check_for_repost && check_for_repost && 329 if (g_check_for_repost && check_for_repost &&
340 entry->GetHasPostData()) { 330 entry->GetHasPostData()) {
341 // The user is asking to reload a page with POST data. Prompt to make sure 331 // The user is asking to reload a page with POST data. Prompt to make sure
342 // they really want to do this. If they do, the dialog will call us back 332 // they really want to do this. If they do, the dialog will call us back
343 // with check_for_repost = false. 333 // with check_for_repost = false.
344 delegate_->NotifyBeforeFormRepostWarningShow(); 334 delegate_->NotifyBeforeFormRepostWarningShow();
345 335
346 pending_reload_ = reload_type; 336 pending_reload_ = reload_type;
347 delegate_->ActivateAndShowRepostFormWarningDialog(); 337 delegate_->ActivateAndShowRepostFormWarningDialog();
348 } else { 338 } else {
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 } 2045 }
2056 } 2046 }
2057 } 2047 }
2058 2048
2059 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2049 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2060 const base::Callback<base::Time()>& get_timestamp_callback) { 2050 const base::Callback<base::Time()>& get_timestamp_callback) {
2061 get_timestamp_callback_ = get_timestamp_callback; 2051 get_timestamp_callback_ = get_timestamp_callback;
2062 } 2052 }
2063 2053
2064 } // namespace content 2054 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698