summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc24
-rw-r--r--chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc5
-rw-r--r--chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h2
-rw-r--r--chrome/browser/infobars/infobar_delegate.cc14
-rw-r--r--chrome/browser/infobars/infobar_delegate.h13
-rw-r--r--chrome/browser/password_manager_delegate_impl.cc9
-rw-r--r--chrome/browser/tab_contents/confirm_infobar_delegate.cc7
-rw-r--r--chrome/browser/tab_contents/confirm_infobar_delegate.h5
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper.cc9
9 files changed, 56 insertions, 32 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 85965929..91dc90b 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -2670,17 +2670,25 @@ ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
DictionaryValue* infobar_item = new DictionaryValue;
InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(i);
- if (infobar->AsConfirmInfoBarDelegate()) {
- // Also covers ThemeInstalledInfoBarDelegate.
- if (infobar->AsOneClickLoginInfoBarDelegate()) {
+ switch (infobar->GetInfoBarAutomationType()) {
+ case InfoBarDelegate::CONFIRM_INFOBAR:
+ infobar_item->SetString("type", "confirm_infobar");
+ break;
+ case InfoBarDelegate::ONE_CLICK_LOGIN_INFOBAR:
infobar_item->SetString("type", "oneclicklogin_infobar");
- } else if (infobar->AsSavePasswordInfoBarDelegate()) {
+ break;
+ case InfoBarDelegate::PASSWORD_INFOBAR:
infobar_item->SetString("type", "password_infobar");
- } else if (infobar->AsRegisterProtocolHandlerInfoBarDelegate()) {
+ break;
+ case InfoBarDelegate::RPH_INFOBAR:
infobar_item->SetString("type", "rph_infobar");
- } else {
- infobar_item->SetString("type", "confirm_infobar");
- }
+ break;
+ case InfoBarDelegate::UNKNOWN_INFOBAR:
+ infobar_item->SetString("type", "unknown_infobar");
+ break;
+ }
+ if (infobar->AsConfirmInfoBarDelegate()) {
+ // Also covers ThemeInstalledInfoBarDelegate.
ConfirmInfoBarDelegate* confirm_infobar =
infobar->AsConfirmInfoBarDelegate();
infobar_item->SetString("text", confirm_infobar->GetMessageText());
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
index 22118a6..4c30d0c 100644
--- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
+++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
@@ -26,6 +26,11 @@ RegisterProtocolHandlerInfoBarDelegate::RegisterProtocolHandlerInfoBarDelegate(
handler_(handler) {
}
+InfoBarDelegate::InfoBarAutomationType
+ RegisterProtocolHandlerInfoBarDelegate::GetInfoBarAutomationType() const {
+ return RPH_INFOBAR;
+}
+
InfoBarDelegate::Type
RegisterProtocolHandlerInfoBarDelegate::GetInfoBarType() const {
return PAGE_ACTION_TYPE;
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h
index 15ae062..c102f5f 100644
--- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h
+++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h
@@ -33,6 +33,8 @@ class RegisterProtocolHandlerInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual RegisterProtocolHandlerInfoBarDelegate*
AsRegisterProtocolHandlerInfoBarDelegate() OVERRIDE;
+ virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE;
+
bool IsReplacedBy(RegisterProtocolHandlerInfoBarDelegate* delegate);
private:
diff --git a/chrome/browser/infobars/infobar_delegate.cc b/chrome/browser/infobars/infobar_delegate.cc
index 58f4501..fc46d3f 100644
--- a/chrome/browser/infobars/infobar_delegate.cc
+++ b/chrome/browser/infobars/infobar_delegate.cc
@@ -19,6 +19,11 @@ using content::NavigationEntry;
InfoBarDelegate::~InfoBarDelegate() {
}
+InfoBarDelegate::InfoBarAutomationType
+ InfoBarDelegate::GetInfoBarAutomationType() const {
+ return UNKNOWN_INFOBAR;
+}
+
bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
return false;
}
@@ -67,15 +72,6 @@ MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfobarDelegate() {
return NULL;
}
-OneClickLoginInfoBarDelegate*
- InfoBarDelegate::AsOneClickLoginInfoBarDelegate() {
- return NULL;
-}
-
-SavePasswordInfoBarDelegate* InfoBarDelegate::AsSavePasswordInfoBarDelegate() {
- return NULL;
-}
-
RegisterProtocolHandlerInfoBarDelegate*
InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() {
return NULL;
diff --git a/chrome/browser/infobars/infobar_delegate.h b/chrome/browser/infobars/infobar_delegate.h
index e109e4b..9011491 100644
--- a/chrome/browser/infobars/infobar_delegate.h
+++ b/chrome/browser/infobars/infobar_delegate.h
@@ -17,7 +17,6 @@ class InfoBarTabHelper;
class InsecureContentInfoBarDelegate;
class LinkInfoBarDelegate;
class MediaStreamInfoBarDelegate;
-class OneClickLoginInfoBarDelegate;
class PluginInstallerInfoBarDelegate;
class RegisterProtocolHandlerInfoBarDelegate;
class SavePasswordInfoBarDelegate;
@@ -45,8 +44,18 @@ class InfoBarDelegate {
PAGE_ACTION_TYPE,
};
+ enum InfoBarAutomationType {
+ CONFIRM_INFOBAR,
+ ONE_CLICK_LOGIN_INFOBAR,
+ PASSWORD_INFOBAR,
+ RPH_INFOBAR,
+ UNKNOWN_INFOBAR,
+ };
+
virtual ~InfoBarDelegate();
+ virtual InfoBarAutomationType GetInfoBarAutomationType() const;
+
// Called to create the InfoBar. Implementation of this method is
// platform-specific.
virtual InfoBar* CreateInfoBar(InfoBarTabHelper* owner) = 0;
@@ -92,10 +101,8 @@ class InfoBarDelegate {
virtual InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate();
virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate();
virtual MediaStreamInfoBarDelegate* AsMediaStreamInfobarDelegate();
- virtual OneClickLoginInfoBarDelegate* AsOneClickLoginInfoBarDelegate();
virtual RegisterProtocolHandlerInfoBarDelegate*
AsRegisterProtocolHandlerInfoBarDelegate();
- virtual SavePasswordInfoBarDelegate* AsSavePasswordInfoBarDelegate();
virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate();
virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate();
diff --git a/chrome/browser/password_manager_delegate_impl.cc b/chrome/browser/password_manager_delegate_impl.cc
index f0caecb..7080fd8 100644
--- a/chrome/browser/password_manager_delegate_impl.cc
+++ b/chrome/browser/password_manager_delegate_impl.cc
@@ -56,8 +56,7 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE;
- virtual SavePasswordInfoBarDelegate*
- AsSavePasswordInfoBarDelegate() OVERRIDE;
+ virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE;
// The PasswordFormManager managing the form we're asking the user about,
// and should update as per her decision.
@@ -115,9 +114,9 @@ bool SavePasswordInfoBarDelegate::Cancel() {
return true;
}
-SavePasswordInfoBarDelegate*
-SavePasswordInfoBarDelegate::AsSavePasswordInfoBarDelegate() {
- return this;
+InfoBarDelegate::InfoBarAutomationType
+ SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const {
+ return PASSWORD_INFOBAR;
}
// PasswordManagerDelegateImpl ------------------------------------------------
diff --git a/chrome/browser/tab_contents/confirm_infobar_delegate.cc b/chrome/browser/tab_contents/confirm_infobar_delegate.cc
index d3a252d..8418c061 100644
--- a/chrome/browser/tab_contents/confirm_infobar_delegate.cc
+++ b/chrome/browser/tab_contents/confirm_infobar_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -8,6 +8,11 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+InfoBarDelegate::InfoBarAutomationType
+ ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
+ return CONFIRM_INFOBAR;
+}
+
int ConfirmInfoBarDelegate::GetButtons() const {
return BUTTON_OK | BUTTON_CANCEL;
}
diff --git a/chrome/browser/tab_contents/confirm_infobar_delegate.h b/chrome/browser/tab_contents/confirm_infobar_delegate.h
index 593fe3d..8d7e703 100644
--- a/chrome/browser/tab_contents/confirm_infobar_delegate.h
+++ b/chrome/browser/tab_contents/confirm_infobar_delegate.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -21,6 +21,9 @@ class ConfirmInfoBarDelegate : public InfoBarDelegate {
BUTTON_CANCEL = 1 << 1,
};
+ // Returns the InfoBar type to be displayed for the InfoBar.
+ virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE;
+
// Returns the message string to be displayed for the InfoBar.
virtual string16 GetMessageText() const = 0;
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index c3c9c4c..19e205d 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -61,8 +61,7 @@ class OneClickLoginInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE;
- virtual OneClickLoginInfoBarDelegate*
- AsOneClickLoginInfoBarDelegate() OVERRIDE;
+ virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE;
// Set the profile preference to turn off one-click sign in so that it won't
// show again in this profile.
@@ -179,9 +178,9 @@ bool OneClickLoginInfoBarDelegate::Cancel() {
return true;
}
-OneClickLoginInfoBarDelegate*
-OneClickLoginInfoBarDelegate::AsOneClickLoginInfoBarDelegate() {
- return this;
+InfoBarDelegate::InfoBarAutomationType
+ OneClickLoginInfoBarDelegate::GetInfoBarAutomationType() const {
+ return ONE_CLICK_LOGIN_INFOBAR;
}
void OneClickLoginInfoBarDelegate::DisableOneClickSignIn() {