| 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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 delegate_->ViewSourceForFrame(this, url, content_state); | 1013 delegate_->ViewSourceForFrame(this, url, content_state); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void TabContents::SetContentRestrictions(int restrictions) { | 1016 void TabContents::SetContentRestrictions(int restrictions) { |
| 1017 content_restrictions_ = restrictions; | 1017 content_restrictions_ = restrictions; |
| 1018 delegate()->ContentRestrictionsChanged(this); | 1018 delegate()->ContentRestrictionsChanged(this); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, | 1021 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, |
| 1022 bool is_main_frame, | 1022 bool is_main_frame, |
| 1023 bool has_opener_set, |
| 1023 const GURL& url) { | 1024 const GURL& url) { |
| 1024 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); | 1025 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); |
| 1025 GURL validated_url(url); | 1026 GURL validated_url(url); |
| 1026 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), | 1027 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), |
| 1027 GetRenderProcessHost()->id(), &validated_url); | 1028 GetRenderProcessHost()->id(), &validated_url); |
| 1028 | 1029 |
| 1029 // Notify observers about the start of the provisional load. | 1030 // Notify observers about the start of the provisional load. |
| 1030 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 1031 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
| 1031 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 1032 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
| 1032 validated_url, is_error_page)); | 1033 validated_url, is_error_page)); |
| 1033 | 1034 |
| 1034 if (is_main_frame) { | 1035 if (is_main_frame) { |
| 1035 // Notify observers about the provisional change in the main frame URL. | 1036 // Notify observers about the provisional change in the main frame URL. |
| 1036 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 1037 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
| 1037 ProvisionalChangeToMainFrameUrl(url)); | 1038 ProvisionalChangeToMainFrameUrl(url, has_opener_set)); |
| 1038 } | 1039 } |
| 1039 } | 1040 } |
| 1040 | 1041 |
| 1041 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, | 1042 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, |
| 1043 bool has_opener_set, |
| 1042 const GURL& source_url, | 1044 const GURL& source_url, |
| 1043 const GURL& target_url) { | 1045 const GURL& target_url) { |
| 1044 // TODO(creis): Remove this method and have the pre-rendering code listen to | 1046 // TODO(creis): Remove this method and have the pre-rendering code listen to |
| 1045 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | 1047 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification |
| 1046 // instead. See http://crbug.com/78512. | 1048 // instead. See http://crbug.com/78512. |
| 1047 NavigationEntry* entry; | 1049 NavigationEntry* entry; |
| 1048 if (page_id == -1) | 1050 if (page_id == -1) |
| 1049 entry = controller_.pending_entry(); | 1051 entry = controller_.pending_entry(); |
| 1050 else | 1052 else |
| 1051 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); | 1053 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); |
| 1052 if (!entry || entry->url() != source_url) | 1054 if (!entry || entry->url() != source_url) |
| 1053 return; | 1055 return; |
| 1054 | 1056 |
| 1055 // Notify observers about the provisional change in the main frame URL. | 1057 // Notify observers about the provisional change in the main frame URL. |
| 1056 FOR_EACH_OBSERVER(TabContentsObserver, observers_, | 1058 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
| 1057 ProvisionalChangeToMainFrameUrl(target_url)); | 1059 ProvisionalChangeToMainFrameUrl(target_url, |
| 1060 has_opener_set)); |
| 1058 } | 1061 } |
| 1059 | 1062 |
| 1060 void TabContents::OnDidFailProvisionalLoadWithError( | 1063 void TabContents::OnDidFailProvisionalLoadWithError( |
| 1061 int64 frame_id, | 1064 int64 frame_id, |
| 1062 bool is_main_frame, | 1065 bool is_main_frame, |
| 1063 int error_code, | 1066 int error_code, |
| 1064 const GURL& url, | 1067 const GURL& url, |
| 1065 bool showing_repost_interstitial) { | 1068 bool showing_repost_interstitial) { |
| 1066 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() | 1069 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() |
| 1067 << ", error_code: " << error_code | 1070 << ", error_code: " << error_code |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 | 2244 |
| 2242 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2245 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2243 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2246 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2244 rwh_view->SetSize(view()->GetContainerSize()); | 2247 rwh_view->SetSize(view()->GetContainerSize()); |
| 2245 } | 2248 } |
| 2246 | 2249 |
| 2247 void TabContents::OnOnlineStateChanged(bool online) { | 2250 void TabContents::OnOnlineStateChanged(bool online) { |
| 2248 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2251 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2249 render_view_host()->routing_id(), online)); | 2252 render_view_host()->routing_id(), online)); |
| 2250 } | 2253 } |
| OLD | NEW |