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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 delegate_->ViewSourceForFrame(this, url, content_state); | 877 delegate_->ViewSourceForFrame(this, url, content_state); |
878 } | 878 } |
879 | 879 |
880 void TabContents::SetContentRestrictions(int restrictions) { | 880 void TabContents::SetContentRestrictions(int restrictions) { |
881 content_restrictions_ = restrictions; | 881 content_restrictions_ = restrictions; |
882 delegate()->ContentRestrictionsChanged(this); | 882 delegate()->ContentRestrictionsChanged(this); |
883 } | 883 } |
884 | 884 |
885 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, | 885 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, |
886 bool is_main_frame, | 886 bool is_main_frame, |
| 887 bool has_opener_set, |
887 const GURL& url) { | 888 const GURL& url) { |
888 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); | 889 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); |
889 GURL validated_url(url); | 890 GURL validated_url(url); |
890 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), | 891 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), |
891 GetRenderProcessHost()->id(), &validated_url); | 892 GetRenderProcessHost()->id(), &validated_url); |
892 | 893 |
893 RenderViewHost* rvh = | 894 RenderViewHost* rvh = |
894 render_manager_.pending_render_view_host() ? | 895 render_manager_.pending_render_view_host() ? |
895 render_manager_.pending_render_view_host() : render_view_host(); | 896 render_manager_.pending_render_view_host() : render_view_host(); |
896 // Notify observers about the start of the provisional load. | 897 // Notify observers about the start of the provisional load. |
897 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 898 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
898 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 899 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
899 validated_url, is_error_page, rvh)); | 900 validated_url, is_error_page, rvh)); |
900 | 901 |
901 if (is_main_frame) { | 902 if (is_main_frame) { |
902 // Notify observers about the provisional change in the main frame URL. | 903 // Notify observers about the provisional change in the main frame URL. |
903 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 904 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
904 ProvisionalChangeToMainFrameUrl(url)); | 905 ProvisionalChangeToMainFrameUrl(url, has_opener_set)); |
905 } | 906 } |
906 } | 907 } |
907 | 908 |
908 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, | 909 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, |
| 910 bool has_opener_set, |
909 const GURL& source_url, | 911 const GURL& source_url, |
910 const GURL& target_url) { | 912 const GURL& target_url) { |
911 // TODO(creis): Remove this method and have the pre-rendering code listen to | 913 // TODO(creis): Remove this method and have the pre-rendering code listen to |
912 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | 914 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification |
913 // instead. See http://crbug.com/78512. | 915 // instead. See http://crbug.com/78512. |
914 NavigationEntry* entry; | 916 NavigationEntry* entry; |
915 if (page_id == -1) | 917 if (page_id == -1) |
916 entry = controller_.pending_entry(); | 918 entry = controller_.pending_entry(); |
917 else | 919 else |
918 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); | 920 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); |
919 if (!entry || entry->url() != source_url) | 921 if (!entry || entry->url() != source_url) |
920 return; | 922 return; |
921 | 923 |
922 // Notify observers about the provisional change in the main frame URL. | 924 // Notify observers about the provisional change in the main frame URL. |
923 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 925 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
924 ProvisionalChangeToMainFrameUrl(target_url)); | 926 ProvisionalChangeToMainFrameUrl(target_url, |
| 927 has_opener_set)); |
925 } | 928 } |
926 | 929 |
927 void TabContents::OnDidFailProvisionalLoadWithError( | 930 void TabContents::OnDidFailProvisionalLoadWithError( |
928 int64 frame_id, | 931 int64 frame_id, |
929 bool is_main_frame, | 932 bool is_main_frame, |
930 int error_code, | 933 int error_code, |
931 const GURL& url, | 934 const GURL& url, |
932 bool showing_repost_interstitial) { | 935 bool showing_repost_interstitial) { |
933 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() | 936 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() |
934 << ", error_code: " << error_code | 937 << ", error_code: " << error_code |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 | 2053 |
2051 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2054 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2052 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2055 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2053 rwh_view->SetSize(view()->GetContainerSize()); | 2056 rwh_view->SetSize(view()->GetContainerSize()); |
2054 } | 2057 } |
2055 | 2058 |
2056 void TabContents::OnOnlineStateChanged(bool online) { | 2059 void TabContents::OnOnlineStateChanged(bool online) { |
2057 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2060 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
2058 render_view_host()->routing_id(), online)); | 2061 render_view_host()->routing_id(), online)); |
2059 } | 2062 } |
OLD | NEW |