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

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

Issue 2926833002: Revert of [Password Manager] Convert |pending_login_managers_| to an array of scoped_refptr (Closed)
Patch Set: Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_PASSWORDS_CLIENT_UI_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
15 #include "components/autofill/core/common/password_form.h" 14 #include "components/autofill/core/common/password_form.h"
16 15
17 namespace content { 16 namespace content {
18 class WebContents; 17 class WebContents;
19 } 18 }
20 19
21 namespace password_manager { 20 namespace password_manager {
22 class PasswordFormManager; 21 class PasswordFormManager;
23 } 22 }
24 23
25 // An interface for ChromePasswordManagerClient implemented by 24 // An interface for ChromePasswordManagerClient implemented by
26 // ManagePasswordsUIController. Allows to push a new state for the tab. 25 // ManagePasswordsUIController. Allows to push a new state for the tab.
27 class PasswordsClientUIDelegate { 26 class PasswordsClientUIDelegate {
28 public: 27 public:
29 // Called when the user submits a form containing login information, so the 28 // Called when the user submits a form containing login information, so the
30 // later requests to save or blacklist can be handled. 29 // later requests to save or blacklist can be handled.
31 // This stores the provided object and triggers the UI to prompt the user 30 // This stores the provided object and triggers the UI to prompt the user
32 // about whether they would like to save the password. 31 // about whether they would like to save the password.
33 virtual void OnPasswordSubmitted( 32 virtual void OnPasswordSubmitted(
34 scoped_refptr<password_manager::PasswordFormManager> form_manager) = 0; 33 std::unique_ptr<password_manager::PasswordFormManager> form_manager) = 0;
35 34
36 // Called when the user submits a new password for an existing credential. 35 // Called when the user submits a new password for an existing credential.
37 // This stores the provided object and triggers the UI to prompt the user 36 // This stores the provided object and triggers the UI to prompt the user
38 // about whether they would like to update the password. 37 // about whether they would like to update the password.
39 virtual void OnUpdatePasswordSubmitted( 38 virtual void OnUpdatePasswordSubmitted(
40 scoped_refptr<password_manager::PasswordFormManager> form_manager) = 0; 39 std::unique_ptr<password_manager::PasswordFormManager> form_manager) = 0;
41 40
42 // Called when the site asks user to choose from credentials. This triggers 41 // Called when the site asks user to choose from credentials. This triggers
43 // the UI to prompt the user. |local_credentials| shouldn't be empty. |origin| 42 // the UI to prompt the user. |local_credentials| shouldn't be empty. |origin|
44 // is a URL of the site that requested a credential. 43 // is a URL of the site that requested a credential.
45 // Returns true when the UI is shown. |callback| is called when the user made 44 // Returns true when the UI is shown. |callback| is called when the user made
46 // a decision. If the UI isn't shown the method returns false and doesn't call 45 // a decision. If the UI isn't shown the method returns false and doesn't call
47 // |callback|. 46 // |callback|.
48 virtual bool OnChooseCredentials( 47 virtual bool OnChooseCredentials(
49 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials, 48 std::vector<std::unique_ptr<autofill::PasswordForm>> local_credentials,
50 const GURL& origin, 49 const GURL& origin,
51 const base::Callback<void(const autofill::PasswordForm*)>& callback) = 0; 50 const base::Callback<void(const autofill::PasswordForm*)>& callback) = 0;
52 51
53 // Called when user is auto signed in to the site. |local_forms[0]| contains 52 // Called when user is auto signed in to the site. |local_forms[0]| contains
54 // the credential returned to the site. |origin| is a URL of the site. 53 // the credential returned to the site. |origin| is a URL of the site.
55 virtual void OnAutoSignin( 54 virtual void OnAutoSignin(
56 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, 55 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms,
57 const GURL& origin) = 0; 56 const GURL& origin) = 0;
58 57
59 // Called when it's the right time to enable autosign-in explicitly. 58 // Called when it's the right time to enable autosign-in explicitly.
60 virtual void OnPromptEnableAutoSignin() = 0; 59 virtual void OnPromptEnableAutoSignin() = 0;
61 60
62 // Called when the password will be saved automatically, but we still wish to 61 // Called when the password will be saved automatically, but we still wish to
63 // visually inform the user that the save has occured. 62 // visually inform the user that the save has occured.
64 virtual void OnAutomaticPasswordSave( 63 virtual void OnAutomaticPasswordSave(
65 scoped_refptr<password_manager::PasswordFormManager> form_manager) = 0; 64 std::unique_ptr<password_manager::PasswordFormManager> form_manager) = 0;
66 65
67 // Called when a form is autofilled with login information, so we can manage 66 // Called when a form is autofilled with login information, so we can manage
68 // password credentials for the current site which are stored in 67 // password credentials for the current site which are stored in
69 // |password_form_map|. This stores a copy of |password_form_map| and shows 68 // |password_form_map|. This stores a copy of |password_form_map| and shows
70 // the manage password icon. |federated_matches| contain the matching stored 69 // the manage password icon. |federated_matches| contain the matching stored
71 // federated credentials to display in the UI. 70 // federated credentials to display in the UI.
72 virtual void OnPasswordAutofilled( 71 virtual void OnPasswordAutofilled(
73 const std::map<base::string16, const autofill::PasswordForm*>& 72 const std::map<base::string16, const autofill::PasswordForm*>&
74 password_form_map, 73 password_form_map,
75 const GURL& origin, 74 const GURL& origin,
76 const std::vector<const autofill::PasswordForm*>* federated_matches) = 0; 75 const std::vector<const autofill::PasswordForm*>* federated_matches) = 0;
77 76
78 protected: 77 protected:
79 virtual ~PasswordsClientUIDelegate() = default; 78 virtual ~PasswordsClientUIDelegate() = default;
80 }; 79 };
81 80
82 // Returns ManagePasswordsUIController instance for |contents| 81 // Returns ManagePasswordsUIController instance for |contents|
83 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents( 82 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents(
84 content::WebContents* web_contents); 83 content::WebContents* web_contents);
85 84
86 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ 85 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698