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 7 #include "chrome/common/automation_messages.h" 8 9 #define NO_CODE ((void)0) 10 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_AttachExternalTab, NO_CODE) 32 IPC_MESSAGE_HANDLER_GENERIC( 33 AutomationMsg_RequestGoToHistoryEntryOffset, NO_CODE) 34 IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_CloseExternalTab, NO_CODE) 35 IPC_MESSAGE_UNHANDLED(is_tab_message = false); 36 IPC_END_MESSAGE_MAP() 37 38 return is_tab_message; 39 } 40 41 #undef NO_CODE 42 43 bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { 44 if (!IsValid()) { 45 DLOG(WARNING) << __FUNCTION__ 46 << " Msgs received for a NULL automation client instance"; 47 return false; 48 } 49 50 bool handled = true; 51 IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg) 52 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, 53 OnNavigationStateChanged) 54 IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) 55 IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, 56 OnAcceleratorPressed) 57 IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) 58 IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) 59 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) 60 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) 61 IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnLoad) 62 IPC_MESSAGE_HANDLER(AutomationMsg_MoveWindow, OnMoveWindow) 63 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, 64 OnMessageFromChromeFrame) 65 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, 66 OnHandleContextMenu) 67 IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart) 68 IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead) 69 IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd) 70 IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, 71 OnDownloadRequestInHost) 72 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) 73 IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, 74 OnGoToHistoryEntryOffset) 75 IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab) 76 IPC_MESSAGE_UNHANDLED(handled = false) 77 IPC_END_MESSAGE_MAP() 78 79 return handled; 80 } 81