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

Side by Side Diff: components/password_manager/core/browser/credential_manager_pending_request_task.h

Issue 1866643002: Reland: Switch components/password_manager code from IPC messages to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 8 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_REQU EST_TASK_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_REQU EST_TASK_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_REQU EST_TASK_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_REQU EST_TASK_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "components/password_manager/core/browser/password_store_consumer.h" 15 #include "components/password_manager/core/browser/password_store_consumer.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace autofill { 18 namespace autofill {
19 struct PasswordForm; 19 struct PasswordForm;
20 } // namespace autofill 20 } // namespace autofill
21 21
22 namespace password_manager { 22 namespace password_manager {
23 23
24 struct CredentialInfo; 24 struct CredentialInfo;
25 class PasswordManagerClient; 25 class PasswordManagerClient;
26 26
27 typedef base::Callback<void(const CredentialInfo& credential)>
28 SendCredentialCallback;
29
27 // Sends credentials retrieved from the PasswordStore to CredentialManager API 30 // Sends credentials retrieved from the PasswordStore to CredentialManager API
28 // clients and retrieves embedder-dependent information. 31 // clients and retrieves embedder-dependent information.
29 class CredentialManagerPendingRequestTaskDelegate { 32 class CredentialManagerPendingRequestTaskDelegate {
30 public: 33 public:
31 // Determines whether zero-click sign-in is allowed. 34 // Determines whether zero-click sign-in is allowed.
32 virtual bool IsZeroClickAllowed() const = 0; 35 virtual bool IsZeroClickAllowed() const = 0;
33 36
34 // Retrieves the current page origin. 37 // Retrieves the current page origin.
35 virtual GURL GetOrigin() const = 0; 38 virtual GURL GetOrigin() const = 0;
36 39
37 // Retrieves a synthetic PasswordForm for the current page origin. 40 // Retrieves a synthetic PasswordForm for the current page origin.
38 virtual autofill::PasswordForm GetSynthesizedFormForOrigin() const = 0; 41 virtual autofill::PasswordForm GetSynthesizedFormForOrigin() const = 0;
39 42
40 // Returns the PasswordManagerClient. 43 // Returns the PasswordManagerClient.
41 virtual PasswordManagerClient* client() const = 0; 44 virtual PasswordManagerClient* client() const = 0;
42 45
43 // Sends a credential to JavaScript. 46 // Sends a credential to JavaScript.
44 virtual void SendCredential(int id, const CredentialInfo& credential) = 0; 47 virtual void SendCredential(const SendCredentialCallback& send_callback,
48 const CredentialInfo& credential) = 0;
45 49
46 // Updates |skip_zero_click| for |form| in the PasswordStore if required. 50 // Updates |skip_zero_click| for |form| in the PasswordStore if required.
47 // Sends a credential to JavaScript. 51 // Sends a credential to JavaScript.
48 virtual void SendPasswordForm(int id, const autofill::PasswordForm* form) = 0; 52 virtual void SendPasswordForm(const SendCredentialCallback& send_callback,
53 const autofill::PasswordForm* form) = 0;
49 }; 54 };
50 55
51 // Retrieves credentials from the PasswordStore. 56 // Retrieves credentials from the PasswordStore.
52 class CredentialManagerPendingRequestTask : public PasswordStoreConsumer { 57 class CredentialManagerPendingRequestTask : public PasswordStoreConsumer {
53 public: 58 public:
54 CredentialManagerPendingRequestTask( 59 CredentialManagerPendingRequestTask(
55 CredentialManagerPendingRequestTaskDelegate* delegate, 60 CredentialManagerPendingRequestTaskDelegate* delegate,
56 int request_id, 61 const SendCredentialCallback& callback,
57 bool request_zero_click_only, 62 bool request_zero_click_only,
58 const GURL& request_origin, 63 const GURL& request_origin,
59 bool include_passwords, 64 bool include_passwords,
60 const std::vector<GURL>& request_federations, 65 const std::vector<GURL>& request_federations,
61 const std::vector<std::string>& affiliated_realms); 66 const std::vector<std::string>& affiliated_realms);
62 ~CredentialManagerPendingRequestTask() override; 67 ~CredentialManagerPendingRequestTask() override;
63 68
64 int id() const { return id_; } 69 SendCredentialCallback send_callback() const { return send_callback_; }
65 const GURL& origin() const { return origin_; } 70 const GURL& origin() const { return origin_; }
66 71
67 // PasswordStoreConsumer implementation. 72 // PasswordStoreConsumer implementation.
68 void OnGetPasswordStoreResults( 73 void OnGetPasswordStoreResults(
69 ScopedVector<autofill::PasswordForm> results) override; 74 ScopedVector<autofill::PasswordForm> results) override;
70 75
71 private: 76 private:
72 CredentialManagerPendingRequestTaskDelegate* delegate_; // Weak; 77 CredentialManagerPendingRequestTaskDelegate* delegate_; // Weak;
73 const int id_; 78 SendCredentialCallback send_callback_;
74 const bool zero_click_only_; 79 const bool zero_click_only_;
75 const GURL origin_; 80 const GURL origin_;
76 const bool include_passwords_; 81 const bool include_passwords_;
77 std::set<std::string> federations_; 82 std::set<std::string> federations_;
78 std::set<std::string> affiliated_realms_; 83 std::set<std::string> affiliated_realms_;
79 84
80 DISALLOW_COPY_AND_ASSIGN(CredentialManagerPendingRequestTask); 85 DISALLOW_COPY_AND_ASSIGN(CredentialManagerPendingRequestTask);
81 }; 86 };
82 87
83 } // namespace password_manager 88 } // namespace password_manager
84 89
85 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_R EQUEST_TASK_H_ 90 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_R EQUEST_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698