1 /* 2 * Copyright 2009, The Android Open Source Project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 /* 27 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in 28 consideration of your agreement to the following terms, and your use, installation, 29 modification or redistribution of this Apple software constitutes acceptance of these 30 terms. If you do not agree with these terms, please do not use, install, modify or 31 redistribute this Apple software. 32 33 In consideration of your agreement to abide by the following terms, and subject to these 34 terms, Apple grants you a personal, non-exclusive license, under Apples copyrights in 35 this original Apple software (the "Apple Software"), to use, reproduce, modify and 36 redistribute the Apple Software, with or without modifications, in source and/or binary 37 forms; provided that if you redistribute the Apple Software in its entirety and without 38 modifications, you must retain this notice and the following text and disclaimers in all 39 such redistributions of the Apple Software. Neither the name, trademarks, service marks 40 or logos of Apple Computer, Inc. may be used to endorse or promote products derived from 41 the Apple Software without specific prior written permission from Apple. Except as expressly 42 stated in this notice, no other rights or licenses, express or implied, are granted by Apple 43 herein, including but not limited to any patent rights that may be infringed by your 44 derivative works or by other works in which the Apple Software may be incorporated. 45 46 The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, 47 EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, 48 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS 49 USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 50 51 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL 52 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 53 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, 54 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND 55 WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR 56 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 57 */ 58 59 #ifndef PluginObject__DEFINED 60 #define PluginObject__DEFINED 61 62 #include "main.h" 63 64 class SubPlugin { 65 public: 66 SubPlugin(NPP inst) : m_inst(inst) {} 67 virtual ~SubPlugin() {} 68 virtual int16_t handleEvent(const ANPEvent* evt) = 0; 69 70 NPP inst() const { return m_inst; } 71 72 private: 73 NPP m_inst; 74 }; 75 76 typedef struct PluginObject { 77 NPObject header; 78 NPP npp; 79 NPWindow* window; 80 81 SubPlugin* subPlugin; 82 83 } PluginObject; 84 85 NPClass *getPluginClass(void); 86 87 #endif // PluginObject__DEFINED 88