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