OLD | NEW |
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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class WebContents; | 16 class WebContents; |
17 } | 17 } |
18 | 18 |
19 namespace password_manager { | 19 namespace password_manager { |
20 struct CredentialInfo; | |
21 class PasswordFormManager; | 20 class PasswordFormManager; |
22 } | 21 } |
23 | 22 |
24 // An interface for ChromePasswordManagerClient implemented by | 23 // An interface for ChromePasswordManagerClient implemented by |
25 // ManagePasswordsUIController. Allows to push a new state for the tab. | 24 // ManagePasswordsUIController. Allows to push a new state for the tab. |
26 class PasswordsClientUIDelegate { | 25 class PasswordsClientUIDelegate { |
27 public: | 26 public: |
28 // Called when the user submits a form containing login information, so the | 27 // Called when the user submits a form containing login information, so the |
29 // later requests to save or blacklist can be handled. | 28 // later requests to save or blacklist can be handled. |
30 // This stores the provided object and triggers the UI to prompt the user | 29 // This stores the provided object and triggers the UI to prompt the user |
(...skipping 11 matching lines...) Expand all Loading... |
42 // the UI to prompt the user. |local_credentials| and |federated_credentials| | 41 // the UI to prompt the user. |local_credentials| and |federated_credentials| |
43 // shouldn't both be empty. |origin| is a URL of the site that requested a | 42 // shouldn't both be empty. |origin| is a URL of the site that requested a |
44 // credential. | 43 // 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 ScopedVector<autofill::PasswordForm> local_credentials, | 48 ScopedVector<autofill::PasswordForm> local_credentials, |
50 ScopedVector<autofill::PasswordForm> federated_credentials, | 49 ScopedVector<autofill::PasswordForm> federated_credentials, |
51 const GURL& origin, | 50 const GURL& origin, |
52 base::Callback<void(const password_manager::CredentialInfo&)> | 51 const base::Callback<void(const autofill::PasswordForm*)>& callback) = 0; |
53 callback) = 0; | |
54 | 52 |
55 // Called when user is auto signed in to the site. |local_forms[0]| contains | 53 // Called when user is auto signed in to the site. |local_forms[0]| contains |
56 // the credential returned to the site. |origin| is a URL of the site. | 54 // the credential returned to the site. |origin| is a URL of the site. |
57 virtual void OnAutoSignin( | 55 virtual void OnAutoSignin( |
58 ScopedVector<autofill::PasswordForm> local_forms, | 56 ScopedVector<autofill::PasswordForm> local_forms, |
59 const GURL& origin) = 0; | 57 const GURL& origin) = 0; |
60 | 58 |
61 // Called when it's the right time to enable autosign-in explicitly. | 59 // Called when it's the right time to enable autosign-in explicitly. |
62 virtual void OnPromptEnableAutoSignin() = 0; | 60 virtual void OnPromptEnableAutoSignin() = 0; |
63 | 61 |
(...skipping 15 matching lines...) Expand all Loading... |
79 | 77 |
80 protected: | 78 protected: |
81 virtual ~PasswordsClientUIDelegate() = default; | 79 virtual ~PasswordsClientUIDelegate() = default; |
82 }; | 80 }; |
83 | 81 |
84 // Returns ManagePasswordsUIController instance for |contents| | 82 // Returns ManagePasswordsUIController instance for |contents| |
85 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents( | 83 PasswordsClientUIDelegate* PasswordsClientUIDelegateFromWebContents( |
86 content::WebContents* web_contents); | 84 content::WebContents* web_contents); |
87 | 85 |
88 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ | 86 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORDS_CLIENT_UI_DELEGATE_H_ |
OLD | NEW |