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

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

Issue 1762603002: Switch components/password_manager code from IPC messages to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add browsertests. Created 4 years, 9 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 50
47 // Retrieves credentials from the PasswordStore. 51 // Retrieves credentials from the PasswordStore.
48 class CredentialManagerPendingRequestTask : public PasswordStoreConsumer { 52 class CredentialManagerPendingRequestTask : public PasswordStoreConsumer {
49 public: 53 public:
50 CredentialManagerPendingRequestTask( 54 CredentialManagerPendingRequestTask(
51 CredentialManagerPendingRequestTaskDelegate* delegate, 55 CredentialManagerPendingRequestTaskDelegate* delegate,
52 int request_id, 56 const SendCredentialCallback& callback,
53 bool request_zero_click_only, 57 bool request_zero_click_only,
54 const GURL& request_origin, 58 const GURL& request_origin,
55 bool include_passwords, 59 bool include_passwords,
56 const std::vector<GURL>& request_federations, 60 const std::vector<GURL>& request_federations,
57 const std::vector<std::string>& affiliated_realms); 61 const std::vector<std::string>& affiliated_realms);
58 ~CredentialManagerPendingRequestTask() override; 62 ~CredentialManagerPendingRequestTask() override;
59 63
60 int id() const { return id_; } 64 SendCredentialCallback send_callback() const { return send_callback_; }
61 const GURL& origin() const { return origin_; } 65 const GURL& origin() const { return origin_; }
62 66
63 // PasswordStoreConsumer implementation. 67 // PasswordStoreConsumer implementation.
64 void OnGetPasswordStoreResults( 68 void OnGetPasswordStoreResults(
65 ScopedVector<autofill::PasswordForm> results) override; 69 ScopedVector<autofill::PasswordForm> results) override;
66 70
67 private: 71 private:
68 CredentialManagerPendingRequestTaskDelegate* delegate_; // Weak; 72 CredentialManagerPendingRequestTaskDelegate* delegate_; // Weak;
69 const int id_; 73 SendCredentialCallback send_callback_;
70 const bool zero_click_only_; 74 const bool zero_click_only_;
71 const GURL origin_; 75 const GURL origin_;
72 const bool include_passwords_; 76 const bool include_passwords_;
73 std::set<std::string> federations_; 77 std::set<std::string> federations_;
74 std::set<std::string> affiliated_realms_; 78 std::set<std::string> affiliated_realms_;
75 79
76 DISALLOW_COPY_AND_ASSIGN(CredentialManagerPendingRequestTask); 80 DISALLOW_COPY_AND_ASSIGN(CredentialManagerPendingRequestTask);
77 }; 81 };
78 82
79 } // namespace password_manager 83 } // namespace password_manager
80 84
81 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_R EQUEST_TASK_H_ 85 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_CREDENTIAL_MANAGER_PENDING_R EQUEST_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698