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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller.h

Issue 399573002: [Password Generation] Trigger confirmation bubble when a password is saved (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win Again Created 6 years, 5 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 | Annotate | Revision Log
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_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/timer/elapsed_timer.h" 10 #include "base/timer/elapsed_timer.h"
(...skipping 17 matching lines...) Expand all
28 : public content::WebContentsObserver, 28 : public content::WebContentsObserver,
29 public content::WebContentsUserData<ManagePasswordsUIController>, 29 public content::WebContentsUserData<ManagePasswordsUIController>,
30 public password_manager::PasswordStore::Observer { 30 public password_manager::PasswordStore::Observer {
31 public: 31 public:
32 virtual ~ManagePasswordsUIController(); 32 virtual ~ManagePasswordsUIController();
33 33
34 // Called when the user submits a form containing login information, so we 34 // Called when the user submits a form containing login information, so we
35 // can handle later requests to save or blacklist that login information. 35 // can handle later requests to save or blacklist that login information.
36 // This stores the provided object in form_manager_ and triggers the UI to 36 // This stores the provided object in form_manager_ and triggers the UI to
37 // prompt the user about whether they would like to save the password. 37 // prompt the user about whether they would like to save the password.
38 void OnPasswordSubmitted(password_manager::PasswordFormManager* form_manager); 38 void OnPasswordSubmitted(
39 scoped_ptr<password_manager::PasswordFormManager> form_manager);
40
41 // Called when the password will be saved automatically, but we still wish to
42 // visually inform the user that the save has occured.
43 void OnAutomaticPasswordSave(
44 scoped_ptr<password_manager::PasswordFormManager> form_manager);
39 45
40 // Called when a form is autofilled with login information, so we can manage 46 // Called when a form is autofilled with login information, so we can manage
41 // password credentials for the current site which are stored in 47 // password credentials for the current site which are stored in
42 // |password_form_map|. This stores a copy of |password_form_map| and shows 48 // |password_form_map|. This stores a copy of |password_form_map| and shows
43 // the manage password icon. 49 // the manage password icon.
44 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map); 50 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map);
45 51
46 // Called when a form is _not_ autofilled due to user blacklisting. This 52 // Called when a form is _not_ autofilled due to user blacklisting. This
47 // stores a copy of |password_form_map| so that we can offer the user the 53 // stores a copy of |password_form_map| so that we can offer the user the
48 // ability to reenable the manager for this form. 54 // ability to reenable the manager for this form.
(...skipping 15 matching lines...) Expand all
64 virtual void NeverSavePassword(); 70 virtual void NeverSavePassword();
65 71
66 // Called from the model when the user chooses to unblacklist the site. The 72 // Called from the model when the user chooses to unblacklist the site. The
67 // controller MUST be in BLACKLIST_STATE, and WILL be in MANAGE_STATE after 73 // controller MUST be in BLACKLIST_STATE, and WILL be in MANAGE_STATE after
68 // this method executes. 74 // this method executes.
69 virtual void UnblacklistSite(); 75 virtual void UnblacklistSite();
70 76
71 // Open a new tab, pointing to the password manager settings page. 77 // Open a new tab, pointing to the password manager settings page.
72 virtual void NavigateToPasswordManagerSettingsPage(); 78 virtual void NavigateToPasswordManagerSettingsPage();
73 79
80 // Open a new tab, pointing to the Google manage passwords website.
81 // TODO(gcasto): Change this to navigate to account central once passwords
82 // are visible there. Currently goes to the Chrome support page.
83 virtual void NavigateToAccountCentralManagementPage();
84
74 virtual const autofill::PasswordForm& PendingCredentials() const; 85 virtual const autofill::PasswordForm& PendingCredentials() const;
75 86
76 // Set the state of the Omnibox icon, and possibly show the associated bubble 87 // Set the state of the Omnibox icon, and possibly show the associated bubble
77 // without user interaction. 88 // without user interaction.
78 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon); 89 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon);
79 90
80 password_manager::ui::State state() const { return state_; } 91 password_manager::ui::State state() const { return state_; }
81 92
82 // True if a password is sitting around, waiting for a user to decide whether 93 // True if a password is sitting around, waiting for a user to decide whether
83 // or not to save it. 94 // or not to save it.
84 bool PasswordPendingUserDecision() const; 95 bool PasswordPendingUserDecision() const;
85 96
86 const autofill::PasswordFormMap best_matches() const { 97 const autofill::ConstPasswordFormMap best_matches() const {
87 return password_form_map_; 98 return password_form_map_;
88 } 99 }
89 100
90 const GURL& origin() const { return origin_; } 101 const GURL& origin() const { return origin_; }
91 102
92 protected: 103 protected:
93 explicit ManagePasswordsUIController( 104 explicit ManagePasswordsUIController(
94 content::WebContents* web_contents); 105 content::WebContents* web_contents);
95 106
96 // The pieces of saving and blacklisting passwords that interact with 107 // The pieces of saving and blacklisting passwords that interact with
97 // FormManager, split off into internal functions for testing/mocking. 108 // FormManager, split off into internal functions for testing/mocking.
98 virtual void SavePasswordInternal(); 109 virtual void SavePasswordInternal();
99 virtual void NeverSavePasswordInternal(); 110 virtual void NeverSavePasswordInternal();
100 111
101 // content::WebContentsObserver: 112 // content::WebContentsObserver:
102 virtual void DidNavigateMainFrame( 113 virtual void DidNavigateMainFrame(
103 const content::LoadCommittedDetails& details, 114 const content::LoadCommittedDetails& details,
104 const content::FrameNavigateParams& params) OVERRIDE; 115 const content::FrameNavigateParams& params) OVERRIDE;
105 116
106 // All previously stored credentials for a specific site. Set by 117 // All previously stored credentials for a specific site.
107 // OnPasswordSubmitted(), OnPasswordAutofilled(), or 118 // Protected, not private, so we can mess with the value in
108 // OnBlacklistBlockedAutofill(). Protected, not private, so we can mess with 119 // ManagePasswordsUIControllerMock.
109 // the value in ManagePasswordsUIControllerMock. 120 autofill::ConstPasswordFormMap password_form_map_;
110 autofill::PasswordFormMap password_form_map_;
111 121
112 // We create copies of PasswordForm objects that come in via OnLoginsChanged() 122 // We create copies of PasswordForm objects that come in via OnLoginsChanged()
113 // and store them in this vector as well as in |password_form_map_| to ensure 123 // and store them in this vector as well as in |password_form_map_| to ensure
114 // that we destroy them correctly. 124 // that we destroy them correctly.
115 ScopedVector<autofill::PasswordForm> new_password_forms_; 125 ScopedVector<autofill::PasswordForm> new_password_forms_;
116 126
117 // The current state of the password manager. Protected so we can manipulate 127 // The current state of the password manager. Protected so we can manipulate
118 // the value in tests. 128 // the value in tests.
119 password_manager::ui::State state_; 129 password_manager::ui::State state_;
120 130
(...skipping 29 matching lines...) Expand all
150 160
151 // The origin of the form we're currently dealing with; we'll use this to 161 // The origin of the form we're currently dealing with; we'll use this to
152 // determine which PasswordStore changes we should care about when updating 162 // determine which PasswordStore changes we should care about when updating
153 // |password_form_map_|. 163 // |password_form_map_|.
154 GURL origin_; 164 GURL origin_;
155 165
156 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); 166 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController);
157 }; 167 };
158 168
159 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 169 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698