File: ppp_instance_combined.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (64 lines) | stat: -rw-r--r-- 2,463 bytes parent folder | download | duplicates (11)
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
64
// Copyright 2012 The Chromium Authors
// 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 <stdint.h>

#include "base/functional/callback.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"

namespace ppapi {

// This exposes the 1.1 interface and forwards it to the 1.0 interface is
// necessary.
struct PPAPI_SHARED_EXPORT PPP_Instance_Combined {
 public:
  // Create a PPP_Instance_Combined. Uses the given |get_interface_func| to
  // query the plugin and find the most recent version of the PPP_Instance
  // interface. If the plugin doesn't support any PPP_Instance interface,
  // returns NULL.
  static PPP_Instance_Combined* Create(
      base::RepeatingCallback<const void*(const char*)> get_plugin_if);

  PPP_Instance_Combined(const PPP_Instance_Combined&) = delete;
  PPP_Instance_Combined& operator=(const PPP_Instance_Combined&) = delete;

  PP_Bool DidCreate(PP_Instance instance,
                    uint32_t argc,
                    const char* argn[],
                    const char* argv[]);
  void DidDestroy(PP_Instance instance);

  // This version of DidChangeView encapsulates all arguments for both 1.0
  // and 1.1 versions of this function. Conversion from 1.1 -> 1.0 is easy,
  // but this class doesn't have the necessary context (resource interfaces)
  // to do the conversion, so the caller must do it.
  void DidChangeView(PP_Instance instance,
                     PP_Resource view_changed_resource,
                     const struct PP_Rect* position,
                     const struct PP_Rect* clip);

  void DidChangeFocus(PP_Instance instance, PP_Bool has_focus);
  PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader);

 private:
  explicit PPP_Instance_Combined(const PPP_Instance_1_0& instance_if);
  explicit PPP_Instance_Combined(const PPP_Instance_1_1& instance_if);

  // For version 1.0, DidChangeView will be NULL, and DidChangeView_1_0 will
  // be set below.
  PPP_Instance_1_1 instance_1_1_;

  // Non-NULL when Instance 1.0 is used.
  void (*did_change_view_1_0_)(PP_Instance instance,
                               const struct PP_Rect* position,
                               const struct PP_Rect* clip);
};

}  // namespace ppapi

#endif  // PPAPI_SHARED_IMPL_PPP_INSTANCE_COMBINED_H_