summaryrefslogtreecommitdiffstats
path: root/chrome_frame/bho.cc
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 19:28:50 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 19:28:50 +0000
commit6e58a95b99e1c88172d5eae8925c8dfa39c2b765 (patch)
tree77e93bb7e93198024c36e5a6bba434b9412820ac /chrome_frame/bho.cc
parentf24a74a242f8605d43085d6cc0cb36e5e376b2d4 (diff)
downloadchromium_src-6e58a95b99e1c88172d5eae8925c8dfa39c2b765.zip
chromium_src-6e58a95b99e1c88172d5eae8925c8dfa39c2b765.tar.gz
chromium_src-6e58a95b99e1c88172d5eae8925c8dfa39c2b765.tar.bz2
Integrate the Ready Mode prompt with IE and Chrome Frame. In Ready Mode, prompts are displayed when the user browses to GCF-enabled sites, allowing the user to permanently activate, permanently decline, or temporarily decline Chrome Frame.
BUG=None TEST=chrome_frame_unittests --gtest_filter=Ready* && chrome_frame_unittests --gtest_filter=Infobar* && setup.exe --chrome-frame --ready-mode --multi-install --system--level --chrome Review URL: http://codereview.chromium.org/6040003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71215 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/bho.cc')
-rw-r--r--chrome_frame/bho.cc45
1 files changed, 44 insertions, 1 deletions
diff --git a/chrome_frame/bho.cc b/chrome_frame/bho.cc
index f7e8129..7feb0ca 100644
--- a/chrome_frame/bho.cc
+++ b/chrome_frame/bho.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -15,9 +15,11 @@
#include "chrome_tab.h" // NOLINT
#include "chrome_frame/crash_reporting/crash_metrics.h"
#include "chrome_frame/extra_system_apis.h"
+#include "chrome_frame/html_utils.h"
#include "chrome_frame/http_negotiate.h"
#include "chrome_frame/metrics_service.h"
#include "chrome_frame/protocol_sink_wrap.h"
+#include "chrome_frame/ready_mode/ready_mode.h"
#include "chrome_frame/urlmon_moniker.h"
#include "chrome_frame/utils.h"
#include "chrome_frame/vtable_patch_manager.h"
@@ -66,6 +68,38 @@ HRESULT Bho::FinalConstruct() {
void Bho::FinalRelease() {
}
+namespace {
+
+// Allows Ready Mode to disable Chrome Frame by deactivating User Agent
+// modification and X-UA-Compatible header/tag detection.
+class ReadyModeDelegateImpl : public ready_mode::Delegate {
+ public:
+ ReadyModeDelegateImpl() {}
+
+ // ready_mode::Delegate implementation
+ virtual void DisableChromeFrame();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ReadyModeDelegateImpl);
+}; // class ReadyModeDelegateImpl
+
+void SynchronizeEnablementState() {
+ std::string user_agent(http_utils::GetDefaultUserAgent());
+ bool enabled = user_agent.find("chromeframe") != std::string::npos;
+ ProtocolSinkWrap::set_ignore_xua(!enabled);
+}
+
+void ReadyModeDelegateImpl::DisableChromeFrame() {
+ if (GetIEVersion() != IE_9) {
+ SynchronizeEnablementState();
+ } else {
+ HttpNegotiatePatch::set_modify_user_agent(false);
+ ProtocolSinkWrap::set_ignore_xua(true);
+ }
+}
+
+} // namespace
+
STDMETHODIMP Bho::SetSite(IUnknown* site) {
HRESULT hr = S_OK;
if (site) {
@@ -74,6 +108,15 @@ STDMETHODIMP Bho::SetSite(IUnknown* site) {
if (web_browser2) {
hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2);
DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr;
+
+ ready_mode::Configure(new ReadyModeDelegateImpl(), web_browser2);
+
+ // At this time, the user agent has been updated to reflect the Ready Mode
+ // state. We should make sure to modify our recognition of meta tags
+ // accordingly. On IE 9, another method is used to manage meta tags.
+ if (GetIEVersion() != IE_9) {
+ SynchronizeEnablementState();
+ }
}
if (g_patch_helper.state() == PatchHelper::PATCH_IBROWSER) {