OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 params->current_history_list_offset = controller.last_committed_entry_index(); | 160 params->current_history_list_offset = controller.last_committed_entry_index(); |
161 params->current_history_list_length = controller.entry_count(); | 161 params->current_history_list_length = controller.entry_count(); |
162 params->url = entry.url(); | 162 params->url = entry.url(); |
163 params->referrer = entry.referrer(); | 163 params->referrer = entry.referrer(); |
164 params->transition = entry.transition_type(); | 164 params->transition = entry.transition_type(); |
165 params->state = entry.content_state(); | 165 params->state = entry.content_state(); |
166 params->navigation_type = | 166 params->navigation_type = |
167 GetNavigationType(controller.browser_context(), entry, reload_type); | 167 GetNavigationType(controller.browser_context(), entry, reload_type); |
168 params->request_time = base::Time::Now(); | 168 params->request_time = base::Time::Now(); |
169 params->extra_headers = entry.extra_headers(); | 169 params->extra_headers = entry.extra_headers(); |
| 170 params->transferred_request_child_id = |
| 171 entry.transferred_global_request_id().child_id; |
| 172 params->transferred_request_request_id = |
| 173 entry.transferred_global_request_id().request_id; |
170 | 174 |
171 if (delegate) | 175 if (delegate) |
172 delegate->AddNavigationHeaders(params->url, ¶ms->extra_headers); | 176 delegate->AddNavigationHeaders(params->url, ¶ms->extra_headers); |
173 } | 177 } |
174 | 178 |
175 } // namespace | 179 } // namespace |
176 | 180 |
177 | 181 |
178 // TabContents ---------------------------------------------------------------- | 182 // TabContents ---------------------------------------------------------------- |
179 | 183 |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 content::NotificationService::current()->Notify( | 1747 content::NotificationService::current()->Notify( |
1744 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 1748 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
1745 content::Source<TabContents>(this), | 1749 content::Source<TabContents>(this), |
1746 content::Details<int>(&page_id)); | 1750 content::Details<int>(&page_id)); |
1747 } | 1751 } |
1748 | 1752 |
1749 void TabContents::RequestOpenURL(const GURL& url, | 1753 void TabContents::RequestOpenURL(const GURL& url, |
1750 const GURL& referrer, | 1754 const GURL& referrer, |
1751 WindowOpenDisposition disposition, | 1755 WindowOpenDisposition disposition, |
1752 int64 source_frame_id) { | 1756 int64 source_frame_id) { |
| 1757 // Delegate to RequestTransferURL because this is just the generic |
| 1758 // case where |old_request_id| is empty. |
| 1759 RequestTransferURL(url, referrer, disposition, source_frame_id, |
| 1760 GlobalRequestID()); |
| 1761 } |
| 1762 |
| 1763 void TabContents::RequestTransferURL(const GURL& url, |
| 1764 const GURL& referrer, |
| 1765 WindowOpenDisposition disposition, |
| 1766 int64 source_frame_id, |
| 1767 const GlobalRequestID& old_request_id) { |
1753 TabContents* new_contents = NULL; | 1768 TabContents* new_contents = NULL; |
1754 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; | 1769 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; |
1755 if (render_manager_.web_ui()) { | 1770 if (render_manager_.web_ui()) { |
1756 // When we're a Web UI, it will provide a page transition type for us (this | 1771 // When we're a Web UI, it will provide a page transition type for us (this |
1757 // is so the new tab page can specify AUTO_BOOKMARK for automatically | 1772 // is so the new tab page can specify AUTO_BOOKMARK for automatically |
1758 // generated suggestions). | 1773 // generated suggestions). |
1759 // | 1774 // |
1760 // Note also that we hide the referrer for Web UI pages. We don't really | 1775 // Note also that we hide the referrer for Web UI pages. We don't really |
1761 // want web sites to see a referrer of "chrome://blah" (and some | 1776 // want web sites to see a referrer of "chrome://blah" (and some |
1762 // chrome: URLs might have search terms or other stuff we don't want to | 1777 // chrome: URLs might have search terms or other stuff we don't want to |
1763 // send to the site), so we send no referrer. | 1778 // send to the site), so we send no referrer. |
1764 new_contents = OpenURL(url, GURL(), disposition, | 1779 OpenURLParams params(url, GURL(), disposition, |
1765 render_manager_.web_ui()->link_transition_type()); | 1780 render_manager_.web_ui()->link_transition_type(), |
| 1781 false /* is_renderer_initiated */); |
| 1782 params.transferred_global_request_id = old_request_id; |
| 1783 new_contents = OpenURL(params); |
1766 transition_type = render_manager_.web_ui()->link_transition_type(); | 1784 transition_type = render_manager_.web_ui()->link_transition_type(); |
1767 } else { | 1785 } else { |
1768 new_contents = OpenURL(OpenURLParams( | 1786 OpenURLParams params(url, referrer, disposition, |
1769 url, referrer, disposition, content::PAGE_TRANSITION_LINK, | 1787 content::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); |
1770 true /* is_renderer_initiated */)); | 1788 params.transferred_global_request_id = old_request_id; |
| 1789 new_contents = OpenURL(params); |
1771 } | 1790 } |
1772 if (new_contents) { | 1791 if (new_contents) { |
1773 // Notify observers. | 1792 // Notify observers. |
1774 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 1793 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
1775 DidOpenRequestedURL(new_contents, | 1794 DidOpenRequestedURL(new_contents, |
1776 url, | 1795 url, |
1777 referrer, | 1796 referrer, |
1778 disposition, | 1797 disposition, |
1779 transition_type, | 1798 transition_type, |
1780 source_frame_id)); | 1799 source_frame_id)); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2077 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2059 // Can be NULL during tests. | 2078 // Can be NULL during tests. |
2060 if (rwh_view) | 2079 if (rwh_view) |
2061 rwh_view->SetSize(view()->GetContainerSize()); | 2080 rwh_view->SetSize(view()->GetContainerSize()); |
2062 } | 2081 } |
2063 | 2082 |
2064 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2083 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
2065 return render_view_host() ? | 2084 return render_view_host() ? |
2066 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2085 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
2067 } | 2086 } |
OLD | NEW |