blob: cd586b632b440cabe9292ce2d9fea6afb58ef08b [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
[email protected]a22f7e02011-02-09 07:15:357#include "chrome/common/automation_messages.h"
8
[email protected]d480ae52011-11-17 22:51:159#define NO_CODE ((void)0)
10
[email protected]f5494d42010-12-23 22:15:3411bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) {
[email protected]f7817822009-09-24 05:11:5812 bool is_tab_message = true;
13 IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message)
[email protected]d480ae52011-11-17 22:51:1514 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]f7817822009-09-24 05:11:5823 IPC_MESSAGE_HANDLER_GENERIC(
[email protected]d480ae52011-11-17 22:51:1524 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]f7817822009-09-24 05:11:5837 IPC_MESSAGE_UNHANDLED(is_tab_message = false);
38 IPC_END_MESSAGE_MAP()
39
[email protected]f7817822009-09-24 05:11:5840 return is_tab_message;
41}
42
[email protected]d480ae52011-11-17 22:51:1543#undef NO_CODE
44
[email protected]a95986a82010-12-24 06:19:2845bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) {
[email protected]f7817822009-09-24 05:11:5846 if (!IsValid()) {
47 DLOG(WARNING) << __FUNCTION__
48 << " Msgs received for a NULL automation client instance";
[email protected]a95986a82010-12-24 06:19:2849 return false;
[email protected]f7817822009-09-24 05:11:5850 }
51
[email protected]a95986a82010-12-24 06:19:2852 bool handled = true;
[email protected]f7817822009-09-24 05:11:5853 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]326d3b72011-03-29 20:38:2464 IPC_MESSAGE_HANDLER(AutomationMsg_MoveWindow, OnMoveWindow)
[email protected]f7817822009-09-24 05:11:5865 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]fc6fb7fb2009-11-07 02:35:0472 IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost,
73 OnDownloadRequestInHost)
[email protected]f7817822009-09-24 05:11:5874 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync)
75 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab)
[email protected]f9cc4c452009-10-13 14:56:3876 IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset,
77 OnGoToHistoryEntryOffset)
[email protected]efd4dfc22010-03-26 20:14:4078 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost)
[email protected]e16dd1672010-06-07 21:40:2979 IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab)
[email protected]a95986a82010-12-24 06:19:2880 IPC_MESSAGE_UNHANDLED(handled = false)
[email protected]f7817822009-09-24 05:11:5881 IPC_END_MESSAGE_MAP()
[email protected]a95986a82010-12-24 06:19:2882
83 return handled;
[email protected]f7817822009-09-24 05:11:5884}