OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/passwords/manage_passwords_bubble_model.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
6 | 6 |
7 #include "chrome/browser/password_manager/password_store_factory.h" | 7 #include "chrome/browser/password_manager/password_store_factory.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 display_disposition_ = metrics_util::MANUAL_BLACKLISTED; | 175 display_disposition_ = metrics_util::MANUAL_BLACKLISTED; |
176 } else { | 176 } else { |
177 display_disposition_ = metrics_util::MANUAL_MANAGE_PASSWORDS; | 177 display_disposition_ = metrics_util::MANUAL_MANAGE_PASSWORDS; |
178 } | 178 } |
179 } else { | 179 } else { |
180 if (state_ == password_manager::ui::CONFIRMATION_STATE) { | 180 if (state_ == password_manager::ui::CONFIRMATION_STATE) { |
181 display_disposition_ = | 181 display_disposition_ = |
182 metrics_util::AUTOMATIC_GENERATED_PASSWORD_CONFIRMATION; | 182 metrics_util::AUTOMATIC_GENERATED_PASSWORD_CONFIRMATION; |
183 } else if (state_ == password_manager::ui::CREDENTIAL_REQUEST_STATE) { | 183 } else if (state_ == password_manager::ui::CREDENTIAL_REQUEST_STATE) { |
184 display_disposition_ = metrics_util::AUTOMATIC_CREDENTIAL_REQUEST; | 184 display_disposition_ = metrics_util::AUTOMATIC_CREDENTIAL_REQUEST; |
185 } else if (state_ == password_manager::ui::AUTO_SIGNIN_STATE) { | |
186 display_disposition_ = metrics_util::AUTOMATIC_AUTO_SIGNIN_TOAST; | |
Mike West
2015/02/18 22:28:04
Nit: AUTOMATIC_AUTO is a bit much. How about AUTOM
vasilii
2015/02/19 09:37:34
Done.
| |
185 } else { | 187 } else { |
186 display_disposition_ = metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING; | 188 display_disposition_ = metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING; |
187 } | 189 } |
188 } | 190 } |
189 if (password_manager::ui::IsAskSubmitURLState(state_)) | 191 if (password_manager::ui::IsAskSubmitURLState(state_)) |
190 RecordURLsCollectionExperimentStatistics(web_contents()); | 192 RecordURLsCollectionExperimentStatistics(web_contents()); |
191 metrics_util::LogUIDisplayDisposition(display_disposition_); | 193 metrics_util::LogUIDisplayDisposition(display_disposition_); |
192 | 194 |
193 // Default to a dismissal reason of "no interaction". If the user interacts | 195 // Default to a dismissal reason of "no interaction". If the user interacts |
194 // with the button in such a way that it closes, we'll reset this value | 196 // with the button in such a way that it closes, we'll reset this value |
(...skipping 28 matching lines...) Expand all Loading... | |
223 state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE; | 225 state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE; |
224 metrics_util::LogAllowToCollectURLBubbleUIDismissalReason( | 226 metrics_util::LogAllowToCollectURLBubbleUIDismissalReason( |
225 dismissal_reason_); | 227 dismissal_reason_); |
226 // Return since we do not want to include "Allow to collect URL?" bubble | 228 // Return since we do not want to include "Allow to collect URL?" bubble |
227 // data in other PasswordManager metrics. | 229 // data in other PasswordManager metrics. |
228 return; | 230 return; |
229 } | 231 } |
230 | 232 |
231 metrics_util::LogUIDismissalReason(dismissal_reason_); | 233 metrics_util::LogUIDismissalReason(dismissal_reason_); |
232 // Other use cases have been reported in the callbacks like OnSaveClicked(). | 234 // Other use cases have been reported in the callbacks like OnSaveClicked(). |
233 if (dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION) | 235 if (state_ == password_manager::ui::PENDING_PASSWORD_STATE && |
Mike West
2015/02/18 22:28:04
What about clicking away in MANAGE state?
vasilii
2015/02/19 09:37:34
We care only about the "Save" bubble. The "Manage"
| |
236 dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION) | |
234 RecordExperimentStatistics(web_contents(), dismissal_reason_); | 237 RecordExperimentStatistics(web_contents(), dismissal_reason_); |
235 } | 238 } |
236 | 239 |
237 void ManagePasswordsBubbleModel::OnCollectURLClicked(const std::string& url) { | 240 void ManagePasswordsBubbleModel::OnCollectURLClicked(const std::string& url) { |
238 dismissal_reason_ = metrics_util::CLICKED_COLLECT_URL; | 241 dismissal_reason_ = metrics_util::CLICKED_COLLECT_URL; |
239 RecordExperimentStatistics(web_contents(), dismissal_reason_); | |
240 // User interaction with bubble has happened, do not need to show bubble | 242 // User interaction with bubble has happened, do not need to show bubble |
241 // in case it was before transition to another page. | 243 // in case it was before transition to another page. |
242 state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE; | 244 state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE; |
243 #if !defined(OS_ANDROID) | 245 #if !defined(OS_ANDROID) |
244 URLCollectionFeedbackSender feedback_sender( | 246 URLCollectionFeedbackSender feedback_sender( |
245 web_contents()->GetBrowserContext(), url); | 247 web_contents()->GetBrowserContext(), url); |
246 feedback_sender.SendFeedback(); | 248 feedback_sender.SendFeedback(); |
247 #endif | 249 #endif |
248 } | 250 } |
249 | 251 |
250 void ManagePasswordsBubbleModel::OnDoNotCollectURLClicked() { | 252 void ManagePasswordsBubbleModel::OnDoNotCollectURLClicked() { |
251 dismissal_reason_ = metrics_util::CLICKED_DO_NOT_COLLECT_URL; | 253 dismissal_reason_ = metrics_util::CLICKED_DO_NOT_COLLECT_URL; |
252 RecordExperimentStatistics(web_contents(), dismissal_reason_); | |
253 // User interaction with bubble has happened, do not need to show bubble | 254 // User interaction with bubble has happened, do not need to show bubble |
254 // in case it was before transition to another page. | 255 // in case it was before transition to another page. |
255 state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE; | 256 state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE; |
256 } | 257 } |
257 | 258 |
258 void ManagePasswordsBubbleModel::OnNopeClicked() { | 259 void ManagePasswordsBubbleModel::OnNopeClicked() { |
259 dismissal_reason_ = metrics_util::CLICKED_NOPE; | 260 dismissal_reason_ = metrics_util::CLICKED_NOPE; |
260 RecordExperimentStatistics(web_contents(), dismissal_reason_); | 261 RecordExperimentStatistics(web_contents(), dismissal_reason_); |
261 if (state_ != password_manager::ui::CREDENTIAL_REQUEST_STATE) | 262 if (state_ != password_manager::ui::CREDENTIAL_REQUEST_STATE) |
262 state_ = password_manager::ui::PENDING_PASSWORD_STATE; | 263 state_ = password_manager::ui::PENDING_PASSWORD_STATE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 void ManagePasswordsBubbleModel::OnOKClicked() { | 308 void ManagePasswordsBubbleModel::OnOKClicked() { |
308 dismissal_reason_ = metrics_util::CLICKED_OK; | 309 dismissal_reason_ = metrics_util::CLICKED_OK; |
309 } | 310 } |
310 | 311 |
311 void ManagePasswordsBubbleModel::OnManageLinkClicked() { | 312 void ManagePasswordsBubbleModel::OnManageLinkClicked() { |
312 dismissal_reason_ = metrics_util::CLICKED_MANAGE; | 313 dismissal_reason_ = metrics_util::CLICKED_MANAGE; |
313 ManagePasswordsUIController::FromWebContents(web_contents()) | 314 ManagePasswordsUIController::FromWebContents(web_contents()) |
314 ->NavigateToPasswordManagerSettingsPage(); | 315 ->NavigateToPasswordManagerSettingsPage(); |
315 } | 316 } |
316 | 317 |
318 void ManagePasswordsBubbleModel::OnAutoSignInToastTimeout() { | |
319 dismissal_reason_ = metrics_util::AUTO_SIGNIN_TOAST_TIMEOUT; | |
320 } | |
321 | |
317 void ManagePasswordsBubbleModel::OnPasswordAction( | 322 void ManagePasswordsBubbleModel::OnPasswordAction( |
318 const autofill::PasswordForm& password_form, | 323 const autofill::PasswordForm& password_form, |
319 PasswordAction action) { | 324 PasswordAction action) { |
320 if (!web_contents()) | 325 if (!web_contents()) |
321 return; | 326 return; |
322 Profile* profile = | 327 Profile* profile = |
323 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 328 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
324 password_manager::PasswordStore* password_store = | 329 password_manager::PasswordStore* password_store = |
325 PasswordStoreFactory::GetForProfile( | 330 PasswordStoreFactory::GetForProfile( |
326 profile, ServiceAccessType::EXPLICIT_ACCESS).get(); | 331 profile, ServiceAccessType::EXPLICIT_ACCESS).get(); |
(...skipping 22 matching lines...) Expand all Loading... | |
349 | 354 |
350 // static | 355 // static |
351 int ManagePasswordsBubbleModel::UsernameFieldWidth() { | 356 int ManagePasswordsBubbleModel::UsernameFieldWidth() { |
352 return GetFieldWidth(USERNAME_FIELD); | 357 return GetFieldWidth(USERNAME_FIELD); |
353 } | 358 } |
354 | 359 |
355 // static | 360 // static |
356 int ManagePasswordsBubbleModel::PasswordFieldWidth() { | 361 int ManagePasswordsBubbleModel::PasswordFieldWidth() { |
357 return GetFieldWidth(PASSWORD_FIELD); | 362 return GetFieldWidth(PASSWORD_FIELD); |
358 } | 363 } |
OLD | NEW |