[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome_frame/chrome_frame_delegate.h" |
| 6 | |
[email protected] | a22f7e0 | 2011-02-09 07:15:35 | [diff] [blame] | 7 | #include "chrome/common/automation_messages.h" |
| 8 | |
[email protected] | d480ae5 | 2011-11-17 22:51:15 | [diff] [blame] | 9 | #define NO_CODE ((void)0) |
| 10 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 11 | bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) { |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 12 | bool is_tab_message = true; |
| 13 | IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message) |
[email protected] | d480ae5 | 2011-11-17 22:51:15 | [diff] [blame] | 14 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, NO_CODE) |
| 15 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_UpdateTargetUrl, NO_CODE) |
| 16 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_HandleAccelerator, NO_CODE) |
| 17 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabbedOut, NO_CODE) |
| 18 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_OpenURL, NO_CODE) |
| 19 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationFailed, NO_CODE) |
| 20 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DidNavigate, NO_CODE) |
| 21 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabLoaded, NO_CODE) |
| 22 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_MoveWindow, NO_CODE) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 23 | IPC_MESSAGE_HANDLER_GENERIC( |
[email protected] | d480ae5 | 2011-11-17 22:51:15 | [diff] [blame] | 24 | AutomationMsg_ForwardMessageToExternalHost, NO_CODE) |
| 25 | IPC_MESSAGE_HANDLER_GENERIC( |
| 26 | AutomationMsg_ForwardContextMenuToExternalHost, NO_CODE) |
| 27 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestStart, NO_CODE) |
| 28 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestRead, NO_CODE) |
| 29 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestEnd, NO_CODE) |
| 30 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DownloadRequestInHost, NO_CODE) |
| 31 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_SetCookieAsync, NO_CODE) |
| 32 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_AttachExternalTab, NO_CODE) |
| 33 | IPC_MESSAGE_HANDLER_GENERIC( |
| 34 | AutomationMsg_RequestGoToHistoryEntryOffset, NO_CODE) |
| 35 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_GetCookiesFromHost, NO_CODE) |
| 36 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_CloseExternalTab, NO_CODE) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 37 | IPC_MESSAGE_UNHANDLED(is_tab_message = false); |
| 38 | IPC_END_MESSAGE_MAP() |
| 39 | |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 40 | return is_tab_message; |
| 41 | } |
| 42 | |
[email protected] | d480ae5 | 2011-11-17 22:51:15 | [diff] [blame] | 43 | #undef NO_CODE |
| 44 | |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 45 | bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 46 | if (!IsValid()) { |
| 47 | DLOG(WARNING) << __FUNCTION__ |
| 48 | << " Msgs received for a NULL automation client instance"; |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 49 | return false; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 50 | } |
| 51 | |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 52 | bool handled = true; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 53 | IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg) |
| 54 | IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, |
| 55 | OnNavigationStateChanged) |
| 56 | IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) |
| 57 | IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, |
| 58 | OnAcceleratorPressed) |
| 59 | IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) |
| 60 | IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) |
| 61 | IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) |
| 62 | IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) |
| 63 | IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnLoad) |
[email protected] | 326d3b7 | 2011-03-29 20:38:24 | [diff] [blame] | 64 | IPC_MESSAGE_HANDLER(AutomationMsg_MoveWindow, OnMoveWindow) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 65 | IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, |
| 66 | OnMessageFromChromeFrame) |
| 67 | IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, |
| 68 | OnHandleContextMenu) |
| 69 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart) |
| 70 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead) |
| 71 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd) |
[email protected] | fc6fb7fb | 2009-11-07 02:35:04 | [diff] [blame] | 72 | IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, |
| 73 | OnDownloadRequestInHost) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 74 | IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync) |
| 75 | IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) |
[email protected] | f9cc4c45 | 2009-10-13 14:56:38 | [diff] [blame] | 76 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, |
| 77 | OnGoToHistoryEntryOffset) |
[email protected] | efd4dfc2 | 2010-03-26 20:14:40 | [diff] [blame] | 78 | IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost) |
[email protected] | e16dd167 | 2010-06-07 21:40:29 | [diff] [blame] | 79 | IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab) |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 80 | IPC_MESSAGE_UNHANDLED(handled = false) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 81 | IPC_END_MESSAGE_MAP() |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 82 | |
| 83 | return handled; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 84 | } |