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

Side by Side Diff: components/password_manager/content/browser/credential_manager_impl.h

Issue 1872133002: Revert of Reland: Switch components/password_manager code from IPC messages to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_I MPL_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_I MPL_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "components/password_manager/content/public/interfaces/credential_manag er.mojom.h"
14 #include "components/password_manager/core/browser/credential_manager_password_f orm_manager.h"
15 #include "components/password_manager/core/browser/credential_manager_pending_re quest_task.h"
16 #include "components/password_manager/core/browser/credential_manager_pending_re quire_user_mediation_task.h"
17 #include "components/password_manager/core/browser/password_store_consumer.h"
18 #include "components/prefs/pref_member.h"
19 #include "content/public/browser/web_contents_observer.h"
20 #include "mojo/public/cpp/bindings/binding_set.h"
21
22 class GURL;
23
24 namespace autofill {
25 struct PasswordForm;
26 }
27
28 namespace content {
29 class WebContents;
30 }
31
32 namespace password_manager {
33 class CredentialManagerPasswordFormManager;
34 class PasswordManagerClient;
35 class PasswordManagerDriver;
36 class PasswordStore;
37 struct CredentialInfo;
38
39 class CredentialManagerImpl
40 : public mojom::CredentialManager,
41 public content::WebContentsObserver,
42 public CredentialManagerPasswordFormManagerDelegate,
43 public CredentialManagerPendingRequestTaskDelegate,
44 public CredentialManagerPendingRequireUserMediationTaskDelegate {
45 public:
46 CredentialManagerImpl(content::WebContents* web_contents,
47 PasswordManagerClient* client);
48 ~CredentialManagerImpl() override;
49
50 void BindRequest(mojom::CredentialManagerRequest request);
51
52 // mojom::CredentialManager methods:
53 void Store(mojom::CredentialInfoPtr credential,
54 const StoreCallback& callback) override;
55 void RequireUserMediation(
56 const RequireUserMediationCallback& callback) override;
57 void Get(bool zero_click_only,
58 bool include_passwords,
59 mojo::Array<mojo::String> federations,
60 const GetCallback& callback) override;
61
62 // CredentialManagerPendingRequestTaskDelegate:
63 bool IsZeroClickAllowed() const override;
64 GURL GetOrigin() const override;
65 void SendCredential(const SendCredentialCallback& send_callback,
66 const CredentialInfo& info) override;
67 void SendPasswordForm(const SendCredentialCallback& send_callback,
68 const autofill::PasswordForm* form) override;
69 PasswordManagerClient* client() const override;
70 autofill::PasswordForm GetSynthesizedFormForOrigin() const override;
71
72 // CredentialManagerPendingSignedOutTaskDelegate:
73 PasswordStore* GetPasswordStore() override;
74 void DoneRequiringUserMediation() override;
75
76 // CredentialManagerPasswordFormManagerDelegate:
77 void OnProvisionalSaveComplete() override;
78
79 private:
80 // Returns the driver for the current main frame.
81 // Virtual for testing.
82 virtual base::WeakPtr<PasswordManagerDriver> GetDriver();
83
84 // Schedules a CredentiaManagerPendingRequestTask (during
85 // |OnRequestCredential()|) after the PasswordStore's AffiliationMatchHelper
86 // grabs a list of realms related to the current web origin.
87 void ScheduleRequestTask(const GetCallback& callback,
88 bool zero_click_only,
89 bool include_passwords,
90 const std::vector<GURL>& federations,
91 const std::vector<std::string>& android_realms);
92
93 // Schedules a CredentialManagerPendingRequireUserMediationTask after the
94 // AffiliationMatchHelper grabs a list of realms related to the current
95 // web origin.
96 void ScheduleRequireMediationTask(
97 const RequireUserMediationCallback& callback,
98 const std::vector<std::string>& android_realms);
99
100 // Returns true iff it's OK to update credentials in the password store.
101 bool IsUpdatingCredentialAllowed() const;
102
103 PasswordManagerClient* client_;
104 std::unique_ptr<CredentialManagerPasswordFormManager> form_manager_;
105
106 // Set to false to disable automatic signing in.
107 BooleanPrefMember auto_signin_enabled_;
108
109 // When 'OnRequestCredential' is called, it in turn calls out to the
110 // PasswordStore; we push enough data into Pending*Task objects so that
111 // they can properly respond to the request once the PasswordStore gives
112 // us data.
113 std::unique_ptr<CredentialManagerPendingRequestTask> pending_request_;
114 std::unique_ptr<CredentialManagerPendingRequireUserMediationTask>
115 pending_require_user_mediation_;
116
117 mojo::BindingSet<mojom::CredentialManager> bindings_;
118
119 base::WeakPtrFactory<CredentialManagerImpl> weak_factory_;
120
121 DISALLOW_COPY_AND_ASSIGN(CredentialManagerImpl);
122 };
123
124 } // namespace password_manager
125
126 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE R_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698