Back to index

lightning-sunbird  0.9+nobinonly
plugin.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef __PLUGIN_HPP__
00039 #define __PLUGIN_HPP__
00040 
00041 #include "npapi.h"
00042 
00043 class CPlugin
00044 {
00045 private:
00046   HMODULE   m_hInst;
00047   NPP       m_pNPInstance;
00048   SHORT     m_wMode;
00049   HWND      m_hWnd;
00050   HWND      m_hWndParent;
00051   HPOINTER  m_hIcon;
00052   char *    m_szURLString;
00053 
00054   char *    m_szCommandMessage;
00055   BOOL      m_bWaitingStreamFromPFS;
00056   NPStream* m_PFSStream;
00057 
00058 public:
00059   BOOL       m_bHidden;
00060   NPMIMEType m_pNPMIMEType;
00061   PSZ        m_szPageURL;       // Location of plug-in HTML page
00062   PSZ        m_szFileURL;       // Location of plug-in JAR file 
00063   PSZ        m_szFileExtension; // File extension associated with the of the unknown mimetype
00064   HWND       m_hWndDialog;
00065 
00066   // environment
00067   BOOL m_bOnline;
00068   BOOL m_bJava;
00069   BOOL m_bJavaScript;
00070   BOOL m_bSmartUpdate;
00071 
00072 private:
00073   BOOL useDefaultURL_P();
00074   BOOL doSmartUpdate_P();
00075   PSZ createURLString();
00076   void getPluginSmart();
00077   void getPluginRegular();
00078 
00079 public:
00080   CPlugin(HMODULE hInst, 
00081           NPP pNPInstance, 
00082           SHORT wMode, 
00083           NPMIMEType pluginType, 
00084           PSZ szPageURL, 
00085           PSZ szFileURL, 
00086           PSZ szFileExtension,
00087           BOOL bHidden);
00088   ~CPlugin();
00089 
00090   BOOL init(HWND hWnd);
00091   void shut();
00092   HWND getWindow();
00093   void showGetPluginDialog();
00094   void getPlugin();
00095   BOOL readyToRefresh();
00096 
00097   // NP API handlers
00098   void print(NPPrint * pNPPrint);
00099   void URLNotify(const char * szURL);
00100   NPError newStream(NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype);
00101   NPError destroyStream(NPStream *stream, NPError reason);
00102 
00103   // Windows message handlers
00104   void onCreate(HWND hWnd);
00105   void onLButtonUp(HWND hWnd, int x, int y, UINT keyFlags);
00106   void onRButtonUp(HWND hWnd, int x, int y, UINT keyFlags);
00107   void onPaint(HWND hWnd);
00108 
00109   void resize();
00110 };
00111 
00112 
00113 #define PAGE_URL_FOR_JAVASCRIPT "http://plugindoc.mozdev.org/winmime.html"
00114 
00115 #define PLUGINFINDER_COMMAND_BEGINNING "javascript:window.open(\""
00116 #define PLUGINFINDER_COMMAND_END "\",\"plugin\",\"toolbar=no,status=no,resizable=no,scrollbars=no,height=252,width=626\");"
00117 #define DEFAULT_PLUGINFINDER_URL "http://plugindoc.mozdev.org/OS2.html"
00118 #define JVM_SMARTUPDATE_URL "http://plugindoc.mozdev.org/OS2.html"
00119 
00120 #define OS2INI_PLACE "Mozilla Default Plugin"
00121 #define GWL_USERDATA        0
00122 #define COLOR_3DSHADOW      COLOR_BTNFACE
00123 #define COLOR_3DLIGHT       COLOR_BTNHIGHLIGHT
00124 #define COLOR_3DDKSHADOW    COLOR_BTNSHADOW
00125 
00126 #define CLASS_NULL_PLUGIN "NullPluginClass"
00127  
00128 BOOL RegisterNullPluginWindowClass();
00129 void UnregisterNullPluginWindowClass();
00130 
00131 extern HMODULE hInst;
00132 
00133 #endif // __PLUGIN_HPP__