OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.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_util.h" | 10 #include "base/string_util.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "chrome/browser/browser_about_handler.h" | 12 #include "chrome/browser/browser_about_handler.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_url_handler.h" | 14 #include "chrome/browser/browser_url_handler.h" |
15 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 15 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
16 #include "chrome/browser/in_process_webkit/webkit_context.h" | 16 #include "chrome/browser/in_process_webkit/webkit_context.h" |
17 #include "chrome/browser/pref_service.h" | 17 #include "chrome/browser/pref_service.h" |
18 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
19 #include "chrome/browser/renderer_host/site_instance.h" | 19 #include "chrome/browser/renderer_host/site_instance.h" |
20 #include "chrome/browser/sessions/session_types.h" | 20 #include "chrome/browser/sessions/session_types.h" |
21 #include "chrome/browser/tab_contents/interstitial_page.h" | 21 #include "chrome/browser/tab_contents/interstitial_page.h" |
22 #include "chrome/browser/tab_contents/navigation_entry.h" | 22 #include "chrome/browser/tab_contents/navigation_entry.h" |
23 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
24 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 24 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 25 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/navigation_types.h" | 26 #include "chrome/common/navigation_types.h" |
26 #include "chrome/common/notification_service.h" | 27 #include "chrome/common/notification_service.h" |
27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
29 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
30 #include "grit/app_resources.h" | 31 #include "grit/app_resources.h" |
31 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
32 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
33 #include "net/base/mime_util.h" | 34 #include "net/base/mime_util.h" |
34 #include "webkit/glue/webkit_glue.h" | 35 #include "webkit/glue/webkit_glue.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // be automatic (i.e., machine-initiated) rather than user-initiated unless | 108 // be automatic (i.e., machine-initiated) rather than user-initiated unless |
108 // a user gesture has been observed. | 109 // a user gesture has been observed. |
109 const base::TimeDelta kMaxAutoNavigationTimeDelta = | 110 const base::TimeDelta kMaxAutoNavigationTimeDelta = |
110 base::TimeDelta::FromSeconds(5); | 111 base::TimeDelta::FromSeconds(5); |
111 | 112 |
112 } // namespace | 113 } // namespace |
113 | 114 |
114 // NavigationController --------------------------------------------------- | 115 // NavigationController --------------------------------------------------- |
115 | 116 |
116 // static | 117 // static |
117 size_t NavigationController::max_entry_count_ = 50; | 118 size_t NavigationController::max_entry_count_ = |
| 119 chrome::kMaxSessionHistoryEntries; |
118 | 120 |
119 // static | 121 // static |
120 bool NavigationController::check_for_repost_ = true; | 122 bool NavigationController::check_for_repost_ = true; |
121 | 123 |
122 // Creates a new NavigationEntry for each TabNavigation in navigations, adding | 124 // Creates a new NavigationEntry for each TabNavigation in navigations, adding |
123 // the NavigationEntry to entries. This is used during session restore. | 125 // the NavigationEntry to entries. This is used during session restore. |
124 static void CreateNavigationEntriesFromTabNavigations( | 126 static void CreateNavigationEntriesFromTabNavigations( |
125 const std::vector<TabNavigation>& navigations, | 127 const std::vector<TabNavigation>& navigations, |
126 std::vector<linked_ptr<NavigationEntry> >* entries) { | 128 std::vector<linked_ptr<NavigationEntry> >* entries) { |
127 // Create a NavigationEntry for each of the navigations. | 129 // Create a NavigationEntry for each of the navigations. |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 return i; | 1099 return i; |
1098 } | 1100 } |
1099 return -1; | 1101 return -1; |
1100 } | 1102 } |
1101 | 1103 |
1102 NavigationEntry* NavigationController::GetTransientEntry() const { | 1104 NavigationEntry* NavigationController::GetTransientEntry() const { |
1103 if (transient_entry_index_ == -1) | 1105 if (transient_entry_index_ == -1) |
1104 return NULL; | 1106 return NULL; |
1105 return entries_[transient_entry_index_].get(); | 1107 return entries_[transient_entry_index_].get(); |
1106 } | 1108 } |
OLD | NEW |