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(infobar_service->CreateConfirmInfoBar( |
52 uma_histogram_suffix)))); | 52 scoped_ptr<ConfirmInfoBarDelegate>(new SavePasswordInfoBarDelegate( |
| 53 form_to_save.Pass(), uma_histogram_suffix)))); |
53 } | 54 } |
54 | 55 |
55 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { | 56 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
56 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", | 57 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
57 infobar_response_, | 58 infobar_response_, |
58 password_manager::metrics_util::NUM_RESPONSE_TYPES); | 59 password_manager::metrics_util::NUM_RESPONSE_TYPES); |
59 | 60 |
60 password_manager::metrics_util::LogUIDismissalReason(infobar_response_); | 61 password_manager::metrics_util::LogUIDismissalReason(infobar_response_); |
61 | 62 |
62 // The shortest period for which the prompt needs to live, so that we don't | 63 // 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 | 133 |
133 void SavePasswordInfoBarDelegate::InfoBarDismissed() { | 134 void SavePasswordInfoBarDelegate::InfoBarDismissed() { |
134 DCHECK(form_to_save_.get()); | 135 DCHECK(form_to_save_.get()); |
135 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; | 136 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; |
136 } | 137 } |
137 | 138 |
138 infobars::InfoBarDelegate::InfoBarAutomationType | 139 infobars::InfoBarDelegate::InfoBarAutomationType |
139 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const { | 140 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const { |
140 return PASSWORD_INFOBAR; | 141 return PASSWORD_INFOBAR; |
141 } | 142 } |
OLD | NEW |