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

Side by Side Diff: chrome/browser/external_tab_container_win.cc

Issue 8416031: Revert 107669 (Looks to have caused bot failures) - Register the RenderViewHost instance created ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/external_tab_container_win.h" 5 #include "chrome/browser/external_tab_container_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 212 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
213 content::Source<NavigationController>(controller)); 213 content::Source<NavigationController>(controller));
214 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, 214 registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
215 content::Source<NavigationController>(controller)); 215 content::Source<NavigationController>(controller));
216 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 216 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
217 content::Source<NavigationController>(controller)); 217 content::Source<NavigationController>(controller));
218 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 218 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
219 content::Source<TabContents>(tab_contents_->tab_contents())); 219 content::Source<TabContents>(tab_contents_->tab_contents()));
220 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, 220 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
221 content::NotificationService::AllSources()); 221 content::NotificationService::AllSources());
222 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED,
223 content::NotificationService::AllSources());
224 222
225 TabContentsObserver::Observe(tab_contents_->tab_contents()); 223 TabContentsObserver::Observe(tab_contents_->tab_contents());
226 224
227 // Start loading initial URL 225 // Start loading initial URL
228 if (!initial_url.is_empty()) { 226 if (!initial_url.is_empty()) {
229 // Navigate out of context since we don't have a 'tab_handle_' yet. 227 // Navigate out of context since we don't have a 'tab_handle_' yet.
230 MessageLoop::current()->PostTask( 228 MessageLoop::current()->PostTask(
231 FROM_HERE, 229 FROM_HERE,
232 external_method_factory_.NewRunnableMethod( 230 external_method_factory_.NewRunnableMethod(
233 &ExternalTabContainer::Navigate, initial_url, referrer)); 231 &ExternalTabContainer::Navigate, initial_url, referrer));
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 if (load != NULL && 831 if (load != NULL &&
834 content::PageTransitionIsMainFrame(load->origin())) { 832 content::PageTransitionIsMainFrame(load->origin())) {
835 TRACE_EVENT_END_ETW("ExternalTabContainer::Navigate", 0, 833 TRACE_EVENT_END_ETW("ExternalTabContainer::Navigate", 0,
836 load->url().spec()); 834 load->url().spec());
837 automation_->Send(new AutomationMsg_TabLoaded(tab_handle_, 835 automation_->Send(new AutomationMsg_TabLoaded(tab_handle_,
838 load->url())); 836 load->url()));
839 } 837 }
840 break; 838 break;
841 } 839 }
842 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { 840 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
843 if (ignore_next_load_notification_) { 841 if (ignore_next_load_notification_) {
844 ignore_next_load_notification_ = false; 842 ignore_next_load_notification_ = false;
845 return; 843 return;
844 }
845
846 const content::LoadCommittedDetails* commit =
847 content::Details<content::LoadCommittedDetails>(details).ptr();
848
849 if (commit->http_status_code >= kHttpClientErrorStart &&
850 commit->http_status_code <= kHttpServerErrorEnd) {
851 automation_->Send(new AutomationMsg_NavigationFailed(
852 tab_handle_, commit->http_status_code, commit->entry->url()));
853
854 ignore_next_load_notification_ = true;
855 } else {
856 NavigationInfo navigation_info;
857 // When the previous entry index is invalid, it will be -1, which
858 // will still make the computation come out right (navigating to the
859 // 0th entry will be +1).
860 if (InitNavigationInfo(&navigation_info, commit->type,
861 commit->previous_entry_index -
862 tab_contents_->controller().last_committed_entry_index()))
863 automation_->Send(new AutomationMsg_DidNavigate(tab_handle_,
864 navigation_info));
865 }
866 break;
846 } 867 }
847
848 const content::LoadCommittedDetails* commit =
849 content::Details<content::LoadCommittedDetails>(details).ptr();
850
851 if (commit->http_status_code >= kHttpClientErrorStart &&
852 commit->http_status_code <= kHttpServerErrorEnd) {
853 automation_->Send(new AutomationMsg_NavigationFailed(
854 tab_handle_, commit->http_status_code, commit->entry->url()));
855
856 ignore_next_load_notification_ = true;
857 } else {
858 NavigationInfo navigation_info;
859 // When the previous entry index is invalid, it will be -1, which
860 // will still make the computation come out right (navigating to the
861 // 0th entry will be +1).
862 if (InitNavigationInfo(&navigation_info, commit->type,
863 commit->previous_entry_index -
864 tab_contents_->controller().last_committed_entry_index()))
865 automation_->Send(new AutomationMsg_DidNavigate(tab_handle_,
866 navigation_info));
867 }
868 break;
869 }
870 case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: { 868 case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: {
871 const ProvisionalLoadDetails* load_details = 869 const ProvisionalLoadDetails* load_details =
872 content::Details<ProvisionalLoadDetails>(details).ptr(); 870 content::Details<ProvisionalLoadDetails>(details).ptr();
873 automation_->Send(new AutomationMsg_NavigationFailed( 871 automation_->Send(new AutomationMsg_NavigationFailed(
874 tab_handle_, load_details->error_code(), load_details->url())); 872 tab_handle_, load_details->error_code(), load_details->url()));
875 873
876 ignore_next_load_notification_ = true; 874 ignore_next_load_notification_ = true;
877 break; 875 break;
878 } 876 }
879 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { 877 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: {
880 if (load_requests_via_automation_) { 878 if (load_requests_via_automation_) {
881 RenderViewHost* rvh = content::Details<RenderViewHost>(details).ptr(); 879 RenderViewHost* rvh = content::Details<RenderViewHost>(details).ptr();
882 RegisterRenderViewHostForAutomation(rvh, false); 880 RegisterRenderViewHostForAutomation(rvh, false);
883 } 881 }
884 break; 882 break;
885 } 883 }
886 case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: { 884 case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: {
887 if (load_requests_via_automation_) { 885 if (load_requests_via_automation_) {
888 RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr(); 886 RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr();
889 UnregisterRenderViewHost(rvh); 887 UnregisterRenderViewHost(rvh);
890 } 888 }
891 break; 889 break;
892 } 890 }
893 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED: {
894 if (load_requests_via_automation_) {
895 RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr();
896 RegisterRenderViewHostForAutomation(rvh, false);
897 }
898 break;
899 }
900 default: 891 default:
901 NOTREACHED(); 892 NOTREACHED();
902 } 893 }
903 } 894 }
904 895
905 //////////////////////////////////////////////////////////////////////////////// 896 ////////////////////////////////////////////////////////////////////////////////
906 // ExternalTabContainer, views::NativeWidgetWin overrides: 897 // ExternalTabContainer, views::NativeWidgetWin overrides:
907 898
908 LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { 899 LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) {
909 LRESULT result = views::NativeWidgetWin::OnCreate(create_struct); 900 LRESULT result = views::NativeWidgetWin::OnCreate(create_struct);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 if (params.disposition == CURRENT_TAB) { 1214 if (params.disposition == CURRENT_TAB) {
1224 DCHECK(route_all_top_level_navigations_); 1215 DCHECK(route_all_top_level_navigations_);
1225 forward_params.disposition = NEW_FOREGROUND_TAB; 1216 forward_params.disposition = NEW_FOREGROUND_TAB;
1226 } 1217 }
1227 TabContents* new_contents = 1218 TabContents* new_contents =
1228 ExternalTabContainer::OpenURLFromTab(source, forward_params); 1219 ExternalTabContainer::OpenURLFromTab(source, forward_params);
1229 // support only one navigation for a dummy tab before it is killed. 1220 // support only one navigation for a dummy tab before it is killed.
1230 ::DestroyWindow(GetNativeView()); 1221 ::DestroyWindow(GetNativeView());
1231 return new_contents; 1222 return new_contents;
1232 } 1223 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698