| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 return notify_disconnection() && | 566 return notify_disconnection() && |
| 567 !showing_interstitial_page() && | 567 !showing_interstitial_page() && |
| 568 !render_view_host()->SuddenTerminationAllowed(); | 568 !render_view_host()->SuddenTerminationAllowed(); |
| 569 } | 569 } |
| 570 | 570 |
| 571 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 571 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
| 572 TabContents* TabContents::OpenURL(const GURL& url, | 572 TabContents* TabContents::OpenURL(const GURL& url, |
| 573 const GURL& referrer, | 573 const GURL& referrer, |
| 574 WindowOpenDisposition disposition, | 574 WindowOpenDisposition disposition, |
| 575 content::PageTransition transition) { | 575 content::PageTransition transition) { |
| 576 return OpenURL(OpenURLParams(url, referrer, disposition, transition, | 576 // For specifying a referrer, use the version of OpenURL taking OpenURLParams. |
| 577 false)); | 577 DCHECK(referrer.is_empty()); |
| 578 return OpenURL(OpenURLParams(url, content::Referrer(), disposition, |
| 579 transition, false)); |
| 578 } | 580 } |
| 579 | 581 |
| 580 TabContents* TabContents::OpenURL(const OpenURLParams& params) { | 582 TabContents* TabContents::OpenURL(const OpenURLParams& params) { |
| 581 if (delegate_) { | 583 if (delegate_) { |
| 582 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); | 584 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); |
| 583 // Notify observers. | 585 // Notify observers. |
| 584 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 586 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
| 585 DidOpenURL(params.url, params.referrer, | 587 DidOpenURL(params.url, params.referrer, |
| 586 params.disposition, params.transition)); | 588 params.disposition, params.transition)); |
| 587 return new_contents; | 589 return new_contents; |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 void TabContents::DocumentOnLoadCompletedInMainFrame( | 1740 void TabContents::DocumentOnLoadCompletedInMainFrame( |
| 1739 RenderViewHost* render_view_host, | 1741 RenderViewHost* render_view_host, |
| 1740 int32 page_id) { | 1742 int32 page_id) { |
| 1741 content::NotificationService::current()->Notify( | 1743 content::NotificationService::current()->Notify( |
| 1742 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 1744 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 1743 content::Source<TabContents>(this), | 1745 content::Source<TabContents>(this), |
| 1744 content::Details<int>(&page_id)); | 1746 content::Details<int>(&page_id)); |
| 1745 } | 1747 } |
| 1746 | 1748 |
| 1747 void TabContents::RequestOpenURL(const GURL& url, | 1749 void TabContents::RequestOpenURL(const GURL& url, |
| 1748 const GURL& referrer, | 1750 const content::Referrer& referrer, |
| 1749 WindowOpenDisposition disposition, | 1751 WindowOpenDisposition disposition, |
| 1750 int64 source_frame_id) { | 1752 int64 source_frame_id) { |
| 1751 TabContents* new_contents = NULL; | 1753 TabContents* new_contents = NULL; |
| 1752 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; | 1754 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; |
| 1753 if (render_manager_.web_ui()) { | 1755 if (render_manager_.web_ui()) { |
| 1754 // When we're a Web UI, it will provide a page transition type for us (this | 1756 // When we're a Web UI, it will provide a page transition type for us (this |
| 1755 // is so the new tab page can specify AUTO_BOOKMARK for automatically | 1757 // is so the new tab page can specify AUTO_BOOKMARK for automatically |
| 1756 // generated suggestions). | 1758 // generated suggestions). |
| 1757 // | 1759 // |
| 1758 // Note also that we hide the referrer for Web UI pages. We don't really | 1760 // Note also that we hide the referrer for Web UI pages. We don't really |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2058 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2057 // Can be NULL during tests. | 2059 // Can be NULL during tests. |
| 2058 if (rwh_view) | 2060 if (rwh_view) |
| 2059 rwh_view->SetSize(view()->GetContainerSize()); | 2061 rwh_view->SetSize(view()->GetContainerSize()); |
| 2060 } | 2062 } |
| 2061 | 2063 |
| 2062 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2064 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
| 2063 return render_view_host() ? | 2065 return render_view_host() ? |
| 2064 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2066 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
| 2065 } | 2067 } |
| OLD | NEW |