summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorgspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 01:13:12 +0000
committergspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 01:13:12 +0000
commit8c2b005ffdc22c871638d0cfd356441741247bd5 (patch)
tree19aafa4b3663bb05548c1918f3e948a8e61ada48 /o3d
parentdf16dd7c01c843479217c472392959e723accd8b (diff)
downloadchromium_src-8c2b005ffdc22c871638d0cfd356441741247bd5.zip
chromium_src-8c2b005ffdc22c871638d0cfd356441741247bd5.tar.gz
chromium_src-8c2b005ffdc22c871638d0cfd356441741247bd5.tar.bz2
Adds in the ActiveX control for O3D.
Review URL: http://codereview.chromium.org/160078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/build/all.gyp11
-rw-r--r--o3d/plugin/npapi_host_control/win/dispatch_proxy.cc10
-rw-r--r--o3d/plugin/npapi_host_control/win/host_control.cc2
-rw-r--r--o3d/plugin/npapi_host_control/win/np_object_proxy.cc10
-rw-r--r--o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc5
-rw-r--r--o3d/plugin/npapi_host_control/win/stream_operation.cc2
-rw-r--r--o3d/plugin/plugin.gyp65
7 files changed, 90 insertions, 15 deletions
diff --git a/o3d/build/all.gyp b/o3d/build/all.gyp
index 8705962..2229b2e3 100644
--- a/o3d/build/all.gyp
+++ b/o3d/build/all.gyp
@@ -25,13 +25,22 @@
'../import/import.gyp:o3dImport',
'../plugin/idl/idl.gyp:o3dPluginIdl',
'../plugin/plugin.gyp:add_version',
- '../plugin/plugin.gyp:npo3dautoplugin',
+ '../plugin/plugin.gyp:o3dPlugin',
'../plugin/plugin.gyp:o3dPluginLogging',
'../serializer/serializer.gyp:o3dSerializer',
'../statsreport/statsreport.gyp:o3dStatsReport',
'../tests/tests.gyp:unit_tests',
'../utils/utils.gyp:o3dUtils',
],
+ 'conditions': [
+ ['OS=="win"',
+ {
+ 'dependencies': [
+ '../plugin/plugin.gyp:o3dActiveXHost',
+ ],
+ },
+ ],
+ ],
},
],
}
diff --git a/o3d/plugin/npapi_host_control/win/dispatch_proxy.cc b/o3d/plugin/npapi_host_control/win/dispatch_proxy.cc
index 334bda4..64c8c23 100644
--- a/o3d/plugin/npapi_host_control/win/dispatch_proxy.cc
+++ b/o3d/plugin/npapi_host_control/win/dispatch_proxy.cc
@@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+#define _SCL_SECURE_NO_WARNINGS
#include "plugin/npapi_host_control/win/dispatch_proxy.h"
#include <atlstr.h>
@@ -68,8 +68,12 @@ HRESULT DispatchInvoke(NPBrowserProxy* browser_proxy,
DISPPARAMS disp_arguments = {0};
disp_arguments.cArgs = arg_count;
disp_arguments.rgvarg = local_args.get();
- hr = dispatch->InvokeEx(member, LOCALE_SYSTEM_DEFAULT,
- flags, &disp_arguments, &return_arg, NULL,
+ hr = dispatch->InvokeEx(member,
+ LOCALE_SYSTEM_DEFAULT,
+ static_cast<WORD>(flags),
+ &disp_arguments,
+ &return_arg,
+ NULL,
NULL);
// If the invoke succeeded, then convert and store the return argument.
diff --git a/o3d/plugin/npapi_host_control/win/host_control.cc b/o3d/plugin/npapi_host_control/win/host_control.cc
index 87f2303..117245c 100644
--- a/o3d/plugin/npapi_host_control/win/host_control.cc
+++ b/o3d/plugin/npapi_host_control/win/host_control.cc
@@ -515,7 +515,7 @@ STDMETHODIMP CHostControl::Load(IPropertyBag* property_bag,
if (property_bag2) {
ULONG property_count;
if (SUCCEEDED(property_bag2->CountProperties(&property_count))) {
- for (int x = 0; x < property_count; ++x) {
+ for (ULONG x = 0; x < property_count; ++x) {
PROPBAG2 property = {0};
ULONG properties_read = 0;
if (SUCCEEDED(property_bag2->GetPropertyInfo(x, 1, &property,
diff --git a/o3d/plugin/npapi_host_control/win/np_object_proxy.cc b/o3d/plugin/npapi_host_control/win/np_object_proxy.cc
index e75b421..4c6ee3b 100644
--- a/o3d/plugin/npapi_host_control/win/np_object_proxy.cc
+++ b/o3d/plugin/npapi_host_control/win/np_object_proxy.cc
@@ -126,7 +126,7 @@ STDMETHODIMP NPObjectProxy::GetIDsOfNames(REFIID riid,
// Convert all of the wide string arguments to UTF-8.
scoped_array<char *> utf8_names(new char*[cNames]);
- for (int x = 0; x < cNames; ++x) {
+ for (UINT x = 0; x < cNames; ++x) {
size_t name_length = wcstombs(NULL, rgszNames[x], 0) + 1;
utf8_names[x] = new char[name_length];
wcstombs(utf8_names[x], rgszNames[x], name_length);
@@ -137,11 +137,11 @@ STDMETHODIMP NPObjectProxy::GetIDsOfNames(REFIID riid,
// For each string in the input arguments, look for a match in the set of
// ids supported by the object instance.
NPUTF8 *string_id = NULL;
- for (int x = 0; x < id_count; ++x) {
+ for (uint32 x = 0; x < id_count; ++x) {
string_id = NPBrowserProxy::GetBrowserFunctions()->
utf8fromidentifier(supported_ids[x]);
ATLASSERT(string_id);
- for (int y = 0; y < cNames; ++y) {
+ for (UINT y = 0; y < cNames; ++y) {
if (strcmp(utf8_names[y], string_id) == 0) {
// Return the ADDRESS of the supported ids string as the DISPID
// for the method.
@@ -154,7 +154,7 @@ STDMETHODIMP NPObjectProxy::GetIDsOfNames(REFIID riid,
}
// Free all intermediate string resources.
- for (int x = 0; x < cNames; ++x) {
+ for (UINT x = 0; x < cNames; ++x) {
delete[] utf8_names[x];
}
NPBrowserProxy::GetBrowserFunctions()->memfree(supported_ids);
@@ -508,7 +508,7 @@ STDMETHODIMP NPObjectProxy::GetNPObjectInstance(void **np_instance) {
bool NPObjectProxy::HasPropertyOrMethod(NPIdentifier np_identifier) {
if (!hosted_) {
- return E_FAIL;
+ return false;
}
return (hosted_->_class->hasProperty != NULL &&
diff --git a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc
index 8fb2ca3..04cd24a 100644
--- a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc
+++ b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc
@@ -291,7 +291,7 @@ void NPPluginProxy::TearDown() {
// completed.
HRESULT hr;
std::vector<HANDLE> stream_handles;
- for (int x = 0; x < active_stream_ops_.size(); ++x) {
+ for (StreamOpArray::size_type x = 0; x < active_stream_ops_.size(); ++x) {
// Request that the stream finish early - so that large file transfers do
// not block leaving the page.
hr = active_stream_ops_[x]->RequestCancellation();
@@ -330,7 +330,8 @@ void NPPluginProxy::TearDown() {
// Note: This approach will potentially leak resources allocated by
// the plug-in, but it prevents access to stale data by the threads
// once the plug-in has been unloaded.
- for (int x = 0; x < active_stream_ops_.size(); ++x) {
+ for (StreamOpArray::size_type x = 0;
+ x < active_stream_ops_.size(); ++x) {
BOOL thread_kill = TerminateThread(stream_handles[x], 0);
ATLASSERT(thread_kill && "Failure killing stalled download thread.");
}
diff --git a/o3d/plugin/npapi_host_control/win/stream_operation.cc b/o3d/plugin/npapi_host_control/win/stream_operation.cc
index 8c0e385..b18c3c9 100644
--- a/o3d/plugin/npapi_host_control/win/stream_operation.cc
+++ b/o3d/plugin/npapi_host_control/win/stream_operation.cc
@@ -410,7 +410,7 @@ HRESULT STDMETHODCALLTYPE StreamOperation::OnDataAvailable(
// Read all of the available data, and pass it to the plug-in, if requested.
HRESULT hr;
char local_data[16384];
- int bytes_received_total = 0;
+ DWORD bytes_received_total = 0;
// If a large number of bytes have been received, then this loop can
// take a long time to complete - which will block the user from leaving
// the page as the plug-in waits for all transfers to complete. We
diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp
index 82b6ff6..8891709 100644
--- a/o3d/plugin/plugin.gyp
+++ b/o3d/plugin/plugin.gyp
@@ -16,14 +16,15 @@
'../../<(gtestdir)',
],
'defines': [
- 'O3D_PLUGIN_NAME="<!(python version_info.py --name)"',
'O3D_PLUGIN_DESCRIPTION="<!(python version_info.py --description)"',
'O3D_PLUGIN_MIME_TYPE="<!(python version_info.py --mimetype)"',
+ 'O3D_PLUGIN_NAME="<!(python version_info.py --name)"',
+ 'O3D_PLUGIN_VERSION="<!(python version_info.py --version)"',
],
},
'targets': [
{
- 'target_name': 'npo3dautoplugin',
+ 'target_name': 'o3dPlugin',
'type': '<(o3d_main_lib_type)',
'dependencies': [
'../../<(jpegdir)/libjpeg.gyp:libjpeg',
@@ -212,5 +213,65 @@
],
},
],
+ ['OS=="win"',
+ {
+ 'targets': [
+ {
+ 'target_name': 'o3dActiveXHost',
+ 'type': 'shared_library',
+ 'include_dirs': [
+ '<(INTERMEDIATE_DIR)',
+ ],
+ 'sources': [
+ '<(INTERMEDIATE_DIR)/npapi_host_control_i.c',
+ 'npapi_host_control/win/dispatch_proxy.cc',
+ 'npapi_host_control/win/dispatch_proxy.h',
+ 'npapi_host_control/win/host_control.cc',
+ 'npapi_host_control/win/host_control.h',
+ 'npapi_host_control/win/module.h',
+ 'npapi_host_control/win/np_browser_proxy.cc',
+ 'npapi_host_control/win/np_browser_proxy.h',
+ 'npapi_host_control/win/np_object_proxy.cc',
+ 'npapi_host_control/win/np_object_proxy.h',
+ 'npapi_host_control/win/np_plugin_proxy.cc',
+ 'npapi_host_control/win/np_plugin_proxy.h',
+ 'npapi_host_control/win/npapi_host_control.cc',
+ 'npapi_host_control/win/npapi_host_control.idl',
+ 'npapi_host_control/win/npapi_host_control.rc',
+ 'npapi_host_control/win/precompile.h',
+ 'npapi_host_control/win/resource.h',
+ 'npapi_host_control/win/stream_operation.cc',
+ 'npapi_host_control/win/stream_operation.h',
+ 'npapi_host_control/win/variant_utils.cc',
+ 'npapi_host_control/win/variant_utils.h',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lwininet.lib',
+ ],
+ },
+ 'defines': [
+ '_MIDL_USE_GUIDDEF_',
+ 'DLL_NPAPI_HOST_CONTROL_EXPORT',
+ ],
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'ModuleDefinitionFile':
+ 'npapi_host_control/win/npapi_host_control.def'
+ },
+ 'VCCLCompilerTool': {
+ 'ForcedIncludeFiles':
+ 'plugin/npapi_host_control/win/precompile.h',
+ 'CompileAs': '2', # Build all the files as C++, since
+ # ATL requires that.
+ },
+ },
+ 'msvs_configuration_attributes': {
+ 'UseOfATL': '1', # 1 = static link to ATL, 2 = dynamic link
+ },
+ },
+ ],
+ },
+ ],
],
}