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

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

Issue 11187032: Handle resubmission of HTTP Posts. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 (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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_number_conversions.h" // Temporary 10 #include "base/string_number_conversions.h" // Temporary
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // CanReload method. 303 // CanReload method.
304 if (current_index == -1) { 304 if (current_index == -1) {
305 return; 305 return;
306 } 306 }
307 307
308 if (g_check_for_repost && check_for_repost && 308 if (g_check_for_repost && check_for_repost &&
309 GetEntryAtIndex(current_index)->GetHasPostData()) { 309 GetEntryAtIndex(current_index)->GetHasPostData()) {
310 // The user is asking to reload a page with POST data. Prompt to make sure 310 // The user is asking to reload a page with POST data. Prompt to make sure
311 // they really want to do this. If they do, the dialog will call us back 311 // they really want to do this. If they do, the dialog will call us back
312 // with check_for_repost = false. 312 // with check_for_repost = false.
313 content::NotificationService::current()->Notify( 313 if (content::NotificationService::current()) {
314 content::NOTIFICATION_REPOST_WARNING_SHOWN, 314 // TODO(sgurun): What is the proper way to handle this? create in
315 content::Source<NavigationController>(this), 315 // contentviewcore?
316 content::NotificationService::NoDetails()); 316 content::NotificationService::current()->Notify(
317 317 content::NOTIFICATION_REPOST_WARNING_SHOWN,
318 content::Source<NavigationController>(this),
319 content::NotificationService::NoDetails());
320 }
318 pending_reload_ = reload_type; 321 pending_reload_ = reload_type;
319 web_contents_->Activate(); 322 web_contents_->Activate();
323 // TODO(sgurun): change the name to onFormResubmission http://crbug/156461
320 web_contents_->GetDelegate()->ShowRepostFormWarningDialog(web_contents_); 324 web_contents_->GetDelegate()->ShowRepostFormWarningDialog(web_contents_);
321 } else { 325 } else {
322 DiscardNonCommittedEntriesInternal(); 326 DiscardNonCommittedEntriesInternal();
323 327
324 NavigationEntryImpl* entry = entries_[current_index].get(); 328 NavigationEntryImpl* entry = entries_[current_index].get();
325 SiteInstanceImpl* site_instance = entry->site_instance(); 329 SiteInstanceImpl* site_instance = entry->site_instance();
326 DCHECK(site_instance); 330 DCHECK(site_instance);
327 331
328 // If we are reloading an entry that no longer belongs to the current 332 // If we are reloading an entry that no longer belongs to the current
329 // site instance (for example, refreshing a page for just installed app), 333 // site instance (for example, refreshing a page for just installed app),
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 linked_ptr<NavigationEntryImpl>( 1624 linked_ptr<NavigationEntryImpl>(
1621 new NavigationEntryImpl(*source.entries_[i]))); 1625 new NavigationEntryImpl(*source.entries_[i])));
1622 } 1626 }
1623 } 1627 }
1624 } 1628 }
1625 1629
1626 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1630 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1627 const base::Callback<base::Time()>& get_timestamp_callback) { 1631 const base::Callback<base::Time()>& get_timestamp_callback) {
1628 get_timestamp_callback_ = get_timestamp_callback; 1632 get_timestamp_callback_ = get_timestamp_callback;
1629 } 1633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698