Fix threading issue in CookieMonster task ordering.
[chromium-blink-merge.git] / chrome_frame / chrome_frame_delegate.cc
blobcd586b632b440cabe9292ce2d9fea6afb58ef08b
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.
5 #include "chrome_frame/chrome_frame_delegate.h"
7 #include "chrome/common/automation_messages.h"
9 #define NO_CODE ((void)0)
11 bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) {
12 bool is_tab_message = true;
13 IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message)
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)
23 IPC_MESSAGE_HANDLER_GENERIC(
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)
37 IPC_MESSAGE_UNHANDLED(is_tab_message = false);
38 IPC_END_MESSAGE_MAP()
40 return is_tab_message;
43 #undef NO_CODE
45 bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) {
46 if (!IsValid()) {
47 DLOG(WARNING) << __FUNCTION__
48 << " Msgs received for a NULL automation client instance";
49 return false;
52 bool handled = true;
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)
64 IPC_MESSAGE_HANDLER(AutomationMsg_MoveWindow, OnMoveWindow)
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)
72 IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost,
73 OnDownloadRequestInHost)
74 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync)
75 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab)
76 IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset,
77 OnGoToHistoryEntryOffset)
78 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost)
79 IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab)
80 IPC_MESSAGE_UNHANDLED(handled = false)
81 IPC_END_MESSAGE_MAP()
83 return handled;