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

Side by Side Diff: chrome/browser/password_manager/save_password_infobar_delegate.h

Issue 1776143003: Remove groups handling from password manager metrics util (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@593295_unify_enums
Patch Set: Keep suffixes, marked as obsolete Created 4 years, 9 months 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 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer/elapsed_timer.h" 10 #include "base/timer/elapsed_timer.h"
(...skipping 14 matching lines...) Expand all
25 // After a successful *new* login attempt, we take the PasswordFormManager in 25 // After a successful *new* login attempt, we take the PasswordFormManager in
26 // provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while 26 // provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while
27 // the user makes up their mind with the "save password" infobar. Note if the 27 // the user makes up their mind with the "save password" infobar. Note if the
28 // login is one we already know about, the end of the line is 28 // login is one we already know about, the end of the line is
29 // provisional_save_manager_ because we just update it on success and so such 29 // provisional_save_manager_ because we just update it on success and so such
30 // forms never end up in an infobar. 30 // forms never end up in an infobar.
31 class SavePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate { 31 class SavePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate {
32 public: 32 public:
33 // If we won't be showing the one-click signin infobar, creates a save 33 // If we won't be showing the one-click signin infobar, creates a save
34 // password infobar and delegate and adds the infobar to the InfoBarService 34 // password infobar and delegate and adds the infobar to the InfoBarService
35 // for |web_contents|. |uma_histogram_suffix| is empty, or one of the 35 // for |web_contents|.
36 // "group_X" suffixes used in the histogram names for infobar usage reporting;
37 // if empty, the usage is not reported, otherwise the suffix is used to choose
38 // the right histogram.
39 static void Create( 36 static void Create(
40 content::WebContents* web_contents, 37 content::WebContents* web_contents,
41 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 38 scoped_ptr<password_manager::PasswordFormManager> form_to_save);
42 const std::string& uma_histogram_suffix);
43 39
44 ~SavePasswordInfoBarDelegate() override; 40 ~SavePasswordInfoBarDelegate() override;
45 41
46 base::string16 GetFirstRunExperienceMessage(); 42 base::string16 GetFirstRunExperienceMessage();
47 43
48 // ConfirmInfoBarDelegate: 44 // ConfirmInfoBarDelegate:
49 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 45 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
50 void InfoBarDismissed() override; 46 void InfoBarDismissed() override;
51 base::string16 GetButtonLabel(InfoBarButton button) const override; 47 base::string16 GetButtonLabel(InfoBarButton button) const override;
52 bool Accept() override; 48 bool Accept() override;
53 bool Cancel() override; 49 bool Cancel() override;
54 50
55 protected: 51 protected:
56 // Makes a ctor available in tests. 52 // Makes a ctor available in tests.
57 SavePasswordInfoBarDelegate( 53 SavePasswordInfoBarDelegate(
58 content::WebContents* web_contents, 54 content::WebContents* web_contents,
59 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 55 scoped_ptr<password_manager::PasswordFormManager> form_to_save,
60 const std::string& uma_histogram_suffix,
61 bool is_smartlock_branding_enabled, 56 bool is_smartlock_branding_enabled,
62 bool should_show_first_run_experience); 57 bool should_show_first_run_experience);
63 58
64 private: 59 private:
65 // The PasswordFormManager managing the form we're asking the user about, 60 // The PasswordFormManager managing the form we're asking the user about,
66 // and should update as per her decision. 61 // and should update as per her decision.
67 scoped_ptr<password_manager::PasswordFormManager> form_to_save_; 62 scoped_ptr<password_manager::PasswordFormManager> form_to_save_;
68 63
69 // Used to track the results we get from the info bar. 64 // Used to track the results we get from the info bar.
70 password_manager::metrics_util::ResponseType infobar_response_; 65 password_manager::metrics_util::ResponseType infobar_response_;
71 66
72 // Measures the "Save password?" prompt lifetime. Used to report an UMA 67 // Measures the "Save password?" prompt lifetime. Used to report an UMA
73 // signal. 68 // signal.
74 base::ElapsedTimer timer_; 69 base::ElapsedTimer timer_;
75 70
76 // The group name corresponding to the domain name of |form_to_save_| if the
77 // form is on a monitored domain. Otherwise, an empty string.
78 const std::string uma_histogram_suffix_;
79
80 // Records source from where infobar was triggered. 71 // Records source from where infobar was triggered.
81 // Infobar appearance (message, buttons) depends on value of this parameter. 72 // Infobar appearance (message, buttons) depends on value of this parameter.
82 password_manager::CredentialSourceType source_type_; 73 password_manager::CredentialSourceType source_type_;
83 74
84 bool should_show_first_run_experience_; 75 bool should_show_first_run_experience_;
85 76
86 content::WebContents* web_contents_; 77 content::WebContents* web_contents_;
87 78
88 DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); 79 DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate);
89 }; 80 };
90 81
91 // Creates the platform-specific SavePassword InfoBar. This function is defined 82 // Creates the platform-specific SavePassword InfoBar. This function is defined
92 // in platform-specific .cc (or .mm) files. 83 // in platform-specific .cc (or .mm) files.
93 scoped_ptr<infobars::InfoBar> CreateSavePasswordInfoBar( 84 scoped_ptr<infobars::InfoBar> CreateSavePasswordInfoBar(
94 scoped_ptr<SavePasswordInfoBarDelegate> delegate); 85 scoped_ptr<SavePasswordInfoBarDelegate> delegate);
95 86
96 #endif // CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ 87 #endif // CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698