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

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: Changes addressed to reviewer comments 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 } else if (model->state() != 187 } else if (model->state() !=
188 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { 188 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
189 // We have separate metrics for the Update bubble so do not record dismissal 189 // We have separate metrics for the Update bubble so do not record dismissal
190 // reason for it. 190 // reason for it.
191 metrics_util::LogUIDismissalReason(dismissal_reason_); 191 metrics_util::LogUIDismissalReason(dismissal_reason_);
192 } 192 }
193 193
194 if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || 194 if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
195 model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { 195 model->state() == password_manager::ui::PENDING_PASSWORD_STATE) {
196 // Send a notification if there was no interaction with the bubble.
197 bool no_interaction =
198 model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE
199 ? update_password_submission_event_ ==
200 metrics_util::NO_UPDATE_SUBMISSION
201 : dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION;
202 if (no_interaction && model->delegate_) {
203 model->delegate_->OnNoInteraction();
204 }
205
206 // Send UMA.
196 if (update_password_submission_event_ == 207 if (update_password_submission_event_ ==
197 metrics_util::NO_UPDATE_SUBMISSION) { 208 metrics_util::NO_UPDATE_SUBMISSION) {
198 update_password_submission_event_ = 209 update_password_submission_event_ =
199 model->GetUpdateDismissalReason(NO_INTERACTION); 210 model->GetUpdateDismissalReason(NO_INTERACTION);
200 if (model->delegate_ &&
201 model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)
202 model->delegate_->OnNoInteractionOnUpdate();
203 } 211 }
204
205 if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION) 212 if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION)
206 LogUpdatePasswordSubmissionEvent(update_password_submission_event_); 213 LogUpdatePasswordSubmissionEvent(update_password_submission_event_);
207 } 214 }
208 } 215 }
209 216
210 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( 217 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
211 base::WeakPtr<PasswordsModelDelegate> delegate, 218 base::WeakPtr<PasswordsModelDelegate> delegate,
212 DisplayReason display_reason) 219 DisplayReason display_reason)
213 : password_overridden_(false), 220 : password_overridden_(false),
214 delegate_(std::move(delegate)) { 221 delegate_(std::move(delegate)) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 return metrics_util::NO_UPDATE_SUBMISSION; 518 return metrics_util::NO_UPDATE_SUBMISSION;
512 } 519 }
513 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) 520 if (state_ != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE)
514 return metrics_util::NO_UPDATE_SUBMISSION; 521 return metrics_util::NO_UPDATE_SUBMISSION;
515 if (password_overridden_) 522 if (password_overridden_)
516 return update_events[3][behavior]; 523 return update_events[3][behavior];
517 if (ShouldShowMultipleAccountUpdateUI()) 524 if (ShouldShowMultipleAccountUpdateUI())
518 return update_events[2][behavior]; 525 return update_events[2][behavior];
519 return update_events[1][behavior]; 526 return update_events[1][behavior];
520 } 527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698