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

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

Powered by Google App Engine
This is Rietveld 408576698