summaryrefslogtreecommitdiff
path: root/dom/plugins/base/nsIPluginInstanceOwner.idl
blob: 87e51599c9119d9384a1d02356554c86e3d19559 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"
#include "nspluginroot.idl"
#include "nsIInputStream.idl"

interface nsIDocument;

%{C++
#include "npapi.h"
#include "mozilla/EventForwards.h"
class nsNPAPIPluginInstance;

enum nsPluginTagType {
  nsPluginTagType_Unknown,
  nsPluginTagType_Embed,
  nsPluginTagType_Object,
  nsPluginTagType_Applet
};
%}

[ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);

// Do not make this interface scriptable, because the virtual functions in C++
// blocks will make script call the wrong functions.
[uuid(7d65452e-c167-4cba-a0e3-ddc61bdde8c3)]
interface nsIPluginInstanceOwner : nsISupports
{
  /**
   * Let the owner know what its instance is
   */
  void setInstance(in nsNPAPIPluginInstancePtr aInstance);

  /**
   * Get the instance associated with this owner.
   */
  nsNPAPIPluginInstancePtr getInstance();

  /**
   * Get a handle to the window structure of the owner.
   * This pointer cannot be made persistent by the caller.
   */
  void getWindow(in NPWindowStarRef aWindow);

  /**
   * Get the display mode for the plugin instance.
   */
  readonly attribute int32_t mode;

  /**
   * Create a place for the plugin to live in the owner's
   * environment. this may or may not create a window
   * depending on the windowless state of the plugin instance.
   */
  void createWidget();

%{C++
  /**
   * Called when there is a valid target so that the proper
   * frame can be updated with new content. will not be called
   * with nullptr aTarget.
   */
  NS_IMETHOD
  GetURL(const char *aURL, const char *aTarget, 
         nsIInputStream *aPostStream,
         void *aHeadersData, uint32_t aHeadersDataLen,
         bool aDoCheckLoadURIChecks) = 0;
%}

  /**
   * Get the associated document.
   */
  readonly attribute nsIDocument document;

  /**
   * Invalidate the rectangle
   */
  void invalidateRect(in NPRectPtr aRect);

  /**
   * Invalidate the region
   */
  void invalidateRegion(in NPRegion aRegion);

  /**
   * Have the plugin recomposited.
   */
  void redrawPlugin();

  /**
   * Get NetscapeWindow, corresponds to NPNVnetscapeWindow
   */
  void getNetscapeWindow(in voidPtr aValue);

  /**
   * Convert between plugin, window, and screen coordinate spaces.
   */
%{C++
  virtual NPBool  ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
                               double *destX, double *destY, NPCoordinateSpace destSpace) = 0;
  virtual NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
                                   void *initData, NPAsyncSurface *surface) = 0;
  virtual NPError FinalizeAsyncSurface(NPAsyncSurface *surface) = 0;
  virtual void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) = 0;
%}

  void setEventModel(in int32_t eventModel);

  /**
   * Call NPP_SetWindow on the plugin.
   */
  void callSetWindow();

  /**
   * Get the contents scale factor for the screen the plugin is
   * drawn on.
   */
  double getContentsScaleFactor();
};