blob: 3e69bd9cf6c17c26930786a57871fbe5530f48eb [file] [log] [blame]
[email protected]f7817822009-09-24 05:11:581// 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
7bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message,
8 int* tab_handle) {
9 bool is_tab_message = true;
10 IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message)
11 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, )
12 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_UpdateTargetUrl, )
13 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_HandleAccelerator, )
14 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabbedOut, )
15 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_OpenURL, )
16 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationFailed, )
17 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DidNavigate, )
18 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabLoaded, )
19 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_ForwardMessageToExternalHost, )
20 IPC_MESSAGE_HANDLER_GENERIC(
21 AutomationMsg_ForwardContextMenuToExternalHost, )
22 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestStart, )
23 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestRead, )
24 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestEnd, )
[email protected]fc6fb7fb2009-11-07 02:35:0425 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DownloadRequestInHost, )
[email protected]f7817822009-09-24 05:11:5826 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_SetCookieAsync, )
27 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_AttachExternalTab, )
[email protected]f9cc4c452009-10-13 14:56:3828 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestGoToHistoryEntryOffset, )
[email protected]70daf0b2010-03-02 19:13:0029 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_GetCookiesFromHost, )
[email protected]f7817822009-09-24 05:11:5830 IPC_MESSAGE_UNHANDLED(is_tab_message = false);
31 IPC_END_MESSAGE_MAP()
32
33 if (is_tab_message) {
34 // Read tab handle from the message.
35 void* iter = NULL;
36 is_tab_message = message.ReadInt(&iter, tab_handle);
37 }
38
39 return is_tab_message;
40}
41
42void ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) {
43 if (!IsValid()) {
44 DLOG(WARNING) << __FUNCTION__
45 << " Msgs received for a NULL automation client instance";
46 return;
47 }
48
49 IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg)
50 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged,
51 OnNavigationStateChanged)
52 IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl)
53 IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator,
54 OnAcceleratorPressed)
55 IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut)
56 IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL)
57 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed)
58 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate)
59 IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnLoad)
60 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost,
61 OnMessageFromChromeFrame)
62 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost,
63 OnHandleContextMenu)
64 IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart)
65 IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead)
66 IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd)
[email protected]fc6fb7fb2009-11-07 02:35:0467 IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost,
68 OnDownloadRequestInHost)
[email protected]f7817822009-09-24 05:11:5869 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync)
70 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab)
[email protected]f9cc4c452009-10-13 14:56:3871 IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset,
72 OnGoToHistoryEntryOffset)
[email protected]efd4dfc22010-03-26 20:14:4073 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost)
[email protected]f7817822009-09-24 05:11:5874 IPC_END_MESSAGE_MAP()
75}