OLD | NEW |
---|---|
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 Loading... | |
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()); | |
222 | 224 |
223 TabContentsObserver::Observe(tab_contents_->tab_contents()); | 225 TabContentsObserver::Observe(tab_contents_->tab_contents()); |
224 | 226 |
225 // Start loading initial URL | 227 // Start loading initial URL |
226 if (!initial_url.is_empty()) { | 228 if (!initial_url.is_empty()) { |
227 // Navigate out of context since we don't have a 'tab_handle_' yet. | 229 // Navigate out of context since we don't have a 'tab_handle_' yet. |
228 MessageLoop::current()->PostTask( | 230 MessageLoop::current()->PostTask( |
229 FROM_HERE, | 231 FROM_HERE, |
230 external_method_factory_.NewRunnableMethod( | 232 external_method_factory_.NewRunnableMethod( |
231 &ExternalTabContainer::Navigate, initial_url, referrer)); | 233 &ExternalTabContainer::Navigate, initial_url, referrer)); |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 // When the previous entry index is invalid, it will be -1, which | 859 // When the previous entry index is invalid, it will be -1, which |
858 // will still make the computation come out right (navigating to the | 860 // will still make the computation come out right (navigating to the |
859 // 0th entry will be +1). | 861 // 0th entry will be +1). |
860 if (InitNavigationInfo(&navigation_info, commit->type, | 862 if (InitNavigationInfo(&navigation_info, commit->type, |
861 commit->previous_entry_index - | 863 commit->previous_entry_index - |
862 tab_contents_->controller().last_committed_entry_index())) | 864 tab_contents_->controller().last_committed_entry_index())) |
863 automation_->Send(new AutomationMsg_DidNavigate(tab_handle_, | 865 automation_->Send(new AutomationMsg_DidNavigate(tab_handle_, |
864 navigation_info)); | 866 navigation_info)); |
865 } | 867 } |
866 break; | 868 break; |
867 } | 869 } |
robertshield
2011/10/28 00:59:39
nit: could you fix the incorrect indentation for t
| |
868 case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: { | 870 case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: { |
869 const ProvisionalLoadDetails* load_details = | 871 const ProvisionalLoadDetails* load_details = |
870 content::Details<ProvisionalLoadDetails>(details).ptr(); | 872 content::Details<ProvisionalLoadDetails>(details).ptr(); |
871 automation_->Send(new AutomationMsg_NavigationFailed( | 873 automation_->Send(new AutomationMsg_NavigationFailed( |
872 tab_handle_, load_details->error_code(), load_details->url())); | 874 tab_handle_, load_details->error_code(), load_details->url())); |
873 | 875 |
874 ignore_next_load_notification_ = true; | 876 ignore_next_load_notification_ = true; |
875 break; | 877 break; |
876 } | 878 } |
877 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { | 879 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { |
878 if (load_requests_via_automation_) { | 880 if (load_requests_via_automation_) { |
879 RenderViewHost* rvh = content::Details<RenderViewHost>(details).ptr(); | 881 RenderViewHost* rvh = content::Details<RenderViewHost>(details).ptr(); |
880 RegisterRenderViewHostForAutomation(rvh, false); | 882 RegisterRenderViewHostForAutomation(rvh, false); |
881 } | 883 } |
882 break; | 884 break; |
883 } | 885 } |
886 | |
robertshield
2011/10/28 00:59:39
nit: remove blank here and the blank line above a
| |
884 case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: { | 887 case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: { |
885 if (load_requests_via_automation_) { | 888 if (load_requests_via_automation_) { |
886 RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr(); | 889 RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr(); |
887 UnregisterRenderViewHost(rvh); | 890 UnregisterRenderViewHost(rvh); |
888 } | 891 } |
889 break; | 892 break; |
890 } | 893 } |
894 | |
895 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED: { | |
896 if (load_requests_via_automation_) { | |
897 RenderViewHost* rvh = content::Source<RenderViewHost>(source).ptr(); | |
898 RegisterRenderViewHostForAutomation(rvh, false); | |
899 } | |
900 break; | |
901 } | |
902 | |
891 default: | 903 default: |
892 NOTREACHED(); | 904 NOTREACHED(); |
893 } | 905 } |
894 } | 906 } |
895 | 907 |
896 //////////////////////////////////////////////////////////////////////////////// | 908 //////////////////////////////////////////////////////////////////////////////// |
897 // ExternalTabContainer, views::NativeWidgetWin overrides: | 909 // ExternalTabContainer, views::NativeWidgetWin overrides: |
898 | 910 |
899 LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { | 911 LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { |
900 LRESULT result = views::NativeWidgetWin::OnCreate(create_struct); | 912 LRESULT result = views::NativeWidgetWin::OnCreate(create_struct); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1214 if (params.disposition == CURRENT_TAB) { | 1226 if (params.disposition == CURRENT_TAB) { |
1215 DCHECK(route_all_top_level_navigations_); | 1227 DCHECK(route_all_top_level_navigations_); |
1216 forward_params.disposition = NEW_FOREGROUND_TAB; | 1228 forward_params.disposition = NEW_FOREGROUND_TAB; |
1217 } | 1229 } |
1218 TabContents* new_contents = | 1230 TabContents* new_contents = |
1219 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1231 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
1220 // support only one navigation for a dummy tab before it is killed. | 1232 // support only one navigation for a dummy tab before it is killed. |
1221 ::DestroyWindow(GetNativeView()); | 1233 ::DestroyWindow(GetNativeView()); |
1222 return new_contents; | 1234 return new_contents; |
1223 } | 1235 } |
OLD | NEW |