Add API messages for IPC.

This commit is contained in:
Cheng Zhao 2013-04-21 11:01:04 +08:00
parent 683087fbc4
commit 993cf1cc61
6 changed files with 84 additions and 0 deletions

33
common/api_messages.cc Normal file
View file

@ -0,0 +1,33 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Get basic type definitions.
#define IPC_MESSAGE_IMPL
#include "common/api_messages.h"
// Generate constructors.
#include "ipc/struct_constructor_macros.h"
#include "common/api_messages.h"
// Generate destructors.
#include "ipc/struct_destructor_macros.h"
#include "common/api_messages.h"
// Generate param traits write methods.
#include "ipc/param_traits_write_macros.h"
namespace IPC {
#include "common/api_messages.h"
} // namespace IPC
// Generate param traits read methods.
#include "ipc/param_traits_read_macros.h"
namespace IPC {
#include "common/api_messages.h"
} // namespace IPC
// Generate param traits log methods.
#include "ipc/param_traits_log_macros.h"
namespace IPC {
#include "common/api_messages.h"
} // namespace IPC

35
common/api_messages.h Normal file
View file

@ -0,0 +1,35 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Multiply-included file, no traditional include guard.
#include <string>
#include "base/values.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
// The message starter should be declared in ipc/ipc_message_start.h. Since
// we don't wan't to patch Chromium, we just pretend to be Content Shell.
#define IPC_MESSAGE_START ShellMsgStart
IPC_SYNC_MESSAGE_CONTROL2_1(AtomViewHostMsg_Allocate_Object,
std::string /* type name */,
DictionaryValue /* options */,
int /* object id */)
IPC_SYNC_MESSAGE_CONTROL1_0(AtomViewHostMsg_Deallocate_Object,
int /* object id */)
IPC_SYNC_MESSAGE_CONTROL3_1(AtomViewHostMsg_Call_Object_Method,
int /* object id */,
std::string /* method name */,
ListValue /* arguments */,
DictionaryValue /* return value */)
IPC_SYNC_MESSAGE_CONTROL2_1(AtomViewMsg_Callback,
int /* callback id */,
ListValue /* arguments */,
DictionaryValue /* return value */)