Chromium Code Reviews| Index: chrome/browser/infobars/insecure_content_infobar_delegate.cc |
| diff --git a/chrome/browser/infobars/insecure_content_infobar_delegate.cc b/chrome/browser/infobars/insecure_content_infobar_delegate.cc |
| index f95bd136df18a3f9ba54b43af114af093e59481c..9ec0e6512d8ef4f3d870dc895ca2e63f8c14a439 100644 |
| --- a/chrome/browser/infobars/insecure_content_infobar_delegate.cc |
| +++ b/chrome/browser/infobars/insecure_content_infobar_delegate.cc |
| @@ -19,11 +19,10 @@ |
| // static |
| -void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, |
| - InfoBarType type) { |
| +void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service) { |
| scoped_ptr<infobars::InfoBar> new_infobar( |
| infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
| - new InsecureContentInfoBarDelegate(type)))); |
| + new InsecureContentInfoBarDelegate()))); |
| // Only supsersede an existing insecure content infobar if we are upgrading |
| // from DISPLAY to RUN. |
|
Peter Kasting
2015/01/27 19:25:22
This comment is no longer applicable and should di
Robert Sesek
2015/01/27 20:33:21
Done.
|
| @@ -31,9 +30,7 @@ void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, |
| infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); |
| InsecureContentInfoBarDelegate* delegate = |
| old_infobar->delegate()->AsInsecureContentInfoBarDelegate(); |
| - if (delegate != NULL) { |
| - if ((type == RUN) && (delegate->type_ == DISPLAY)) |
| - return; |
| + if (delegate != nullptr) { |
| infobar_service->ReplaceInfoBar(old_infobar, new_infobar.Pass()); |
| break; |
| } |
| @@ -42,13 +39,12 @@ void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, |
| infobar_service->AddInfoBar(new_infobar.Pass()); |
| UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
|
Peter Kasting
2015/01/27 19:25:22
Nit: If you move this call to the top of the funct
Robert Sesek
2015/01/27 20:33:21
Done.
|
| - (type == DISPLAY) ? DISPLAY_INFOBAR_SHOWN : RUN_INFOBAR_SHOWN, |
| - NUM_EVENTS); |
| + DISPLAY_INFOBAR_SHOWN, |
| + NUM_EVENTS); |
|
Peter Kasting
2015/01/27 19:25:22
Nit: Could combine this with previous line (severa
Robert Sesek
2015/01/27 20:33:21
Done.
|
| } |
| -InsecureContentInfoBarDelegate::InsecureContentInfoBarDelegate(InfoBarType type) |
| - : ConfirmInfoBarDelegate(), |
| - type_(type) { |
| +InsecureContentInfoBarDelegate::InsecureContentInfoBarDelegate() |
| + : ConfirmInfoBarDelegate() { |
| } |
| InsecureContentInfoBarDelegate::~InsecureContentInfoBarDelegate() { |
| @@ -56,8 +52,8 @@ InsecureContentInfoBarDelegate::~InsecureContentInfoBarDelegate() { |
| void InsecureContentInfoBarDelegate::InfoBarDismissed() { |
| UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
| - (type_ == DISPLAY) ? DISPLAY_INFOBAR_DISMISSED : RUN_INFOBAR_DISMISSED, |
| - NUM_EVENTS); |
| + DISPLAY_INFOBAR_DISMISSED, |
| + NUM_EVENTS); |
| ConfirmInfoBarDelegate::InfoBarDismissed(); |
| } |
| @@ -80,8 +76,8 @@ base::string16 InsecureContentInfoBarDelegate::GetButtonLabel( |
| // means stay secure, so do nothing but count the event and dismiss. |
| bool InsecureContentInfoBarDelegate::Accept() { |
| UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
| - (type_ == DISPLAY) ? DISPLAY_USER_DID_NOT_LOAD : RUN_USER_DID_NOT_LOAD, |
| - NUM_EVENTS); |
| + DISPLAY_USER_DID_NOT_LOAD, |
| + NUM_EVENTS); |
| return true; |
| } |
| @@ -89,16 +85,14 @@ bool InsecureContentInfoBarDelegate::Accept() { |
| // means become insecure, so do the work of reloading the page. |
| bool InsecureContentInfoBarDelegate::Cancel() { |
| UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
| - (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, |
| - NUM_EVENTS); |
| + DISPLAY_USER_OVERRIDE, |
| + NUM_EVENTS); |
| content::WebContents* web_contents = |
| InfoBarService::WebContentsFromInfoBar(infobar()); |
| - web_contents->SendToAllFrames((type_ == DISPLAY) ? |
| - static_cast<IPC::Message*>( |
| - new ChromeViewMsg_SetAllowDisplayingInsecureContent(MSG_ROUTING_NONE, |
| - true)) : |
| - new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true)); |
| + web_contents->SendToAllFrames( |
| + new ChromeViewMsg_SetAllowDisplayingInsecureContent( |
| + MSG_ROUTING_NONE, true)); |
| web_contents->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( |
| web_contents->GetMainFrame()->GetRoutingID())); |
| return true; |