OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 delegate_->WebIntentDispatch(this, intents_dispatcher); | 1203 delegate_->WebIntentDispatch(this, intents_dispatcher); |
1204 } | 1204 } |
1205 | 1205 |
1206 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, | 1206 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, |
1207 bool is_main_frame, | 1207 bool is_main_frame, |
1208 const GURL& opener_url, | 1208 const GURL& opener_url, |
1209 const GURL& url) { | 1209 const GURL& url) { |
1210 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); | 1210 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); |
1211 GURL validated_url(url); | 1211 GURL validated_url(url); |
1212 GetRenderViewHost()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), | 1212 GetRenderViewHost()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), |
1213 GetRenderProcessHost()->GetID(), &validated_url); | 1213 GetRenderProcessHost()->GetID(), false, &validated_url); |
1214 | 1214 |
1215 RenderViewHost* rvh = | 1215 RenderViewHost* rvh = |
1216 render_manager_.pending_render_view_host() ? | 1216 render_manager_.pending_render_view_host() ? |
1217 render_manager_.pending_render_view_host() : GetRenderViewHost(); | 1217 render_manager_.pending_render_view_host() : GetRenderViewHost(); |
1218 // Notify observers about the start of the provisional load. | 1218 // Notify observers about the start of the provisional load. |
1219 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1219 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1220 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 1220 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
1221 validated_url, is_error_page, rvh)); | 1221 validated_url, is_error_page, rvh)); |
1222 | 1222 |
1223 if (is_main_frame) { | 1223 if (is_main_frame) { |
1224 // Notify observers about the provisional change in the main frame URL. | 1224 // Notify observers about the provisional change in the main frame URL. |
1225 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1225 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1226 ProvisionalChangeToMainFrameUrl(url, opener_url)); | 1226 ProvisionalChangeToMainFrameUrl(validated_url, |
| 1227 opener_url)); |
1227 } | 1228 } |
1228 } | 1229 } |
1229 | 1230 |
1230 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, | 1231 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, |
1231 const GURL& opener_url, | 1232 const GURL& opener_url, |
1232 const GURL& source_url, | 1233 const GURL& source_url, |
1233 const GURL& target_url) { | 1234 const GURL& target_url) { |
1234 // TODO(creis): Remove this method and have the pre-rendering code listen to | 1235 // TODO(creis): Remove this method and have the pre-rendering code listen to |
1235 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | 1236 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification |
1236 // instead. See http://crbug.com/78512. | 1237 // instead. See http://crbug.com/78512. |
(...skipping 15 matching lines...) Expand all Loading... |
1252 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1253 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
1253 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1254 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
1254 << ", error_code: " << params.error_code | 1255 << ", error_code: " << params.error_code |
1255 << ", error_description: " << params.error_description | 1256 << ", error_description: " << params.error_description |
1256 << ", is_main_frame: " << params.is_main_frame | 1257 << ", is_main_frame: " << params.is_main_frame |
1257 << ", showing_repost_interstitial: " << | 1258 << ", showing_repost_interstitial: " << |
1258 params.showing_repost_interstitial | 1259 params.showing_repost_interstitial |
1259 << ", frame_id: " << params.frame_id; | 1260 << ", frame_id: " << params.frame_id; |
1260 GURL validated_url(params.url); | 1261 GURL validated_url(params.url); |
1261 GetRenderViewHost()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), | 1262 GetRenderViewHost()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), |
1262 GetRenderProcessHost()->GetID(), &validated_url); | 1263 GetRenderProcessHost()->GetID(), false, &validated_url); |
1263 | 1264 |
1264 if (net::ERR_ABORTED == params.error_code) { | 1265 if (net::ERR_ABORTED == params.error_code) { |
1265 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. | 1266 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. |
1266 // This means that the interstitial won't be torn down properly, which is | 1267 // This means that the interstitial won't be torn down properly, which is |
1267 // bad. But if we have an interstitial, go back to another tab type, and | 1268 // bad. But if we have an interstitial, go back to another tab type, and |
1268 // then load the same interstitial again, we could end up getting the first | 1269 // then load the same interstitial again, we could end up getting the first |
1269 // interstitial's "failed" message (as a result of the cancel) when we're on | 1270 // interstitial's "failed" message (as a result of the cancel) when we're on |
1270 // the second one. | 1271 // the second one. |
1271 // | 1272 // |
1272 // We can't tell this apart, so we think we're tearing down the current page | 1273 // We can't tell this apart, so we think we're tearing down the current page |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 encoding_ = content::GetContentClient()->browser()-> | 2301 encoding_ = content::GetContentClient()->browser()-> |
2301 GetCanonicalEncodingNameByAliasName(encoding); | 2302 GetCanonicalEncodingNameByAliasName(encoding); |
2302 } | 2303 } |
2303 | 2304 |
2304 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2305 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2305 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2306 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2306 // Can be NULL during tests. | 2307 // Can be NULL during tests. |
2307 if (rwh_view) | 2308 if (rwh_view) |
2308 rwh_view->SetSize(GetView()->GetContainerSize()); | 2309 rwh_view->SetSize(GetView()->GetContainerSize()); |
2309 } | 2310 } |
OLD | NEW |