From 79206cd0e7123e56006b165c824acdb0b3559b63 Mon Sep 17 00:00:00 2001 From: "robertshield@chromium.org" Date: Wed, 17 Nov 2010 17:53:48 +0000 Subject: Make use of the new version flag in Chrome to load the correct chrome.dll version. Also fix a memory leak in the Chrome Frame automation code. BUG=61609 TEST=Chrome.exe always loads the specified chrome.dll when run by Chrome Frame. Review URL: http://codereview.chromium.org/5090001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66462 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/chrome_frame_automation.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'chrome_frame/chrome_frame_automation.cc') diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index b05c32aa..7a49f18 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -45,6 +45,15 @@ static const wchar_t kUmaSendIntervalValue[] = L"UmaSendInterval"; // threads. Lock g_ChromeFrameHistogramLock; +namespace { +std::wstring GetCurrentModuleVersion() { + scoped_ptr module_version_info( + FileVersionInfo::CreateFileVersionInfoForCurrentModule()); + DCHECK(module_version_info.get() != NULL); + return module_version_info->file_version(); +} +} + class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter : public IPC::ChannelProxy::MessageFilter { public: @@ -305,6 +314,10 @@ void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params, command_line->AppendSwitchPath(switches::kUserDataDir, params->profile_path()); + // Ensure that Chrome is running the specified version of chrome.dll. + command_line->AppendSwitchNative(switches::kChromeVersion, + GetCurrentModuleVersion()); + if (!params->language().empty()) command_line->AppendSwitchNative(switches::kLang, params->language()); @@ -1301,14 +1314,7 @@ void ChromeFrameAutomationClient::SendContextMenuCommandToChromeFrame( } std::wstring ChromeFrameAutomationClient::GetVersion() const { - static FileVersionInfo* version_info = - FileVersionInfo::CreateFileVersionInfoForCurrentModule(); - - std::wstring version; - if (version_info) - version = version_info->product_version(); - - return version; + return GetCurrentModuleVersion(); } void ChromeFrameAutomationClient::Print(HDC print_dc, -- cgit v1.1