| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/common/frame_messages.h" | 28 #include "content/common/frame_messages.h" |
| 29 #include "content/common/view_messages.h" | 29 #include "content/common/view_messages.h" |
| 30 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
| 31 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
| 32 #include "content/public/browser/invalidate_type.h" | 32 #include "content/public/browser/invalidate_type.h" |
| 33 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
| 34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
| 36 #include "content/public/browser/render_widget_host.h" | 36 #include "content/public/browser/render_widget_host.h" |
| 37 #include "content/public/browser/render_widget_host_view.h" | 37 #include "content/public/browser/render_widget_host_view.h" |
| 38 #include "content/public/browser/session_restore_uma.h" |
| 38 #include "content/public/browser/storage_partition.h" | 39 #include "content/public/browser/storage_partition.h" |
| 39 #include "content/public/browser/user_metrics.h" | 40 #include "content/public/browser/user_metrics.h" |
| 40 #include "content/public/common/content_client.h" | 41 #include "content/public/common/content_client.h" |
| 41 #include "content/public/common/content_constants.h" | 42 #include "content/public/common/content_constants.h" |
| 42 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 43 #include "net/base/escape.h" | 44 #include "net/base/escape.h" |
| 44 #include "net/base/mime_util.h" | 45 #include "net/base/mime_util.h" |
| 45 #include "net/base/net_util.h" | 46 #include "net/base/net_util.h" |
| 46 #include "skia/ext/platform_canvas.h" | 47 #include "skia/ext/platform_canvas.h" |
| 47 #include "url/url_constants.h" | 48 #include "url/url_constants.h" |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 } | 1744 } |
| 1744 | 1745 |
| 1745 // static | 1746 // static |
| 1746 size_t NavigationControllerImpl::max_entry_count() { | 1747 size_t NavigationControllerImpl::max_entry_count() { |
| 1747 if (max_entry_count_for_testing_ != kMaxEntryCountForTestingNotSet) | 1748 if (max_entry_count_for_testing_ != kMaxEntryCountForTestingNotSet) |
| 1748 return max_entry_count_for_testing_; | 1749 return max_entry_count_for_testing_; |
| 1749 return kMaxSessionHistoryEntries; | 1750 return kMaxSessionHistoryEntries; |
| 1750 } | 1751 } |
| 1751 | 1752 |
| 1752 void NavigationControllerImpl::SetActive(bool is_active) { | 1753 void NavigationControllerImpl::SetActive(bool is_active) { |
| 1753 if (is_active && needs_reload_) | 1754 if (is_active && needs_reload_) { |
| 1755 // If the pending navigation is a session restore entry then it is being |
| 1756 // loaded because of user action, and not automatically by the TabLoader. |
| 1757 // Consider this a deferred reload that the user then forced to occur. |
| 1758 // Better session restore tab prioritization should reduce the number of |
| 1759 // times this occurs. |
| 1760 NavigationEntryImpl* pending_entry = |
| 1761 entries_[last_committed_entry_index_].get(); |
| 1762 if (pending_entry->restore_type() == RESTORE_LAST_SESSION_EXITED_CLEANLY || |
| 1763 pending_entry->restore_type() == RESTORE_LAST_SESSION_CRASHED) { |
| 1764 UMA_HISTOGRAM_ENUMERATION( |
| 1765 content::kSessionRestoreTabActions, |
| 1766 content::kSessionRestoreTabActionsUma_DeferredTabLoadedByUserAction, |
| 1767 content::kSessionRestoreTabActionsUma_Max); |
| 1768 } |
| 1769 |
| 1754 LoadIfNecessary(); | 1770 LoadIfNecessary(); |
| 1771 } |
| 1755 } | 1772 } |
| 1756 | 1773 |
| 1757 void NavigationControllerImpl::LoadIfNecessary() { | 1774 void NavigationControllerImpl::LoadIfNecessary() { |
| 1758 if (!needs_reload_) | 1775 if (!needs_reload_) |
| 1759 return; | 1776 return; |
| 1760 | 1777 |
| 1761 // Calling Reload() results in ignoring state, and not loading. | 1778 // Calling Reload() results in ignoring state, and not loading. |
| 1762 // Explicitly use NavigateToPendingEntry so that the renderer uses the | 1779 // Explicitly use NavigateToPendingEntry so that the renderer uses the |
| 1763 // cached state. | 1780 // cached state. |
| 1764 pending_entry_index_ = last_committed_entry_index_; | 1781 pending_entry_index_ = last_committed_entry_index_; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 } | 1884 } |
| 1868 } | 1885 } |
| 1869 } | 1886 } |
| 1870 | 1887 |
| 1871 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1888 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1872 const base::Callback<base::Time()>& get_timestamp_callback) { | 1889 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1873 get_timestamp_callback_ = get_timestamp_callback; | 1890 get_timestamp_callback_ = get_timestamp_callback; |
| 1874 } | 1891 } |
| 1875 | 1892 |
| 1876 } // namespace content | 1893 } // namespace content |
| OLD | NEW |