Commit 182d71d6 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Misc. cleanup for infobars.

* Init members in declaration
* Use =default
* Shorten code
* Use enum names instead of constant values
* Add comments
* Better use of auto
* Remove some bare news
* Remove using declarations

Bug: none
Change-Id: I710527a697406510143575ec4d582c5b5b37a071
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1983508
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728803}
parent 5936ab4d
......@@ -39,7 +39,7 @@ class GlobalConfirmInfoBar::DelegateProxy : public ConfirmInfoBarDelegate {
bool Accept() override;
bool Cancel() override;
infobars::InfoBar* info_bar_;
infobars::InfoBar* info_bar_ = nullptr;
base::WeakPtr<GlobalConfirmInfoBar> global_info_bar_;
DISALLOW_COPY_AND_ASSIGN(DelegateProxy);
......@@ -47,12 +47,9 @@ class GlobalConfirmInfoBar::DelegateProxy : public ConfirmInfoBarDelegate {
GlobalConfirmInfoBar::DelegateProxy::DelegateProxy(
base::WeakPtr<GlobalConfirmInfoBar> global_info_bar)
: info_bar_(nullptr),
global_info_bar_(global_info_bar) {
}
: global_info_bar_(global_info_bar) {}
GlobalConfirmInfoBar::DelegateProxy::~DelegateProxy() {
}
GlobalConfirmInfoBar::DelegateProxy::~DelegateProxy() = default;
infobars::InfoBarDelegate::InfoBarIdentifier
GlobalConfirmInfoBar::DelegateProxy::GetIdentifier() const {
......@@ -71,9 +68,8 @@ GURL GlobalConfirmInfoBar::DelegateProxy::GetLinkURL() const {
bool GlobalConfirmInfoBar::DelegateProxy::LinkClicked(
WindowOpenDisposition disposition) {
return global_info_bar_
? global_info_bar_->delegate_->LinkClicked(disposition)
: false;
return global_info_bar_ &&
global_info_bar_->delegate_->LinkClicked(disposition);
}
void GlobalConfirmInfoBar::DelegateProxy::InfoBarDismissed() {
......@@ -102,7 +98,7 @@ GlobalConfirmInfoBar::DelegateProxy::GetMessageElideBehavior() const {
int GlobalConfirmInfoBar::DelegateProxy::GetButtons() const {
return global_info_bar_ ? global_info_bar_->delegate_->GetButtons()
: 0;
: BUTTON_NONE;
}
base::string16 GlobalConfirmInfoBar::DelegateProxy::GetButtonLabel(
......@@ -150,9 +146,9 @@ void GlobalConfirmInfoBar::DelegateProxy::Detach() {
// static
base::WeakPtr<GlobalConfirmInfoBar> GlobalConfirmInfoBar::Show(
std::unique_ptr<ConfirmInfoBarDelegate> delegate) {
GlobalConfirmInfoBar* info_bar =
new GlobalConfirmInfoBar(std::move(delegate));
return info_bar->weak_factory_.GetWeakPtr();
// Owns itself, deleted by Close().
auto* infobar = new GlobalConfirmInfoBar(std::move(delegate));
return infobar->weak_factory_.GetWeakPtr();
}
void GlobalConfirmInfoBar::Close() {
......@@ -161,9 +157,7 @@ void GlobalConfirmInfoBar::Close() {
GlobalConfirmInfoBar::GlobalConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate> delegate)
: delegate_(std::move(delegate)),
browser_tab_strip_tracker_(this, nullptr, nullptr),
is_closing_(false) {
: delegate_(std::move(delegate)) {
browser_tab_strip_tracker_.Init();
}
......@@ -196,7 +190,7 @@ void GlobalConfirmInfoBar::TabChangedAt(content::WebContents* web_contents,
void GlobalConfirmInfoBar::OnInfoBarRemoved(infobars::InfoBar* info_bar,
bool animate) {
// Do not process alien infobars.
for (auto it : proxies_) {
for (const auto& it : proxies_) {
if (it.second->info_bar_ == info_bar) {
OnManagerShuttingDown(info_bar->owner());
break;
......@@ -218,8 +212,8 @@ void GlobalConfirmInfoBar::MaybeAddInfoBar(content::WebContents* web_contents) {
if (base::Contains(proxies_, infobar_service))
return;
std::unique_ptr<GlobalConfirmInfoBar::DelegateProxy> proxy(
new GlobalConfirmInfoBar::DelegateProxy(weak_factory_.GetWeakPtr()));
auto proxy = std::make_unique<GlobalConfirmInfoBar::DelegateProxy>(
weak_factory_.GetWeakPtr());
GlobalConfirmInfoBar::DelegateProxy* proxy_ptr = proxy.get();
infobars::InfoBar* added_bar = infobar_service->AddInfoBar(
infobar_service->CreateConfirmInfoBar(std::move(proxy)));
......
......@@ -56,11 +56,11 @@ class GlobalConfirmInfoBar : public TabStripModelObserver,
std::unique_ptr<ConfirmInfoBarDelegate> delegate_;
std::map<infobars::InfoBarManager*, DelegateProxy*> proxies_;
BrowserTabStripTracker browser_tab_strip_tracker_;
BrowserTabStripTracker browser_tab_strip_tracker_{this, nullptr, nullptr};
// Indicates if the global infobar is currently in the process of shutting
// down.
bool is_closing_;
bool is_closing_ = false;
base::WeakPtrFactory<GlobalConfirmInfoBar> weak_factory_{this};
......
......@@ -18,11 +18,9 @@ void NaClInfoBarDelegate::Create(InfoBarService* infobar_service) {
std::unique_ptr<ConfirmInfoBarDelegate>(new NaClInfoBarDelegate())));
}
NaClInfoBarDelegate::NaClInfoBarDelegate() : ConfirmInfoBarDelegate() {
}
NaClInfoBarDelegate::NaClInfoBarDelegate() = default;
NaClInfoBarDelegate::~NaClInfoBarDelegate() {
}
NaClInfoBarDelegate::~NaClInfoBarDelegate() = default;
infobars::InfoBarDelegate::InfoBarIdentifier
NaClInfoBarDelegate::GetIdentifier() const {
......
......@@ -12,11 +12,7 @@
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
PasswordManagerInfoBarDelegate::~PasswordManagerInfoBarDelegate() {}
PasswordManagerInfoBarDelegate::PasswordManagerInfoBarDelegate()
: ConfirmInfoBarDelegate(),
details_message_(base::string16()) {}
PasswordManagerInfoBarDelegate::~PasswordManagerInfoBarDelegate() = default;
base::string16 PasswordManagerInfoBarDelegate::GetDetailsMessageText() const {
return details_message_;
......@@ -50,6 +46,8 @@ base::string16 PasswordManagerInfoBarDelegate::GetMessageText() const {
return message_;
}
PasswordManagerInfoBarDelegate::PasswordManagerInfoBarDelegate() = default;
void PasswordManagerInfoBarDelegate::SetMessage(const base::string16& message) {
message_ = message;
}
......
......@@ -40,8 +40,7 @@ PepperBrokerInfoBarDelegate::PepperBrokerInfoBarDelegate(
HostContentSettingsMap* content_settings,
TabSpecificContentSettings* tab_content_settings,
base::OnceCallback<void(bool)> callback)
: ConfirmInfoBarDelegate(),
url_(url),
: url_(url),
plugin_name_(plugin_name),
content_settings_(content_settings),
tab_content_settings_(tab_content_settings),
......
......@@ -7,7 +7,6 @@
#include <memory>
#include "base/feature_list.h"
#include "base/time/time.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
......@@ -26,33 +25,6 @@
#include "url/gurl.h"
#include "url/url_constants.h"
namespace {
constexpr base::TimeDelta kMessageCooldown = base::TimeDelta::FromDays(14);
// This duration is the same as the "default browser" banner's duration.
constexpr base::TimeDelta kMinimumDurationBeforeExpiryOnNavigation =
base::TimeDelta::FromSeconds(8);
bool IsFlashDeprecationWarningCooldownActive(Profile* profile) {
base::Time last_dismissal =
profile->GetPrefs()->GetTime(prefs::kPluginsDeprecationInfobarLastShown);
// More than |kMessageCooldown| days have passed.
if (base::Time::Now() - last_dismissal > kMessageCooldown) {
return false;
}
return true;
}
void ActivateFlashDeprecationWarningCooldown(Profile* profile) {
profile->GetPrefs()->SetTime(prefs::kPluginsDeprecationInfobarLastShown,
base::Time::Now());
}
} // namespace
// static
void FlashDeprecationInfoBarDelegate::Create(InfoBarService* infobar_service,
Profile* profile) {
......@@ -63,38 +35,39 @@ void FlashDeprecationInfoBarDelegate::Create(InfoBarService* infobar_service,
// static
bool FlashDeprecationInfoBarDelegate::ShouldDisplayFlashDeprecation(
Profile* profile) {
HostContentSettingsMap* host_content_settings_map =
HostContentSettingsMapFactory::GetForProfile(profile);
DCHECK(host_content_settings_map);
if (!base::FeatureList::IsEnabled(features::kFlashDeprecationWarning))
return false;
// Generally, display the infobar if the Flash setting is anything other than
// BLOCK.
HostContentSettingsMap* host_content_settings_map =
HostContentSettingsMapFactory::GetForProfile(profile);
DCHECK(host_content_settings_map);
bool is_managed = false;
ContentSetting flash_setting =
PluginUtils::UnsafeGetRawDefaultFlashContentSetting(
host_content_settings_map, &is_managed);
if (flash_setting == CONTENT_SETTING_BLOCK)
return false;
// If the user can't do anything about their browser's Flash behavior
// there's no point to showing a Flash deprecation warning infobar.
//
// Also limit showing the infobar to at most once per |kMessageCooldown|.
// Users should be periodically reminded that they need to take action, but
// if they couldn't take action and turn off flash it's unlikely they will
// able to the next time they start a session. The message become more
// annoying than informative in that case.
if (is_managed || IsFlashDeprecationWarningCooldownActive(profile)) {
// However, if the user can't do anything about their browser's Flash
// behavior, there's no point to showing a Flash deprecation warning infobar.
if (is_managed)
return false;
}
// Display the infobar if the Flash setting is anything other than BLOCK.
return flash_setting != CONTENT_SETTING_BLOCK;
// Also limit how frequently the infobar is shown. Users should be
// periodically reminded that they need to take action, but if they couldn't
// take action and turn off flash it's unlikely they will able to the next
// time they start a session. The message becomes more annoying than
// informative in that case.
const base::Time last_dismissal =
profile->GetPrefs()->GetTime(prefs::kPluginsDeprecationInfobarLastShown);
return (base::Time::Now() - last_dismissal) > base::TimeDelta::FromDays(14);
}
FlashDeprecationInfoBarDelegate::FlashDeprecationInfoBarDelegate(
Profile* profile)
: profile_(profile), display_start_(base::Time::Now()) {}
: profile_(profile) {}
infobars::InfoBarDelegate::InfoBarIdentifier
FlashDeprecationInfoBarDelegate::GetIdentifier() const {
......@@ -116,14 +89,16 @@ GURL FlashDeprecationInfoBarDelegate::GetLinkURL() const {
bool FlashDeprecationInfoBarDelegate::ShouldExpire(
const NavigationDetails& details) const {
bool minimum_duration_elapsed = base::Time::Now() - display_start_ >
kMinimumDurationBeforeExpiryOnNavigation;
// This duration is the same as the "default browser" banner's duration.
const bool minimum_duration_elapsed =
(base::Time::Now() - display_start_) > base::TimeDelta::FromSeconds(8);
return minimum_duration_elapsed &&
ConfirmInfoBarDelegate::ShouldExpire(details);
}
void FlashDeprecationInfoBarDelegate::InfoBarDismissed() {
ActivateFlashDeprecationWarningCooldown(profile_);
profile_->GetPrefs()->SetTime(prefs::kPluginsDeprecationInfobarLastShown,
base::Time::Now());
}
base::string16 FlashDeprecationInfoBarDelegate::GetMessageText() const {
......@@ -136,18 +111,16 @@ int FlashDeprecationInfoBarDelegate::GetButtons() const {
base::string16 FlashDeprecationInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
DCHECK_EQ(button, BUTTON_OK);
return l10n_util::GetStringUTF16(IDS_TURN_OFF);
}
bool FlashDeprecationInfoBarDelegate::Accept() {
HostContentSettingsMap* host_content_settings_map =
HostContentSettingsMapFactory::GetForProfile(profile_);
// Can be nullptr in tests.
if (!host_content_settings_map)
return true;
host_content_settings_map->SetDefaultContentSetting(
ContentSettingsType::PLUGINS, CONTENT_SETTING_DEFAULT);
// Can be null in tests.
if (host_content_settings_map) {
host_content_settings_map->SetDefaultContentSetting(
ContentSettingsType::PLUGINS, CONTENT_SETTING_DEFAULT);
}
return true;
}
......@@ -5,15 +5,12 @@
#ifndef CHROME_BROWSER_PLUGINS_FLASH_DEPRECATION_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_PLUGINS_FLASH_DEPRECATION_INFOBAR_DELEGATE_H_
#include "base/time/time.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
class Profile;
class InfoBarService;
namespace base {
class Time;
}
class FlashDeprecationInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
static void Create(InfoBarService* infobar_service, Profile* profile);
......@@ -43,7 +40,7 @@ class FlashDeprecationInfoBarDelegate : public ConfirmInfoBarDelegate {
// The time at which the banner has started to be displayed. Used to determine
// if the banner should expire on navigation, based on how long it has been
// visible.
base::Time display_start_;
base::Time display_start_ = base::Time::Now();
};
#endif // CHROME_BROWSER_PLUGINS_FLASH_DEPRECATION_INFOBAR_DELEGATE_H_
......@@ -38,7 +38,7 @@ class PreviewsLitePageInfoBarDelegate : public ConfirmInfoBarDelegate {
PreviewsLitePageInfoBarDelegate();
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
InfoBarIdentifier GetIdentifier() const override;
void InfoBarDismissed() override;
int GetButtons() const override;
base::string16 GetMessageText() const override;
......
......@@ -8,7 +8,6 @@
#include <utility>
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
......@@ -26,24 +25,12 @@
#include "chrome/browser/ssl/known_interception_disclosure_infobar.h"
#endif
namespace {
// How long to suppress the disclosure UI after showing it to the user. On
// Android, this is measured across browser sessions (which tend to be short)
// by storing the last dismissal time in a pref. On Desktop, the last dismissal
// time is stored in memory, so this is is only measured within the same
// browsing session (and thus will trigger on every browser startup).
constexpr base::TimeDelta kMessageCooldown = base::TimeDelta::FromDays(7);
} // namespace
KnownInterceptionDisclosureCooldown*
KnownInterceptionDisclosureCooldown::GetInstance() {
return base::Singleton<KnownInterceptionDisclosureCooldown>::get();
}
bool KnownInterceptionDisclosureCooldown::
IsKnownInterceptionDisclosureCooldownActive(Profile* profile) {
bool KnownInterceptionDisclosureCooldown::IsActive(Profile* profile) {
base::Time last_dismissal;
#if defined(OS_ANDROID)
......@@ -53,15 +40,11 @@ bool KnownInterceptionDisclosureCooldown::
last_dismissal = last_dismissal_time_;
#endif
// More than |kMessageCooldown| days have passed.
if (clock_->Now() - last_dismissal > kMessageCooldown)
return false;
return true;
// Suppress the disclosure UI for 7 days after showing it to the user.
return (clock_->Now() - last_dismissal) <= base::TimeDelta::FromDays(7);
}
void KnownInterceptionDisclosureCooldown::
ActivateKnownInterceptionDisclosureCooldown(Profile* profile) {
void KnownInterceptionDisclosureCooldown::Activate(Profile* profile) {
#if defined(OS_ANDROID)
profile->GetPrefs()->SetTime(
prefs::kKnownInterceptionDisclosureInfobarLastShown, clock_->Now());
......@@ -75,16 +58,16 @@ void KnownInterceptionDisclosureCooldown::SetClockForTesting(
clock_ = std::move(clock);
}
KnownInterceptionDisclosureCooldown::KnownInterceptionDisclosureCooldown()
: clock_(std::make_unique<base::DefaultClock>()) {}
KnownInterceptionDisclosureCooldown::KnownInterceptionDisclosureCooldown() =
default;
KnownInterceptionDisclosureCooldown::~KnownInterceptionDisclosureCooldown() =
default;
void MaybeShowKnownInterceptionDisclosureDialog(
content::WebContents* web_contents,
net::CertStatus cert_status) {
KnownInterceptionDisclosureCooldown* disclosure_tracker =
KnownInterceptionDisclosureCooldown::GetInstance();
auto* disclosure_tracker = KnownInterceptionDisclosureCooldown::GetInstance();
if (!(cert_status & net::CERT_STATUS_KNOWN_INTERCEPTION_DETECTED) &&
!disclosure_tracker->get_has_seen_known_interception()) {
return;
......@@ -100,8 +83,7 @@ void MaybeShowKnownInterceptionDisclosureDialog(
std::make_unique<KnownInterceptionDisclosureInfoBarDelegate>(profile);
infobars::InfoBar* infobar = nullptr;
if (!KnownInterceptionDisclosureCooldown::GetInstance()
->IsKnownInterceptionDisclosureCooldownActive(profile)) {
if (!KnownInterceptionDisclosureCooldown::GetInstance()->IsActive(profile)) {
#if defined(OS_ANDROID)
infobar = infobar_service->AddInfoBar(
KnownInterceptionDisclosureInfoBar::CreateInfoBar(std::move(delegate)));
......@@ -135,8 +117,7 @@ bool KnownInterceptionDisclosureInfoBarDelegate::ShouldExpire(
}
void KnownInterceptionDisclosureInfoBarDelegate::InfoBarDismissed() {
KnownInterceptionDisclosureCooldown::GetInstance()
->ActivateKnownInterceptionDisclosureCooldown(profile_);
KnownInterceptionDisclosureCooldown::GetInstance()->Activate(profile_);
Cancel();
}
......@@ -154,8 +135,7 @@ int KnownInterceptionDisclosureInfoBarDelegate::GetButtons() const {
}
bool KnownInterceptionDisclosureInfoBarDelegate::Accept() {
KnownInterceptionDisclosureCooldown::GetInstance()
->ActivateKnownInterceptionDisclosureCooldown(profile_);
KnownInterceptionDisclosureCooldown::GetInstance()->Activate(profile_);
return true;
}
......@@ -167,17 +147,7 @@ int KnownInterceptionDisclosureInfoBarDelegate::GetIconId() const {
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
switch (button) {
case BUTTON_OK:
return l10n_util::GetStringUTF16(
IDS_KNOWN_INTERCEPTION_INFOBAR_BUTTON_TEXT);
case BUTTON_CANCEL:
FALLTHROUGH;
case BUTTON_NONE:
NOTREACHED();
}
NOTREACHED();
return base::string16();
return l10n_util::GetStringUTF16(IDS_KNOWN_INTERCEPTION_INFOBAR_BUTTON_TEXT);
}
base::string16 KnownInterceptionDisclosureInfoBarDelegate::GetDescriptionText()
......
......@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/memory/singleton.h"
#include "base/time/default_clock.h"
#include "build/build_config.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar_delegate.h"
......@@ -27,13 +28,17 @@ class PrefRegistrySyncable;
class Profile;
// Singleton that tracks the known interception disclosure cooldown time.
// Singleton that tracks the known interception disclosure cooldown time. On
// Android, this is measured across browser sessions (which tend to be short) by
// storing the last dismissal time in a pref. On Desktop, the last dismissal
// time is stored in memory, so this is is only measured within the same
// browsing session (and thus will trigger on every browser startup).
class KnownInterceptionDisclosureCooldown {
public:
static KnownInterceptionDisclosureCooldown* GetInstance();
bool IsKnownInterceptionDisclosureCooldownActive(Profile* profile);
void ActivateKnownInterceptionDisclosureCooldown(Profile* profile);
bool IsActive(Profile* profile);
void Activate(Profile* profile);
bool get_has_seen_known_interception() {
return has_seen_known_interception_;
......@@ -51,7 +56,7 @@ class KnownInterceptionDisclosureCooldown {
KnownInterceptionDisclosureCooldown();
~KnownInterceptionDisclosureCooldown();
std::unique_ptr<base::Clock> clock_;
std::unique_ptr<base::Clock> clock_ = std::make_unique<base::DefaultClock>();
bool has_seen_known_interception_ = false;
#if !defined(OS_ANDROID)
......
......@@ -25,10 +25,7 @@ void AdsBlockedInfobarDelegate::Create(InfoBarService* infobar_service) {
base::WrapUnique(new AdsBlockedInfobarDelegate())));
}
AdsBlockedInfobarDelegate::AdsBlockedInfobarDelegate()
: ConfirmInfoBarDelegate() {}
AdsBlockedInfobarDelegate::~AdsBlockedInfobarDelegate() {}
AdsBlockedInfobarDelegate::~AdsBlockedInfobarDelegate() = default;
base::string16 AdsBlockedInfobarDelegate::GetExplanationText() const {
return l10n_util::GetStringUTF16(IDS_BLOCKED_ADS_PROMPT_EXPLANATION);
......@@ -54,20 +51,14 @@ GURL AdsBlockedInfobarDelegate::GetLinkURL() const {
bool AdsBlockedInfobarDelegate::LinkClicked(WindowOpenDisposition disposition) {
if (infobar_expanded_) {
DCHECK_EQ(disposition, WindowOpenDisposition::NEW_FOREGROUND_TAB);
infobar()->owner()->OpenURL(GetLinkURL(),
WindowOpenDisposition::NEW_FOREGROUND_TAB);
ChromeSubresourceFilterClient::LogAction(
SubresourceFilterAction::kClickedLearnMore);
} else {
ChromeSubresourceFilterClient::LogAction(
SubresourceFilterAction::kDetailsShown);
infobar_expanded_ = true;
return ConfirmInfoBarDelegate::LinkClicked(disposition);
}
// Returning false keeps the infobar up, which is the behavior we want in all
// cases. If the user is navigating via a new foreground tab we do not want
// the infobar going away on the tab (and therefore invoking our smart-hiding
// logic).
ChromeSubresourceFilterClient::LogAction(
SubresourceFilterAction::kDetailsShown);
infobar_expanded_ = true;
return false;
}
......@@ -81,15 +72,15 @@ int AdsBlockedInfobarDelegate::GetButtons() const {
base::string16 AdsBlockedInfobarDelegate::GetButtonLabel(
InfoBarButton button) const {
if (button == BUTTON_OK)
return l10n_util::GetStringUTF16(IDS_OK);
return l10n_util::GetStringUTF16(IDS_APP_MENU_RELOAD);
return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK
: IDS_APP_MENU_RELOAD);
}
bool AdsBlockedInfobarDelegate::Cancel() {
content::WebContents* web_contents =
InfoBarService::WebContentsFromInfoBar(infobar());
ChromeSubresourceFilterClient::FromWebContents(web_contents)
->OnReloadRequested();
auto* filter_client = ChromeSubresourceFilterClient::FromWebContents(
InfoBarService::WebContentsFromInfoBar(infobar()));
filter_client->OnReloadRequested();
return true;
}
AdsBlockedInfobarDelegate::AdsBlockedInfobarDelegate() = default;
......@@ -28,7 +28,7 @@ class AdsBlockedInfobarDelegate : public ConfirmInfoBarDelegate {
base::string16 GetToggleText() const;
// ConfirmInfoBarDelegate:
infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
InfoBarIdentifier GetIdentifier() const override;
int GetIconId() const override;
GURL GetLinkURL() const override;
bool LinkClicked(WindowOpenDisposition disposition) override;
......
......@@ -5,17 +5,13 @@
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "base/logging.h"
#include "components/infobars/core/infobar.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/strings/grit/ui_strings.h"
using infobars::InfoBarDelegate;
ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() = default;
ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() {
}
InfoBarDelegate::InfoBarAutomationType
ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
infobars::InfoBarDelegate::InfoBarAutomationType
ConfirmInfoBarDelegate::GetInfoBarAutomationType() const {
return CONFIRM_INFOBAR;
}
......@@ -29,8 +25,8 @@ int ConfirmInfoBarDelegate::GetButtons() const {
base::string16 ConfirmInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
IDS_APP_OK : IDS_APP_CANCEL);
return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK
: IDS_APP_CANCEL);
}
bool ConfirmInfoBarDelegate::OKButtonTriggersUACPrompt() const {
......@@ -45,9 +41,10 @@ bool ConfirmInfoBarDelegate::Cancel() {
return true;
}
ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() {}
ConfirmInfoBarDelegate::ConfirmInfoBarDelegate() = default;
bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
bool ConfirmInfoBarDelegate::EqualsDelegate(
infobars::InfoBarDelegate* delegate) const {
ConfirmInfoBarDelegate* confirm_delegate =
delegate->AsConfirmInfoBarDelegate();
return confirm_delegate &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment