diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 01:14:41 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 01:14:41 +0000 |
commit | f30e74751217091c0b6050080f46cd6eb4914226 (patch) | |
tree | a2dcb8e715d1578698856e38c36459602dc19732 /chrome_frame/chrome_frame_activex.cc | |
parent | 9b2ab5910c58603ec655bb613bec7596e732f87b (diff) | |
download | chromium_src-f30e74751217091c0b6050080f46cd6eb4914226.zip chromium_src-f30e74751217091c0b6050080f46cd6eb4914226.tar.gz chromium_src-f30e74751217091c0b6050080f46cd6eb4914226.tar.bz2 |
Adding a privileged callback used in IE CF to check whether to show
the version mismatch warning dialog. Used this in ceee/ to only show
it once per tab.
Changed the logic in Firefox to show the warning dialog even when
in privileged mode. This will mean it gets shown once per Firefox
window.
Wrote a unit test for the additional logic in ChromeFrameActivex.
To write the unit test, used com_mock.py to generate a mock of
the IChromeFramePrivileged interface. This can be extended to
generate mocks of the other CF interfaces.
Discovered duplication of np_browser_functions.h and .cc, resolved
this to a single copy (the one under chrome_frame).
Changed things around so chrome_tab.idl is built only once; this
also lets me more easily depend on it in the com_mock rule.
BUG=none
TEST=chrome_frame_unittests.exe
Review URL: http://codereview.chromium.org/4563001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_frame_activex.cc')
-rw-r--r-- | chrome_frame/chrome_frame_activex.cc | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index a5d6d99..6085546 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -246,13 +246,35 @@ void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle, } } +bool ChromeFrameActivex::ShouldShowVersionMismatchDialog( + bool is_privileged, + IOleClientSite* client_site) { + if (!is_privileged) { + return true; + } + + if (client_site) { + ScopedComPtr<IChromeFramePrivileged> service; + HRESULT hr = DoQueryService(SID_ChromeFramePrivileged, + client_site, + service.Receive()); + if (SUCCEEDED(hr) && service) { + return (S_FALSE != service->ShouldShowVersionMismatchDialog()); + } + } + + NOTREACHED(); + return true; +} + void ChromeFrameActivex::OnAutomationServerLaunchFailed( AutomationLaunchResult reason, const std::string& server_version) { Base::OnAutomationServerLaunchFailed(reason, server_version); - // Do not display warnings for privileged instances of Chrome Frame. - if (reason == AUTOMATION_VERSION_MISMATCH && !is_privileged_) { - THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.VersionMismatchDisplayed", 1); + if (reason == AUTOMATION_VERSION_MISMATCH && + ShouldShowVersionMismatchDialog(is_privileged_, m_spClientSite)) { + THREAD_SAFE_UMA_HISTOGRAM_COUNTS( + "ChromeFrame.VersionMismatchDisplayed", 1); DisplayVersionMismatchWarning(m_hWnd, server_version); } } |