Changes to make it possible to statically link Gears. This is disabled by an
#ifdef. This only partially works. Missing pieces: - gears resources for HTML dialogs (permissions, shortcut, settings). - able to compile with a non-official gears build. Review URL: http://codereview.chromium.org/18299 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8238 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome/common
gears
webkit/glue/plugins
@ -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;
|
||||
|
@ -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(
|
||||
|
@ -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 = [
|
||||
|
@ -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;
|
||||
|
||||
|
@ -22,6 +22,7 @@ namespace NPAPI
|
||||
{
|
||||
|
||||
#define kDefaultPluginLibraryName FILE_PATH_LITERAL("default_plugin")
|
||||
#define kGearsPluginLibraryName FILE_PATH_LITERAL("gears")
|
||||
|
||||
class PluginInstance;
|
||||
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user