summaryrefslogtreecommitdiffstats
path: root/ceee
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 01:14:41 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 01:14:41 +0000
commitf30e74751217091c0b6050080f46cd6eb4914226 (patch)
treea2dcb8e715d1578698856e38c36459602dc19732 /ceee
parent9b2ab5910c58603ec655bb613bec7596e732f87b (diff)
downloadchromium_src-f30e74751217091c0b6050080f46cd6eb4914226.zip
chromium_src-f30e74751217091c0b6050080f46cd6eb4914226.tar.gz
chromium_src-f30e74751217091c0b6050080f46cd6eb4914226.tar.bz2
Adding a privileged callback used in IE CF to check whether to show
the version mismatch warning dialog. Used this in ceee/ to only show it once per tab. Changed the logic in Firefox to show the warning dialog even when in privileged mode. This will mean it gets shown once per Firefox window. Wrote a unit test for the additional logic in ChromeFrameActivex. To write the unit test, used com_mock.py to generate a mock of the IChromeFramePrivileged interface. This can be extended to generate mocks of the other CF interfaces. Discovered duplication of np_browser_functions.h and .cc, resolved this to a single copy (the one under chrome_frame). Changed things around so chrome_tab.idl is built only once; this also lets me more easily depend on it in the com_mock rule. BUG=none TEST=chrome_frame_unittests.exe Review URL: http://codereview.chromium.org/4563001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee')
-rw-r--r--ceee/common/common.gyp2
-rw-r--r--ceee/common/np_browser_functions.cc435
-rw-r--r--ceee/common/np_browser_functions.h260
-rw-r--r--ceee/ie/common/chrome_frame_host.cc5
-rw-r--r--ceee/ie/common/chrome_frame_host.h1
-rw-r--r--ceee/ie/common/common.gyp4
-rw-r--r--ceee/ie/plugin/bho/infobar_browser_window.cc5
-rw-r--r--ceee/ie/plugin/bho/infobar_browser_window.h1
-rw-r--r--ceee/ie/plugin/toolband/tool_band.cc6
-rw-r--r--ceee/ie/plugin/toolband/tool_band.h1
-rw-r--r--ceee/ie/plugin/toolband/toolband.gyp20
-rw-r--r--ceee/testing/utils/mock_com.h9
-rw-r--r--ceee/testing/utils/mock_ioleclientsite.gen15
-rw-r--r--ceee/testing/utils/test_utils.gyp1
14 files changed, 45 insertions, 720 deletions
diff --git a/ceee/common/common.gyp b/ceee/common/common.gyp
index ce8cc2b..82f61d6 100644
--- a/ceee/common/common.gyp
+++ b/ceee/common/common.gyp
@@ -62,8 +62,6 @@
'initializing_coclass.h',
'install_utils.cc',
'install_utils.h',
- 'np_browser_functions.cc',
- 'np_browser_functions.h',
'npobject_impl.cc',
'npobject_impl.h',
'npplugin_impl.cc',
diff --git a/ceee/common/np_browser_functions.cc b/ceee/common/np_browser_functions.cc
deleted file mode 100644
index b421f7c..0000000
--- a/ceee/common/np_browser_functions.cc
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include "ceee/common/np_browser_functions.h"
-
-#include "base/logging.h"
-
-namespace npapi {
-
-// global function pointers (within this namespace) for the NPN functions.
-NPN_GetURLProcPtr g_geturl = NULL;
-NPN_PostURLProcPtr g_posturl = NULL;
-NPN_RequestReadProcPtr g_requestread = NULL;
-NPN_NewStreamProcPtr g_newstream = NULL;
-NPN_WriteProcPtr g_write = NULL;
-NPN_DestroyStreamProcPtr g_destroystream = NULL;
-NPN_StatusProcPtr g_status = NULL;
-NPN_UserAgentProcPtr g_useragent = NULL;
-NPN_MemAllocProcPtr g_memalloc = NULL;
-NPN_MemFreeProcPtr g_memfree = NULL;
-NPN_MemFlushProcPtr g_memflush = NULL;
-NPN_ReloadPluginsProcPtr g_reloadplugins = NULL;
-NPN_GetJavaEnvProcPtr g_getJavaEnv = NULL;
-NPN_GetJavaPeerProcPtr g_getJavaPeer = NULL;
-NPN_GetURLNotifyProcPtr g_geturlnotify = NULL;
-NPN_PostURLNotifyProcPtr g_posturlnotify = NULL;
-NPN_GetValueProcPtr g_getvalue = NULL;
-NPN_SetValueProcPtr g_setvalue = NULL;
-NPN_InvalidateRectProcPtr g_invalidaterect = NULL;
-NPN_InvalidateRegionProcPtr g_invalidateregion = NULL;
-NPN_ForceRedrawProcPtr g_forceredraw = NULL;
-NPN_GetStringIdentifierProcPtr g_getstringidentifier = NULL;
-NPN_GetStringIdentifiersProcPtr g_getstringidentifiers = NULL;
-NPN_GetIntIdentifierProcPtr g_getintidentifier = NULL;
-NPN_IdentifierIsStringProcPtr g_identifierisstring = NULL;
-NPN_UTF8FromIdentifierProcPtr g_utf8fromidentifier = NULL;
-NPN_IntFromIdentifierProcPtr g_intfromidentifier = NULL;
-NPN_CreateObjectProcPtr g_createobject = NULL;
-NPN_RetainObjectProcPtr g_retainobject = NULL;
-NPN_ReleaseObjectProcPtr g_releaseobject = NULL;
-NPN_InvokeProcPtr g_invoke = NULL;
-NPN_InvokeDefaultProcPtr g_invoke_default = NULL;
-NPN_EvaluateProcPtr g_evaluate = NULL;
-NPN_GetPropertyProcPtr g_getproperty = NULL;
-NPN_SetPropertyProcPtr g_setproperty = NULL;
-NPN_RemovePropertyProcPtr g_removeproperty = NULL;
-NPN_HasPropertyProcPtr g_hasproperty = NULL;
-NPN_HasMethodProcPtr g_hasmethod = NULL;
-NPN_ReleaseVariantValueProcPtr g_releasevariantvalue = NULL;
-NPN_SetExceptionProcPtr g_setexception = NULL;
-NPN_PushPopupsEnabledStateProcPtr g_pushpopupsenabledstate = NULL;
-NPN_PopPopupsEnabledStateProcPtr g_poppopupsenabledstate = NULL;
-NPN_EnumerateProcPtr g_enumerate = NULL;
-NPN_PluginThreadAsyncCallProcPtr g_pluginthreadasynccall = NULL;
-NPN_ConstructProcPtr g_construct = NULL;
-
-// Must be called prior to calling any of the browser functions below.
-void InitializeBrowserFunctions(NPNetscapeFuncs* functions) {
- CHECK(functions);
- DCHECK(g_geturl == NULL || g_geturl == functions->geturl);
-
- g_geturl = functions->geturl;
- g_posturl = functions->posturl;
- g_requestread = functions->requestread;
- g_newstream = functions->newstream;
- g_write = functions->write;
- g_destroystream = functions->destroystream;
- g_status = functions->status;
- g_useragent = functions->uagent;
- g_memalloc = functions->memalloc;
- g_memfree = functions->memfree;
- g_memflush = functions->memflush;
- g_reloadplugins = functions->reloadplugins;
- g_getJavaEnv = functions->getJavaEnv;
- g_getJavaPeer = functions->getJavaPeer;
- g_geturlnotify = functions->geturlnotify;
- g_posturlnotify = functions->posturlnotify;
- g_getvalue = functions->getvalue;
- g_setvalue = functions->setvalue;
- g_invalidaterect = functions->invalidaterect;
- g_invalidateregion = functions->invalidateregion;
- g_forceredraw = functions->forceredraw;
- g_getstringidentifier = functions->getstringidentifier;
- g_getstringidentifiers = functions->getstringidentifiers;
- g_getintidentifier = functions->getintidentifier;
- g_identifierisstring = functions->identifierisstring;
- g_utf8fromidentifier = functions->utf8fromidentifier;
- g_intfromidentifier = functions->intfromidentifier;
- g_createobject = functions->createobject;
- g_retainobject = functions->retainobject;
- g_releaseobject = functions->releaseobject;
- g_invoke = functions->invoke;
- g_invoke_default = functions->invokeDefault;
- g_evaluate = functions->evaluate;
- g_getproperty = functions->getproperty;
- g_setproperty = functions->setproperty;
- g_removeproperty = functions->removeproperty;
- g_hasproperty = functions->hasproperty;
- g_hasmethod = functions->hasmethod;
- g_releasevariantvalue = functions->releasevariantvalue;
- g_setexception = functions->setexception;
- g_pushpopupsenabledstate = functions->pushpopupsenabledstate;
- g_poppopupsenabledstate = functions->poppopupsenabledstate;
- g_enumerate = functions->enumerate;
- g_pluginthreadasynccall = functions->pluginthreadasynccall;
- g_construct = functions->construct;
-}
-
-void UninitializeBrowserFunctions() {
-// We skip doing this in the official build as it doesn't serve much purpose
-// during shutdown. The reason for it being here in the other types of builds
-// is to spot potential browser bugs whereby the browser leaves living objects
-// in our DLL after shutdown has been called. In theory those objects could
-// trigger a call to the browser functions after shutdown has been called
-// and for non official builds we want that to simply crash.
-// For official builds we leave the function pointers around since they
-// continue to valid.
- g_geturl = NULL;
- g_posturl = NULL;
- g_requestread = NULL;
- g_newstream = NULL;
- g_write = NULL;
- g_destroystream = NULL;
- g_status = NULL;
- g_useragent = NULL;
- g_memalloc = NULL;
- g_memfree = NULL;
- g_memflush = NULL;
- g_reloadplugins = NULL;
- g_getJavaEnv = NULL;
- g_getJavaPeer = NULL;
- g_geturlnotify = NULL;
- g_posturlnotify = NULL;
- g_getvalue = NULL;
- g_setvalue = NULL;
- g_invalidaterect = NULL;
- g_invalidateregion = NULL;
- g_forceredraw = NULL;
- g_getstringidentifier = NULL;
- g_getstringidentifiers = NULL;
- g_getintidentifier = NULL;
- g_identifierisstring = NULL;
- g_utf8fromidentifier = NULL;
- g_intfromidentifier = NULL;
- g_createobject = NULL;
- g_retainobject = NULL;
- g_releaseobject = NULL;
- g_invoke = NULL;
- g_invoke_default = NULL;
- g_evaluate = NULL;
- g_getproperty = NULL;
- g_setproperty = NULL;
- g_removeproperty = NULL;
- g_hasproperty = NULL;
- g_hasmethod = NULL;
- g_releasevariantvalue = NULL;
- g_setexception = NULL;
- g_pushpopupsenabledstate = NULL;
- g_poppopupsenabledstate = NULL;
- g_enumerate = NULL;
- g_pluginthreadasynccall = NULL;
- g_construct = NULL;
-}
-
-bool IsInitialized() {
- // We only check one function for convenience.
- return g_getvalue != NULL;
-}
-
-// Function stubs for functions that the host browser implements.
-
-NPError GetURL(NPP instance, const char* URL, const char* window) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_geturl(instance, URL, window);
-}
-
-NPError PostURL(NPP instance, const char* URL, const char* window, uint32 len,
- const char* buf, NPBool file) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_posturl(instance, URL, window, len, buf, file);
-}
-
-NPError RequestRead(NPStream* stream, NPByteRange* rangeList) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_requestread(stream, rangeList);
-}
-
-NPError NewStream(NPP instance, NPMIMEType type, const char* window,
- NPStream** stream) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_newstream(instance, type, window, stream);
-}
-
-int32 Write(NPP instance, NPStream* stream, int32 len, void* buffer) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_write(instance, stream, len, buffer);
-}
-
-NPError DestroyStream(NPP instance, NPStream* stream, NPReason reason) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_destroystream(instance, stream, reason);
-}
-
-void Status(NPP instance, const char* message) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_status(instance, message);
-}
-
-const char* UserAgent(NPP instance) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_useragent(instance);
-}
-
-void* MemAlloc(uint32 size) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_memalloc(size);
-}
-
-void MemFree(void* ptr) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_memfree(ptr);
-}
-
-uint32 MemFlush(uint32 size) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_memflush(size);
-}
-
-void ReloadPlugins(NPBool reloadPages) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_reloadplugins(reloadPages);
-}
-
-void* GetJavaEnv() {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getJavaEnv();
-}
-
-void* GetJavaPeer(NPP instance) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getJavaPeer(instance);
-}
-
-NPError GetURLNotify(NPP instance, const char* URL, const char* window,
- void* notifyData) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_geturlnotify(instance, URL, window, notifyData);
-}
-
-NPError PostURLNotify(NPP instance, const char* URL, const char* window,
- uint32 len, const char* buf, NPBool file,
- void* notifyData) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_posturlnotify(instance, URL, window, len, buf, file, notifyData);
-}
-
-NPError GetValue(NPP instance, NPNVariable variable, void* ret_value) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getvalue(instance, variable, ret_value);
-}
-
-NPError SetValue(NPP instance, NPPVariable variable, void* value) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_setvalue(instance, variable, value);
-}
-
-void InvalidateRect(NPP instance, NPRect* rect) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_invalidaterect(instance, rect);
-}
-
-void InvalidateRegion(NPP instance, NPRegion region) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_invalidateregion(instance, region);
-}
-
-void ForceRedraw(NPP instance) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_forceredraw(instance);
-}
-
-void ReleaseVariantValue(NPVariant* variant) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_releasevariantvalue(variant);
-}
-
-NPIdentifier GetStringIdentifier(const NPUTF8* name) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getstringidentifier(name);
-}
-
-void GetStringIdentifiers(const NPUTF8** names, int32_t nameCount,
- NPIdentifier* identifiers) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getstringidentifiers(names, nameCount, identifiers);
-}
-
-NPIdentifier GetIntIdentifier(int32_t intid) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getintidentifier(intid);
-}
-
-int32_t IntFromIdentifier(NPIdentifier identifier) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_intfromidentifier(identifier);
-}
-
-bool IdentifierIsString(NPIdentifier identifier) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_identifierisstring(identifier);
-}
-
-NPUTF8* UTF8FromIdentifier(NPIdentifier identifier) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_utf8fromidentifier(identifier);
-}
-
-NPObject* CreateObject(NPP instance, NPClass* aClass) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_createobject(instance, aClass);
-}
-
-NPObject* RetainObject(NPObject* obj) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_retainobject(obj);
-}
-
-void ReleaseObject(NPObject* obj) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_releaseobject(obj);
-}
-
-bool Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
- const NPVariant* args, unsigned argCount, NPVariant* result) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_invoke(npp, obj, methodName, args, argCount, result);
-}
-
-bool InvokeDefault(NPP npp, NPObject* obj, const NPVariant* args,
- unsigned argCount, NPVariant* result) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_invoke_default(npp, obj, args, argCount, result);
-}
-
-bool Evaluate(NPP npp, NPObject* obj, NPString* script, NPVariant* result) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_evaluate(npp, obj, script, result);
-}
-
-bool GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
- NPVariant* result) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_getproperty(npp, obj, propertyName, result);
-}
-
-bool SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
- const NPVariant* value) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_setproperty(npp, obj, propertyName, value);
-}
-
-bool HasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_hasproperty(npp, npobj, propertyName);
-}
-
-bool HasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_hasmethod(npp, npobj, methodName);
-}
-
-bool RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_removeproperty(npp, obj, propertyName);
-}
-
-void SetException(NPObject* obj, const NPUTF8* message) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_setexception(obj, message);
-}
-
-void PushPopupsEnabledState(NPP npp, NPBool enabled) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_pushpopupsenabledstate(npp, enabled);
-}
-
-void PopPopupsEnabledState(NPP npp) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_poppopupsenabledstate(npp);
-}
-
-bool Enumerate(NPP npp, NPObject* obj, NPIdentifier** identifier,
- uint32_t* count) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_enumerate(npp, obj, identifier, count);
-}
-
-void PluginThreadAsyncCall(NPP instance,
- void (*func)(void*), // NOLINT
- void* userData) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_pluginthreadasynccall(instance, func, userData);
-}
-
-bool Construct(NPP npp, NPObject* obj, const NPVariant* args, uint32_t argCount,
- NPVariant* result) {
- DCHECK(IsInitialized()) << __FUNCTION__;
- return g_construct(npp, obj, args, argCount, result);
-}
-
-std::string StringFromIdentifier(NPIdentifier identifier) {
- std::string ret;
- NPUTF8* utf8 = UTF8FromIdentifier(identifier);
- if (utf8) {
- ret = utf8;
- MemFree(utf8);
- }
- return ret;
-}
-
-} // namespace npapi
-
-void AllocateStringVariant(const std::string& str, NPVariant* var) {
- DCHECK(var);
-
- int len = str.length();
- NPUTF8* buffer = reinterpret_cast<NPUTF8*>(npapi::MemAlloc(len + 1));
- if (buffer) {
- buffer[len] = '\0';
- memcpy(buffer, str.c_str(), len);
- STRINGN_TO_NPVARIANT(buffer, len, *var);
- } else {
- NULL_TO_NPVARIANT(*var);
- }
-}
diff --git a/ceee/common/np_browser_functions.h b/ceee/common/np_browser_functions.h
deleted file mode 100644
index 8ab8b63..0000000
--- a/ceee/common/np_browser_functions.h
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#ifndef CEEE_COMMON_NP_BROWSER_FUNCTIONS_H_
-#define CEEE_COMMON_NP_BROWSER_FUNCTIONS_H_
-
-#include <string>
-#include "base/logging.h"
-#include "third_party/npapi/bindings/nphostapi.h"
-
-namespace npapi {
-
-// Must be called prior to calling any of the browser functions below.
-void InitializeBrowserFunctions(NPNetscapeFuncs* functions);
-void UninitializeBrowserFunctions();
-
-// Returns true iff InitializeBrowserFunctions has been called successully.
-bool IsInitialized();
-
-// Function stubs for functions that the host browser implements.
-
-NPError GetURL(NPP instance, const char* URL, const char* window);
-
-NPError PostURL(NPP instance, const char* URL, const char* window, uint32 len,
- const char* buf, NPBool file);
-
-NPError RequestRead(NPStream* stream, NPByteRange* rangeList);
-
-NPError NewStream(NPP instance, NPMIMEType type, const char* window,
- NPStream** stream);
-
-int32 Write(NPP instance, NPStream* stream, int32 len, void* buffer);
-
-NPError DestroyStream(NPP instance, NPStream* stream, NPReason reason);
-
-void Status(NPP instance, const char* message);
-
-const char* UserAgent(NPP instance);
-
-void* MemAlloc(uint32 size);
-
-void MemFree(void* ptr);
-
-uint32 MemFlush(uint32 size);
-
-void ReloadPlugins(NPBool reloadPages);
-
-void* GetJavaEnv();
-
-void* GetJavaPeer(NPP instance);
-
-NPError GetURLNotify(NPP instance, const char* URL, const char* window,
- void* notifyData);
-
-NPError PostURLNotify(NPP instance, const char* URL, const char* window,
- uint32 len, const char* buf, NPBool file,
- void* notifyData);
-
-NPError GetValue(NPP instance, NPNVariable variable, void* ret_value);
-
-NPError SetValue(NPP instance, NPPVariable variable, void* value);
-
-void InvalidateRect(NPP instance, NPRect* rect);
-
-void InvalidateRegion(NPP instance, NPRegion region);
-
-void ForceRedraw(NPP instance);
-
-void ReleaseVariantValue(NPVariant* variant);
-
-NPIdentifier GetStringIdentifier(const NPUTF8* name);
-
-void GetStringIdentifiers(const NPUTF8** names, int32_t nameCount,
- NPIdentifier* identifiers);
-
-NPIdentifier GetIntIdentifier(int32_t intid);
-
-int32_t IntFromIdentifier(NPIdentifier identifier);
-
-bool IdentifierIsString(NPIdentifier identifier);
-
-NPUTF8* UTF8FromIdentifier(NPIdentifier identifier);
-
-NPObject* CreateObject(NPP, NPClass* aClass);
-
-NPObject* RetainObject(NPObject* obj);
-
-void ReleaseObject(NPObject* obj);
-
-bool Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
- const NPVariant* args, unsigned argCount, NPVariant* result);
-
-bool InvokeDefault(NPP npp, NPObject* obj, const NPVariant* args,
- unsigned argCount, NPVariant* result);
-
-bool Evaluate(NPP npp, NPObject* obj, NPString* script, NPVariant* result);
-
-bool GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
- NPVariant* result);
-
-bool SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
- const NPVariant* value);
-
-bool HasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName);
-
-bool HasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName);
-
-bool RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName);
-
-void SetException(NPObject* obj, const NPUTF8* message);
-
-void PushPopupsEnabledState(NPP npp, NPBool enabled);
-
-void PopPopupsEnabledState(NPP npp);
-
-bool Enumerate(NPP npp, NPObject* obj, NPIdentifier** identifier,
- uint32_t* count);
-
-void PluginThreadAsyncCall(NPP instance,
- void (*func)(void*), // NOLINT
- void* userData);
-
-bool Construct(NPP npp, NPObject* obj, const NPVariant* args, uint32_t argCount,
- NPVariant* result);
-
-// Helper routine that wraps UTF8FromIdentifier to convert a string identifier
-// to an STL string. It's not super efficient since it could possibly do two
-// heap allocations (STL string has a stack based buffer for smaller strings).
-// For debugging purposes it is useful.
-std::string StringFromIdentifier(NPIdentifier identifier);
-
-} // namespace npapi
-
-// Simple helper class for freeing NPVariants at the end of a scope.
-class ScopedNpVariant : public NPVariant {
- public:
- ScopedNpVariant() {
- VOID_TO_NPVARIANT(*this);
- }
-
- ~ScopedNpVariant() {
- Free();
- }
-
- void Free() {
- npapi::ReleaseVariantValue(this);
- VOID_TO_NPVARIANT(*this);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ScopedNpVariant);
-};
-
-// Simple helper class for freeing NPObjects at the end of a scope.
-template <typename NpoType = NPObject>
-class ScopedNpObject {
- public:
- ScopedNpObject() : npo_(NULL) {
- }
-
- explicit ScopedNpObject(NpoType* npo) : npo_(npo) {
- }
-
- ~ScopedNpObject() {
- Free();
- }
-
- NpoType* get() const {
- return npo_;
- }
-
- operator NpoType*() const {
- return npo_;
- }
-
- NpoType* operator->() const {
- return npo_;
- }
-
- ScopedNpObject<NpoType>& operator=(NpoType* npo) {
- if (npo != npo_) {
- DCHECK(npo_ == NULL);
- npapi::RetainObject(npo);
- npo_ = npo;
- }
- return *this;
- }
-
- void Free() {
- if (npo_) {
- npapi::ReleaseObject(npo_);
- npo_ = NULL;
- }
- }
-
- NpoType** Receive() {
- DCHECK(npo_ == NULL) << "Object leak. Pointer must be NULL";
- return &npo_;
- }
-
- NpoType* Detach() {
- NpoType* p = npo_;
- npo_ = NULL;
- return p;
- }
-
- void Attach(NpoType* p) {
- DCHECK(npo_ == NULL);
- npo_ = p;
- }
-
- NpoType* Copy() const {
- if (npo_ != NULL)
- npapi::RetainObject(npo_);
- return npo_;
- }
-
- bool Invoke0(NPP npp, NPIdentifier id, NPVariant* result) {
- return npapi::Invoke(npp, npo_, id, NULL, 0, result);
- }
- bool Invoke0(NPP npp, const NPUTF8* name, NPVariant* result) {
- return Invoke0(npp, npapi::GetStringIdentifier(name), result);
- }
-
- bool Invoke1(NPP npp, NPIdentifier id, const NPVariant &arg1,
- NPVariant* result) {
- return npapi::Invoke(npp, npo_, id, &arg1, 1, result);
- }
- bool Invoke1(NPP npp, const NPUTF8* name, const NPVariant &arg1,
- NPVariant* result) {
- return Invoke1(npp, npapi::GetStringIdentifier(name), arg1, result);
- }
- bool InvokeN(NPP npp, NPIdentifier id, const NPVariant* args, unsigned argc,
- NPVariant* result) {
- return npapi::Invoke(npp, npo_, id, args, argc, result);
- }
- bool InvokeN(NPP npp, const NPUTF8* name, const NPVariant* args,
- unsigned argc, NPVariant* result) {
- return Invoke1(npp, npapi::GetStringIdentifier(name), args, argc, result);
- }
-
- bool GetProperty(NPP npp, NPIdentifier id, NPVariant* result) {
- return npapi::GetProperty(npp, npo_, id, result);
- }
-
- bool GetProperty(NPP npp, const NPUTF8* name, NPVariant* result) {
- return GetProperty(npp, npapi::GetStringIdentifier(name), result);
- }
-
- private:
- NpoType* npo_;
- DISALLOW_COPY_AND_ASSIGN(ScopedNpObject);
-};
-
-// Allocates a new NPUTF8 string and assigns it to the variant.
-// If memory allocation fails, the variant type will be set to NULL.
-// The memory allocation is done via the npapi browser functions.
-void AllocateStringVariant(const std::string& str, NPVariant* var);
-
-#endif // CEEE_COMMON_NP_BROWSER_FUNCTIONS_H_
diff --git a/ceee/ie/common/chrome_frame_host.cc b/ceee/ie/common/chrome_frame_host.cc
index 77c0bc9..66e8efc 100644
--- a/ceee/ie/common/chrome_frame_host.cc
+++ b/ceee/ie/common/chrome_frame_host.cc
@@ -107,6 +107,11 @@ STDMETHODIMP ChromeFrameHost::GetExtensionApisToAutomate(
return hr;
}
+STDMETHODIMP ChromeFrameHost::ShouldShowVersionMismatchDialog() {
+ // Only our toolband allows the notification dialog to be shown.
+ return S_FALSE;
+}
+
HRESULT ChromeFrameHost::Initialize() {
return S_OK;
}
diff --git a/ceee/ie/common/chrome_frame_host.h b/ceee/ie/common/chrome_frame_host.h
index ef43499..b04b7b5 100644
--- a/ceee/ie/common/chrome_frame_host.h
+++ b/ceee/ie/common/chrome_frame_host.h
@@ -143,6 +143,7 @@ class ATL_NO_VTABLE ChromeFrameHost
STDMETHOD(GetChromeExtraArguments)(BSTR* args);
STDMETHOD(GetChromeProfileName)(BSTR* args);
STDMETHOD(GetExtensionApisToAutomate)(BSTR* functions_enabled);
+ STDMETHOD(ShouldShowVersionMismatchDialog)();
// @}
// @name ChromeFrame event handlers
diff --git a/ceee/ie/common/common.gyp b/ceee/ie/common/common.gyp
index 759c901..7c42be7 100644
--- a/ceee/ie/common/common.gyp
+++ b/ceee/ie/common/common.gyp
@@ -33,7 +33,7 @@
'dependencies': [
'ie_common_settings',
'../plugin/toolband/toolband.gyp:toolband_idl',
- '../plugin/toolband/toolband.gyp:chrome_tab_idl',
+ '<(DEPTH)/chrome_frame/chrome_frame.gyp:chrome_tab_idl',
],
'sources': [
'ie_guids.cc',
@@ -54,7 +54,7 @@
'../../../ceee/common/common.gyp:initializing_coclass',
'../../../ceee/common/common.gyp:ceee_common',
'../../../ceee/testing/utils/test_utils.gyp:test_utils',
- '../plugin/toolband/toolband.gyp:chrome_tab_idl',
+ '<(DEPTH)/chrome_frame/chrome_frame.gyp:chrome_tab_idl',
'../plugin/toolband/toolband.gyp:toolband_idl',
],
'sources': [
diff --git a/ceee/ie/plugin/bho/infobar_browser_window.cc b/ceee/ie/plugin/bho/infobar_browser_window.cc
index 49fbd85..8a332e4 100644
--- a/ceee/ie/plugin/bho/infobar_browser_window.cc
+++ b/ceee/ie/plugin/bho/infobar_browser_window.cc
@@ -64,6 +64,11 @@ STDMETHODIMP InfobarBrowserWindow::GetExtensionApisToAutomate(
return S_FALSE;
}
+STDMETHODIMP InfobarBrowserWindow::ShouldShowVersionMismatchDialog() {
+ // Only our toolband allows the notification dialog to be shown.
+ return S_FALSE;
+}
+
STDMETHODIMP_(void) InfobarBrowserWindow::OnCfReadyStateChanged(LONG state) {
if (state == READYSTATE_COMPLETE) {
// We already loaded the extension, enable them in this CF.
diff --git a/ceee/ie/plugin/bho/infobar_browser_window.h b/ceee/ie/plugin/bho/infobar_browser_window.h
index 7e6dbcb..9c4b39f 100644
--- a/ceee/ie/plugin/bho/infobar_browser_window.h
+++ b/ceee/ie/plugin/bho/infobar_browser_window.h
@@ -105,6 +105,7 @@ class ATL_NO_VTABLE InfobarBrowserWindow
STDMETHOD(GetChromeExtraArguments)(BSTR *args);
STDMETHOD(GetChromeProfileName)(BSTR *args);
STDMETHOD(GetExtensionApisToAutomate)(BSTR *args);
+ STDMETHOD(ShouldShowVersionMismatchDialog)();
// @}
// @name ChromeFrame event handlers.
diff --git a/ceee/ie/plugin/toolband/tool_band.cc b/ceee/ie/plugin/toolband/tool_band.cc
index b8dfcea..e3ea63c 100644
--- a/ceee/ie/plugin/toolband/tool_band.cc
+++ b/ceee/ie/plugin/toolband/tool_band.cc
@@ -234,6 +234,12 @@ STDMETHODIMP ToolBand::GetExtensionApisToAutomate(BSTR* functions_enabled) {
return S_FALSE;
}
+STDMETHODIMP ToolBand::ShouldShowVersionMismatchDialog() {
+ // Only the toolband shows the warning dialog, meaning it gets shown once
+ // per tab.
+ return S_OK;
+}
+
HRESULT ToolBand::Initialize(IUnknown* site) {
TRACE_EVENT_INSTANT("ceee.toolband.initialize", this, "");
diff --git a/ceee/ie/plugin/toolband/tool_band.h b/ceee/ie/plugin/toolband/tool_band.h
index 33ad61c..e66993f 100644
--- a/ceee/ie/plugin/toolband/tool_band.h
+++ b/ceee/ie/plugin/toolband/tool_band.h
@@ -140,6 +140,7 @@ class ATL_NO_VTABLE ToolBand : public CComObjectRootEx<CComSingleThreadModel>,
STDMETHOD(GetChromeExtraArguments)(BSTR *args);
STDMETHOD(GetChromeProfileName)(BSTR *args);
STDMETHOD(GetExtensionApisToAutomate)(BSTR *args);
+ STDMETHOD(ShouldShowVersionMismatchDialog)();
// @}
diff --git a/ceee/ie/plugin/toolband/toolband.gyp b/ceee/ie/plugin/toolband/toolband.gyp
index 551092d..fd9df79 100644
--- a/ceee/ie/plugin/toolband/toolband.gyp
+++ b/ceee/ie/plugin/toolband/toolband.gyp
@@ -11,28 +11,10 @@
],
'targets': [
{
- # This target builds Chrome Frame's IDL file to our
- # shared intermediate directory
- 'target_name': 'chrome_tab_idl',
- 'type': 'none',
- 'msvs_settings': {
- 'VCMIDLTool': {
- 'OutputDirectory': '<(SHARED_INTERMEDIATE_DIR)',
- },
- },
- 'sources': [
- '../../../../chrome_frame/chrome_tab.idl',
- ],
- # Add the output dir for those who depend on us.
- 'direct_dependent_settings': {
- 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)'],
- },
- },
- {
'target_name': 'ceee_ie_lib',
'type': 'static_library',
'dependencies': [
- 'chrome_tab_idl',
+ '<(DEPTH)/chrome_frame/chrome_frame.gyp:chrome_tab_idl',
'../../common/common.gyp:ie_common_settings',
'../../../../base/base.gyp:base',
'../../../../ceee/common/common.gyp:ceee_common',
diff --git a/ceee/testing/utils/mock_com.h b/ceee/testing/utils/mock_com.h
index 36f2d65..23cb233 100644
--- a/ceee/testing/utils/mock_com.h
+++ b/ceee/testing/utils/mock_com.h
@@ -22,6 +22,13 @@
namespace testing {
+class IOleClientSiteMockImpl : public IOleClientSite {
+ // The methods in this class are code generated using this command line:
+ // [ ceee\testing\utils\com_mock.py IOleClientSite \
+ // "%WindowsSdkDir%\Include\OleIdl.h" ]
+#include "ceee/testing/utils/mock_ioleclientsite.gen"
+};
+
class IOleObjecMockImpl: public IOleObject {
public:
// The methods in this class are code generated using this command line:
@@ -139,7 +146,7 @@ class ITravelLogStgMockImpl : public ITravelLogStg {
class MockIServiceProvider
: public CComObjectRootEx<CComSingleThreadModel>,
public testing::StrictMock<IServiceProviderMockImpl> {
- DECLARE_NOT_AGGREGATABLE(MockIServiceProvider )
+ DECLARE_NOT_AGGREGATABLE(MockIServiceProvider)
BEGIN_COM_MAP(MockIServiceProvider)
COM_INTERFACE_ENTRY(IServiceProvider)
END_COM_MAP()
diff --git a/ceee/testing/utils/mock_ioleclientsite.gen b/ceee/testing/utils/mock_ioleclientsite.gen
new file mode 100644
index 0000000..a1cce79
--- /dev/null
+++ b/ceee/testing/utils/mock_ioleclientsite.gen
@@ -0,0 +1,15 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Auto-generated by com_mock.py
+
+
+MOCK_METHOD0_WITH_CALLTYPE(__stdcall, SaveObject, HRESULT());
+MOCK_METHOD3_WITH_CALLTYPE(__stdcall, GetMoniker, HRESULT(
+ DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk));
+MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetContainer, HRESULT(
+ IOleContainer **ppContainer));
+MOCK_METHOD0_WITH_CALLTYPE(__stdcall, ShowObject, HRESULT());
+MOCK_METHOD1_WITH_CALLTYPE(__stdcall, OnShowWindow, HRESULT(BOOL fShow));
+MOCK_METHOD0_WITH_CALLTYPE(__stdcall, RequestNewObjectLayout, HRESULT());
diff --git a/ceee/testing/utils/test_utils.gyp b/ceee/testing/utils/test_utils.gyp
index 7a62688..33f7c4b 100644
--- a/ceee/testing/utils/test_utils.gyp
+++ b/ceee/testing/utils/test_utils.gyp
@@ -54,7 +54,6 @@
'mshtml_mocks.h',
'mshtml_mocks.py',
'com_mock.py',
- '<(SHARED_INTERMEDIATE_DIR)/mshtml_mocks.gen',
],
'actions': [
{