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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 web_contents_->UpdateMaxPageIDForSiteInstance(site_instance.get(), | 1398 web_contents_->UpdateMaxPageIDForSiteInstance(site_instance.get(), |
1399 max_page_id); | 1399 max_page_id); |
1400 } | 1400 } |
1401 } | 1401 } |
1402 | 1402 |
1403 void NavigationControllerImpl::PruneAllButActive() { | 1403 void NavigationControllerImpl::PruneAllButActive() { |
1404 PruneAllButActiveInternal(); | 1404 PruneAllButActiveInternal(); |
1405 | 1405 |
1406 // If there is an entry left, we need to update the session history length of | 1406 // If there is an entry left, we need to update the session history length of |
1407 // the RenderView. | 1407 // the RenderView. |
1408 if (!GetEntryCount()) | 1408 if (!GetActiveEntry()) |
1409 return; | 1409 return; |
1410 | 1410 |
1411 NavigationEntryImpl* entry = | 1411 NavigationEntryImpl* entry = |
1412 NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); | 1412 NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); |
1413 CHECK(entry); | |
1414 // We pass 0 instead of GetEntryCount() for the history_length parameter of | 1413 // We pass 0 instead of GetEntryCount() for the history_length parameter of |
1415 // SetHistoryLengthAndPrune, because it will create history_length additional | 1414 // SetHistoryLengthAndPrune, because it will create history_length additional |
1416 // history entries. | 1415 // history entries. |
1417 // TODO(jochen): This API is confusing and we should clean it up. | 1416 // TODO(jochen): This API is confusing and we should clean it up. |
1418 // http://crbug.com/178491 | 1417 // http://crbug.com/178491 |
1419 web_contents_->SetHistoryLengthAndPrune( | 1418 web_contents_->SetHistoryLengthAndPrune( |
1420 entry->site_instance(), 0, entry->GetPageID()); | 1419 entry->site_instance(), 0, entry->GetPageID()); |
1421 } | 1420 } |
1422 | 1421 |
1423 void NavigationControllerImpl::PruneAllButActiveInternal() { | 1422 void NavigationControllerImpl::PruneAllButActiveInternal() { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 const base::Callback<base::Time()>& get_timestamp_callback) { | 1811 const base::Callback<base::Time()>& get_timestamp_callback) { |
1813 get_timestamp_callback_ = get_timestamp_callback; | 1812 get_timestamp_callback_ = get_timestamp_callback; |
1814 } | 1813 } |
1815 | 1814 |
1816 void NavigationControllerImpl::SetTakeScreenshotCallbackForTest( | 1815 void NavigationControllerImpl::SetTakeScreenshotCallbackForTest( |
1817 const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) { | 1816 const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) { |
1818 take_screenshot_callback_ = take_screenshot_callback; | 1817 take_screenshot_callback_ = take_screenshot_callback; |
1819 } | 1818 } |
1820 | 1819 |
1821 } // namespace content | 1820 } // namespace content |
OLD | NEW |