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/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/password_manager/core/browser/credential_manager_dispatcher
.h" | 10 #include "components/password_manager/core/browser/credential_manager_dispatcher
.h" |
11 #include "components/password_manager/core/browser/password_store_consumer.h" | 11 #include "components/password_manager/core/browser/password_store_consumer.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 struct PasswordForm; | 17 struct PasswordForm; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class WebContents; | 21 class WebContents; |
22 } | 22 } |
23 | 23 |
24 namespace password_manager { | 24 namespace password_manager { |
25 | 25 |
26 class CredentialManagerPasswordFormManager; | 26 class CredentialManagerPasswordFormManager; |
27 class PasswordManagerClient; | 27 class PasswordManagerClient; |
| 28 class PasswordManagerDriver; |
28 class PasswordStore; | 29 class PasswordStore; |
29 struct CredentialInfo; | 30 struct CredentialInfo; |
30 | 31 |
31 class ContentCredentialManagerDispatcher : public CredentialManagerDispatcher, | 32 class ContentCredentialManagerDispatcher : public CredentialManagerDispatcher, |
32 public content::WebContentsObserver, | 33 public content::WebContentsObserver, |
33 public PasswordStoreConsumer { | 34 public PasswordStoreConsumer { |
34 public: | 35 public: |
35 ContentCredentialManagerDispatcher(content::WebContents* web_contents, | 36 ContentCredentialManagerDispatcher(content::WebContents* web_contents, |
36 PasswordManagerClient* client); | 37 PasswordManagerClient* client); |
37 ~ContentCredentialManagerDispatcher() override; | 38 ~ContentCredentialManagerDispatcher() override; |
(...skipping 10 matching lines...) Expand all Loading... |
48 bool zero_click_only, | 49 bool zero_click_only, |
49 const std::vector<GURL>& federations) override; | 50 const std::vector<GURL>& federations) override; |
50 | 51 |
51 // content::WebContentsObserver implementation. | 52 // content::WebContentsObserver implementation. |
52 bool OnMessageReceived(const IPC::Message& message) override; | 53 bool OnMessageReceived(const IPC::Message& message) override; |
53 | 54 |
54 // PasswordStoreConsumer implementation. | 55 // PasswordStoreConsumer implementation. |
55 void OnGetPasswordStoreResults( | 56 void OnGetPasswordStoreResults( |
56 const std::vector<autofill::PasswordForm*>& results) override; | 57 const std::vector<autofill::PasswordForm*>& results) override; |
57 | 58 |
| 59 // For testing only. |
| 60 void set_password_manager_driver(PasswordManagerDriver* driver) { |
| 61 driver_ = driver; |
| 62 } |
| 63 |
58 using CredentialCallback = | 64 using CredentialCallback = |
59 base::Callback<void(const autofill::PasswordForm&)>; | 65 base::Callback<void(const autofill::PasswordForm&)>; |
60 | 66 |
61 private: | 67 private: |
62 PasswordStore* GetPasswordStore(); | 68 PasswordStore* GetPasswordStore(); |
63 | 69 |
64 void SendCredential(int request_id, const CredentialInfo& info); | 70 void SendCredential(int request_id, const CredentialInfo& info); |
65 | 71 |
66 PasswordManagerClient* client_; | 72 PasswordManagerClient* client_; |
| 73 PasswordManagerDriver* driver_; |
67 scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; | 74 scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; |
68 | 75 |
69 // When 'OnRequestCredential' is called, it in turn calls out to the | 76 // When 'OnRequestCredential' is called, it in turn calls out to the |
70 // PasswordStore; we store the request ID here in order to properly respond | 77 // PasswordStore; we store the request ID here in order to properly respond |
71 // to the request once the PasswordStore gives us data. | 78 // to the request once the PasswordStore gives us data. |
72 int pending_request_id_; | 79 int pending_request_id_; |
73 | 80 |
74 DISALLOW_COPY_AND_ASSIGN(ContentCredentialManagerDispatcher); | 81 DISALLOW_COPY_AND_ASSIGN(ContentCredentialManagerDispatcher); |
75 }; | 82 }; |
76 | 83 |
77 } // namespace password_manager | 84 } // namespace password_manager |
78 | 85 |
79 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_DISPATCHER_H_ | 86 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_DISPATCHER_H_ |
OLD | NEW |