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

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

Issue 14606009: Cleanup: Remove unneeded base/file_util.h includes in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "base/string_number_conversions.h" // Temporary 9 #include "base/string_number_conversions.h" // Temporary
11 #include "base/string_util.h" 10 #include "base/string_util.h"
12 #include "base/time.h" 11 #include "base/time.h"
13 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
14 #include "content/browser/browser_url_handler_impl.h" 13 #include "content/browser/browser_url_handler_impl.h"
15 #include "content/browser/child_process_security_policy_impl.h" 14 #include "content/browser/child_process_security_policy_impl.h"
16 #include "content/browser/dom_storage/dom_storage_context_impl.h" 15 #include "content/browser/dom_storage/dom_storage_context_impl.h"
17 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
18 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary 17 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } // namespace 137 } // namespace
139 138
140 // NavigationControllerImpl ---------------------------------------------------- 139 // NavigationControllerImpl ----------------------------------------------------
141 140
142 const size_t kMaxEntryCountForTestingNotSet = -1; 141 const size_t kMaxEntryCountForTestingNotSet = -1;
143 142
144 // static 143 // static
145 size_t NavigationControllerImpl::max_entry_count_for_testing_ = 144 size_t NavigationControllerImpl::max_entry_count_for_testing_ =
146 kMaxEntryCountForTestingNotSet; 145 kMaxEntryCountForTestingNotSet;
147 146
148 // Should Reload check for post data? The default is true, but is set to false 147 // Should Reload check for post data? The default is true, but is set to false
149 // when testing. 148 // when testing.
150 static bool g_check_for_repost = true; 149 static bool g_check_for_repost = true;
151 150
152 // static 151 // static
153 NavigationEntry* NavigationController::CreateNavigationEntry( 152 NavigationEntry* NavigationController::CreateNavigationEntry(
154 const GURL& url, 153 const GURL& url,
155 const Referrer& referrer, 154 const Referrer& referrer,
156 PageTransition transition, 155 PageTransition transition,
157 bool is_renderer_initiated, 156 bool is_renderer_initiated,
158 const std::string& extra_headers, 157 const std::string& extra_headers,
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 const ViewHostMsg_FrameNavigate_Params& params) { 940 const ViewHostMsg_FrameNavigate_Params& params) {
942 // For main frame transition, we judge by params.transition. 941 // For main frame transition, we judge by params.transition.
943 // Otherwise, by params.redirects. 942 // Otherwise, by params.redirects.
944 if (PageTransitionIsMainFrame(params.transition)) { 943 if (PageTransitionIsMainFrame(params.transition)) {
945 return PageTransitionIsRedirect(params.transition); 944 return PageTransitionIsRedirect(params.transition);
946 } 945 }
947 return params.redirects.size() > 1; 946 return params.redirects.size() > 1;
948 } 947 }
949 948
950 void NavigationControllerImpl::RendererDidNavigateToNewPage( 949 void NavigationControllerImpl::RendererDidNavigateToNewPage(
951 const ViewHostMsg_FrameNavigate_Params& params, bool replace_entry) { 950 const ViewHostMsg_FrameNavigate_Params& params, bool replace_entry) {
952 NavigationEntryImpl* new_entry; 951 NavigationEntryImpl* new_entry;
953 bool update_virtual_url; 952 bool update_virtual_url;
954 // Only make a copy of the pending entry if it is appropriate for the new page 953 // Only make a copy of the pending entry if it is appropriate for the new page
955 // that was just loaded. We verify this at a coarse grain by checking that 954 // that was just loaded. We verify this at a coarse grain by checking that
956 // the SiteInstance hasn't been assigned to something else. 955 // the SiteInstance hasn't been assigned to something else.
957 if (pending_entry_ && 956 if (pending_entry_ &&
958 (!pending_entry_->site_instance() || 957 (!pending_entry_->site_instance() ||
959 pending_entry_->site_instance() == web_contents_->GetSiteInstance())) { 958 pending_entry_->site_instance() == web_contents_->GetSiteInstance())) {
960 new_entry = new NavigationEntryImpl(*pending_entry_); 959 new_entry = new NavigationEntryImpl(*pending_entry_);
961 960
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 DCHECK_EQ(GetEntryCount() - 1, transient_entry_index_); 1302 DCHECK_EQ(GetEntryCount() - 1, transient_entry_index_);
1304 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); 1303 entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_);
1305 transient_entry_index_ = 0; 1304 transient_entry_index_ = 0;
1306 last_committed_entry_index_ = -1; 1305 last_committed_entry_index_ = -1;
1307 pending_entry_index_ = -1; 1306 pending_entry_index_ = -1;
1308 } else if (!pending_entry_) { 1307 } else if (!pending_entry_) {
1309 // There's no pending entry. Leave the last entry (if there is one). 1308 // There's no pending entry. Leave the last entry (if there is one).
1310 if (!GetEntryCount()) 1309 if (!GetEntryCount())
1311 return; 1310 return;
1312 1311
1313 DCHECK(last_committed_entry_index_ >= 0); 1312 DCHECK_GE(last_committed_entry_index_, 0);
1314 entries_.erase(entries_.begin(), 1313 entries_.erase(entries_.begin(),
1315 entries_.begin() + last_committed_entry_index_); 1314 entries_.begin() + last_committed_entry_index_);
1316 entries_.erase(entries_.begin() + 1, entries_.end()); 1315 entries_.erase(entries_.begin() + 1, entries_.end());
1317 last_committed_entry_index_ = 0; 1316 last_committed_entry_index_ = 0;
1318 } else if (pending_entry_index_ != -1) { 1317 } else if (pending_entry_index_ != -1) {
1319 entries_.erase(entries_.begin(), entries_.begin() + pending_entry_index_); 1318 entries_.erase(entries_.begin(), entries_.begin() + pending_entry_index_);
1320 entries_.erase(entries_.begin() + 1, entries_.end()); 1319 entries_.erase(entries_.begin() + 1, entries_.end());
1321 pending_entry_index_ = 0; 1320 pending_entry_index_ = 0;
1322 last_committed_entry_index_ = 0; 1321 last_committed_entry_index_ = 0;
1323 } else { 1322 } else {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 entries_.push_back(linked_ptr<NavigationEntryImpl>(entry)); 1480 entries_.push_back(linked_ptr<NavigationEntryImpl>(entry));
1482 last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1; 1481 last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1;
1483 1482
1484 // This is a new page ID, so we need everybody to know about it. 1483 // This is a new page ID, so we need everybody to know about it.
1485 web_contents_->UpdateMaxPageID(entry->GetPageID()); 1484 web_contents_->UpdateMaxPageID(entry->GetPageID());
1486 } 1485 }
1487 1486
1488 void NavigationControllerImpl::PruneOldestEntryIfFull() { 1487 void NavigationControllerImpl::PruneOldestEntryIfFull() {
1489 if (entries_.size() >= max_entry_count()) { 1488 if (entries_.size() >= max_entry_count()) {
1490 DCHECK_EQ(max_entry_count(), entries_.size()); 1489 DCHECK_EQ(max_entry_count(), entries_.size());
1491 DCHECK(last_committed_entry_index_ > 0); 1490 DCHECK_GT(last_committed_entry_index_, 0);
1492 RemoveEntryAtIndex(0); 1491 RemoveEntryAtIndex(0);
1493 NotifyPrunedEntries(this, true, 1); 1492 NotifyPrunedEntries(this, true, 1);
1494 } 1493 }
1495 } 1494 }
1496 1495
1497 void NavigationControllerImpl::NavigateToPendingEntry(ReloadType reload_type) { 1496 void NavigationControllerImpl::NavigateToPendingEntry(ReloadType reload_type) {
1498 needs_reload_ = false; 1497 needs_reload_ = false;
1499 1498
1500 // If we were navigating to a slow-to-commit page, and the user performs 1499 // If we were navigating to a slow-to-commit page, and the user performs
1501 // a session history navigation to the last committed page, RenderViewHost 1500 // a session history navigation to the last committed page, RenderViewHost
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 } 1677 }
1679 } 1678 }
1680 } 1679 }
1681 1680
1682 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1681 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1683 const base::Callback<base::Time()>& get_timestamp_callback) { 1682 const base::Callback<base::Time()>& get_timestamp_callback) {
1684 get_timestamp_callback_ = get_timestamp_callback; 1683 get_timestamp_callback_ = get_timestamp_callback;
1685 } 1684 }
1686 1685
1687 } // namespace content 1686 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/trace_subscriber_stdio_unittest.cc ('k') | content/browser/web_contents/web_drag_source_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698