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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 !render_view_host()->SuddenTerminationAllowed(); | 569 !render_view_host()->SuddenTerminationAllowed(); |
570 } | 570 } |
571 | 571 |
572 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 572 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
573 TabContents* TabContents::OpenURL(const GURL& url, | 573 TabContents* TabContents::OpenURL(const GURL& url, |
574 const GURL& referrer, | 574 const GURL& referrer, |
575 WindowOpenDisposition disposition, | 575 WindowOpenDisposition disposition, |
576 content::PageTransition transition) { | 576 content::PageTransition transition) { |
577 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. | 577 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. |
578 DCHECK(referrer.is_empty()); | 578 DCHECK(referrer.is_empty()); |
579 return OpenURL(OpenURLParams(url, referrer, disposition, transition, | 579 return OpenURL(OpenURLParams(url, content::Referrer(), disposition, |
580 false)); | 580 transition, false)); |
581 } | 581 } |
582 | 582 |
583 TabContents* TabContents::OpenURL(const OpenURLParams& params) { | 583 TabContents* TabContents::OpenURL(const OpenURLParams& params) { |
584 if (delegate_) { | 584 if (delegate_) { |
585 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); | 585 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); |
586 // Notify observers. | 586 // Notify observers. |
587 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 587 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
588 DidOpenURL(params.url, params.referrer, | 588 DidOpenURL(params.url, params.referrer, |
589 params.disposition, params.transition)); | 589 params.disposition, params.transition)); |
590 return new_contents; | 590 return new_contents; |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 // | 1760 // |
1761 // Note also that we hide the referrer for Web UI pages. We don't really | 1761 // Note also that we hide the referrer for Web UI pages. We don't really |
1762 // want web sites to see a referrer of "chrome://blah" (and some | 1762 // want web sites to see a referrer of "chrome://blah" (and some |
1763 // chrome: URLs might have search terms or other stuff we don't want to | 1763 // chrome: URLs might have search terms or other stuff we don't want to |
1764 // send to the site), so we send no referrer. | 1764 // send to the site), so we send no referrer. |
1765 new_contents = OpenURL(url, GURL(), disposition, | 1765 new_contents = OpenURL(url, GURL(), disposition, |
1766 render_manager_.web_ui()->link_transition_type()); | 1766 render_manager_.web_ui()->link_transition_type()); |
1767 transition_type = render_manager_.web_ui()->link_transition_type(); | 1767 transition_type = render_manager_.web_ui()->link_transition_type(); |
1768 } else { | 1768 } else { |
1769 new_contents = OpenURL(OpenURLParams( | 1769 new_contents = OpenURL(OpenURLParams( |
1770 url, referrer.url, disposition, content::PAGE_TRANSITION_LINK, | 1770 url, referrer, disposition, content::PAGE_TRANSITION_LINK, |
1771 true /* is_renderer_initiated */)); | 1771 true /* is_renderer_initiated */)); |
1772 } | 1772 } |
1773 if (new_contents) { | 1773 if (new_contents) { |
1774 // Notify observers. | 1774 // Notify observers. |
1775 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 1775 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
1776 DidOpenRequestedURL(new_contents, | 1776 DidOpenRequestedURL(new_contents, |
1777 url, | 1777 url, |
1778 referrer.url, | 1778 referrer, |
1779 disposition, | 1779 disposition, |
1780 transition_type, | 1780 transition_type, |
1781 source_frame_id)); | 1781 source_frame_id)); |
1782 } | 1782 } |
1783 } | 1783 } |
1784 | 1784 |
1785 void TabContents::RunJavaScriptMessage( | 1785 void TabContents::RunJavaScriptMessage( |
1786 const RenderViewHost* rvh, | 1786 const RenderViewHost* rvh, |
1787 const string16& message, | 1787 const string16& message, |
1788 const string16& default_prompt, | 1788 const string16& default_prompt, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2059 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2060 // Can be NULL during tests. | 2060 // Can be NULL during tests. |
2061 if (rwh_view) | 2061 if (rwh_view) |
2062 rwh_view->SetSize(view()->GetContainerSize()); | 2062 rwh_view->SetSize(view()->GetContainerSize()); |
2063 } | 2063 } |
2064 | 2064 |
2065 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2065 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
2066 return render_view_host() ? | 2066 return render_view_host() ? |
2067 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2067 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
2068 } | 2068 } |
OLD | NEW |