Chromium Code Reviews| Index: chrome/browser/devtools/global_confirm_info_bar.cc |
| diff --git a/chrome/browser/devtools/global_confirm_info_bar.cc b/chrome/browser/devtools/global_confirm_info_bar.cc |
| index 8ef6809dfc55336ea0a3253f9f0e52a9a0a21300..114b4f086e171cf5473541d621113f19ff363a81 100644 |
| --- a/chrome/browser/devtools/global_confirm_info_bar.cc |
| +++ b/chrome/browser/devtools/global_confirm_info_bar.cc |
| @@ -12,6 +12,7 @@ |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "components/infobars/core/infobar.h" |
| #include "ui/gfx/image/image.h" |
| +#include "ui/gfx/vector_icons_public.h" |
| // InfoBarDelegateProxy ------------------------------------------------------- |
| @@ -36,6 +37,14 @@ class GlobalConfirmInfoBar::DelegateProxy : public ConfirmInfoBarDelegate { |
| bool LinkClicked(WindowOpenDisposition disposition) override; |
| bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
| void InfoBarDismissed() override; |
| + infobars::InfoBarDelegate::Type GetInfoBarType() const override; |
| + gfx::VectorIconId GetVectorIconId() const override; |
|
Peter Kasting
2017/02/08 08:23:44
Nit: These last two go just above and just below G
|
| + |
| + void set_infobar(infobars::InfoBar* info_bar) { |
| + info_bar_ = info_bar; |
| + if (global_info_bar_) |
| + global_info_bar_->delegate_->set_infobar(info_bar_); |
|
Peter Kasting
2017/02/08 08:23:44
I'm worried about this.
It seems like |global_inf
|
| + } |
| infobars::InfoBar* info_bar_; |
| base::WeakPtr<GlobalConfirmInfoBar> global_info_bar_; |
| @@ -124,6 +133,17 @@ void GlobalConfirmInfoBar::DelegateProxy::InfoBarDismissed() { |
| info_bar->Close(); |
| } |
| +infobars::InfoBarDelegate::Type |
| +GlobalConfirmInfoBar::DelegateProxy::GetInfoBarType() const { |
| + return global_info_bar_ ? global_info_bar_->delegate_->GetInfoBarType() |
| + : WARNING_TYPE; |
|
Peter Kasting
2017/02/08 08:23:44
Nit: Don't hardcode the fallback type; use Confirm
|
| +} |
| + |
| +gfx::VectorIconId GlobalConfirmInfoBar::DelegateProxy::GetVectorIconId() const { |
| + return global_info_bar_ ? global_info_bar_->delegate_->GetVectorIconId() |
| + : gfx::VectorIconId::VECTOR_ICON_NONE; |
|
Peter Kasting
2017/02/08 08:23:44
Nit: Same comment
|
| +} |
| + |
| void GlobalConfirmInfoBar::DelegateProxy::Detach() { |
| global_info_bar_.reset(); |
| } |
| @@ -205,7 +225,7 @@ void GlobalConfirmInfoBar::MaybeAddInfoBar(content::WebContents* web_contents) { |
| infobars::InfoBar* added_bar = infobar_service->AddInfoBar( |
| infobar_service->CreateConfirmInfoBar(std::move(proxy))); |
| - proxy_ptr->info_bar_ = added_bar; |
| + proxy_ptr->set_infobar(added_bar); |
| DCHECK(added_bar); |
|
Peter Kasting
2017/02/08 08:23:44
This DCHECK is unsafe; we can't guarantee |added_b
|
| proxies_[infobar_service] = proxy_ptr; |
| infobar_service->AddObserver(this); |