Chromium Code Reviews| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 } | 573 } |
| 570 | 574 |
| 571 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 575 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
| 572 TabContents* TabContents::OpenURL(const GURL& url, | 576 TabContents* TabContents::OpenURL(const GURL& url, |
| 573 const GURL& referrer, | 577 const GURL& referrer, |
| 574 WindowOpenDisposition disposition, | 578 WindowOpenDisposition disposition, |
| 575 content::PageTransition transition) { | 579 content::PageTransition transition) { |
| 576 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. | 580 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. |
| 577 DCHECK(referrer.is_empty()); | 581 DCHECK(referrer.is_empty()); |
| 578 return OpenURL(OpenURLParams(url, referrer, disposition, transition, | 582 return OpenURL(OpenURLParams(url, referrer, disposition, transition, |
| 579 false)); | 583 false)); |
| 580 } | 584 |
|
Charlie Reis
2011/12/02 22:38:11
Typo?
Matt Perry
2011/12/03 00:14:24
Done.
| |
| 581 | 585 |
| 582 TabContents* TabContents::OpenURL(const OpenURLParams& params) { | 586 TabContents* TabContents::OpenURL(const OpenURLParams& params) { |
| 583 if (delegate_) { | 587 if (delegate_) { |
| 584 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); | 588 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); |
| 585 // Notify observers. | 589 // Notify observers. |
| 586 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 590 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
| 587 DidOpenURL(params.url, params.referrer, | 591 DidOpenURL(params.url, params.referrer, |
| 588 params.disposition, params.transition)); | 592 params.disposition, params.transition)); |
| 589 return new_contents; | 593 return new_contents; |
| 590 } | 594 } |
| (...skipping 1152 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 |