| 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_frame/external_tab.h" | 5 #include "chrome_frame/external_tab.h" |
| 6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
| 7 #include "base/tracked.h" | 7 #include "base/tracked.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
| 10 #include "chrome/common/automation_messages.h" | 10 #include "chrome/common/automation_messages.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 ExternalTabProxy::ExternalTabProxy() : state_(NONE), tab_(0), tab_wnd_(NULL), | 28 ExternalTabProxy::ExternalTabProxy() : state_(NONE), tab_(0), tab_wnd_(NULL), |
| 29 chrome_wnd_(NULL), proxy_factory_(g_proxy_factory.Pointer()), proxy_(NULL), | 29 chrome_wnd_(NULL), proxy_factory_(g_proxy_factory.Pointer()), proxy_(NULL), |
| 30 ui_delegate_(NULL) { | 30 ui_delegate_(NULL) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 ExternalTabProxy::~ExternalTabProxy() { | 33 ExternalTabProxy::~ExternalTabProxy() { |
| 34 Destroy(); | 34 Destroy(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { | 37 bool ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { |
| 38 bool handled = true; |
| 38 IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message) | 39 IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message) |
| 39 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, | 40 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, |
| 40 OnNavigationStateChanged) | 41 OnNavigationStateChanged) |
| 41 IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) | 42 IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) |
| 42 IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, OnHandleAccelerator) | 43 IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, OnHandleAccelerator) |
| 43 IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) | 44 IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) |
| 44 IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) | 45 IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) |
| 45 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) | 46 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) |
| 46 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) | 47 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) |
| 47 IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnTabLoaded) | 48 IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnTabLoaded) |
| 48 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, | 49 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, |
| 49 OnMessageToHost) | 50 OnMessageToHost) |
| 50 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, | 51 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, |
| 51 OnHandleContextMenu) | 52 OnHandleContextMenu) |
| 52 IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnNetwork_Start) | 53 IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnNetwork_Start) |
| 53 IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnNetwork_Read) | 54 IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnNetwork_Read) |
| 54 IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnNetwork_End) | 55 IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnNetwork_End) |
| 55 IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, | 56 IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, |
| 56 OnNetwork_DownloadInHost) | 57 OnNetwork_DownloadInHost) |
| 57 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookies) | 58 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookies) |
| 58 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookie) | 59 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookie) |
| 59 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachTab) | 60 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachTab) |
| 60 IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, | 61 IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, |
| 61 OnGoToHistoryOffset) | 62 OnGoToHistoryOffset) |
| 62 IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed) | 63 IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed) |
| 64 IPC_MESSAGE_UNHANDLED(handled = false) |
| 63 IPC_END_MESSAGE_MAP() | 65 IPC_END_MESSAGE_MAP() |
| 66 return handled; |
| 64 } | 67 } |
| 65 | 68 |
| 66 void ExternalTabProxy::Init() { | 69 void ExternalTabProxy::Init() { |
| 67 if (m_hWnd == NULL) { | 70 if (m_hWnd == NULL) { |
| 68 // Create a window on the UI thread for marshaling messages back and forth | 71 // Create a window on the UI thread for marshaling messages back and forth |
| 69 // from the IPC thread. This window cannot be a message only window as the | 72 // from the IPC thread. This window cannot be a message only window as the |
| 70 // external chrome tab window initially is created as a child of this window | 73 // external chrome tab window initially is created as a child of this window |
| 71 CWindowImpl<ExternalTabProxy>::Create(GetDesktopWindow(), NULL, NULL, | 74 CWindowImpl<ExternalTabProxy>::Create(GetDesktopWindow(), NULL, NULL, |
| 72 WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_TOOLWINDOW); | 75 WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_TOOLWINDOW); |
| 73 DCHECK(m_hWnd != NULL); | 76 DCHECK(m_hWnd != NULL); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 370 } |
| 368 | 371 |
| 369 void ExternalTabProxy::OnTabClosed() { | 372 void ExternalTabProxy::OnTabClosed() { |
| 370 // TODO(stoyan): | 373 // TODO(stoyan): |
| 371 } | 374 } |
| 372 | 375 |
| 373 void ExternalTabProxy::OnAttachTab( | 376 void ExternalTabProxy::OnAttachTab( |
| 374 const AttachExternalTabParams& attach_params) { | 377 const AttachExternalTabParams& attach_params) { |
| 375 // TODO(stoyan): | 378 // TODO(stoyan): |
| 376 } | 379 } |
| OLD | NEW |