OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/tab_contents/navigation_controller.h" | 5 #include "chrome/browser/tab_contents/navigation_controller.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/dom_ui/dom_ui_host.h" | 11 #include "chrome/browser/dom_ui/dom_ui_host.h" |
12 #include "chrome/browser/repost_form_warning_dialog.h" | |
13 #include "chrome/browser/sessions/session_types.h" | 12 #include "chrome/browser/sessions/session_types.h" |
14 #include "chrome/browser/tab_contents/navigation_entry.h" | 13 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 14 #include "chrome/browser/tab_contents/repost_form_warning.h" |
15 #include "chrome/browser/tab_contents/site_instance.h" | 15 #include "chrome/browser/tab_contents/site_instance.h" |
16 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
17 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 17 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
18 #include "chrome/common/navigation_types.h" | 18 #include "chrome/common/navigation_types.h" |
19 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
20 #include "chrome/common/resource_bundle.h" | 20 #include "chrome/common/resource_bundle.h" |
21 #include "webkit/glue/webkit_glue.h" | 21 #include "webkit/glue/webkit_glue.h" |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void NavigationController::Reload(bool check_for_repost) { | 205 void NavigationController::Reload(bool check_for_repost) { |
206 // Reloading a transient entry does nothing. | 206 // Reloading a transient entry does nothing. |
207 if (transient_entry_index_ != -1) | 207 if (transient_entry_index_ != -1) |
208 return; | 208 return; |
209 | 209 |
210 DiscardNonCommittedEntriesInternal(); | 210 DiscardNonCommittedEntriesInternal(); |
211 int current_index = GetCurrentEntryIndex(); | 211 int current_index = GetCurrentEntryIndex(); |
212 if (check_for_repost_ && check_for_repost && current_index != -1 && | 212 if (check_for_repost_ && check_for_repost && current_index != -1 && |
213 GetEntryAtIndex(current_index)->has_post_data()) { | 213 GetEntryAtIndex(current_index)->has_post_data()) { |
214 // The user is asking to reload a page with POST data. Prompt to make sure | 214 // The user is asking to reload a page with POST data. Prompt to make sure |
215 // they really want to do this. If they do, RepostFormWarningDialog calls us | 215 // they really want to do this. If they do, the dialog will call us back |
216 // back with ReloadDontCheckForRepost. | 216 // with check_for_repost = false. |
217 active_contents_->Activate(); | 217 active_contents_->Activate(); |
218 RepostFormWarningDialog::RunRepostFormWarningDialog(this); | 218 RunRepostFormWarningDialog(this); |
219 } else { | 219 } else { |
220 // Base the navigation on where we are now... | 220 // Base the navigation on where we are now... |
221 int current_index = GetCurrentEntryIndex(); | 221 int current_index = GetCurrentEntryIndex(); |
222 | 222 |
223 // If we are no where, then we can't reload. TODO(darin): We should add a | 223 // If we are no where, then we can't reload. TODO(darin): We should add a |
224 // CanReload method. | 224 // CanReload method. |
225 if (current_index == -1) | 225 if (current_index == -1) |
226 return; | 226 return; |
227 | 227 |
228 DiscardNonCommittedEntriesInternal(); | 228 DiscardNonCommittedEntriesInternal(); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 return i; | 1212 return i; |
1213 } | 1213 } |
1214 return -1; | 1214 return -1; |
1215 } | 1215 } |
1216 | 1216 |
1217 NavigationEntry* NavigationController::GetTransientEntry() const { | 1217 NavigationEntry* NavigationController::GetTransientEntry() const { |
1218 if (transient_entry_index_ == -1) | 1218 if (transient_entry_index_ == -1) |
1219 return NULL; | 1219 return NULL; |
1220 return entries_[transient_entry_index_].get(); | 1220 return entries_[transient_entry_index_].get(); |
1221 } | 1221 } |
OLD | NEW |