summaryrefslogtreecommitdiffstats
path: root/chrome_frame/chrome_tab.cc
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 20:03:23 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 20:03:23 +0000
commit8adbf7e5d0af7fec5d3fde8d472716739d3183fc (patch)
treec4210f0d8e9c01ad49cbe48f8c4fcaa56fa9d891 /chrome_frame/chrome_tab.cc
parentd17054237974d50db49c10d18a05a42048478db7 (diff)
downloadchromium_src-8adbf7e5d0af7fec5d3fde8d472716739d3183fc.zip
chromium_src-8adbf7e5d0af7fec5d3fde8d472716739d3183fc.tar.gz
chromium_src-8adbf7e5d0af7fec5d3fde8d472716739d3183fc.tar.bz2
Recommit of the ill-fated r44474, this time with new compiling goodness.
Add multi-version delegation to Chrome Frame such that CF will scan for older versions on load and delegate to them. This is to support clean upgrade scenarios whereby a new version is registered while IE is running. BUG=40117 TEST=Register a new CF version while an old one is loaded in IE. Open a few new tabs and observe nothing bad happening. TBR=tommi Review URL: http://codereview.chromium.org/1585037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_tab.cc')
-rw-r--r--chrome_frame/chrome_tab.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc
index d8deec4..08e8a84 100644
--- a/chrome_frame/chrome_tab.cc
+++ b/chrome_frame/chrome_tab.cc
@@ -13,6 +13,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/file_version_info.h"
+#include "base/lock.h"
#include "base/logging.h"
#include "base/logging_win.h"
#include "base/path_service.h"
@@ -30,6 +31,7 @@
#include "chrome_frame/chrome_frame_reporting.h"
#include "chrome_frame/chrome_launcher.h"
#include "chrome_frame/chrome_protocol.h"
+#include "chrome_frame/module_utils.h"
#include "chrome_frame/resource.h"
#include "chrome_frame/utils.h"
#include "googleurl/src/url_util.h"
@@ -45,7 +47,6 @@ void InitGoogleUrl() {
url_util::IsStandard(kDummyUrl,
url_parse::MakeRange(0, arraysize(kDummyUrl)));
}
-
}
static const wchar_t kBhoRegistryPath[] =
@@ -72,6 +73,11 @@ OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument)
OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex)
OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol)
+
+// See comments in DllGetClassObject.
+DllRedirector g_dll_redirector;
+Lock g_redirector_lock;
+
class ChromeTabModule
: public AtlPerUserModule<CAtlDllModuleT<ChromeTabModule> > {
public:
@@ -316,12 +322,29 @@ STDAPI DllCanUnloadNow() {
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) {
- if (g_patch_helper.InitializeAndPatchProtocolsIfNeeded()) {
- // We should only get here once.
- UrlMkSetSessionOption(URLMON_OPTION_USERAGENT_REFRESH, NULL, 0, 0);
+ // On first call, we scan the loaded module list to see if an older version
+ // of Chrome Frame is already loaded. If it is, then we delegate all calls
+ // to DllGetClassObject to it. This is to avoid having instances of
+ // different versions of e.g. the BHO through an upgrade. It also prevents
+ // us from repeatedly patching.
+ LPFNGETCLASSOBJECT redir_ptr = NULL;
+ {
+ AutoLock lock(g_redirector_lock);
+ g_dll_redirector.EnsureInitialized(L"npchrome_frame.dll",
+ CLSID_ChromeActiveDocument);
+ redir_ptr = g_dll_redirector.get_dll_get_class_object_ptr();
}
- return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
+ if (redir_ptr) {
+ return redir_ptr(rclsid, riid, ppv);
+ } else {
+ if (g_patch_helper.InitializeAndPatchProtocolsIfNeeded()) {
+ // We should only get here once.
+ UrlMkSetSessionOption(URLMON_OPTION_USERAGENT_REFRESH, NULL, 0, 0);
+ }
+
+ return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
+ }
}
// DllRegisterServer - Adds entries to the system registry