[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] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 9 | bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) { |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 10 | bool is_tab_message = true; |
| 11 | IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message) |
| 12 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, ) |
| 13 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_UpdateTargetUrl, ) |
| 14 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_HandleAccelerator, ) |
| 15 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabbedOut, ) |
| 16 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_OpenURL, ) |
| 17 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationFailed, ) |
| 18 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DidNavigate, ) |
| 19 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabLoaded, ) |
| 20 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_ForwardMessageToExternalHost, ) |
| 21 | IPC_MESSAGE_HANDLER_GENERIC( |
| 22 | AutomationMsg_ForwardContextMenuToExternalHost, ) |
| 23 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestStart, ) |
| 24 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestRead, ) |
| 25 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestEnd, ) |
[email protected] | fc6fb7fb | 2009-11-07 02:35:04 | [diff] [blame] | 26 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DownloadRequestInHost, ) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 27 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_SetCookieAsync, ) |
| 28 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_AttachExternalTab, ) |
[email protected] | f9cc4c45 | 2009-10-13 14:56:38 | [diff] [blame] | 29 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestGoToHistoryEntryOffset, ) |
[email protected] | 70daf0b | 2010-03-02 19:13:00 | [diff] [blame] | 30 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_GetCookiesFromHost, ) |
[email protected] | e16dd167 | 2010-06-07 21:40:29 | [diff] [blame] | 31 | IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_CloseExternalTab, ) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 32 | IPC_MESSAGE_UNHANDLED(is_tab_message = false); |
| 33 | IPC_END_MESSAGE_MAP() |
| 34 | |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 35 | return is_tab_message; |
| 36 | } |
| 37 | |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 38 | bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 39 | if (!IsValid()) { |
| 40 | DLOG(WARNING) << __FUNCTION__ |
| 41 | << " Msgs received for a NULL automation client instance"; |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 42 | return false; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 43 | } |
| 44 | |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 45 | bool handled = true; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 46 | IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg) |
| 47 | IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, |
| 48 | OnNavigationStateChanged) |
| 49 | IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) |
| 50 | IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, |
| 51 | OnAcceleratorPressed) |
| 52 | IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) |
| 53 | IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) |
| 54 | IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) |
| 55 | IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) |
| 56 | IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnLoad) |
| 57 | IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, |
| 58 | OnMessageFromChromeFrame) |
| 59 | IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, |
| 60 | OnHandleContextMenu) |
| 61 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart) |
| 62 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead) |
| 63 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd) |
[email protected] | fc6fb7fb | 2009-11-07 02:35:04 | [diff] [blame] | 64 | IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, |
| 65 | OnDownloadRequestInHost) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 66 | IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync) |
| 67 | IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) |
[email protected] | f9cc4c45 | 2009-10-13 14:56:38 | [diff] [blame] | 68 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, |
| 69 | OnGoToHistoryEntryOffset) |
[email protected] | efd4dfc2 | 2010-03-26 20:14:40 | [diff] [blame] | 70 | IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost) |
[email protected] | e16dd167 | 2010-06-07 21:40:29 | [diff] [blame] | 71 | IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab) |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 72 | IPC_MESSAGE_UNHANDLED(handled = false) |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 73 | IPC_END_MESSAGE_MAP() |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 74 | |
| 75 | return handled; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 76 | } |