| 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 /* | 5 /* |
| 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 52 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 53 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 53 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 54 #include "content/browser/frame_host/debug_urls.h" | 54 #include "content/browser/frame_host/debug_urls.h" |
| 55 #include "content/browser/frame_host/interstitial_page_impl.h" | 55 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 56 #include "content/browser/frame_host/navigation_entry_impl.h" | 56 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 57 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 57 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
| 58 #include "content/browser/frame_host/navigator.h" | 58 #include "content/browser/frame_host/navigator.h" |
| 59 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary | 59 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary |
| 60 #include "content/browser/site_instance_impl.h" | 60 #include "content/browser/site_instance_impl.h" |
| 61 #include "content/common/frame_messages.h" | 61 #include "content/common/frame_messages.h" |
| 62 #include "content/common/navigation_params.h" |
| 62 #include "content/common/site_isolation_policy.h" | 63 #include "content/common/site_isolation_policy.h" |
| 63 #include "content/common/ssl_status_serialization.h" | 64 #include "content/common/ssl_status_serialization.h" |
| 64 #include "content/common/view_messages.h" | 65 #include "content/common/view_messages.h" |
| 65 #include "content/public/browser/browser_context.h" | 66 #include "content/public/browser/browser_context.h" |
| 66 #include "content/public/browser/content_browser_client.h" | 67 #include "content/public/browser/content_browser_client.h" |
| 67 #include "content/public/browser/invalidate_type.h" | 68 #include "content/public/browser/invalidate_type.h" |
| 68 #include "content/public/browser/navigation_details.h" | 69 #include "content/public/browser/navigation_details.h" |
| 69 #include "content/public/browser/notification_service.h" | 70 #include "content/public/browser/notification_service.h" |
| 70 #include "content/public/browser/notification_types.h" | 71 #include "content/public/browser/notification_types.h" |
| 71 #include "content/public/browser/render_widget_host.h" | 72 #include "content/public/browser/render_widget_host.h" |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 | 1738 |
| 1738 if (!success) | 1739 if (!success) |
| 1739 DiscardNonCommittedEntries(); | 1740 DiscardNonCommittedEntries(); |
| 1740 } | 1741 } |
| 1741 | 1742 |
| 1742 bool NavigationControllerImpl::NavigateToPendingEntryInternal( | 1743 bool NavigationControllerImpl::NavigateToPendingEntryInternal( |
| 1743 ReloadType reload_type) { | 1744 ReloadType reload_type) { |
| 1744 DCHECK(pending_entry_); | 1745 DCHECK(pending_entry_); |
| 1745 FrameTreeNode* root = delegate_->GetFrameTree()->root(); | 1746 FrameTreeNode* root = delegate_->GetFrameTree()->root(); |
| 1746 | 1747 |
| 1748 LoFiState lofi_state = |
| 1749 (reload_type == RELOAD_IGNORING_CACHE || reload_type == RELOAD || |
| 1750 reload_type == RELOAD_ORIGINAL_REQUEST_URL) ? LOFI_OFF : LOFI_DEFAULT; |
| 1751 |
| 1747 // In default Chrome, there are no subframe FrameNavigationEntries. Either | 1752 // In default Chrome, there are no subframe FrameNavigationEntries. Either |
| 1748 // navigate the main frame or use the main frame's FrameNavigationEntry to | 1753 // navigate the main frame or use the main frame's FrameNavigationEntry to |
| 1749 // tell the indicated frame where to go. | 1754 // tell the indicated frame where to go. |
| 1750 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 1755 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 1751 FrameNavigationEntry* frame_entry = GetPendingEntry()->GetFrameEntry(root); | 1756 FrameNavigationEntry* frame_entry = GetPendingEntry()->GetFrameEntry(root); |
| 1752 FrameTreeNode* frame = root; | 1757 FrameTreeNode* frame = root; |
| 1753 int ftn_id = GetPendingEntry()->frame_tree_node_id(); | 1758 int ftn_id = GetPendingEntry()->frame_tree_node_id(); |
| 1754 if (ftn_id != -1) { | 1759 if (ftn_id != -1) { |
| 1755 frame = delegate_->GetFrameTree()->FindByID(ftn_id); | 1760 frame = delegate_->GetFrameTree()->FindByID(ftn_id); |
| 1756 DCHECK(frame); | 1761 DCHECK(frame); |
| 1757 } | 1762 } |
| 1758 return frame->navigator()->NavigateToPendingEntry(frame, *frame_entry, | 1763 return frame->navigator()->NavigateToPendingEntry(frame, *frame_entry, |
| 1759 reload_type, false); | 1764 reload_type, false, |
| 1765 lofi_state); |
| 1760 } | 1766 } |
| 1761 | 1767 |
| 1762 // In --site-per-process, we compare FrameNavigationEntries to see which | 1768 // In --site-per-process, we compare FrameNavigationEntries to see which |
| 1763 // frames in the tree need to be navigated. | 1769 // frames in the tree need to be navigated. |
| 1764 FrameLoadVector same_document_loads; | 1770 FrameLoadVector same_document_loads; |
| 1765 FrameLoadVector different_document_loads; | 1771 FrameLoadVector different_document_loads; |
| 1766 if (GetLastCommittedEntry()) { | 1772 if (GetLastCommittedEntry()) { |
| 1767 FindFramesToNavigate(root, &same_document_loads, &different_document_loads); | 1773 FindFramesToNavigate(root, &same_document_loads, &different_document_loads); |
| 1768 } | 1774 } |
| 1769 | 1775 |
| 1770 if (same_document_loads.empty() && different_document_loads.empty()) { | 1776 if (same_document_loads.empty() && different_document_loads.empty()) { |
| 1771 // If we don't have any frames to navigate at this point, either | 1777 // If we don't have any frames to navigate at this point, either |
| 1772 // (1) there is no previous history entry to compare against, or | 1778 // (1) there is no previous history entry to compare against, or |
| 1773 // (2) we were unable to match any frames by name. In the first case, | 1779 // (2) we were unable to match any frames by name. In the first case, |
| 1774 // doing a different document navigation to the root item is the only valid | 1780 // doing a different document navigation to the root item is the only valid |
| 1775 // thing to do. In the second case, we should have been able to find a | 1781 // thing to do. In the second case, we should have been able to find a |
| 1776 // frame to navigate based on names if this were a same document | 1782 // frame to navigate based on names if this were a same document |
| 1777 // navigation, so we can safely assume this is the different document case. | 1783 // navigation, so we can safely assume this is the different document case. |
| 1778 different_document_loads.push_back( | 1784 different_document_loads.push_back( |
| 1779 std::make_pair(root, pending_entry_->GetFrameEntry(root))); | 1785 std::make_pair(root, pending_entry_->GetFrameEntry(root))); |
| 1780 } | 1786 } |
| 1781 | 1787 |
| 1782 // If all the frame loads fail, we will discard the pending entry. | 1788 // If all the frame loads fail, we will discard the pending entry. |
| 1783 bool success = false; | 1789 bool success = false; |
| 1784 | 1790 |
| 1785 // Send all the same document frame loads before the different document loads. | 1791 // Send all the same document frame loads before the different document loads. |
| 1786 for (const auto& item : same_document_loads) { | 1792 for (const auto& item : same_document_loads) { |
| 1787 FrameTreeNode* frame = item.first; | 1793 FrameTreeNode* frame = item.first; |
| 1788 success |= frame->navigator()->NavigateToPendingEntry(frame, *item.second, | 1794 success |= frame->navigator()->NavigateToPendingEntry(frame, *item.second, |
| 1789 reload_type, true); | 1795 reload_type, true, |
| 1796 lofi_state); |
| 1790 } | 1797 } |
| 1791 for (const auto& item : different_document_loads) { | 1798 for (const auto& item : different_document_loads) { |
| 1792 FrameTreeNode* frame = item.first; | 1799 FrameTreeNode* frame = item.first; |
| 1793 success |= frame->navigator()->NavigateToPendingEntry(frame, *item.second, | 1800 success |= frame->navigator()->NavigateToPendingEntry(frame, *item.second, |
| 1794 reload_type, false); | 1801 reload_type, false, |
| 1802 lofi_state); |
| 1795 } | 1803 } |
| 1796 return success; | 1804 return success; |
| 1797 } | 1805 } |
| 1798 | 1806 |
| 1799 void NavigationControllerImpl::FindFramesToNavigate( | 1807 void NavigationControllerImpl::FindFramesToNavigate( |
| 1800 FrameTreeNode* frame, | 1808 FrameTreeNode* frame, |
| 1801 FrameLoadVector* same_document_loads, | 1809 FrameLoadVector* same_document_loads, |
| 1802 FrameLoadVector* different_document_loads) { | 1810 FrameLoadVector* different_document_loads) { |
| 1803 DCHECK(pending_entry_); | 1811 DCHECK(pending_entry_); |
| 1804 DCHECK_GE(last_committed_entry_index_, 0); | 1812 DCHECK_GE(last_committed_entry_index_, 0); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 } | 2000 } |
| 1993 } | 2001 } |
| 1994 } | 2002 } |
| 1995 | 2003 |
| 1996 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2004 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1997 const base::Callback<base::Time()>& get_timestamp_callback) { | 2005 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1998 get_timestamp_callback_ = get_timestamp_callback; | 2006 get_timestamp_callback_ = get_timestamp_callback; |
| 1999 } | 2007 } |
| 2000 | 2008 |
| 2001 } // namespace content | 2009 } // namespace content |
| OLD | NEW |