summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 14:52:13 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 14:52:13 +0000
commit6bdc0c05de20c550dda6bf317e18499f510759e5 (patch)
tree179ee06c6ef65d4923085dc37e34bbaea8c5e78c /chrome_frame
parent5af3c573076a8f04c285d6a0c40237462375e7c5 (diff)
downloadchromium_src-6bdc0c05de20c550dda6bf317e18499f510759e5.zip
chromium_src-6bdc0c05de20c550dda6bf317e18499f510759e5.tar.gz
chromium_src-6bdc0c05de20c550dda6bf317e18499f510759e5.tar.bz2
First step for cleaning registration code for ChromeFrame.
Create separate RGS file for registering CLSID as a BHO. Remove the code that manually did the BHO registration. BUG=48987 Review URL: http://codereview.chromium.org/3029007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/chrome_frame.gyp1
-rw-r--r--chrome_frame/chrome_tab.cc66
-rw-r--r--chrome_frame/register_bho.rgs17
-rw-r--r--chrome_frame/resources/chrome_frame_resources.grd1
4 files changed, 24 insertions, 61 deletions
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index b08cb14..a0362ca 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -648,6 +648,7 @@
'ole_document_impl.h',
'protocol_sink_wrap.cc',
'protocol_sink_wrap.h',
+ 'register_bho.rgs',
'stream_impl.cc',
'stream_impl.h',
'sync_msg_reply_dispatcher.cc',
diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc
index 71c20ff..aa404b2 100644
--- a/chrome_frame/chrome_tab.cc
+++ b/chrome_frame/chrome_tab.cc
@@ -83,10 +83,9 @@ OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol)
// See comments in DllGetClassObject.
LPFNGETCLASSOBJECT g_dll_get_class_object_redir_ptr = NULL;
-class ChromeTabModule
- : public AtlPerUserModule<CAtlDllModuleT<ChromeTabModule> > {
+class ChromeTabModule : public CAtlDllModuleT<ChromeTabModule> {
public:
- typedef AtlPerUserModule<CAtlDllModuleT<ChromeTabModule> > ParentClass;
+ typedef CAtlDllModuleT<ChromeTabModule> ParentClass;
DECLARE_LIBID(LIBID_ChromeTabLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_CHROMETAB,
@@ -242,61 +241,6 @@ HRESULT RefreshElevationPolicy() {
return hr;
}
-HRESULT RegisterChromeTabBHO() {
- RegKey ie_bho_key;
- if (!ie_bho_key.Create(HKEY_LOCAL_MACHINE, kBhoRegistryPath,
- KEY_CREATE_SUB_KEY)) {
- DLOG(WARNING) << "Failed to open registry key "
- << kBhoRegistryPath
- << " for write";
- return E_FAIL;
- }
-
- wchar_t bho_class_id_as_string[MAX_PATH] = {0};
- StringFromGUID2(CLSID_ChromeFrameBHO, bho_class_id_as_string,
- arraysize(bho_class_id_as_string));
-
- if (!ie_bho_key.CreateKey(bho_class_id_as_string, KEY_READ | KEY_WRITE)) {
- DLOG(WARNING) << "Failed to create bho registry key under "
- << kBhoRegistryPath
- << " for write";
- return E_FAIL;
- }
-
- ie_bho_key.WriteValue(kBhoNoLoadExplorerValue, 1);
- DLOG(INFO) << "Registered ChromeTab BHO";
-
- // We now add the chromeframe user agent at runtime.
- RefreshElevationPolicy();
- return S_OK;
-}
-
-HRESULT UnregisterChromeTabBHO() {
- RegKey ie_bho_key;
- if (!ie_bho_key.Open(HKEY_LOCAL_MACHINE, kBhoRegistryPath,
- KEY_READ | KEY_WRITE)) {
- DLOG(WARNING) << "Failed to open registry key "
- << kBhoRegistryPath
- << " for write.";
- return E_FAIL;
- }
-
- wchar_t bho_class_id_as_string[MAX_PATH] = {0};
- StringFromGUID2(CLSID_ChromeFrameBHO, bho_class_id_as_string,
- arraysize(bho_class_id_as_string));
-
- if (!ie_bho_key.DeleteKey(bho_class_id_as_string)) {
- DLOG(WARNING) << "Failed to delete bho registry key "
- << bho_class_id_as_string
- << " under "
- << kBhoRegistryPath;
- return E_FAIL;
- }
-
- DLOG(INFO) << "Unregistered ChromeTab BHO";
- return S_OK;
-}
-
// Experimental boot prefetch optimization for Chrome Frame
//
// If chrome is warmed up during a single reboot, it gets paged
@@ -364,14 +308,14 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) {
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer() {
- // registers object, typelib and all interfaces in typelib
+ // registers objects, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer(TRUE);
if (SUCCEEDED(hr)) {
// Best effort attempt to register the BHO. At this point we silently
// ignore any errors during registration. There are some traces emitted
// to the debug log.
- RegisterChromeTabBHO();
+ _AtlModule.UpdateRegistryFromResourceS(IDR_REGISTER_BHO, TRUE);
if (!RegisterSecuredMimeHandler(true))
hr = E_FAIL;
SetupRunOnce();
@@ -392,7 +336,7 @@ STDAPI DllUnregisterServer() {
// Best effort attempt to unregister the BHO. At this point we silently
// ignore any errors during unregistration. There are some traces emitted
// to the debug log.
- UnregisterChromeTabBHO();
+ _AtlModule.UpdateRegistryFromResourceS(IDR_REGISTER_BHO, FALSE);
if (!RegisterSecuredMimeHandler(false))
hr = E_FAIL;
}
diff --git a/chrome_frame/register_bho.rgs b/chrome_frame/register_bho.rgs
new file mode 100644
index 0000000..87df0a1
--- /dev/null
+++ b/chrome_frame/register_bho.rgs
@@ -0,0 +1,17 @@
+HKLM {
+ NoRemove SOFTWARE {
+ NoRemove Microsoft {
+ NoRemove Windows {
+ NoRemove CurrentVersion {
+ NoRemove Explorer {
+ NoRemove 'Browser Helper Objects' {
+ ForceRemove {ECB3C477-1A0A-44BD-BB57-78F9EFE34FA7} = s 'ChromeFrame BHO' {
+ val NoExplorer = d 1
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/chrome_frame/resources/chrome_frame_resources.grd b/chrome_frame/resources/chrome_frame_resources.grd
index 97b09de..11cb3ee 100644
--- a/chrome_frame/resources/chrome_frame_resources.grd
+++ b/chrome_frame/resources/chrome_frame_resources.grd
@@ -25,6 +25,7 @@ for localizable strings
</structure>
</structures>
<includes>
+ <include name="IDR_REGISTER_BHO" file="../register_bho.rgs" type="REGISTRY" />
<include name="IDR_BHO" file="../bho.rgs" type="REGISTRY" />
<include name="IDR_CHROMEACTIVEDOCUMENT" file="../chrome_active_document.rgs" type="REGISTRY" />
<include name="IDR_CHROMEFRAME_ACTIVEX" file="../chrome_frame_activex.rgs" type="REGISTRY" />