OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/win_util.h" | 9 #include "app/win_util.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 external_method_factory_.NewRunnableMethod( | 214 external_method_factory_.NewRunnableMethod( |
215 &ExternalTabContainer::OnReinitialize)); | 215 &ExternalTabContainer::OnReinitialize)); |
216 | 216 |
217 if (parent_window) | 217 if (parent_window) |
218 SetParent(GetNativeView(), parent_window); | 218 SetParent(GetNativeView(), parent_window); |
219 return true; | 219 return true; |
220 } | 220 } |
221 | 221 |
222 void ExternalTabContainer::SetTabHandle(int handle) { | 222 void ExternalTabContainer::SetTabHandle(int handle) { |
223 tab_handle_ = handle; | 223 tab_handle_ = handle; |
224 if (automation_resource_message_filter_.get() && | |
225 load_requests_via_automation_) { | |
226 InitializeAutomationRequestContext(tab_handle_); | |
227 } | |
228 } | 224 } |
229 | 225 |
230 void ExternalTabContainer::ProcessUnhandledAccelerator(const MSG& msg) { | 226 void ExternalTabContainer::ProcessUnhandledAccelerator(const MSG& msg) { |
231 NativeWebKeyboardEvent keyboard_event(msg.hwnd, msg.message, msg.wParam, | 227 NativeWebKeyboardEvent keyboard_event(msg.hwnd, msg.message, msg.wParam, |
232 msg.lParam); | 228 msg.lParam); |
233 unhandled_keyboard_event_handler_.HandleKeyboardEvent(keyboard_event, | 229 unhandled_keyboard_event_handler_.HandleKeyboardEvent(keyboard_event, |
234 focus_manager_); | 230 focus_manager_); |
235 } | 231 } |
236 | 232 |
237 void ExternalTabContainer::FocusThroughTabTraversal( | 233 void ExternalTabContainer::FocusThroughTabTraversal( |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 bool ExternalTabContainer::OnGoToEntryOffset(int offset) { | 877 bool ExternalTabContainer::OnGoToEntryOffset(int offset) { |
882 if (load_requests_via_automation_) { | 878 if (load_requests_via_automation_) { |
883 automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( | 879 automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( |
884 0, tab_handle_, offset)); | 880 0, tab_handle_, offset)); |
885 return false; | 881 return false; |
886 } | 882 } |
887 | 883 |
888 return true; | 884 return true; |
889 } | 885 } |
890 | 886 |
891 void ExternalTabContainer::InitializeAutomationRequestContext( | |
892 int tab_handle) { | |
893 request_context_ = | |
894 AutomationRequestContext::CreateAutomationURLRequestContextForTab( | |
895 tab_handle, tab_contents_->profile(), | |
896 automation_resource_message_filter_); | |
897 | |
898 DCHECK(request_context_.get() != NULL); | |
899 tab_contents_->set_request_context(request_context_.get()); | |
900 } | |
901 | |
902 void ExternalTabContainer::LoadAccelerators() { | 887 void ExternalTabContainer::LoadAccelerators() { |
903 HACCEL accelerator_table = AtlLoadAccelerators(IDR_CHROMEFRAME); | 888 HACCEL accelerator_table = AtlLoadAccelerators(IDR_CHROMEFRAME); |
904 DCHECK(accelerator_table); | 889 DCHECK(accelerator_table); |
905 | 890 |
906 // We have to copy the table to access its contents. | 891 // We have to copy the table to access its contents. |
907 int count = CopyAcceleratorTable(accelerator_table, 0, 0); | 892 int count = CopyAcceleratorTable(accelerator_table, 0, 0); |
908 if (count == 0) { | 893 if (count == 0) { |
909 // Nothing to do in that case. | 894 // Nothing to do in that case. |
910 return; | 895 return; |
911 } | 896 } |
(...skipping 18 matching lines...) Expand all Loading... |
930 accelerator_table_[accelerator] = accelerators[i].cmd; | 915 accelerator_table_[accelerator] = accelerators[i].cmd; |
931 | 916 |
932 // Also register with the focus manager. | 917 // Also register with the focus manager. |
933 if (focus_manager_) | 918 if (focus_manager_) |
934 focus_manager_->RegisterAccelerator(accelerator, this); | 919 focus_manager_->RegisterAccelerator(accelerator, this); |
935 } | 920 } |
936 } | 921 } |
937 | 922 |
938 void ExternalTabContainer::OnReinitialize() { | 923 void ExternalTabContainer::OnReinitialize() { |
939 if (load_requests_via_automation_) { | 924 if (load_requests_via_automation_) { |
940 InitializeAutomationRequestContext(tab_handle_); | |
941 | |
942 RenderViewHost* rvh = tab_contents_->render_view_host(); | 925 RenderViewHost* rvh = tab_contents_->render_view_host(); |
943 if (rvh) { | 926 if (rvh) { |
944 AutomationResourceMessageFilter::ResumePendingRenderView( | 927 AutomationResourceMessageFilter::ResumePendingRenderView( |
945 rvh->process()->id(), rvh->routing_id(), | 928 rvh->process()->id(), rvh->routing_id(), |
946 tab_handle_, automation_resource_message_filter_); | 929 tab_handle_, automation_resource_message_filter_); |
947 } | 930 } |
948 } | 931 } |
949 | 932 |
950 NavigationStateChanged(tab_contents_, 0); | 933 NavigationStateChanged(tab_contents_, 0); |
951 ServicePendingOpenURLRequests(); | 934 ServicePendingOpenURLRequests(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 | 975 |
993 layout->StartRow(0, 0); | 976 layout->StartRow(0, 0); |
994 layout->AddView(info_bar_container); | 977 layout->AddView(info_bar_container); |
995 layout->StartRow(1, 0); | 978 layout->StartRow(1, 0); |
996 layout->AddView(tab_contents_container_); | 979 layout->AddView(tab_contents_container_); |
997 SetContentsView(external_tab_view_); | 980 SetContentsView(external_tab_view_); |
998 // Note that SetTabContents must be called after AddChildView is called | 981 // Note that SetTabContents must be called after AddChildView is called |
999 tab_contents_container_->ChangeTabContents(tab_contents_); | 982 tab_contents_container_->ChangeTabContents(tab_contents_); |
1000 } | 983 } |
1001 | 984 |
OLD | NEW |