OLD | NEW |
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 COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_D
ISPATCHER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_D
ISPATCHER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_D
ISPATCHER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_D
ISPATCHER_H_ |
7 | 7 |
| 8 #include "base/callback.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "components/password_manager/core/browser/credential_manager_dispatcher
.h" | 10 #include "components/password_manager/core/browser/credential_manager_dispatcher
.h" |
10 #include "components/password_manager/core/browser/password_store_consumer.h" | 11 #include "components/password_manager/core/browser/password_store_consumer.h" |
11 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
12 | 13 |
13 class GURL; | 14 class GURL; |
14 | 15 |
15 namespace autofill { | 16 namespace autofill { |
16 struct PasswordForm; | 17 struct PasswordForm; |
17 } | 18 } |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class WebContents; | 21 class WebContents; |
21 } | 22 } |
22 | 23 |
23 namespace password_manager { | 24 namespace password_manager { |
24 | 25 |
25 class CredentialManagerPasswordFormManager; | 26 class CredentialManagerPasswordFormManager; |
26 class PasswordManagerClient; | 27 class PasswordManagerClient; |
27 class PasswordStore; | 28 class PasswordStore; |
28 struct CredentialInfo; | 29 struct CredentialInfo; |
29 | 30 |
30 class ContentCredentialManagerDispatcher : public CredentialManagerDispatcher, | 31 class ContentCredentialManagerDispatcher : public CredentialManagerDispatcher, |
31 public content::WebContentsObserver, | 32 public content::WebContentsObserver, |
32 public PasswordStoreConsumer { | 33 public PasswordStoreConsumer { |
33 public: | 34 public: |
34 // |client| isn't yet used by this class, but is necessary for the next step: | |
35 // wiring this up as a subclass of PasswordStoreConsumer. | |
36 ContentCredentialManagerDispatcher(content::WebContents* web_contents, | 35 ContentCredentialManagerDispatcher(content::WebContents* web_contents, |
37 PasswordManagerClient* client); | 36 PasswordManagerClient* client); |
38 ~ContentCredentialManagerDispatcher() override; | 37 ~ContentCredentialManagerDispatcher() override; |
39 | 38 |
40 void OnProvisionalSaveComplete(); | 39 void OnProvisionalSaveComplete(); |
41 | 40 |
42 // CredentialManagerDispatcher implementation. | 41 // CredentialManagerDispatcher implementation. |
43 void OnNotifyFailedSignIn(int request_id, | 42 void OnNotifyFailedSignIn(int request_id, |
44 const password_manager::CredentialInfo&) override; | 43 const password_manager::CredentialInfo&) override; |
45 void OnNotifySignedIn(int request_id, | 44 void OnNotifySignedIn(int request_id, |
46 const password_manager::CredentialInfo&) override; | 45 const password_manager::CredentialInfo&) override; |
47 void OnNotifySignedOut(int request_id) override; | 46 void OnNotifySignedOut(int request_id) override; |
48 void OnRequestCredential(int request_id, | 47 void OnRequestCredential(int request_id, |
49 bool zero_click_only, | 48 bool zero_click_only, |
50 const std::vector<GURL>& federations) override; | 49 const std::vector<GURL>& federations) override; |
51 | 50 |
52 // content::WebContentsObserver implementation. | 51 // content::WebContentsObserver implementation. |
53 bool OnMessageReceived(const IPC::Message& message) override; | 52 bool OnMessageReceived(const IPC::Message& message) override; |
54 | 53 |
55 // PasswordStoreConsumer implementation. | 54 // PasswordStoreConsumer implementation. |
56 void OnGetPasswordStoreResults( | 55 void OnGetPasswordStoreResults( |
57 const std::vector<autofill::PasswordForm*>& results) override; | 56 const std::vector<autofill::PasswordForm*>& results) override; |
58 | 57 |
| 58 using CredentialCallback = |
| 59 base::Callback<void(const autofill::PasswordForm&)>; |
| 60 |
59 private: | 61 private: |
60 PasswordStore* GetPasswordStore(); | 62 PasswordStore* GetPasswordStore(); |
61 | 63 |
| 64 void SendCredential(int request_id, const CredentialInfo& info); |
| 65 |
62 PasswordManagerClient* client_; | 66 PasswordManagerClient* client_; |
63 scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; | 67 scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; |
64 | 68 |
65 // When 'OnRequestCredential' is called, it in turn calls out to the | 69 // When 'OnRequestCredential' is called, it in turn calls out to the |
66 // PasswordStore; we store the request ID here in order to properly respond | 70 // PasswordStore; we store the request ID here in order to properly respond |
67 // to the request once the PasswordStore gives us data. | 71 // to the request once the PasswordStore gives us data. |
68 int pending_request_id_; | 72 int pending_request_id_; |
69 | 73 |
70 DISALLOW_COPY_AND_ASSIGN(ContentCredentialManagerDispatcher); | 74 DISALLOW_COPY_AND_ASSIGN(ContentCredentialManagerDispatcher); |
71 }; | 75 }; |
72 | 76 |
73 } // namespace password_manager | 77 } // namespace password_manager |
74 | 78 |
75 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_DISPATCHER_H_ | 79 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_DISPATCHER_H_ |
OLD | NEW |