| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" | 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 (realm == GURL("https://www.google.com/"))) && | 39 (realm == GURL("https://www.google.com/"))) && |
| 40 switches::IsEnableWebBasedSignin() && | 40 switches::IsEnableWebBasedSignin() && |
| 41 OneClickSigninHelper::CanOffer( | 41 OneClickSigninHelper::CanOffer( |
| 42 web_contents, | 42 web_contents, |
| 43 OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, | 43 OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, |
| 44 base::UTF16ToUTF8(form_to_save->associated_username()), | 44 base::UTF16ToUTF8(form_to_save->associated_username()), |
| 45 NULL)) | 45 NULL)) |
| 46 return; | 46 return; |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 InfoBarService::FromWebContents(web_contents)->AddInfoBar( | 49 InfoBarService* infobar_service = |
| 50 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 50 InfoBarService::FromWebContents(web_contents); |
| 51 new SavePasswordInfoBarDelegate(form_to_save.Pass(), | 51 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 52 uma_histogram_suffix)))); | 52 infobar_service, |
| 53 scoped_ptr<ConfirmInfoBarDelegate>(new SavePasswordInfoBarDelegate( |
| 54 form_to_save.Pass(), uma_histogram_suffix)))); |
| 53 } | 55 } |
| 54 | 56 |
| 55 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { | 57 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
| 56 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", | 58 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
| 57 infobar_response_, | 59 infobar_response_, |
| 58 password_manager::metrics_util::NUM_RESPONSE_TYPES); | 60 password_manager::metrics_util::NUM_RESPONSE_TYPES); |
| 59 | 61 |
| 60 password_manager::metrics_util::LogUIDismissalReason(infobar_response_); | 62 password_manager::metrics_util::LogUIDismissalReason(infobar_response_); |
| 61 | 63 |
| 62 // The shortest period for which the prompt needs to live, so that we don't | 64 // The shortest period for which the prompt needs to live, so that we don't |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 134 |
| 133 void SavePasswordInfoBarDelegate::InfoBarDismissed() { | 135 void SavePasswordInfoBarDelegate::InfoBarDismissed() { |
| 134 DCHECK(form_to_save_.get()); | 136 DCHECK(form_to_save_.get()); |
| 135 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; | 137 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; |
| 136 } | 138 } |
| 137 | 139 |
| 138 infobars::InfoBarDelegate::InfoBarAutomationType | 140 infobars::InfoBarDelegate::InfoBarAutomationType |
| 139 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const { | 141 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const { |
| 140 return PASSWORD_INFOBAR; | 142 return PASSWORD_INFOBAR; |
| 141 } | 143 } |
| OLD | NEW |