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

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: Uploading synced version for commit. 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 delegate_->ViewSourceForFrame(this, url, content_state); 1008 delegate_->ViewSourceForFrame(this, url, content_state);
1009 } 1009 }
1010 1010
1011 void TabContents::SetContentRestrictions(int restrictions) { 1011 void TabContents::SetContentRestrictions(int restrictions) {
1012 content_restrictions_ = restrictions; 1012 content_restrictions_ = restrictions;
1013 delegate()->ContentRestrictionsChanged(this); 1013 delegate()->ContentRestrictionsChanged(this);
1014 } 1014 }
1015 1015
1016 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, 1016 void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id,
1017 bool is_main_frame, 1017 bool is_main_frame,
1018 bool has_opener_set,
1018 const GURL& url) { 1019 const GURL& url) {
1019 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); 1020 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL);
1020 GURL validated_url(url); 1021 GURL validated_url(url);
1021 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), 1022 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(),
1022 GetRenderProcessHost()->id(), &validated_url); 1023 GetRenderProcessHost()->id(), &validated_url);
1023 1024
1024 RenderViewHost* rvh = 1025 RenderViewHost* rvh =
1025 render_manager_.pending_render_view_host() ? 1026 render_manager_.pending_render_view_host() ?
1026 render_manager_.pending_render_view_host() : render_view_host(); 1027 render_manager_.pending_render_view_host() : render_view_host();
1027 // Notify observers about the start of the provisional load. 1028 // Notify observers about the start of the provisional load.
1028 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1029 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1029 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, 1030 DidStartProvisionalLoadForFrame(frame_id, is_main_frame,
1030 validated_url, is_error_page, rvh)); 1031 validated_url, is_error_page, rvh));
1031 1032
1032 if (is_main_frame) { 1033 if (is_main_frame) {
1033 // Notify observers about the provisional change in the main frame URL. 1034 // Notify observers about the provisional change in the main frame URL.
1034 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1035 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1035 ProvisionalChangeToMainFrameUrl(url)); 1036 ProvisionalChangeToMainFrameUrl(url, has_opener_set));
1036 } 1037 }
1037 } 1038 }
1038 1039
1039 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, 1040 void TabContents::OnDidRedirectProvisionalLoad(int32 page_id,
1041 bool has_opener_set,
1040 const GURL& source_url, 1042 const GURL& source_url,
1041 const GURL& target_url) { 1043 const GURL& target_url) {
1042 // TODO(creis): Remove this method and have the pre-rendering code listen to 1044 // TODO(creis): Remove this method and have the pre-rendering code listen to
1043 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification 1045 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification
1044 // instead. See http://crbug.com/78512. 1046 // instead. See http://crbug.com/78512.
1045 NavigationEntry* entry; 1047 NavigationEntry* entry;
1046 if (page_id == -1) 1048 if (page_id == -1)
1047 entry = controller_.pending_entry(); 1049 entry = controller_.pending_entry();
1048 else 1050 else
1049 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); 1051 entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id);
1050 if (!entry || entry->url() != source_url) 1052 if (!entry || entry->url() != source_url)
1051 return; 1053 return;
1052 1054
1053 // Notify observers about the provisional change in the main frame URL. 1055 // Notify observers about the provisional change in the main frame URL.
1054 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 1056 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
1055 ProvisionalChangeToMainFrameUrl(target_url)); 1057 ProvisionalChangeToMainFrameUrl(target_url,
1058 has_opener_set));
1056 } 1059 }
1057 1060
1058 void TabContents::OnDidFailProvisionalLoadWithError( 1061 void TabContents::OnDidFailProvisionalLoadWithError(
1059 int64 frame_id, 1062 int64 frame_id,
1060 bool is_main_frame, 1063 bool is_main_frame,
1061 int error_code, 1064 int error_code,
1062 const GURL& url, 1065 const GURL& url,
1063 bool showing_repost_interstitial) { 1066 bool showing_repost_interstitial) {
1064 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() 1067 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec()
1065 << ", error_code: " << error_code 1068 << ", error_code: " << error_code
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 2222
2220 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2223 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2221 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2224 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2222 rwh_view->SetSize(view()->GetContainerSize()); 2225 rwh_view->SetSize(view()->GetContainerSize());
2223 } 2226 }
2224 2227
2225 void TabContents::OnOnlineStateChanged(bool online) { 2228 void TabContents::OnOnlineStateChanged(bool online) {
2226 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 2229 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
2227 render_view_host()->routing_id(), online)); 2230 render_view_host()->routing_id(), online));
2228 } 2231 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698