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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 return notify_disconnection() && | 529 return notify_disconnection() && |
530 !showing_interstitial_page() && | 530 !showing_interstitial_page() && |
531 !render_view_host()->SuddenTerminationAllowed(); | 531 !render_view_host()->SuddenTerminationAllowed(); |
532 } | 532 } |
533 | 533 |
534 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 534 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
535 TabContents* TabContents::OpenURL(const GURL& url, | 535 TabContents* TabContents::OpenURL(const GURL& url, |
536 const GURL& referrer, | 536 const GURL& referrer, |
537 WindowOpenDisposition disposition, | 537 WindowOpenDisposition disposition, |
538 content::PageTransition transition) { | 538 content::PageTransition transition) { |
539 return OpenURL(OpenURLParams(url, referrer, disposition, transition)); | 539 return OpenURL(OpenURLParams(url, referrer, disposition, transition, |
| 540 false)); |
540 } | 541 } |
541 | 542 |
542 TabContents* TabContents::OpenURL(const OpenURLParams& params) { | 543 TabContents* TabContents::OpenURL(const OpenURLParams& params) { |
543 if (delegate_) { | 544 if (delegate_) { |
544 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); | 545 TabContents* new_contents = delegate_->OpenURLFromTab(this, params); |
545 // Notify observers. | 546 // Notify observers. |
546 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 547 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
547 DidOpenURL(params.url, params.referrer, | 548 DidOpenURL(params.url, params.referrer, |
548 params.disposition, params.transition)); | 549 params.disposition, params.transition)); |
549 return new_contents; | 550 return new_contents; |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 // generated suggestions). | 1679 // generated suggestions). |
1679 // | 1680 // |
1680 // Note also that we hide the referrer for Web UI pages. We don't really | 1681 // Note also that we hide the referrer for Web UI pages. We don't really |
1681 // want web sites to see a referrer of "chrome://blah" (and some | 1682 // want web sites to see a referrer of "chrome://blah" (and some |
1682 // chrome: URLs might have search terms or other stuff we don't want to | 1683 // chrome: URLs might have search terms or other stuff we don't want to |
1683 // send to the site), so we send no referrer. | 1684 // send to the site), so we send no referrer. |
1684 new_contents = OpenURL(url, GURL(), disposition, | 1685 new_contents = OpenURL(url, GURL(), disposition, |
1685 render_manager_.web_ui()->link_transition_type()); | 1686 render_manager_.web_ui()->link_transition_type()); |
1686 transition_type = render_manager_.web_ui()->link_transition_type(); | 1687 transition_type = render_manager_.web_ui()->link_transition_type(); |
1687 } else { | 1688 } else { |
1688 new_contents = OpenURL( | 1689 new_contents = OpenURL(OpenURLParams( |
1689 url, referrer, disposition, content::PAGE_TRANSITION_LINK); | 1690 url, referrer, disposition, content::PAGE_TRANSITION_LINK, |
| 1691 true /* is_renderer_initiated */)); |
1690 } | 1692 } |
1691 if (new_contents) { | 1693 if (new_contents) { |
1692 // Notify observers. | 1694 // Notify observers. |
1693 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 1695 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
1694 DidOpenRequestedURL(new_contents, | 1696 DidOpenRequestedURL(new_contents, |
1695 url, | 1697 url, |
1696 referrer, | 1698 referrer, |
1697 disposition, | 1699 disposition, |
1698 transition_type, | 1700 transition_type, |
1699 source_frame_id)); | 1701 source_frame_id)); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 | 1971 |
1970 void TabContents::set_encoding(const std::string& encoding) { | 1972 void TabContents::set_encoding(const std::string& encoding) { |
1971 encoding_ = content::GetContentClient()->browser()-> | 1973 encoding_ = content::GetContentClient()->browser()-> |
1972 GetCanonicalEncodingNameByAliasName(encoding); | 1974 GetCanonicalEncodingNameByAliasName(encoding); |
1973 } | 1975 } |
1974 | 1976 |
1975 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1977 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
1976 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1978 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
1977 rwh_view->SetSize(view()->GetContainerSize()); | 1979 rwh_view->SetSize(view()->GetContainerSize()); |
1978 } | 1980 } |
OLD | NEW |