diff options
-rw-r--r-- | base/base.gypi | 1 | ||||
-rw-r--r-- | base/win/rgs_helper.h | 89 | ||||
-rw-r--r-- | ceee/ie/broker/broker.h | 8 | ||||
-rw-r--r-- | ceee/ie/broker/broker.rgs | 4 | ||||
-rw-r--r-- | ceee/ie/plugin/bho/browser_helper_object.h | 8 | ||||
-rw-r--r-- | ceee/ie/plugin/bho/browser_helper_object.rgs | 4 | ||||
-rw-r--r-- | ceee/ie/plugin/bho/executor.h | 15 | ||||
-rw-r--r-- | ceee/ie/plugin/bho/executor.rgs | 4 | ||||
-rw-r--r-- | ceee/ie/plugin/bho/executor_creator.rgs | 9 | ||||
-rw-r--r-- | ceee/ie/plugin/toolband/resource.h | 9 | ||||
-rw-r--r-- | ceee/ie/plugin/toolband/tool_band.h | 7 | ||||
-rw-r--r-- | ceee/ie/plugin/toolband/tool_band.rgs | 4 | ||||
-rw-r--r-- | ceee/ie/plugin/toolband/toolband.gyp | 1 | ||||
-rw-r--r-- | ceee/ie/plugin/toolband/toolband.rc | 6 |
14 files changed, 141 insertions, 28 deletions
diff --git a/base/base.gypi b/base/base.gypi index 9b5ac05..a7d1986 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -308,6 +308,7 @@ 'win/pe_image.h', 'win/registry.cc', 'win/registry.h', + 'win/rgs_helper.h', 'win/scoped_bstr.cc', 'win/scoped_bstr.h', 'win/scoped_comptr.h', diff --git a/base/win/rgs_helper.h b/base/win/rgs_helper.h new file mode 100644 index 0000000..16e33bf --- /dev/null +++ b/base/win/rgs_helper.h @@ -0,0 +1,89 @@ +// 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. +// +// Defines a map for adding variables to rgs files. This allows COM object +// classes to declare the values of these variables so that we don't need to +// copy/paste them and manually keep them in sync. +// To use this, declare the registry ID of your RGS file using +// the DECLARE_REGISTRY_RESOURCEID_EX macro, instead of the +// DECLARE_REGISTRY_RESOURCEID, then add a registry map to your class +// using the registry map macros: +// BEGIN_REGISTRY_MAP(MyClassName) +// REGMAP_ENTRY("NAME", "MyClassName Class") +// REGMAP_ENTRY_UUID("CLSID", CLSID_MyClassName) +// END_REGISTRY_MAP() +// +// You can then refer to the names above in your RGS file as +// variables %NAME% and %CLSID%, respectively. +#ifndef BASE_WIN_RGS_HELPER_H_ +#define BASE_WIN_RGS_HELPER_H_ + +#include "base/string_util.h" + +struct ATLRegmapEntryHelper : public _ATL_REGMAP_ENTRY { + ATLRegmapEntryHelper() { + szKey = NULL; + szData = NULL; + } + ATLRegmapEntryHelper(LPCOLESTR key, LPCOLESTR data) { + szKey = key; + size_t size = lstrlen(data) + 1; + szData = new wchar_t[size]; + base::wcslcpy(const_cast<wchar_t*>(szData), data, size); + } + + ATLRegmapEntryHelper(LPCOLESTR key, UINT resid) { + wchar_t data[256] = {0}; + szKey = key; + if (::LoadString(_pModule->m_hInstResource, resid, data, + arraysize(data) - 1) == 0) { + *data = L'\0'; + } + + size_t size = lstrlen(data) + 1; + + szData = new wchar_t[size]; + base::wcslcpy(const_cast<wchar_t*>(szData), data, size); + } + + ATLRegmapEntryHelper(LPCOLESTR key, REFGUID guid) { + szKey = key; + static const size_t kGuidStringSize = 40; + szData = new wchar_t[kGuidStringSize]; + if (szData) { + if (::StringFromGUID2(guid, const_cast<LPOLESTR>(szData), + kGuidStringSize) == 0) { + *const_cast<LPOLESTR>(szData) = L'\0'; + } + } + } + ~ATLRegmapEntryHelper() { + delete [] szData; + } +}; + +#define BEGIN_REGISTRY_MAP(x)\ + static struct _ATL_REGMAP_ENTRY *_GetRegistryMap() {\ + static const ATLRegmapEntryHelper map[] = { +#define REGMAP_ENTRY(x, y) ATLRegmapEntryHelper(OLESTR(##x), OLESTR(##y)), + +#define REGMAP_UUID(x, clsid) ATLRegmapEntryHelper(OLESTR(##x), clsid), + +// This allows usage of a Resource string. +#define REGMAP_RESOURCE(x, resid) ATLRegmapEntryHelper(OLESTR(##x), resid), + +// This allows usage of a static function to be called to provide the string. +#define REGMAP_FUNCTION(x, f) ATLRegmapEntryHelper(OLESTR(##x), ##f()), + +#define END_REGISTRY_MAP() ATLRegmapEntryHelper() };\ + return (_ATL_REGMAP_ENTRY*)map;\ + } + +#define DECLARE_REGISTRY_RESOURCEID_EX(x)\ + static HRESULT WINAPI UpdateRegistry(BOOL bRegister) {\ + return ATL::_pAtlModule->UpdateRegistryFromResource((UINT)x, bRegister, \ + _GetRegistryMap());\ + } + +#endif // BASE_WIN_RGS_HELPER_H_ diff --git a/ceee/ie/broker/broker.h b/ceee/ie/broker/broker.h index 8132e8a..163757a 100644 --- a/ceee/ie/broker/broker.h +++ b/ceee/ie/broker/broker.h @@ -11,6 +11,7 @@ #include <atlbase.h> #include <atlcom.h> +#include "base/win/rgs_helper.h" #include "ceee/ie/broker/resource.h" #include "broker_lib.h" // NOLINT @@ -30,7 +31,12 @@ class ATL_NO_VTABLE CeeeBroker public ICeeeBrokerRegistrar, public IExternalConnectionImpl<CeeeBroker> { public: - DECLARE_REGISTRY_RESOURCEID(IDR_BROKER) + DECLARE_REGISTRY_RESOURCEID_EX(IDR_BROKER) + BEGIN_REGISTRY_MAP(CeeeBroker) + REGMAP_UUID("CLSID", CLSID_CeeeBroker) + REGMAP_UUID("LIBID", LIBID_CeeeBrokerLib) + REGMAP_ENTRY("NAME", "Google CEEE Broker") + END_REGISTRY_MAP() DECLARE_NOT_AGGREGATABLE(CeeeBroker) BEGIN_COM_MAP(CeeeBroker) diff --git a/ceee/ie/broker/broker.rgs b/ceee/ie/broker/broker.rgs index 65b012b..50ee07d 100644 --- a/ceee/ie/broker/broker.rgs +++ b/ceee/ie/broker/broker.rgs @@ -1,9 +1,9 @@ HKCR { NoRemove CLSID { - ForceRemove {6D88A70D-2218-4466-BBD6-87AB563811A2} = s 'Google CEEE Broker' { + ForceRemove '%CLSID%' = s '%NAME%' { ForceRemove 'Programmable' LocalServer32 = s '%MODULE%' - 'TypeLib' = s '{45B783D0-8040-49a6-A719-84E320AAB3C5}' + 'TypeLib' = s '%LIBID%' } } } diff --git a/ceee/ie/plugin/bho/browser_helper_object.h b/ceee/ie/plugin/bho/browser_helper_object.h index 293858f..074ee84 100644 --- a/ceee/ie/plugin/bho/browser_helper_object.h +++ b/ceee/ie/plugin/bho/browser_helper_object.h @@ -21,6 +21,7 @@ #include "base/win/scoped_bstr.h" #include "base/win/scoped_comptr.h" #include "base/task.h" +#include "base/win/rgs_helper.h" #include "ceee/ie/broker/broker_rpc_client.h" #include "ceee/ie/plugin/bho/tab_events_funnel.h" #include "ceee/ie/common/chrome_frame_host.h" @@ -50,7 +51,12 @@ class ATL_NO_VTABLE BrowserHelperObject public ToolBandVisibility, public WebBrowserEventsSource { public: - DECLARE_REGISTRY_RESOURCEID(IDR_BROWSERHELPEROBJECT) + DECLARE_REGISTRY_RESOURCEID_EX(IDR_BROWSERHELPEROBJECT) + BEGIN_REGISTRY_MAP(BrowserHelperObject) + REGMAP_UUID("CLSID", CLSID_BrowserHelperObject) + REGMAP_RESOURCE("NAME", IDS_CEEE_NAME) + END_REGISTRY_MAP() + DECLARE_NOT_AGGREGATABLE(BrowserHelperObject) BEGIN_COM_MAP(BrowserHelperObject) diff --git a/ceee/ie/plugin/bho/browser_helper_object.rgs b/ceee/ie/plugin/bho/browser_helper_object.rgs index fd794ab..f8cf0eb 100644 --- a/ceee/ie/plugin/bho/browser_helper_object.rgs +++ b/ceee/ie/plugin/bho/browser_helper_object.rgs @@ -1,6 +1,6 @@ HKCR { NoRemove CLSID { - ForceRemove {E49EBDB7-CEC9-4014-A5F5-8D3C8F5997DC} = s 'Google Chrome Extensions Execution Environment Helper' { + ForceRemove '%CLSID%' = s '%NAME%' { InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } @@ -15,7 +15,7 @@ HKLM { NoRemove CurrentVersion { NoRemove Explorer { NoRemove 'Browser Helper Objects' { - ForceRemove '{E49EBDB7-CEC9-4014-A5F5-8D3C8F5997DC}' = s 'Google Chrome Extensions Execution Environment Helper' { + ForceRemove '%CLSID%' = s '%NAME%' { val 'NoExplorer' = d '1' } } diff --git a/ceee/ie/plugin/bho/executor.h b/ceee/ie/plugin/bho/executor.h index eeea590..7df38fe 100644 --- a/ceee/ie/plugin/bho/executor.h +++ b/ceee/ie/plugin/bho/executor.h @@ -15,6 +15,7 @@ #include "base/scoped_ptr.h" #include "base/task.h" +#include "base/win/rgs_helper.h" #include "ceee/ie/plugin/bho/infobar_manager.h" #include "ceee/ie/plugin/toolband/resource.h" @@ -38,7 +39,12 @@ class ATL_NO_VTABLE CeeeExecutorCreator CeeeExecutorCreator(); void FinalRelease(); - DECLARE_REGISTRY_RESOURCEID(IDR_EXECUTOR_CREATOR) + DECLARE_REGISTRY_RESOURCEID_EX(IDR_EXECUTOR) + BEGIN_REGISTRY_MAP(CeeeExecutorCreator) + REGMAP_UUID("CLSID", CLSID_CeeeExecutorCreator) + REGMAP_RESOURCE("NAME", IDS_CEEE_EXECUTOR_CREATOR_NAME) + REGMAP_ENTRY("THREADING_MODEL", "Free") + END_REGISTRY_MAP() DECLARE_NOT_AGGREGATABLE(CeeeExecutorCreator) BEGIN_COM_MAP(CeeeExecutorCreator) @@ -167,7 +173,12 @@ class ATL_NO_VTABLE CeeeExecutor public ICeeeCookieExecutor, public ICeeeInfobarExecutor { public: - DECLARE_REGISTRY_RESOURCEID(IDR_EXECUTOR) + DECLARE_REGISTRY_RESOURCEID_EX(IDR_EXECUTOR) + BEGIN_REGISTRY_MAP(CeeeExecutor) + REGMAP_UUID("CLSID", CLSID_CeeeExecutor) + REGMAP_RESOURCE("NAME", IDS_CEEE_EXECUTOR_NAME) + REGMAP_ENTRY("THREADING_MODEL", "Apartment") + END_REGISTRY_MAP() DECLARE_NOT_AGGREGATABLE(CeeeExecutor) BEGIN_COM_MAP(CeeeExecutor) diff --git a/ceee/ie/plugin/bho/executor.rgs b/ceee/ie/plugin/bho/executor.rgs index 4fed5bc..07fb84a 100644 --- a/ceee/ie/plugin/bho/executor.rgs +++ b/ceee/ie/plugin/bho/executor.rgs @@ -1,8 +1,8 @@ HKCR { NoRemove CLSID { - ForceRemove '{057FCFE3-F872-483d-86B0-0430E375E41F}' = s 'Google CEEE Executor' { + ForceRemove '%CLSID%' = s '%NAME%' { InprocServer32 = s '%MODULE%' { - val ThreadingModel = s 'Apartment' + val ThreadingModel = s '%THREADING_MODEL%' } } } diff --git a/ceee/ie/plugin/bho/executor_creator.rgs b/ceee/ie/plugin/bho/executor_creator.rgs deleted file mode 100644 index 3a81441..0000000 --- a/ceee/ie/plugin/bho/executor_creator.rgs +++ /dev/null @@ -1,9 +0,0 @@ -HKCR { - NoRemove CLSID { - ForceRemove '{4A562910-2D54-4e98-B87F-D4A7F5F5D0B9}' = s 'Google CEEE Executor Creator' { - InprocServer32 = s '%MODULE%' { - val ThreadingModel = s 'Free' - } - } - } -} diff --git a/ceee/ie/plugin/toolband/resource.h b/ceee/ie/plugin/toolband/resource.h index 1d27001..b3856e5 100644 --- a/ceee/ie/plugin/toolband/resource.h +++ b/ceee/ie/plugin/toolband/resource.h @@ -17,17 +17,20 @@ #define IDR_TOOL_BAND 103 #define IDR_GREASEMONKEY_API_JS 105 #define IDR_EXECUTOR 106 -#define IDR_EXECUTOR_CREATOR 107 #define IDR_TOOLBAND_PROXY 108 +#define IDS_CEEE_NAME 109 +#define IDS_CEEE_EXECUTOR_CREATOR_NAME 110 +#define IDS_CEEE_EXECUTOR_NAME 111 + // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 109 +#define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 109 +#define _APS_NEXT_SYMED_VALUE 112 #endif #endif diff --git a/ceee/ie/plugin/toolband/tool_band.h b/ceee/ie/plugin/toolband/tool_band.h index 08ae691..e48dfd5 100644 --- a/ceee/ie/plugin/toolband/tool_band.h +++ b/ceee/ie/plugin/toolband/tool_band.h @@ -20,6 +20,7 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" +#include "base/win/rgs_helper.h" #include "ceee/ie/plugin/toolband/resource.h" #include "chrome_tab.h" // NOLINT @@ -53,7 +54,11 @@ class ATL_NO_VTABLE ToolBand : public CComObjectRootEx<CComSingleThreadModel>, ToolBand(); ~ToolBand(); - DECLARE_REGISTRY_RESOURCEID(IDR_TOOL_BAND) + DECLARE_REGISTRY_RESOURCEID_EX(IDR_TOOL_BAND) + BEGIN_REGISTRY_MAP(ToolBand) + REGMAP_UUID("CLSID", CLSID_ToolBand) + REGMAP_RESOURCE("NAME", IDS_CEEE_NAME) + END_REGISTRY_MAP() BEGIN_COM_MAP(ToolBand) COM_INTERFACE_ENTRY(IDeskBand) diff --git a/ceee/ie/plugin/toolband/tool_band.rgs b/ceee/ie/plugin/toolband/tool_band.rgs index 0a7ec34..e9ff6ba 100644 --- a/ceee/ie/plugin/toolband/tool_band.rgs +++ b/ceee/ie/plugin/toolband/tool_band.rgs @@ -1,6 +1,6 @@ HKCR { NoRemove CLSID { - ForceRemove '{2F1A2D6B-55F6-4B63-8C37-F698D28FDC2B}' = s 'Google Chrome Extensions Execution Environment' { + ForceRemove '%CLSID%' = s '%NAME%' { InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } @@ -12,7 +12,7 @@ HKLM { NoRemove Microsoft { NoRemove 'Internet Explorer' { NoRemove Toolbar { - val '{2F1A2D6B-55F6-4B63-8C37-F698D28FDC2B}' = s 'Google Chrome Extensions Execution Environment' + val '%CLSID%' = s '%NAME%' } } } diff --git a/ceee/ie/plugin/toolband/toolband.gyp b/ceee/ie/plugin/toolband/toolband.gyp index 63686f1..16eb0e5 100644 --- a/ceee/ie/plugin/toolband/toolband.gyp +++ b/ceee/ie/plugin/toolband/toolband.gyp @@ -63,7 +63,6 @@ 'toolband_module.cc', '../bho/browser_helper_object.rgs', '../executor.rgs', - '../executor_creator.rgs', '../scripting/content_script_manager.rc', ], 'libraries': [ diff --git a/ceee/ie/plugin/toolband/toolband.rc b/ceee/ie/plugin/toolband/toolband.rc index d31f5b2..9a2609a 100644 --- a/ceee/ie/plugin/toolband/toolband.rc +++ b/ceee/ie/plugin/toolband/toolband.rc @@ -80,7 +80,6 @@ END IDR_BROWSERHELPEROBJECT REGISTRY "ceee\\ie\\plugin\\bho\\browser_helper_object.rgs" IDR_EXECUTOR REGISTRY "ceee\\ie\\plugin\\bho\\executor.rgs" -IDR_EXECUTOR_CREATOR REGISTRY "ceee\\ie\\plugin\\bho\\executor_creator.rgs" IDR_TOOL_BAND REGISTRY "tool_band.rgs" IDR_TOOLBAND_PROXY REGISTRY "toolband_proxy.rgs" @@ -98,7 +97,10 @@ IDR_GREASEMONKEY_API_JS BINDATA "chrome\\renderer\\resources\\gr STRINGTABLE BEGIN - IDS_PROJNAME "IE" + IDS_PROJNAME "IE" + IDS_CEEE_NAME "Google Chrome Extensions Execution Environment" + IDS_CEEE_EXECUTOR_CREATOR_NAME "Google CEEE Executor Creator" + IDS_CEEE_EXECUTOR_NAME "Google CEEE Executor" END #endif // English (U.S.) resources |