OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/password_manager_delegate_impl.h" | 5 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/perftimer.h" | |
9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 11 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/password_manager/password_form_manager.h" | 13 #include "chrome/browser/password_manager/password_form_manager.h" |
13 #include "chrome/browser/password_manager/password_manager.h" | 14 #include "chrome/browser/password_manager/password_manager.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 16 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
16 #include "components/autofill/content/browser/autofill_driver_impl.h" | 17 #include "components/autofill/content/browser/autofill_driver_impl.h" |
17 #include "components/autofill/core/browser/autofill_manager.h" | 18 #include "components/autofill/core/browser/autofill_manager.h" |
18 #include "components/autofill/core/common/autofill_messages.h" | 19 #include "components/autofill/core/common/autofill_messages.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
46 PasswordFormManager* form_to_save); | 47 PasswordFormManager* form_to_save); |
47 | 48 |
48 private: | 49 private: |
49 enum ResponseType { | 50 enum ResponseType { |
50 NO_RESPONSE = 0, | 51 NO_RESPONSE = 0, |
51 REMEMBER_PASSWORD, | 52 REMEMBER_PASSWORD, |
52 DONT_REMEMBER_PASSWORD, | 53 DONT_REMEMBER_PASSWORD, |
53 NUM_RESPONSE_TYPES, | 54 NUM_RESPONSE_TYPES, |
54 }; | 55 }; |
55 | 56 |
57 PerfTimer timer_; | |
58 | |
59 std::string domain_name_; | |
60 | |
56 SavePasswordInfoBarDelegate(InfoBarService* infobar_service, | 61 SavePasswordInfoBarDelegate(InfoBarService* infobar_service, |
57 PasswordFormManager* form_to_save); | 62 PasswordFormManager* form_to_save); |
58 virtual ~SavePasswordInfoBarDelegate(); | 63 virtual ~SavePasswordInfoBarDelegate(); |
59 | 64 |
60 // ConfirmInfoBarDelegate | 65 // ConfirmInfoBarDelegate |
61 virtual int GetIconID() const OVERRIDE; | 66 virtual int GetIconID() const OVERRIDE; |
62 virtual Type GetInfoBarType() const OVERRIDE; | 67 virtual Type GetInfoBarType() const OVERRIDE; |
63 virtual string16 GetMessageText() const OVERRIDE; | 68 virtual string16 GetMessageText() const OVERRIDE; |
64 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 69 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
65 virtual bool Accept() OVERRIDE; | 70 virtual bool Accept() OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | 104 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
100 new SavePasswordInfoBarDelegate(infobar_service, form_to_save))); | 105 new SavePasswordInfoBarDelegate(infobar_service, form_to_save))); |
101 } | 106 } |
102 | 107 |
103 SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( | 108 SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( |
104 InfoBarService* infobar_service, | 109 InfoBarService* infobar_service, |
105 PasswordFormManager* form_to_save) | 110 PasswordFormManager* form_to_save) |
106 : ConfirmInfoBarDelegate(infobar_service), | 111 : ConfirmInfoBarDelegate(infobar_service), |
107 form_to_save_(form_to_save), | 112 form_to_save_(form_to_save), |
108 infobar_response_(NO_RESPONSE) { | 113 infobar_response_(NO_RESPONSE) { |
114 GURL gurl(form_to_save->realm()); | |
115 domain_name_ = gurl.host(); | |
vabr (Chromium)
2013/08/14 14:39:58
Here again, only for a handful of hosts we want to
| |
116 if (domain_name_.size()) | |
117 domain_name_.insert(0, "_"); | |
118 UMA_HISTOGRAM_BOOLEAN("PasswordManager.InfobarDisplayed" + domain_name_, | |
119 true); | |
109 } | 120 } |
110 | 121 |
111 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { | 122 SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
123 // Time in milliseconds. | |
vabr (Chromium)
2013/08/14 14:39:58
Time of what? Please comment (in the code, not in
| |
124 const int kTime = 200; | |
112 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", | 125 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
vabr (Chromium)
2013/08/14 14:39:58
This comments is on behalf of Jordy, as a reminder
Garrett Casto
2013/08/14 23:02:47
It sounds like they are just migrating from the in
| |
113 infobar_response_, NUM_RESPONSE_TYPES); | 126 infobar_response_, NUM_RESPONSE_TYPES); |
127 UMA_HISTOGRAM_BOOLEAN( | |
128 "PasswordManager.InfobarDislayedTooShortly" + domain_name_, | |
129 timer_.Elapsed().InMilliseconds() > kTime ? true : false); | |
vabr (Chromium)
2013/08/14 14:39:58
1) Omit the ternary operator.
boolean ? true :
| |
114 } | 130 } |
115 | 131 |
116 int SavePasswordInfoBarDelegate::GetIconID() const { | 132 int SavePasswordInfoBarDelegate::GetIconID() const { |
117 return IDR_INFOBAR_SAVE_PASSWORD; | 133 return IDR_INFOBAR_SAVE_PASSWORD; |
118 } | 134 } |
119 | 135 |
120 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { | 136 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { |
121 return PAGE_ACTION_TYPE; | 137 return PAGE_ACTION_TYPE; |
122 } | 138 } |
123 | 139 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { | 199 bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() { |
184 content::NavigationEntry* entry = | 200 content::NavigationEntry* entry = |
185 web_contents_->GetController().GetActiveEntry(); | 201 web_contents_->GetController().GetActiveEntry(); |
186 if (!entry) { | 202 if (!entry) { |
187 NOTREACHED(); | 203 NOTREACHED(); |
188 return false; | 204 return false; |
189 } | 205 } |
190 | 206 |
191 return net::IsCertStatusError(entry->GetSSL().cert_status); | 207 return net::IsCertStatusError(entry->GetSSL().cert_status); |
192 } | 208 } |
OLD | NEW |