• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 /*
6  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef PluginObject_h
31 #define PluginObject_h
32 
33 #include <bindings/npfunctions.h>
34 #include <stdarg.h>
35 
36 class PluginTest;
37 
38 extern NPNetscapeFuncs *browser;
39 extern NPPluginFuncs* pluginFunctions;
40 
41 typedef struct {
42     NPObject header;
43 
44     PluginTest* pluginTest;
45 
46     NPP npp;
47     NPBool eventLogging;
48     NPBool logSetWindow;
49     NPBool logDestroy;
50     NPBool returnNegativeOneFromWrite;
51     NPBool returnErrorFromNewStream;
52     NPObject* testObject;
53     NPObject* rememberedObject;
54     NPStream* stream;
55     NPBool testGetURLOnDestroy;
56     NPBool testWindowOpen;
57     NPBool testKeyboardFocusForPlugins;
58     NPBool mouseDownForEvaluateScript;
59     char* onStreamLoad;
60     char* onStreamDestroy;
61     char* onDestroy;
62     char* onURLNotify;
63     char* onSetWindow;
64     char* onPaintEvent;
65     char* firstUrl;
66     char* firstHeaders;
67     char* lastUrl;
68     char* lastHeaders;
69     char* evaluateScriptOnMouseDownOrKeyDown;
70 #ifdef XP_MACOSX
71     NPEventModel eventModel;
72 #endif
73 #ifdef XP_MACOSX
74     void* coreAnimationLayer;
75 #endif
76     NPWindow lastWindow;
77     NPBool alwaysFilterEvents;
78 } PluginObject;
79 
80 extern NPClass* createPluginClass(void);
81 
82 extern void handleCallback(PluginObject* object,
83                            const char* url,
84                            NPReason reason,
85                            void* notifyData);
86 extern void notifyStream(PluginObject* object,
87                          const char* url,
88                          const char* headers);
89 extern void testNPRuntime(NPP npp);
90 extern void pluginLog(NPP instance, const char* format, ...);
91 extern void pluginLogWithArguments(NPP instance,
92                                    const char* format,
93                                    va_list args);
94 extern bool testDocumentOpen(NPP npp);
95 extern bool testWindowOpen(NPP npp);
96 
97 #ifdef XP_MACOSX
98 extern void* createCoreAnimationLayer();
99 #endif
100 
101 #endif // PluginObject_h
102