diff options
-rw-r--r-- | chrome/common/chrome_plugin_lib.cc | 14 | ||||
-rw-r--r-- | gears/SConscript | 25 | ||||
-rw-r--r-- | gears/SConscript.browser | 19 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_lib_win.cc | 24 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.h | 1 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list_win.cc | 10 |
6 files changed, 81 insertions, 12 deletions
diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc index 0f4b4e6..4af7a558 100644 --- a/chrome/common/chrome_plugin_lib.cc +++ b/chrome/common/chrome_plugin_lib.cc @@ -36,6 +36,12 @@ static PluginMap* g_loaded_libs; static DWORD g_plugin_thread_id = 0; static MessageLoop* g_plugin_thread_loop = NULL; +#ifdef GEARS_STATIC_LIB +// defined in gears/base/chrome/module_cr.cc +CPError STDCALL Gears_CP_Initialize(CPID id, const CPBrowserFuncs *bfuncs, + CPPluginFuncs *pfuncs); +#endif + static bool IsSingleProcessMode() { // We don't support ChromePlugins in single-process mode. CommandLine command_line; @@ -231,6 +237,14 @@ int ChromePluginLib::CP_Test(void* param) { bool ChromePluginLib::Load() { DCHECK(module_ == 0); +#ifdef GEARS_STATIC_LIB + FilePath path; + if (filename_.BaseName().value().find(FILE_PATH_LITERAL("gears")) == 0) { + CP_Initialize_ = &Gears_CP_Initialize; + return true; + } +#endif + module_ = LoadLibrary(filename_.value().c_str()); if (module_ == 0) return false; diff --git a/gears/SConscript b/gears/SConscript index 345c5c1..3d16d3e 100644 --- a/gears/SConscript +++ b/gears/SConscript @@ -74,7 +74,9 @@ vars.AddVariables( EnumVariable('MODE', 'Type of binary to generate', 'dbg', ['dbg', 'opt']), BoolVariable('OFFICIAL_BUILD', - 'Create a binary suitable for public release', 0) + 'Create a binary suitable for public release', 0), + BoolVariable('GEARS_STATIC_LIB', + 'Create a static library for linking with Chrome', 0), ) vars.Update(env) @@ -349,15 +351,24 @@ if env['OFFICIAL_BUILD']: CPPDEFINES = 'OFFICIAL_BUILD=1', M4FLAGS = '-DOFFICIAL_BUILD=1', ) +if env['GEARS_STATIC_LIB']: + env.Append( + CPPDEFINES = 'GEARS_STATIC_LIB=1', + ) # TODO: if USING_LIBPNG env.Append( CPPDEFINES = [ 'PNG_USER_CONFIG', 'CHROME_PNG_WRITE_SUPPORT', - 'GEARS_PNG_BUILD', ] ) +if not env['GEARS_STATIC_LIB']: + # If we're not linking with Chrome, don't prefix all the symbols with + # webkit_. + env.Append(CPPDEFINES = ['GEARS_PNG_BUILD']) + + # TODO: if USING_ZLIB env.Append( CPPDEFINES = [ @@ -468,7 +479,6 @@ if env['OS'] in ['win32', 'wince']: ], CPPFLAGS = [ '/nologo', - '/Zc:wchar_t-', '/c', '/W3', '/WX', @@ -600,6 +610,15 @@ if env['OS'] in ['win32', 'wince']: '/OPT:ICF', ], ) + if not env['GEARS_STATIC_LIB']: + # Build with 2-byte wchar_t's only if we're building a DLL. To link with + # Chrome, we need 4-byte wchar_t. + env.Append( + CPPFLAGS = [ + '/Zc:wchar_t-', + ], + ) + #--------------------------- LINUX --------------------------- elif env['OS'] == 'linux': env.Append( diff --git a/gears/SConscript.browser b/gears/SConscript.browser index ffb0c30..c6b4d48 100644 --- a/gears/SConscript.browser +++ b/gears/SConscript.browser @@ -503,14 +503,17 @@ outputs['MODULE'] = env.InstallAs('${SHLIBPREFIX}gears${SHLIBSUFFIX}', module) if env['OS'] in ['win32', 'wince'] and env['MODE'] == 'dbg': outputs['MODULE_PDB'] = env.InstallAs('gears.pdb', 'gears-$OS-$ARCH-$MODE-${BROWSER}.pdb') - env.Alias('gears', outputs['MODULE_PDB']) -env.Alias('gears', outputs['MODULE']) - -if env['OS'] == 'win32' and env['BROWSER'] == 'NPAPI': - lib = env.ChromeLibrary('gears-static', - env.SharedObject(GetInputs('$BROWSER_CPPSRCS')) + - GetInputs('$BROWSER_LINKSRCS')) - env.Alias('gears-static', lib) + +if env['GEARS_STATIC_LIB']: + if env['OS'] == 'win32' and env['BROWSER'] == 'NPAPI': + lib = env.ChromeLibrary('gears-static', + env.SharedObject(GetInputs('$BROWSER_CPPSRCS')) + + GetInputs('$BROWSER_LINKSRCS')) + env.Alias('gears', lib) +else: + env.Alias('gears', outputs['MODULE']) + if 'MODULE_PDB' in outputs: + env.Alias('gears', outputs['MODULE_PDB']) if env['OS'] == 'wince': env.Append(WINCE_SETUP_LINKSRCS = [ diff --git a/webkit/glue/plugins/plugin_lib_win.cc b/webkit/glue/plugins/plugin_lib_win.cc index 423056a..a5a4aff 100644 --- a/webkit/glue/plugins/plugin_lib_win.cc +++ b/webkit/glue/plugins/plugin_lib_win.cc @@ -15,6 +15,13 @@ #include "webkit/glue/plugins/plugin_constants_win.h" #include "webkit/glue/plugins/plugin_list.h" +#ifdef GEARS_STATIC_LIB +// defined in gears/base/common/module.cc +NPError API_CALL Gears_NP_GetEntryPoints(NPPluginFuncs* funcs); +NPError API_CALL Gears_NP_Initialize(NPNetscapeFuncs* funcs); +NPError API_CALL Gears_NP_Shutdown(void); +#endif + namespace NPAPI { @@ -60,6 +67,21 @@ static const InternalPluginInfo g_internal_plugins[] = { default_plugin::NP_Initialize, default_plugin::NP_Shutdown }, +#ifdef GEARS_STATIC_LIB + { + {FilePath(kGearsPluginLibraryName), + L"Gears", + L"Statically linked Gears", + L"1, 0, 0, 1", + L"application/x-googlegears", + L"", + L"" + }, + Gears_NP_GetEntryPoints, + Gears_NP_Initialize, + Gears_NP_Shutdown + }, +#endif }; static const size_t g_internal_plugins_size = arraysize(g_internal_plugins); @@ -117,6 +139,8 @@ bool CreateWebPluginInfo(const PluginVersionInfo& pvi, SplitString(base::SysWideToNativeMB(pvi.file_extents), '|', &file_extensions); SplitString(pvi.file_open_names, '|', &descriptions); + info->mime_types.clear(); + if (mime_types.empty()) return false; diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 088217e..3b1a76d 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -22,6 +22,7 @@ namespace NPAPI { #define kDefaultPluginLibraryName FILE_PATH_LITERAL("default_plugin") +#define kGearsPluginLibraryName FILE_PATH_LITERAL("gears") class PluginInstance; diff --git a/webkit/glue/plugins/plugin_list_win.cc b/webkit/glue/plugins/plugin_list_win.cc index bb81ddc..94dcce3 100644 --- a/webkit/glue/plugins/plugin_list_win.cc +++ b/webkit/glue/plugins/plugin_list_win.cc @@ -324,10 +324,18 @@ bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info) { } void PluginList::LoadInternalPlugins() { + WebPluginInfo info; + + #ifdef GEARS_STATIC_LIB + if (PluginLib::ReadWebPluginInfo(FilePath(kGearsPluginLibraryName), + &info)) { + plugins_.push_back(info); + } +#endif + if (!use_internal_activex_shim_) return; - WebPluginInfo info; if (PluginLib::ReadWebPluginInfo(FilePath(kActiveXShimFileName), &info)) { plugins_.push_back(info); |