From 09911bf300f1a419907a9412154760efd0b7abc3 Mon Sep 17 00:00:00 2001 From: "initial.commit" Date: Sat, 26 Jul 2008 23:55:29 +0000 Subject: Add chrome to the repository. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/activex_test_control/SConscript | 93 +++++++ .../activex_test_control/activex_test_control.cc | 74 ++++++ .../activex_test_control/activex_test_control.def | 9 + .../activex_test_control/activex_test_control.idl | 108 ++++++++ .../activex_test_control/activex_test_control.rc | 128 +++++++++ .../activex_test_control/activex_test_control.rgs | 11 + .../activex_test_control.vcproj | 193 ++++++++++++++ .../activex_test_control.vsprops | 26 ++ .../activex_test_control/chrome_test_control.bmp | Bin 0 -> 246 bytes .../activex_test_control/chrome_test_control.cc | 59 +++++ .../activex_test_control/chrome_test_control.h | 286 +++++++++++++++++++++ .../activex_test_control/chrome_test_control.rgs | 34 +++ .../activex_test_control/chrome_test_control_cp.h | 42 +++ chrome/test/activex_test_control/resource.h | 19 ++ 14 files changed, 1082 insertions(+) create mode 100644 chrome/test/activex_test_control/SConscript create mode 100644 chrome/test/activex_test_control/activex_test_control.cc create mode 100644 chrome/test/activex_test_control/activex_test_control.def create mode 100644 chrome/test/activex_test_control/activex_test_control.idl create mode 100644 chrome/test/activex_test_control/activex_test_control.rc create mode 100644 chrome/test/activex_test_control/activex_test_control.rgs create mode 100644 chrome/test/activex_test_control/activex_test_control.vcproj create mode 100644 chrome/test/activex_test_control/activex_test_control.vsprops create mode 100644 chrome/test/activex_test_control/chrome_test_control.bmp create mode 100644 chrome/test/activex_test_control/chrome_test_control.cc create mode 100644 chrome/test/activex_test_control/chrome_test_control.h create mode 100644 chrome/test/activex_test_control/chrome_test_control.rgs create mode 100644 chrome/test/activex_test_control/chrome_test_control_cp.h create mode 100644 chrome/test/activex_test_control/resource.h (limited to 'chrome/test/activex_test_control') diff --git a/chrome/test/activex_test_control/SConscript b/chrome/test/activex_test_control/SConscript new file mode 100644 index 0000000..6f459c1 --- /dev/null +++ b/chrome/test/activex_test_control/SConscript @@ -0,0 +1,93 @@ +# Copyright 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Import('env') + +env = env.Clone() + + +env.Prepend( + CPPPATH = [ + '.', + '#/..', + ], + LINKFLAGS = [ + '/INCREMENTAL', + + '/MANIFEST', + '/DELAYLOAD:"dwmapi.dll"', + '/DELAYLOAD:"uxtheme.dll"', + '/MACHINE:X86', + '/FIXED:No', + + '/safeseh', + '/dynamicbase', + '/ignore:4199', + '/nxcompat', + + '/DEBUG', + ], + LIBS = [ + 'wininet.lib', + 'version.lib', + 'msimg32.lib', + 'ws2_32.lib', + 'usp10.lib', + 'psapi.lib', + 'comsuppw.lib', + 'kernel32.lib', + 'user32.lib', + 'gdi32.lib', + 'winspool.lib', + 'comdlg32.lib', + 'advapi32.lib', + 'shell32.lib', + 'ole32.lib', + 'oleaut32.lib', + 'uuid.lib', + 'odbc32.lib', + 'odbccp32.lib', + + 'DelayImp.lib', + ], +) + +env.TypeLibrary('activex_test_control.idl') + +input_files = [ + 'activex_test_control.cc', + 'activex_test_control.def', + 'chrome_test_control.cc', +] + +dll = env.SharedLibrary(['activex_test_control', 'activex_test_control.lib'], + input_files) + +i = env.Install('$TARGET_ROOT', dll) +env.Alias('chrome', i) diff --git a/chrome/test/activex_test_control/activex_test_control.cc b/chrome/test/activex_test_control/activex_test_control.cc new file mode 100644 index 0000000..829cb9a --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.cc @@ -0,0 +1,74 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +#include "activex_test_control.h" +#include "activex_test_control_i.c" +#include "chrome/test/activex_test_control/resource.h" + +class ActiveXTestControllModule + : public CAtlDllModuleT { + public: + DECLARE_LIBID(LIBID_activex_test_controlLib) + DECLARE_REGISTRY_APPID_RESOURCEID(IDR_ACTIVEX_TEST_CONTROL, + "{CDBC0D94-AFF6-4918-90A9-7967179A77D8}") +}; + +ActiveXTestControllModule g_atlmodule; + +// DLL Entry Point +extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, + LPVOID reserved) { + return g_atlmodule.DllMain(reason, reserved); +} + +// Used to determine whether the DLL can be unloaded by OLE +STDAPI DllCanUnloadNow(void) { + return g_atlmodule.DllCanUnloadNow(); +} + +// Returns a class factory to create an object of the requested type +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { + return g_atlmodule.DllGetClassObject(rclsid, riid, ppv); +} + +// DllRegisterServer - Adds entries to the system registry +STDAPI DllRegisterServer(void) { + // registers object, typelib and all interfaces in typelib + HRESULT hr = g_atlmodule.DllRegisterServer(); + return hr; +} + +// DllUnregisterServer - Removes entries from the system registry +STDAPI DllUnregisterServer(void) { + HRESULT hr = g_atlmodule.DllUnregisterServer(); + return hr; +} diff --git a/chrome/test/activex_test_control/activex_test_control.def b/chrome/test/activex_test_control/activex_test_control.def new file mode 100644 index 0000000..b006b57 --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.def @@ -0,0 +1,9 @@ +; activex_test_control.def : Declares the module parameters. + +LIBRARY "activex_test_control.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/chrome/test/activex_test_control/activex_test_control.idl b/chrome/test/activex_test_control/activex_test_control.idl new file mode 100644 index 0000000..04a2f42 --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.idl @@ -0,0 +1,108 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file will be processed by the MIDL tool to +// produce the type library (activex_test_control.tlb) and marshalling code. + +#include "olectl.h" +import "oaidl.idl"; +import "ocidl.idl"; + +[ + object, + uuid(9AC37249-E247-4B82-AC1E-0917737528E9), + dual, + nonextensible, + helpstring("IChromeTestControl Interface"), + pointer_default(unique) +] +interface IChromeTestControl : IDispatch{ + [propput, bindable, requestedit, id(DISPID_BACKCOLOR)] + HRESULT BackColor([in]OLE_COLOR clr); + [propget, bindable, requestedit, id(DISPID_BACKCOLOR)] + HRESULT BackColor([out,retval]OLE_COLOR* pclr); + [propput, bindable, requestedit, id(DISPID_BORDERCOLOR)] + HRESULT BorderColor([in]OLE_COLOR clr); + [propget, bindable, requestedit, id(DISPID_BORDERCOLOR)] + HRESULT BorderColor([out, retval]OLE_COLOR* pclr); + [propput, bindable, requestedit, id(DISPID_FORECOLOR)] + HRESULT ForeColor([in]OLE_COLOR clr); + [propget, bindable, requestedit, id(DISPID_FORECOLOR)] + HRESULT ForeColor([out,retval]OLE_COLOR* pclr); + [propput, bindable, requestedit, id(DISPID_CAPTION)] + HRESULT Caption([in]BSTR strCaption); + [propget, bindable, requestedit, id(DISPID_CAPTION)] + HRESULT Caption([out,retval]BSTR* pstrCaption); + [propget, id(1), helpstring("property StringProp")] HRESULT StringProp([out, retval] BSTR* pVal); + [propput, id(1), helpstring("property StringProp")] HRESULT StringProp([in] BSTR newVal); + [propget, id(2), helpstring("property LongProp")] HRESULT LongProp([out, retval] LONG* pVal); + [propput, id(2), helpstring("property LongProp")] HRESULT LongProp([in] LONG newVal); + [propget, id(3), helpstring("property DoubleProp")] HRESULT DoubleProp([out, retval] DOUBLE* pVal); + [propput, id(3), helpstring("property DoubleProp")] HRESULT DoubleProp([in] DOUBLE newVal); + [propget, id(4), helpstring("property BoolProp")] HRESULT BoolProp([out, retval] VARIANT_BOOL* pVal); + [propput, id(4), helpstring("property BoolProp")] HRESULT BoolProp([in] VARIANT_BOOL newVal); + [propget, id(5), helpstring("property ByteProp")] HRESULT ByteProp([out, retval] BYTE* pVal); + [propput, id(5), helpstring("property ByteProp")] HRESULT ByteProp([in] BYTE newVal); + [propget, id(6), helpstring("property FloatProp")] HRESULT FloatProp([out, retval] FLOAT* pVal); + [propput, id(6), helpstring("property FloatProp")] HRESULT FloatProp([in] FLOAT newVal); + [id(7), helpstring("method BigSetMethod")] HRESULT BigSetMethodRet([in] BSTR string_param, [in] BYTE byte_param, [in] FLOAT float_param, [in] VARIANT_BOOL bool_param, [out,retval] BSTR* ret); + [id(8), helpstring("method SetByte")] HRESULT SetByte([in] BYTE val); + [id(9), helpstring("method SetByteRet")] HRESULT SetByteRet([in] BYTE byte_param, [out,retval] BYTE* ret); + [id(10), helpstring("method SetStringRet")] HRESULT SetStringRet([in] BSTR val, [out,retval] BSTR* ret); + [id(11), helpstring("method GetCookie")] HRESULT GetCookie([out,retval] BSTR* cookie); +}; + +[ + uuid(83D767F4-5C4F-4ACA-B0E8-928C54845C33), + version(1.0), + helpstring("activex_test_control 1.0 Type Library") +] +library activex_test_controlLib +{ + importlib("stdole2.tlb"); + [ + uuid(EF88DE01-35AF-463F-9802-1BF908F48696), + helpstring("_IChromeTestControlEvents Interface") + ] + dispinterface _IChromeTestControlEvents + { + properties: + methods: + }; + [ + uuid(4E174456-5EE6-494D-B6F2-2B52898A620E), + control, + helpstring("ChromeTestControl Class") + ] + coclass ChromeTestControl + { + [default] interface IChromeTestControl; + [default, source] dispinterface _IChromeTestControlEvents; + }; +}; diff --git a/chrome/test/activex_test_control/activex_test_control.rc b/chrome/test/activex_test_control/activex_test_control.rc new file mode 100644 index 0000000..e6046bd --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.rc @@ -0,0 +1,128 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "1 TYPELIB ""activex_test_control.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Google Inc." + VALUE "FileDescription", "ActiveX Test Control" + VALUE "FileVersion", "1.0.0.1" + VALUE "LegalCopyright", "Google Inc. All rights reserved." + VALUE "InternalName", "activex_test_control.dll" + VALUE "OriginalFilename", "activex_test_control.dll" + VALUE "ProductName", "Google Chrome" + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_ACTIVEX_TEST_CONTROL REGISTRY "activex_test_control.rgs" +IDR_CHROMETESTCONTROL REGISTRY "chrome_test_control.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_CHROMETESTCONTROL BITMAP "chrome_test_control.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_PROJNAME "activex_test_control" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "activex_test_control.tlb" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/chrome/test/activex_test_control/activex_test_control.rgs b/chrome/test/activex_test_control/activex_test_control.rgs new file mode 100644 index 0000000..2873a48 --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.rgs @@ -0,0 +1,11 @@ +HKCR +{ + NoRemove AppID + { + '%APPID%' = s 'activex_test_control' + 'activex_test_control.DLL' + { + val AppID = s '%APPID%' + } + } +} diff --git a/chrome/test/activex_test_control/activex_test_control.vcproj b/chrome/test/activex_test_control/activex_test_control.vcproj new file mode 100644 index 0000000..b40d9b3e --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.vcproj @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chrome/test/activex_test_control/activex_test_control.vsprops b/chrome/test/activex_test_control/activex_test_control.vsprops new file mode 100644 index 0000000..d873ddf --- /dev/null +++ b/chrome/test/activex_test_control/activex_test_control.vsprops @@ -0,0 +1,26 @@ + + + + + + diff --git a/chrome/test/activex_test_control/chrome_test_control.bmp b/chrome/test/activex_test_control/chrome_test_control.bmp new file mode 100644 index 0000000..1229764 Binary files /dev/null and b/chrome/test/activex_test_control/chrome_test_control.bmp differ diff --git a/chrome/test/activex_test_control/chrome_test_control.cc b/chrome/test/activex_test_control/chrome_test_control.cc new file mode 100644 index 0000000..5b0655c --- /dev/null +++ b/chrome/test/activex_test_control/chrome_test_control.cc @@ -0,0 +1,59 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "chrome/test/activex_test_control/chrome_test_control.h" + +// CChromeTestControl +HRESULT ChromeTestControl::OnDraw(ATL_DRAWINFO& di) { + RECT& rc = *(RECT*)di.prcBounds; + // Set Clip region to the rectangle specified by di.prcBounds + HRGN rgn_old = NULL; + if (GetClipRgn(di.hdcDraw, rgn_old) != 1) + rgn_old = NULL; + bool select_old_rgn = false; + + HRGN rgn_new = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom); + + if (rgn_new != NULL) + select_old_rgn = (SelectClipRgn(di.hdcDraw, rgn_new) != ERROR); + + Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom); + SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE); + LPCTSTR pszText = _T("ATL 8.0 : ChromeTestControl"); + TextOut(di.hdcDraw, + (rc.left + rc.right) / 2, + (rc.top + rc.bottom) / 2, + pszText, + lstrlen(pszText)); + + if (select_old_rgn) + SelectClipRgn(di.hdcDraw, rgn_old); + + return S_OK; +} diff --git a/chrome/test/activex_test_control/chrome_test_control.h b/chrome/test/activex_test_control/chrome_test_control.h new file mode 100644 index 0000000..e923307 --- /dev/null +++ b/chrome/test/activex_test_control/chrome_test_control.h @@ -0,0 +1,286 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_H__ +#define CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_H__ + +#include +#include +#include +#include +#include "activex_test_control.h" +#include "chrome/test/activex_test_control/chrome_test_control_cp.h" +#include "chrome/test/activex_test_control/resource.h" + +// ChromeTestControl +class ATL_NO_VTABLE ChromeTestControl + : public CComObjectRootEx, + public CStockPropImpl, + public IPersistStreamInitImpl, + public IOleControlImpl, + public IOleObjectImpl, + public IOleInPlaceActiveObjectImpl, + public IViewObjectExImpl, + public IOleInPlaceObjectWindowlessImpl, + public ISupportErrorInfo, + public IConnectionPointContainerImpl, + public CProxy_IChromeTestControlEvents, + public IObjectWithSiteImpl, + public IServiceProviderImpl, + public IPersistStorageImpl, + public ISpecifyPropertyPagesImpl, + public IQuickActivateImpl, + public IDataObjectImpl, + public IProvideClassInfo2Impl<&CLSID_ChromeTestControl, + &__uuidof(_IChromeTestControlEvents), &LIBID_activex_test_controlLib>, + public IPropertyNotifySinkCP, + public IObjectSafetyImpl, + public CComCoClass, + public CComControl { + public: + ChromeTestControl() { + } + +DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE | + OLEMISC_CANTLINKINSIDE | + OLEMISC_INSIDEOUT | + OLEMISC_ACTIVATEWHENVISIBLE | + OLEMISC_SETCLIENTSITEFIRST) + +DECLARE_REGISTRY_RESOURCEID(IDR_CHROMETESTCONTROL) + +BEGIN_COM_MAP(ChromeTestControl) + COM_INTERFACE_ENTRY(IChromeTestControl) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(IViewObjectEx) + COM_INTERFACE_ENTRY(IViewObject2) + COM_INTERFACE_ENTRY(IViewObject) + COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY(IOleInPlaceObject) + COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) + COM_INTERFACE_ENTRY(IOleControl) + COM_INTERFACE_ENTRY(IOleObject) + COM_INTERFACE_ENTRY(IPersistStreamInit) + COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY(IConnectionPointContainer) + COM_INTERFACE_ENTRY(ISpecifyPropertyPages) + COM_INTERFACE_ENTRY(IQuickActivate) + COM_INTERFACE_ENTRY(IPersistStorage) + COM_INTERFACE_ENTRY(IDataObject) + COM_INTERFACE_ENTRY(IProvideClassInfo) + COM_INTERFACE_ENTRY(IProvideClassInfo2) + COM_INTERFACE_ENTRY(IObjectWithSite) + COM_INTERFACE_ENTRY(IServiceProvider) + COM_INTERFACE_ENTRY_IID(IID_IObjectSafety, IObjectSafety) +END_COM_MAP() + +BEGIN_PROP_MAP(ChromeTestControl) + PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) + PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) + PROP_ENTRY("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage) + PROP_ENTRY("BorderColor", DISPID_BORDERCOLOR, CLSID_StockColorPage) + PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL) + PROP_ENTRY("ForeColor", DISPID_FORECOLOR, CLSID_StockColorPage) + // Example entries + // PROP_ENTRY("Property Description", dispid, clsid) + // PROP_PAGE(CLSID_StockColorPage) +END_PROP_MAP() + +BEGIN_CONNECTION_POINT_MAP(ChromeTestControl) + CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink) + CONNECTION_POINT_ENTRY(__uuidof(_IChromeTestControlEvents)) +END_CONNECTION_POINT_MAP() + +BEGIN_MSG_MAP(ChromeTestControl) + CHAIN_MSG_MAP(CComControl) + DEFAULT_REFLECTION_HANDLER() +END_MSG_MAP() + + // ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) { + static const IID* arr[] = { + &IID_IChromeTestControl, + }; + + for (int i=0; i container; + m_spClientSite->GetContainer(&container); + CComQIPtr doc = container; + if (doc == NULL) { + *cookie = SysAllocString(L"Bad"); + return S_FALSE; + } else { + return doc->get_cookie(cookie); + } + } + + // These varialbes are used by CStockPropImpl invisibly and they have to be + // be public to be accessible. + OLE_COLOR m_clrBackColor; + OLE_COLOR m_clrBorderColor; + CComBSTR m_bstrCaption; + OLE_COLOR m_clrForeColor; + private: + _bstr_t string_prop_; + LONG long_prop_; + DOUBLE double_prop_; + VARIANT_BOOL bool_prop_; + BYTE byte_prop_; + FLOAT float_prop_; +}; + +OBJECT_ENTRY_AUTO(__uuidof(ChromeTestControl), ChromeTestControl) + +#endif // #ifndef CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_H__ diff --git a/chrome/test/activex_test_control/chrome_test_control.rgs b/chrome/test/activex_test_control/chrome_test_control.rgs new file mode 100644 index 0000000..9e327bc --- /dev/null +++ b/chrome/test/activex_test_control/chrome_test_control.rgs @@ -0,0 +1,34 @@ +HKCR +{ + activex_test_control.ChromeTestContro.1 = s 'ChromeTestControl Class' + { + CLSID = s '{4E174456-5EE6-494D-B6F2-2B52898A620E}' + } + activex_test_control.ChromeTestControl = s 'ChromeTestControl Class' + { + CLSID = s '{4E174456-5EE6-494D-B6F2-2B52898A620E}' + CurVer = s 'activex_test_control.ChromeTestContro.1' + } + NoRemove CLSID + { + ForceRemove {4E174456-5EE6-494D-B6F2-2B52898A620E} = s 'ChromeTestControl Class' + { + ProgID = s 'activex_test_control.ChromeTestContro.1' + VersionIndependentProgID = s 'activex_test_control.ChromeTestControl' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + val AppID = s '%APPID%' + ForceRemove 'Control' + ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 102' + 'MiscStatus' = s '0' + { + '1' = s '%OLEMISC%' + } + 'TypeLib' = s '{83D767F4-5C4F-4ACA-B0E8-928C54845C33}' + 'Version' = s '1.0' + } + } +} diff --git a/chrome/test/activex_test_control/chrome_test_control_cp.h b/chrome/test/activex_test_control/chrome_test_control_cp.h new file mode 100644 index 0000000..734b326 --- /dev/null +++ b/chrome/test/activex_test_control/chrome_test_control_cp.h @@ -0,0 +1,42 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_CP_H__ +#define CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_CP_H__ + + +template +class CProxy_IChromeTestControlEvents + : public IConnectionPointImpl { + //Warning this class will be regenerated by the wizard. + public: +}; + +#endif // #ifndef CHROME_TEST_ACTIVEX_TEST_CONTROL_CHROME_TEST_CONTROL_CP_H__ diff --git a/chrome/test/activex_test_control/resource.h b/chrome/test/activex_test_control/resource.h new file mode 100644 index 0000000..fc3cd4e --- /dev/null +++ b/chrome/test/activex_test_control/resource.h @@ -0,0 +1,19 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by activex_test_control.rc +// +#define IDS_PROJNAME 100 +#define IDR_ACTIVEX_TEST_CONTROL 101 +#define IDB_CHROMETESTCONTROL 102 +#define IDR_CHROMETESTCONTROL 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif -- cgit v1.1