Chromium Code Reviews| Index: ppapi/c/dev/pp_message_event_dev.h |
| =================================================================== |
| --- ppapi/c/dev/pp_message_event_dev.h (revision 0) |
| +++ ppapi/c/dev/pp_message_event_dev.h (revision 0) |
| @@ -0,0 +1,65 @@ |
| +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| +#ifndef PPAPI_C_DEV_PP_MESSAGE_EVENT_DEV_H_ |
| +#define PPAPI_C_DEV_PP_MESSAGE_EVENT_DEV_H_ |
| + |
| +#include "ppapi/c/pp_macros.h" |
| +#include "ppapi/c/pp_var.h" |
| + |
| +/** |
| + * PP_MessageEvent_Dev defines a PPAPI version of MessageEvent, as defined |
| + * in: |
| + * http://dev.w3.org/html5/postmsg/#event-definitions |
| + * Note that PPAPI does not currently support @a lastEventId or @a ports. |
| + */ |
| +struct PP_MessageEvent_Dev { |
| + /** @a data represents the contents of the message. Currently, it can be an |
| + * instrinsic type or string (but not structured data such as an object or |
|
Mark Seaborn
2011/02/17 19:18:47
"instrinsic" -> "intrinsic"
Does "intrinsic type
dmichael(do not use this one)
2011/02/17 20:07:04
I agree, it's not. But the postMessage spec allow
dmichael(do not use this one)
2011/02/17 22:18:22
I reworded it.
|
| + * array). |
| + * DESIGN ISSUE: I want to support structured data and the structured |
|
darin (slow to review)
2011/02/17 19:20:52
SGTM2
|
| + * clone algorithm in the future. I believe that will |
| + * require adding a new type for PP_Var, which is perhaps a |
| + * tree structure encompassing the object, or a serialized |
| + * blob. In the latter case, the wire format becomes part |
| + * of the PPAPI interface. In the former case, the wire |
| + * format is more hidden but still needs to be carefully |
| + * managed by the proxy code to maintain backwards |
| + * compatibility. This does not need to be resolved now. |
| + */ |
| + struct PP_Var data; |
|
Mark Seaborn
2011/02/17 19:18:47
I thought the purpose of this async messaging was
dmichael(do not use this one)
2011/02/17 20:07:04
The proposal is more about getting rid of PPB_Var,
|
| + |
| + /** @a origin is a UTF string containing the origin of the message. It is |
| + * strongly recommended that message handlers check @a origin before doing |
|
Mark Seaborn
2011/02/17 19:18:47
This is contradictory. On the one hand you say th
dmichael(do not use this one)
2011/02/17 20:07:04
PP_MessageEvent_Dev is based around the spec for M
|
| + * any processing of the message data, to ensure it was received from the |
| + * expected @a origin. |
| + * DESIGN ISSUE: There was discussion of omitting this parameter. For now, |
|
darin (slow to review)
2011/02/17 19:20:52
OK, yeah...
While NaCl has a same-origin restrict
dmichael(do not use this one)
2011/02/17 20:07:04
Ah, thanks for pointing that out!
|
| + * there is no way to send messages to other origins or |
| + * receive messages from other origins, so this is arguably |
| + * not necessary. |
| + * |
| + * I think we can provide it anyway for now. That frees us |
| + * up to relax that restriction in the future without changing |
| + * this structure. It also makes this structure a little more |
| + * familiar to people used to the JavaScript postMessage. |
| + */ |
| + struct PP_Var origin; |
| + |
| + /** @a source is a reference to the WindowObject that sent this message. |
| + * DESIGN ISSUE: Part of me originally wanted to yank out the 'object id' |
| + * type for PP_Var eventually. But... maybe it's okay to |
| + * keep the ID if we can only ever use it asynchronously. I |
| + * think in this case, source fills the role of a WindowProxy |
| + * and allows us to respond to the same iframe/window that |
| + * invoked postMessage on us. Currently, I'm not showing an |
| + * interface that would allow you to post a message to just |
| + * any PP_Var (only to instances), so we could omit this. But |
| + * like origin, we can provide it now easily and possibly make |
| + * use of it later. |
| + */ |
| + struct PP_Var source; |
|
darin (slow to review)
2011/02/17 19:20:52
it is an interesting idea to include this here. i
brettw
2011/02/17 20:40:01
Yeah, I would probably just delete this.
dmichael(do not use this one)
2011/02/17 22:18:22
Done.
|
| +}; |
| + |
| +#endif /* PPAPI_C_DEV_PP_MESSAGE_EVENT_DEV_H_ */ |
| + |
| Property changes on: ppapi/c/dev/pp_message_event_dev.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |