summaryrefslogtreecommitdiffstats
path: root/chrome/browser/infobars
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 00:53:12 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 00:53:12 +0000
commitf9b2160d75ad5e1f317e977042ef85cd6869af54 (patch)
tree81c18cb9e188db7922f43c7775a4d9a6ab4bf8f0 /chrome/browser/infobars
parenta2984e27fd749f70f99239520fe03e89aa823c4a (diff)
downloadchromium_src-f9b2160d75ad5e1f317e977042ef85cd6869af54.zip
chromium_src-f9b2160d75ad5e1f317e977042ef85cd6869af54.tar.gz
chromium_src-f9b2160d75ad5e1f317e977042ef85cd6869af54.tar.bz2
infobars: Componentize ConfirmInfoBarDelegate.
Changes: 1- Change it to use ui_strings.h 2- Use IDS_APP_OK and IDS_APP_CANCEL from ui_strings. 3- Move to components/infobars/core from chrome/browser/infobars (done with tools/git/move_source_file.py). BUG=373234 TEST=chrome still links and run fine. R=droger@chromium.org, pkasting@chromium.org TBR=ben # for trivial chrome/ changes Review URL: https://codereview.chromium.org/289083004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/infobars')
-rw-r--r--chrome/browser/infobars/confirm_infobar_delegate.cc71
-rw-r--r--chrome/browser/infobars/confirm_infobar_delegate.h85
-rw-r--r--chrome/browser/infobars/insecure_content_infobar_delegate.h2
-rw-r--r--chrome/browser/infobars/simple_alert_infobar_delegate.h2
4 files changed, 2 insertions, 158 deletions
diff --git a/chrome/browser/infobars/confirm_infobar_delegate.cc b/chrome/browser/infobars/confirm_infobar_delegate.cc
deleted file mode 100644
index 51f8702..0000000
--- a/chrome/browser/infobars/confirm_infobar_delegate.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
-
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-using infobars::InfoBarDelegate;
-
-ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
-}
-
-InfoBarDelegate::InfoBarAutomationType
- ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
- return CONFIRM_INFOBAR;
-}
-
-int ConfirmInfoBarDelegate::GetButtons() const {
- return BUTTON_OK | BUTTON_CANCEL;
-}
-
-base::string16 ConfirmInfoBarDelegate::GetButtonLabel(
- InfoBarButton button) const {
- return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL);
-}
-
-bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const {
- return false;
-}
-
-bool ConfirmInfoBarDelegate::Accept() {
- return true;
-}
-
-bool ConfirmInfoBarDelegate::Cancel() {
- return true;
-}
-
-base::string16 ConfirmInfoBarDelegate::GetLinkText() const {
- return base::string16();
-}
-
-bool ConfirmInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
- return true;
-}
-
-ConfirmInfoBarDelegate::ConfirmInfoBarDelegate()
- : InfoBarDelegate() {
-}
-
-bool ConfirmInfoBarDelegate::ShouldExpireInternal(
- const NavigationDetails& details) const {
- return !details.did_replace_entry &&
- InfoBarDelegate::ShouldExpireInternal(details);
-}
-
-// ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
-// files.
-
-bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
- ConfirmInfoBarDelegate* confirm_delegate =
- delegate->AsConfirmInfoBarDelegate();
- return confirm_delegate &&
- (confirm_delegate->GetMessageText() == GetMessageText());
-}
-
-ConfirmInfoBarDelegate* ConfirmInfoBarDelegate::AsConfirmInfoBarDelegate() {
- return this;
-}
diff --git a/chrome/browser/infobars/confirm_infobar_delegate.h b/chrome/browser/infobars/confirm_infobar_delegate.h
deleted file mode 100644
index e17b0fc..0000000
--- a/chrome/browser/infobars/confirm_infobar_delegate.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_
-#define CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string16.h"
-#include "components/infobars/core/infobar_delegate.h"
-
-namespace infobars {
-class InfoBar;
-}
-
-// An interface derived from InfoBarDelegate implemented by objects wishing to
-// control a ConfirmInfoBar.
-class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate {
- public:
- enum InfoBarButton {
- BUTTON_NONE = 0,
- BUTTON_OK = 1 << 0,
- BUTTON_CANCEL = 1 << 1,
- };
-
- virtual ~ConfirmInfoBarDelegate();
-
- // 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 base::string16 GetMessageText() const = 0;
-
- // Returns the buttons to be shown for this InfoBar.
- virtual int GetButtons() const;
-
- // Returns the label for the specified button. The default implementation
- // returns "OK" for the OK button and "Cancel" for the Cancel button.
- virtual base::string16 GetButtonLabel(InfoBarButton button) const;
-
- // Returns whether or not the OK button will trigger a UAC elevation prompt on
- // Windows.
- virtual bool OKButtonTriggersUACPrompt() const;
-
- // Called when the OK button is pressed. If this function returns true, the
- // infobar is then immediately closed. Subclasses MUST NOT return true if in
- // handling this call something triggers the infobar to begin closing.
- virtual bool Accept();
-
- // Called when the Cancel button is pressed. If this function returns true,
- // the infobar is then immediately closed. Subclasses MUST NOT return true if
- // in handling this call something triggers the infobar to begin closing.
- virtual bool Cancel();
-
- // Returns the text of the link to be displayed, if any. Otherwise returns
- // and empty string.
- virtual base::string16 GetLinkText() const;
-
- // Called when the Link (if any) is clicked. The |disposition| specifies how
- // the resulting document should be loaded (based on the event flags present
- // when the link was clicked). If this function returns true, the infobar is
- // then immediately closed. Subclasses MUST NOT return true if in handling
- // this call something triggers the infobar to begin closing.
- virtual bool LinkClicked(WindowOpenDisposition disposition);
-
- protected:
- ConfirmInfoBarDelegate();
-
- // Returns a confirm infobar that owns |delegate|.
- static scoped_ptr<infobars::InfoBar> CreateInfoBar(
- scoped_ptr<ConfirmInfoBarDelegate> delegate);
-
- virtual bool ShouldExpireInternal(
- const NavigationDetails& details) const OVERRIDE;
-
- private:
- // InfoBarDelegate:
- virtual bool EqualsDelegate(
- infobars::InfoBarDelegate* delegate) const OVERRIDE;
- virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate);
-};
-
-#endif // CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_
diff --git a/chrome/browser/infobars/insecure_content_infobar_delegate.h b/chrome/browser/infobars/insecure_content_infobar_delegate.h
index b6a0f21..b0a2c16 100644
--- a/chrome/browser/infobars/insecure_content_infobar_delegate.h
+++ b/chrome/browser/infobars/insecure_content_infobar_delegate.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
class InfoBarService;
diff --git a/chrome/browser/infobars/simple_alert_infobar_delegate.h b/chrome/browser/infobars/simple_alert_infobar_delegate.h
index 846a885..eb0f1b1 100644
--- a/chrome/browser/infobars/simple_alert_infobar_delegate.h
+++ b/chrome/browser/infobars/simple_alert_infobar_delegate.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/strings/string16.h"
-#include "chrome/browser/infobars/confirm_infobar_delegate.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
class InfoBarService;