| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/external_tab_container.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/win_util.h" | 10 #include "app/win_util.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 AutomationResourceMessageFilter* filter) { | 180 AutomationResourceMessageFilter* filter) { |
| 181 if (!automation_provider || !filter) { | 181 if (!automation_provider || !filter) { |
| 182 NOTREACHED(); | 182 NOTREACHED(); |
| 183 return false; | 183 return false; |
| 184 } | 184 } |
| 185 | 185 |
| 186 automation_ = automation_provider; | 186 automation_ = automation_provider; |
| 187 automation_resource_message_filter_ = filter; | 187 automation_resource_message_filter_ = filter; |
| 188 | 188 |
| 189 if (load_requests_via_automation_) { | 189 if (load_requests_via_automation_) { |
| 190 InitializeAutomationRequestContext(tab_handle_); |
| 191 |
| 190 RenderViewHost* rvh = tab_contents_->render_view_host(); | 192 RenderViewHost* rvh = tab_contents_->render_view_host(); |
| 191 if (rvh) { | 193 if (rvh) { |
| 192 AutomationResourceMessageFilter::RegisterRenderView( | 194 AutomationResourceMessageFilter::RegisterRenderView( |
| 193 rvh->process()->id(), rvh->routing_id(), | 195 rvh->process()->id(), rvh->routing_id(), |
| 194 tab_handle_, automation_resource_message_filter_); | 196 tab_handle_, automation_resource_message_filter_); |
| 195 } | 197 } |
| 196 } | 198 } |
| 197 | 199 |
| 198 // We cannot send the navigation state right away as the automation channel | 200 // We cannot send the navigation state right away as the automation channel |
| 199 // may not have been fully setup yet. | 201 // may not have been fully setup yet. |
| 200 MessageLoop::current()->PostTask( | 202 MessageLoop::current()->PostTask( |
| 201 FROM_HERE, | 203 FROM_HERE, |
| 202 external_method_factory_.NewRunnableMethod( | 204 external_method_factory_.NewRunnableMethod( |
| 203 &ExternalTabContainer::NavigationStateChanged, tab_contents_, 0)); | 205 &ExternalTabContainer::NavigationStateChanged, tab_contents_, 0)); |
| 204 return true; | 206 return true; |
| 205 } | 207 } |
| 206 | 208 |
| 207 void ExternalTabContainer::SetTabHandle(int handle) { | 209 void ExternalTabContainer::SetTabHandle(int handle) { |
| 208 tab_handle_ = handle; | 210 tab_handle_ = handle; |
| 209 if (load_requests_via_automation_) { | |
| 210 InitializeAutomationRequestContext(handle); | |
| 211 } | |
| 212 } | 211 } |
| 213 | 212 |
| 214 void ExternalTabContainer::ProcessUnhandledAccelerator(const MSG& msg) { | 213 void ExternalTabContainer::ProcessUnhandledAccelerator(const MSG& msg) { |
| 215 DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam); | 214 DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam); |
| 216 } | 215 } |
| 217 | 216 |
| 218 void ExternalTabContainer::FocusThroughTabTraversal(bool reverse) { | 217 void ExternalTabContainer::FocusThroughTabTraversal(bool reverse) { |
| 219 DCHECK(tab_contents_); | 218 DCHECK(tab_contents_); |
| 220 if (tab_contents_) { | 219 if (tab_contents_) { |
| 221 static_cast<TabContents*>(tab_contents_)->Focus(); | 220 static_cast<TabContents*>(tab_contents_)->Focus(); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 void ExternalTabContainer::InitializeAutomationRequestContext( | 711 void ExternalTabContainer::InitializeAutomationRequestContext( |
| 713 int tab_handle) { | 712 int tab_handle) { |
| 714 request_context_ = | 713 request_context_ = |
| 715 AutomationRequestContext::CreateAutomationURLRequestContextForTab( | 714 AutomationRequestContext::CreateAutomationURLRequestContextForTab( |
| 716 tab_handle, tab_contents_->profile(), | 715 tab_handle, tab_contents_->profile(), |
| 717 automation_resource_message_filter_); | 716 automation_resource_message_filter_); |
| 718 | 717 |
| 719 DCHECK(request_context_.get() != NULL); | 718 DCHECK(request_context_.get() != NULL); |
| 720 tab_contents_->set_request_context(request_context_.get()); | 719 tab_contents_->set_request_context(request_context_.get()); |
| 721 } | 720 } |
| OLD | NEW |