Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 6915019: Changes to not use the prerendered contents when window.opener needs to be set. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 delegate_->ViewSourceForFrame(this, url, content_state); 1084 delegate_->ViewSourceForFrame(this, url, content_state);
1085 } 1085 }
1086 1086
1087 void TabContents::SetContentRestrictions(int restrictions) { 1087 void TabContents::SetContentRestrictions(int restrictions) {
1088 content_restrictions_ = restrictions; 1088 content_restrictions_ = restrictions;
1089 delegate()->ContentRestrictionsChanged(this); 1089 delegate()->ContentRestrictionsChanged(this);
1090 } 1090 }
1091 1091
1092 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, 1092 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id,
1093 bool is_main_frame, 1093 bool is_main_frame,
1094 bool has_opener_set,
1094 const GURL& url) { 1095 const GURL& url) {
1095 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); 1096 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL);
1096 GURL validated_url(url); 1097 GURL validated_url(url);
1097 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), 1098 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(),
1098 GetRenderProcessHost()->id(), &validated_url); 1099 GetRenderProcessHost()->id(), &validated_url);
1099 1100
1100 // Notify observers about the start of the provisional load. 1101 // Notify observers about the start of the provisional load.
1101 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1102 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1102 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, 1103 DidStartProvisionalLoadForFrame(frame_id, is_main_frame,
1103 validated_url, is_error_page)); 1104 validated_url, is_error_page));
1104 1105
1105 if (is_main_frame) { 1106 if (is_main_frame) {
1106 // Notify observers about the provisional change in the main frame URL. 1107 // Notify observers about the provisional change in the main frame URL.
1107 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1108 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1108 ProvisionalChangeToMainFrameUrl(url)); 1109 ProvisionalChangeToMainFrameUrl(url, has_opener_set));
1109 } 1110 }
1110 } 1111 }
1111 1112
1112 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, 1113 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id,
1114 bool has_opener_set,
1113 const GURL& source_url, 1115 const GURL& source_url,
1114 const GURL& target_url) { 1116 const GURL& target_url) {
1115 // TODO(creis): Remove this method and have the pre-rendering code listen to 1117 // TODO(creis): Remove this method and have the pre-rendering code listen to
1116 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification 1118 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification
1117 // instead. See http://crbug.com/78512. 1119 // instead. See http://crbug.com/78512.
1118 NavigationEntry* entry; 1120 NavigationEntry* entry;
1119 if (page_id == -1) 1121 if (page_id == -1)
1120 entry = controller_.pending_entry(); 1122 entry = controller_.pending_entry();
1121 else 1123 else
1122 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); 1124 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id);
1123 if (!entry || entry->url() != source_url) 1125 if (!entry || entry->url() != source_url)
1124 return; 1126 return;
1125 1127
1126 // Notify observers about the provisional change in the main frame URL. 1128 // Notify observers about the provisional change in the main frame URL.
1127 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1129 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1128 ProvisionalChangeToMainFrameUrl(target_url)); 1130 ProvisionalChangeToMainFrameUrl(target_url,
1131 has_opener_set));
1129 } 1132 }
1130 1133
1131 void TabContents::OnDidFailProvisionalLoadWithError( 1134 void TabContents::OnDidFailProvisionalLoadWithError(
1132 int64 frame_id, 1135 int64 frame_id,
1133 bool is_main_frame, 1136 bool is_main_frame,
1134 int error_code, 1137 int error_code,
1135 const GURL& url, 1138 const GURL& url,
1136 bool showing_repost_interstitial) { 1139 bool showing_repost_interstitial) {
1137 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() 1140 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec()
1138 << ", error_code: " << error_code 1141 << ", error_code: " << error_code
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 2318
2316 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2319 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2317 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2320 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2318 rwh_view->SetSize(view()->GetContainerSize()); 2321 rwh_view->SetSize(view()->GetContainerSize());
2319 } 2322 }
2320 2323
2321 void TabContents::OnOnlineStateChanged(bool online) { 2324 void TabContents::OnOnlineStateChanged(bool online) {
2322 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 2325 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
2323 render_view_host()->routing_id(), online)); 2326 render_view_host()->routing_id(), online));
2324 } 2327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698