OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/web_contents/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" // Temporary | 10 #include "base/strings/string_number_conversions.h" // Temporary |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 entry = NavigationEntryImpl::FromNavigationEntry( | 296 entry = NavigationEntryImpl::FromNavigationEntry( |
297 GetEntryAtIndex(current_index)); | 297 GetEntryAtIndex(current_index)); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 // If we are no where, then we can't reload. TODO(darin): We should add a | 301 // If we are no where, then we can't reload. TODO(darin): We should add a |
302 // CanReload method. | 302 // CanReload method. |
303 if (!entry) | 303 if (!entry) |
304 return; | 304 return; |
305 | 305 |
| 306 if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL && |
| 307 entry->GetOriginalRequestURL().is_valid() && !entry->GetHasPostData()) { |
| 308 // We may have been redirected when navigating to the current URL. |
| 309 // Use the URL the user originally intended to visit, if it's valid and if a |
| 310 // POST wasn't involved; the latter case avoids issues with sending data to |
| 311 // the wrong page. |
| 312 entry->SetURL(entry->GetOriginalRequestURL()); |
| 313 } |
| 314 |
306 if (g_check_for_repost && check_for_repost && | 315 if (g_check_for_repost && check_for_repost && |
307 entry->GetHasPostData()) { | 316 entry->GetHasPostData()) { |
308 // The user is asking to reload a page with POST data. Prompt to make sure | 317 // The user is asking to reload a page with POST data. Prompt to make sure |
309 // they really want to do this. If they do, the dialog will call us back | 318 // they really want to do this. If they do, the dialog will call us back |
310 // with check_for_repost = false. | 319 // with check_for_repost = false. |
311 web_contents_->NotifyBeforeFormRepostWarningShow(); | 320 web_contents_->NotifyBeforeFormRepostWarningShow(); |
312 | 321 |
313 pending_reload_ = reload_type; | 322 pending_reload_ = reload_type; |
314 web_contents_->Activate(); | 323 web_contents_->Activate(); |
315 web_contents_->GetDelegate()->ShowRepostFormWarningDialog(web_contents_); | 324 web_contents_->GetDelegate()->ShowRepostFormWarningDialog(web_contents_); |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 } | 1698 } |
1690 } | 1699 } |
1691 } | 1700 } |
1692 | 1701 |
1693 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1702 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1694 const base::Callback<base::Time()>& get_timestamp_callback) { | 1703 const base::Callback<base::Time()>& get_timestamp_callback) { |
1695 get_timestamp_callback_ = get_timestamp_callback; | 1704 get_timestamp_callback_ = get_timestamp_callback; |
1696 } | 1705 } |
1697 | 1706 |
1698 } // namespace content | 1707 } // namespace content |
OLD | NEW |