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 "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 namespace password_manager { | 25 namespace password_manager { |
26 | 26 |
27 class CredentialManagerPasswordFormManager; | 27 class CredentialManagerPasswordFormManager; |
28 class PasswordManagerClient; | 28 class PasswordManagerClient; |
29 class PasswordManagerDriver; | 29 class PasswordManagerDriver; |
30 class PasswordStore; | 30 class PasswordStore; |
31 struct CredentialInfo; | 31 struct CredentialInfo; |
32 | 32 |
33 class CredentialManagerDispatcher : public content::WebContentsObserver, | 33 class CredentialManagerDispatcher : public content::WebContentsObserver { |
34 public PasswordStoreConsumer { | |
35 public: | 34 public: |
36 CredentialManagerDispatcher(content::WebContents* web_contents, | 35 CredentialManagerDispatcher(content::WebContents* web_contents, |
37 PasswordManagerClient* client); | 36 PasswordManagerClient* client); |
38 ~CredentialManagerDispatcher() override; | 37 ~CredentialManagerDispatcher() override; |
39 | 38 |
40 void OnProvisionalSaveComplete(); | 39 void OnProvisionalSaveComplete(); |
41 | 40 |
42 // Called in response to an IPC from the renderer, triggered by a page's call | 41 // Called in response to an IPC from the renderer, triggered by a page's call |
43 // to 'navigator.credentials.notifyFailedSignIn'. | 42 // to 'navigator.credentials.notifyFailedSignIn'. |
44 virtual void OnNotifyFailedSignIn(int request_id, | 43 virtual void OnNotifyFailedSignIn(int request_id, |
(...skipping 10 matching lines...) Expand all Loading... |
55 | 54 |
56 // Called in response to an IPC from the renderer, triggered by a page's call | 55 // Called in response to an IPC from the renderer, triggered by a page's call |
57 // to 'navigator.credentials.request'. | 56 // to 'navigator.credentials.request'. |
58 virtual void OnRequestCredential(int request_id, | 57 virtual void OnRequestCredential(int request_id, |
59 bool zero_click_only, | 58 bool zero_click_only, |
60 const std::vector<GURL>& federations); | 59 const std::vector<GURL>& federations); |
61 | 60 |
62 // content::WebContentsObserver implementation. | 61 // content::WebContentsObserver implementation. |
63 bool OnMessageReceived(const IPC::Message& message) override; | 62 bool OnMessageReceived(const IPC::Message& message) override; |
64 | 63 |
65 // PasswordStoreConsumer implementation. | |
66 void OnGetPasswordStoreResults( | |
67 const std::vector<autofill::PasswordForm*>& results) override; | |
68 | |
69 using CredentialCallback = | 64 using CredentialCallback = |
70 base::Callback<void(const autofill::PasswordForm&)>; | 65 base::Callback<void(const autofill::PasswordForm&)>; |
71 | 66 |
| 67 PasswordManagerClient* client() const { return client_; } |
| 68 |
72 private: | 69 private: |
73 struct PendingRequestParameters; | 70 class PendingRequestTask; |
74 | 71 |
75 PasswordStore* GetPasswordStore(); | 72 PasswordStore* GetPasswordStore(); |
76 | 73 |
77 bool IsSavingEnabledForCurrentPage() const; | 74 bool IsSavingEnabledForCurrentPage() const; |
78 bool IsZeroClickAllowed() const; | 75 bool IsZeroClickAllowed() const; |
79 | 76 |
80 // Returns the driver for the current main frame. | 77 // Returns the driver for the current main frame. |
81 // Virtual for testing. | 78 // Virtual for testing. |
82 virtual base::WeakPtr<PasswordManagerDriver> GetDriver(); | 79 virtual base::WeakPtr<PasswordManagerDriver> GetDriver(); |
83 | 80 |
84 void SendCredential(int request_id, const CredentialInfo& info); | 81 void SendCredential(int request_id, const CredentialInfo& info); |
85 | 82 |
86 PasswordManagerClient* client_; | 83 PasswordManagerClient* client_; |
87 scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; | 84 scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; |
88 | 85 |
89 // When 'OnRequestCredential' is called, it in turn calls out to the | 86 // When 'OnRequestCredential' is called, it in turn calls out to the |
90 // PasswordStore; we store request details here in order to properly | 87 // PasswordStore; we push enough data into Pending*Task objects so that |
91 // respond to the request once the PasswordStore gives us data. | 88 // they can properly respond to the request once the PasswordStore gives |
92 scoped_ptr<PendingRequestParameters> pending_request_; | 89 // us data. |
| 90 scoped_ptr<PendingRequestTask> pending_request_; |
93 | 91 |
94 DISALLOW_COPY_AND_ASSIGN(CredentialManagerDispatcher); | 92 DISALLOW_COPY_AND_ASSIGN(CredentialManagerDispatcher); |
95 }; | 93 }; |
96 | 94 |
97 } // namespace password_manager | 95 } // namespace password_manager |
98 | 96 |
99 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_DISPATCHER_H_ | 97 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_DISPATCHER_H_ |
OLD | NEW |