summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/ppp_instance_combined.h
blob: 57b5beb58f39a028fbf74273056a23574deaac1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// 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_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_
#define PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_

#include "base/basictypes.h"
#include "ppapi/c/ppp_instance.h"

// TODO(dmichael): This is here only for temporary backwards compatibility so
// that NaCl and other plugins aren't broken while the change propagates. This
// needs to be deleted in 14, because we don't intend to support PPP_Instance.
// HandleInputEvent.
// --- Begin backwards compatibility code.
union PP_InputEventData {
  struct PP_InputEvent_Key key;
  struct PP_InputEvent_Character character;
  struct PP_InputEvent_Mouse mouse;
  struct PP_InputEvent_Wheel wheel;
  char padding[64];
};
struct PP_InputEvent {
  PP_InputEvent_Type type;
  int32_t padding;
  PP_TimeTicks time_stamp;
  union PP_InputEventData u;
};
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80);

#define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5"

struct PPP_Instance_0_5 {
  PP_Bool (*DidCreate)(PP_Instance instance,
                       uint32_t argc,
                       const char* argn[],
                       const char* argv[]);
  void (*DidDestroy)(PP_Instance instance);
  void (*DidChangeView)(PP_Instance instance,
                        const struct PP_Rect* position,
                        const struct PP_Rect* clip);
  void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus);
  PP_Bool (*HandleInputEvent)(PP_Instance instance,
                              const struct PP_InputEvent* event);
  PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader);
};
// --- End backwards compatibility code.
namespace ppapi {

struct PPP_Instance_Combined : public PPP_Instance_1_0 {
 public:
  explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if);
  explicit PPP_Instance_Combined(const PPP_Instance_0_5& instance_if);
  PP_Bool (*HandleInputEvent_0_5)(PP_Instance instance,
                                 const struct PP_InputEvent* event);

  DISALLOW_COPY_AND_ASSIGN(PPP_Instance_Combined);
};

}  // namespace ppapi

#endif  // PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_