Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1530)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc

Issue 2542093002: [Password Generation] Fixes sending votes about the usage of the password generation popup (Closed)
Patch Set: Fix for the failed Mac test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Class responsible for collecting and reporting all the runtime interactions 73 // Class responsible for collecting and reporting all the runtime interactions
74 // with the bubble. 74 // with the bubble.
75 class ManagePasswordsBubbleModel::InteractionKeeper { 75 class ManagePasswordsBubbleModel::InteractionKeeper {
76 public: 76 public:
77 InteractionKeeper( 77 InteractionKeeper(
78 password_manager::InteractionsStats stats, 78 password_manager::InteractionsStats stats,
79 password_manager::metrics_util::UIDisplayDisposition display_disposition); 79 password_manager::metrics_util::UIDisplayDisposition display_disposition);
80 80
81 ~InteractionKeeper() = default; 81 ~InteractionKeeper() = default;
82 82
83 // Records UMA events and updates the interaction statistics when the bubble 83 // Records UMA events, updates the interaction statistics and sends
84 // is closed. 84 // notifications to the delegate when the bubble is closed.
85 void ReportInteractions(const ManagePasswordsBubbleModel* model); 85 void ReportInteractions(const ManagePasswordsBubbleModel* model);
86 86
87 void set_dismissal_reason( 87 void set_dismissal_reason(
88 password_manager::metrics_util::UIDismissalReason reason) { 88 password_manager::metrics_util::UIDismissalReason reason) {
89 dismissal_reason_ = reason; 89 dismissal_reason_ = reason;
90 } 90 }
91 91
92 void set_update_password_submission_event( 92 void set_update_password_submission_event(
93 password_manager::metrics_util::UpdatePasswordSubmissionEvent event) { 93 password_manager::metrics_util::UpdatePasswordSubmissionEvent event) {
94 update_password_submission_event_ = event; 94 update_password_submission_event_ = event;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 } else if (model->state() != 194 } else if (model->state() !=
195 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { 195 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
196 // We have separate metrics for the Update bubble so do not record dismissal 196 // We have separate metrics for the Update bubble so do not record dismissal
197 // reason for it. 197 // reason for it.
198 metrics_util::LogUIDismissalReason(dismissal_reason_); 198 metrics_util::LogUIDismissalReason(dismissal_reason_);
199 } 199 }
200 200
201 if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || 201 if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
202 model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { 202 model->state() == password_manager::ui::PENDING_PASSWORD_STATE) {
203 // Send a notification if there was no interaction with the bubble.
204 bool no_interaction =
205 model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE
206 ? update_password_submission_event_ ==
207 metrics_util::NO_UPDATE_SUBMISSION
208 : dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION;
209 if (no_interaction && model->delegate_) {
210 model->delegate_->OnNoInteraction();
211 }
212
213 // Send UMA.
203 if (update_password_submission_event_ == 214 if (update_password_submission_event_ ==
204 metrics_util::NO_UPDATE_SUBMISSION) { 215 metrics_util::NO_UPDATE_SUBMISSION) {
205 update_password_submission_event_ = 216 update_password_submission_event_ =
206 model->GetUpdateDismissalReason(NO_INTERACTION); 217 model->GetUpdateDismissalReason(NO_INTERACTION);
207 if (model->delegate_ &&
208 model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)
209 model->delegate_->OnNoInteractionOnUpdate();
210 } 218 }
211
212 if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION) 219 if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION)
213 LogUpdatePasswordSubmissionEvent(update_password_submission_event_); 220 LogUpdatePasswordSubmissionEvent(update_password_submission_event_);
214 } 221 }
215 } 222 }
216 223
217 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( 224 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
218 base::WeakPtr<PasswordsModelDelegate> delegate, 225 base::WeakPtr<PasswordsModelDelegate> delegate,
219 DisplayReason display_reason) 226 DisplayReason display_reason)
220 : password_overridden_(false), 227 : password_overridden_(false),
221 delegate_(std::move(delegate)) { 228 delegate_(std::move(delegate)) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return metrics_util::NO_UPDATE_SUBMISSION; 525 return metrics_util::NO_UPDATE_SUBMISSION;
519 } 526 }
520 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) 527 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)
521 return metrics_util::NO_UPDATE_SUBMISSION; 528 return metrics_util::NO_UPDATE_SUBMISSION;
522 if (password_overridden_) 529 if (password_overridden_)
523 return update_events[3][behavior]; 530 return update_events[3][behavior];
524 if (ShouldShowMultipleAccountUpdateUI()) 531 if (ShouldShowMultipleAccountUpdateUI())
525 return update_events[2][behavior]; 532 return update_events[2][behavior];
526 return update_events[1][behavior]; 533 return update_events[1][behavior];
527 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698