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

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: 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 if (current_index != -1) { 320 if (current_index != -1) {
321 entry = GetEntryAtIndex(current_index); 321 entry = GetEntryAtIndex(current_index);
322 } 322 }
323 } 323 }
324 324
325 // If we are no where, then we can't reload. TODO(darin): We should add a 325 // If we are no where, then we can't reload. TODO(darin): We should add a
326 // CanReload method. 326 // CanReload method.
327 if (!entry) 327 if (!entry)
328 return; 328 return;
329 329
330 if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL &&
331 entry->GetOriginalRequestURL().is_valid() && !entry->GetHasPostData()) {
332 // We may have been redirected when navigating to the current URL.
333 // Use the URL the user originally intended to visit, if it's valid and if a
334 // POST wasn't involved; the latter case avoids issues with sending data to
335 // the wrong page.
336 entry->SetURL(entry->GetOriginalRequestURL());
337 entry->SetReferrer(Referrer());
338 }
339
340 if (g_check_for_repost && check_for_repost && 330 if (g_check_for_repost && check_for_repost &&
341 entry->GetHasPostData()) { 331 entry->GetHasPostData()) {
342 // The user is asking to reload a page with POST data. Prompt to make sure 332 // The user is asking to reload a page with POST data. Prompt to make sure
343 // they really want to do this. If they do, the dialog will call us back 333 // they really want to do this. If they do, the dialog will call us back
344 // with check_for_repost = false. 334 // with check_for_repost = false.
345 delegate_->NotifyBeforeFormRepostWarningShow(); 335 delegate_->NotifyBeforeFormRepostWarningShow();
346 336
347 pending_reload_ = reload_type; 337 pending_reload_ = reload_type;
348 delegate_->ActivateAndShowRepostFormWarningDialog(); 338 delegate_->ActivateAndShowRepostFormWarningDialog();
349 } else { 339 } else {
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 } 1997 }
2008 } 1998 }
2009 } 1999 }
2010 2000
2011 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2001 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2012 const base::Callback<base::Time()>& get_timestamp_callback) { 2002 const base::Callback<base::Time()>& get_timestamp_callback) {
2013 get_timestamp_callback_ = get_timestamp_callback; 2003 get_timestamp_callback_ = get_timestamp_callback;
2014 } 2004 }
2015 2005
2016 } // namespace content 2006 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698