summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-23 22:58:12 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-23 22:58:12 +0000
commitdfd686c82fe33506859d276a3eff69364cc9cb0f (patch)
treecf97fef93846503ad953ae87cd5be0e74ba8910d /chrome
parent0b65762d496cec3272f5473c05c49ec99df21dff (diff)
downloadchromium_src-dfd686c82fe33506859d276a3eff69364cc9cb0f.zip
chromium_src-dfd686c82fe33506859d276a3eff69364cc9cb0f.tar.gz
chromium_src-dfd686c82fe33506859d276a3eff69364cc9cb0f.tar.bz2
Insecure content infobar cleanup:
* Rename files, classes and functions from "BlockedInfoBarXXX" (which sounds like Chrome blocked an infobar, or perhaps blocked something else that we don't know what) to "InsecureContentInfoBarXXX" * Eliminate subclasses of the base delegate and just use a type enum -- eliminates duplicated code * Collapse histograms into a single histogram so it will be easy to compare display/run stats * Remove "OK" button which duplicated close button functionality ("OK" is never a good button title anyway) * Clean up #includes a little BUG=none TEST=none Review URL: http://codereview.chromium.org/7244011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/browser/tab_contents/blocked_infobar_delegate.cc152
-rw-r--r--chrome/browser/tab_contents/blocked_infobar_delegate.h74
-rw-r--r--chrome/browser/tab_contents/infobar_delegate.cc7
-rw-r--r--chrome/browser/tab_contents/infobar_delegate.h4
-rw-r--r--chrome/browser/tab_contents/insecure_content_infobar_delegate.cc76
-rw-r--r--chrome/browser/tab_contents/insecure_content_infobar_delegate.h56
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc26
-rw-r--r--chrome/chrome_browser.gypi4
9 files changed, 157 insertions, 245 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index ab8712b..99c812e 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4519,8 +4519,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
Insecure script has been blocked.
</message>
<message name="IDS_ALLOW_INSECURE_CONTENT_BUTTON" desc="Button to allow insecure content to be displayed">
- Load Anyway
+ Load anyway (not recommended)
</message>
+
<if expr="pp_ifdef('chromeos')">
<!-- Locale Change Notification-->
<message name="IDS_LOCALE_CHANGE_MESSAGE" desc="Message shown when locale was changed based on profile content.">
diff --git a/chrome/browser/tab_contents/blocked_infobar_delegate.cc b/chrome/browser/tab_contents/blocked_infobar_delegate.cc
deleted file mode 100644
index f644c33..0000000
--- a/chrome/browser/tab_contents/blocked_infobar_delegate.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-// 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.
-
-#include "chrome/browser/tab_contents/blocked_infobar_delegate.h"
-
-#include "base/metrics/histogram.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/render_messages.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-namespace {
-
-enum BlockedInfoBarEvent {
- BLOCKED_INFOBAR_EVENT_SHOWN = 0, // Infobar was added to the tab.
- BLOCKED_INFOBAR_EVENT_ALLOWED, // User clicked allowed anyay button.
- BLOCKED_INFOBAR_EVENT_CANCELLED, // Reserved (if future cancel button).
- BLOCKED_INFOBAR_EVENT_DISMISSED, // User clicked "x" to dismiss bar.
- BLOCKED_INFOBAR_EVENT_LAST // First unused value.
-};
-
-const char kDisplayingLearnMoreURL[] =
- "https://www.google.com/support/chrome/bin/answer.py?answer=1342710";
-
-const char kRunningLearnMoreURL[] =
- "https://www.google.com/support/chrome/bin/answer.py?answer=1342714";
-
-} // namespace
-
-BlockedInfoBarDelegate::BlockedInfoBarDelegate(TabContentsWrapper* wrapper,
- int message_resource_id,
- int button_resource_id,
- const GURL& url)
- : ConfirmInfoBarDelegate(wrapper->tab_contents()),
- wrapper_(wrapper),
- message_resource_id_(message_resource_id),
- button_resource_id_(button_resource_id),
- url_(url) {
-}
-
-BlockedInfoBarDelegate* BlockedInfoBarDelegate::AsBlockedInfoBarDelegate() {
- return this;
-}
-
-string16 BlockedInfoBarDelegate::GetMessageText() const {
- return l10n_util::GetStringUTF16(message_resource_id_);
-}
-
-int BlockedInfoBarDelegate::GetButtons() const {
- return BUTTON_OK | BUTTON_CANCEL;
-}
-
-string16 BlockedInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
- return l10n_util::GetStringUTF16(
- button == BUTTON_OK ? IDS_OK : button_resource_id_);
-};
-
-string16 BlockedInfoBarDelegate::GetLinkText() {
- return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
-}
-
-bool BlockedInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
- TabContents* contents = wrapper_->tab_contents();
- if (disposition == CURRENT_TAB)
- disposition = NEW_FOREGROUND_TAB;
- contents->OpenURL(url_, GURL(), disposition, PageTransition::LINK);
- return false;
-}
-
-BlockedRunningInfoBarDelegate*
-BlockedInfoBarDelegate::AsBlockedRunningInfoBarDelegate() {
- return NULL;
-}
-
-BlockedDisplayingInfoBarDelegate::BlockedDisplayingInfoBarDelegate(
- TabContentsWrapper* wrapper)
- : BlockedInfoBarDelegate(
- wrapper,
- IDS_BLOCKED_DISPLAYING_INSECURE_CONTENT,
- IDS_ALLOW_INSECURE_CONTENT_BUTTON,
- GURL(kDisplayingLearnMoreURL)) {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar",
- BLOCKED_INFOBAR_EVENT_SHOWN,
- BLOCKED_INFOBAR_EVENT_LAST);
-}
-
-void BlockedDisplayingInfoBarDelegate::InfoBarDismissed() {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar",
- BLOCKED_INFOBAR_EVENT_DISMISSED,
- BLOCKED_INFOBAR_EVENT_LAST);
- InfoBarDelegate::InfoBarDismissed();
-}
-
-bool BlockedDisplayingInfoBarDelegate::Accept() {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar",
- BLOCKED_INFOBAR_EVENT_CANCELLED,
- BLOCKED_INFOBAR_EVENT_LAST);
- return true;
-}
-
-bool BlockedDisplayingInfoBarDelegate::Cancel() {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar",
- BLOCKED_INFOBAR_EVENT_ALLOWED,
- BLOCKED_INFOBAR_EVENT_LAST);
- wrapper()->Send(new ViewMsg_SetAllowDisplayingInsecureContent(
- wrapper()->routing_id(), true));
- return true;
-}
-
-BlockedRunningInfoBarDelegate::BlockedRunningInfoBarDelegate(
- TabContentsWrapper* wrapper)
- : BlockedInfoBarDelegate(
- wrapper,
- IDS_BLOCKED_RUNNING_INSECURE_CONTENT,
- IDS_ALLOW_INSECURE_CONTENT_BUTTON,
- GURL(kRunningLearnMoreURL)) {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar",
- BLOCKED_INFOBAR_EVENT_SHOWN,
- BLOCKED_INFOBAR_EVENT_LAST);
-}
-
-BlockedRunningInfoBarDelegate*
-BlockedRunningInfoBarDelegate::AsBlockedRunningInfoBarDelegate() {
- return this;
-}
-
-void BlockedRunningInfoBarDelegate::InfoBarDismissed() {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar",
- BLOCKED_INFOBAR_EVENT_DISMISSED,
- BLOCKED_INFOBAR_EVENT_LAST);
- InfoBarDelegate::InfoBarDismissed();
-}
-
-bool BlockedRunningInfoBarDelegate::Accept() {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar",
- BLOCKED_INFOBAR_EVENT_CANCELLED,
- BLOCKED_INFOBAR_EVENT_LAST);
- return true;
-}
-
-bool BlockedRunningInfoBarDelegate::Cancel() {
- UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar",
- BLOCKED_INFOBAR_EVENT_ALLOWED,
- BLOCKED_INFOBAR_EVENT_LAST);
- wrapper()->Send(new ViewMsg_SetAllowRunningInsecureContent(
- wrapper()->routing_id(), true));
- return true;
-}
-
-
diff --git a/chrome/browser/tab_contents/blocked_infobar_delegate.h b/chrome/browser/tab_contents/blocked_infobar_delegate.h
deleted file mode 100644
index 9eede2b..0000000
--- a/chrome/browser/tab_contents/blocked_infobar_delegate.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_TAB_CONTENTS_BLOCKED_INFOBAR_DELEGATE_H_
-#define CHROME_BROWSER_TAB_CONTENTS_BLOCKED_INFOBAR_DELEGATE_H_
-
-#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "googleurl/src/gurl.h"
-
-class BlockedRunningInfoBarDelegate;
-
-// Infobar class for blocked mixed content warnings.
-class BlockedInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
-
- // Create an infobar with a localized message from the resource bundle
- // corresponding to |message_resource_id|, an allow button labeled with
- // the localized string corresponding to |button_resource_id|, and a link
- // labeled with a localized "learn more" string that takes you to |url|
- // when clicked.
- BlockedInfoBarDelegate(TabContentsWrapper* wrapper,
- int message_resource_id,
- int button_resource_id,
- const GURL& url);
-
- // Type-checking downcast routine.
- virtual BlockedRunningInfoBarDelegate* AsBlockedRunningInfoBarDelegate();
-
- protected:
- TabContentsWrapper* wrapper() { return wrapper_; }
-
- private:
- // InfoBarDelegate:
- virtual BlockedInfoBarDelegate* AsBlockedInfoBarDelegate() OVERRIDE;
-
- // ConfirmInfoBarDelegate:
- virtual string16 GetMessageText() const;
- virtual int GetButtons() const OVERRIDE;
- virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
- virtual string16 GetLinkText() OVERRIDE;
- virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
-
- TabContentsWrapper* wrapper_;
- int message_resource_id_;
- int button_resource_id_;
- GURL url_;
-};
-
-// A subclass specific to the blocked displaying insecure content case.
-class BlockedDisplayingInfoBarDelegate : public BlockedInfoBarDelegate {
- public:
- explicit BlockedDisplayingInfoBarDelegate(TabContentsWrapper* wrapper);
- private:
- virtual void InfoBarDismissed() OVERRIDE;
- virtual bool Accept() OVERRIDE;
- virtual bool Cancel() OVERRIDE;
-};
-
-// A subclass specific to the blocked running insecure content case.
-class BlockedRunningInfoBarDelegate : public BlockedInfoBarDelegate {
- public:
- explicit BlockedRunningInfoBarDelegate(TabContentsWrapper* wrapper);
- virtual BlockedRunningInfoBarDelegate*
- AsBlockedRunningInfoBarDelegate() OVERRIDE;
- private:
- virtual void InfoBarDismissed() OVERRIDE;
- virtual bool Accept() OVERRIDE;
- virtual bool Cancel() OVERRIDE;
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_BLOCKED_INFOBAR_DELEGATE_H_
-
diff --git a/chrome/browser/tab_contents/infobar_delegate.cc b/chrome/browser/tab_contents/infobar_delegate.cc
index 0c6aab6..9d0c77e 100644
--- a/chrome/browser/tab_contents/infobar_delegate.cc
+++ b/chrome/browser/tab_contents/infobar_delegate.cc
@@ -49,15 +49,16 @@ InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const {
return WARNING_TYPE;
}
-BlockedInfoBarDelegate* InfoBarDelegate::AsBlockedInfoBarDelegate() {
+ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() {
return NULL;
}
-ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() {
+ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() {
return NULL;
}
-ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() {
+InsecureContentInfoBarDelegate*
+ InfoBarDelegate::AsInsecureContentInfoBarDelegate() {
return NULL;
}
diff --git a/chrome/browser/tab_contents/infobar_delegate.h b/chrome/browser/tab_contents/infobar_delegate.h
index b82d33a..7ab8c42 100644
--- a/chrome/browser/tab_contents/infobar_delegate.h
+++ b/chrome/browser/tab_contents/infobar_delegate.h
@@ -10,10 +10,10 @@
#include "base/string16.h"
#include "webkit/glue/window_open_disposition.h"
-class BlockedInfoBarDelegate;
class ConfirmInfoBarDelegate;
class ExtensionInfoBarDelegate;
class InfoBar;
+class InsecureContentInfoBarDelegate;
class LinkInfoBarDelegate;
class PluginInstallerInfoBarDelegate;
class TabContents;
@@ -78,9 +78,9 @@ class InfoBarDelegate {
virtual Type GetInfoBarType() const;
// Type-checking downcast routines:
- virtual BlockedInfoBarDelegate* AsBlockedInfoBarDelegate();
virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate();
virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate();
+ virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate();
virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate();
virtual PluginInstallerInfoBarDelegate* AsPluginInstallerInfoBarDelegate();
virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate();
diff --git a/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc b/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc
new file mode 100644
index 0000000..daa1bb6
--- /dev/null
+++ b/chrome/browser/tab_contents/insecure_content_infobar_delegate.cc
@@ -0,0 +1,76 @@
+// 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.
+
+#include "chrome/browser/tab_contents/insecure_content_infobar_delegate.h"
+
+#include "base/metrics/histogram.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/render_messages.h"
+#include "content/common/page_transition_types.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+InsecureContentInfoBarDelegate::InsecureContentInfoBarDelegate(
+ TabContentsWrapper* tab_contents,
+ InfoBarType type)
+ : ConfirmInfoBarDelegate(tab_contents->tab_contents()),
+ tab_contents_(tab_contents),
+ type_(type) {
+ UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegate",
+ (type_ == DISPLAY) ? DISPLAY_INFOBAR_SHOWN : RUN_INFOBAR_SHOWN,
+ NUM_EVENTS);
+}
+
+InsecureContentInfoBarDelegate::~InsecureContentInfoBarDelegate() {
+}
+
+void InsecureContentInfoBarDelegate::InfoBarDismissed() {
+ UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegate",
+ (type_ == DISPLAY) ? DISPLAY_INFOBAR_DISMISSED : RUN_INFOBAR_DISMISSED,
+ NUM_EVENTS);
+ ConfirmInfoBarDelegate::InfoBarDismissed();
+}
+
+InsecureContentInfoBarDelegate*
+ InsecureContentInfoBarDelegate::AsInsecureContentInfoBarDelegate() {
+ return this;
+}
+
+string16 InsecureContentInfoBarDelegate::GetMessageText() const {
+ return l10n_util::GetStringUTF16((type_ == DISPLAY) ?
+ IDS_BLOCKED_DISPLAYING_INSECURE_CONTENT :
+ IDS_BLOCKED_RUNNING_INSECURE_CONTENT);
+}
+
+string16 InsecureContentInfoBarDelegate::GetButtonLabel(
+ InfoBarButton button) const {
+ return l10n_util::GetStringUTF16(IDS_ALLOW_INSECURE_CONTENT_BUTTON);
+};
+
+bool InsecureContentInfoBarDelegate::Accept() {
+ UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegate",
+ (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE,
+ NUM_EVENTS);
+
+ int32 routing_id = tab_contents_->routing_id();
+ tab_contents_->Send((type_ == DISPLAY) ? static_cast<IPC::Message*>(
+ new ViewMsg_SetAllowDisplayingInsecureContent(routing_id, true)) :
+ new ViewMsg_SetAllowRunningInsecureContent(routing_id, true));
+ return true;
+}
+
+string16 InsecureContentInfoBarDelegate::GetLinkText() {
+ return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
+}
+
+bool InsecureContentInfoBarDelegate::LinkClicked(
+ WindowOpenDisposition disposition) {
+ tab_contents_->tab_contents()->OpenURL(
+ GURL((type_ == DISPLAY) ?
+ "https://www.google.com/support/chrome/bin/answer.py?answer=1342710" :
+ "https://www.google.com/support/chrome/bin/answer.py?answer=1342714"),
+ GURL(), (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
+ PageTransition::LINK);
+ return false;
+}
diff --git a/chrome/browser/tab_contents/insecure_content_infobar_delegate.h b/chrome/browser/tab_contents/insecure_content_infobar_delegate.h
new file mode 100644
index 0000000..38207f0
--- /dev/null
+++ b/chrome/browser/tab_contents/insecure_content_infobar_delegate.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef CHROME_BROWSER_TAB_CONTENTS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_TAB_CONTENTS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
+#pragma once
+
+#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
+
+class TabContentsWrapper;
+
+// Base class for delegates that show warnings on HTTPS pages which try to
+// display or run insecure content.
+class InsecureContentInfoBarDelegate : public ConfirmInfoBarDelegate {
+ public:
+ enum InfoBarType {
+ DISPLAY, // Shown when "inactive" content (e.g. images) has been blocked.
+ RUN, // Shown when "active" content (e.g. script) has been blocked.
+ };
+
+ InsecureContentInfoBarDelegate(TabContentsWrapper* tab_contents,
+ InfoBarType type);
+ virtual ~InsecureContentInfoBarDelegate();
+
+ InfoBarType type() const { return type_; }
+
+ private:
+ enum HistogramEvents {
+ DISPLAY_INFOBAR_SHOWN = 0, // Infobar was displayed.
+ DISPLAY_USER_OVERRIDE, // User clicked allowed anyway button.
+ DISPLAY_INFOBAR_DISMISSED, // User clicked close button.
+ RUN_INFOBAR_SHOWN,
+ RUN_USER_OVERRIDE,
+ RUN_INFOBAR_DISMISSED,
+ NUM_EVENTS
+ };
+
+ // ConfirmInfoBarDelegate:
+ virtual void InfoBarDismissed() OVERRIDE;
+ virtual InsecureContentInfoBarDelegate*
+ AsInsecureContentInfoBarDelegate() OVERRIDE;
+ virtual string16 GetMessageText() const;
+ virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
+ virtual bool Accept() OVERRIDE;
+ virtual string16 GetLinkText() OVERRIDE;
+ virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
+
+ TabContentsWrapper* tab_contents_;
+ InfoBarType type_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_TAB_CONTENTS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
+
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index 4ee881b..b5571d6 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -34,8 +34,8 @@
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/safe_browsing/client_side_detection_host.h"
-#include "chrome/browser/tab_contents/blocked_infobar_delegate.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "chrome/browser/tab_contents/insecure_content_infobar_delegate.h"
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h"
@@ -593,24 +593,28 @@ void TabContentsWrapper::OnPDFHasUnsupportedFeature() {
void TabContentsWrapper::OnDidBlockDisplayingInsecureContent() {
// At most one infobar and do not supersede the stronger running content bar.
for (size_t i = 0; i < infobar_count(); ++i) {
- if (GetInfoBarDelegateAt(i)->AsBlockedInfoBarDelegate())
+ if (GetInfoBarDelegateAt(i)->AsInsecureContentInfoBarDelegate())
return;
}
- AddInfoBar(new BlockedDisplayingInfoBarDelegate(this));
+ AddInfoBar(new InsecureContentInfoBarDelegate(this,
+ InsecureContentInfoBarDelegate::DISPLAY));
}
void TabContentsWrapper::OnDidBlockRunningInsecureContent() {
- // At most one infobar but supersede the weaker displaying content bar.
+ // At most one infobar superseding any weaker displaying content bar.
for (size_t i = 0; i < infobar_count(); ++i) {
- BlockedInfoBarDelegate* blocked =
- GetInfoBarDelegateAt(i)->AsBlockedInfoBarDelegate();
- if (blocked) {
- if (blocked->AsBlockedRunningInfoBarDelegate())
- return;
- RemoveInfoBar(blocked);
+ InsecureContentInfoBarDelegate* delegate =
+ GetInfoBarDelegateAt(i)->AsInsecureContentInfoBarDelegate();
+ if (delegate) {
+ if (delegate->type() != InsecureContentInfoBarDelegate::RUN) {
+ ReplaceInfoBar(delegate, new InsecureContentInfoBarDelegate(this,
+ InsecureContentInfoBarDelegate::RUN));
+ }
+ return;
}
}
- AddInfoBar(new BlockedRunningInfoBarDelegate(this));
+ AddInfoBar(new InsecureContentInfoBarDelegate(this,
+ InsecureContentInfoBarDelegate::RUN));
}
GURL TabContentsWrapper::GetAlternateErrorPageURL() const {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 2d85a16..877ddec 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2057,8 +2057,6 @@
'browser/tab_closeable_state_watcher.h',
'browser/tab_contents/background_contents.cc',
'browser/tab_contents/background_contents.h',
- 'browser/tab_contents/blocked_infobar_delegate.cc',
- 'browser/tab_contents/blocked_infobar_delegate.h',
'browser/tab_contents/chrome_interstitial_page.cc',
'browser/tab_contents/chrome_interstitial_page.h',
'browser/tab_contents/confirm_infobar_delegate.cc',
@@ -2069,6 +2067,8 @@
'browser/tab_contents/infobar_container.h',
'browser/tab_contents/infobar_delegate.cc',
'browser/tab_contents/infobar_delegate.h',
+ 'browser/tab_contents/insecure_content_infobar_delegate.cc',
+ 'browser/tab_contents/insecure_content_infobar_delegate.h',
'browser/tab_contents/language_state.cc',
'browser/tab_contents/language_state.h',
'browser/tab_contents/link_infobar_delegate.cc',