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.
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_DISPATCHER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_DISPATCHER_H_
8 #include "base/macros.h"
9 #include "components/password_manager/core/browser/credential_manager_dispatcher.h"
10 #include "components/password_manager/core/browser/password_store_consumer.h"
11 #include "content/public/browser/web_contents_observer.h"
23 namespace password_manager
{
25 class CredentialManagerPasswordFormManager
;
26 class PasswordManagerClient
;
28 struct CredentialInfo
;
30 class ContentCredentialManagerDispatcher
: public CredentialManagerDispatcher
,
31 public content::WebContentsObserver
,
32 public PasswordStoreConsumer
{
34 // |client| isn't yet used by this class, but is necessary for the next step:
35 // wiring this up as a subclass of PasswordStoreConsumer.
36 ContentCredentialManagerDispatcher(content::WebContents
* web_contents
,
37 PasswordManagerClient
* client
);
38 ~ContentCredentialManagerDispatcher() override
;
40 void OnProvisionalSaveComplete();
42 // CredentialManagerDispatcher implementation.
43 void OnNotifyFailedSignIn(int request_id
,
44 const password_manager::CredentialInfo
&) override
;
45 void OnNotifySignedIn(int request_id
,
46 const password_manager::CredentialInfo
&) override
;
47 void OnNotifySignedOut(int request_id
) override
;
48 void OnRequestCredential(int request_id
,
50 const std::vector
<GURL
>& federations
) override
;
52 // content::WebContentsObserver implementation.
53 bool OnMessageReceived(const IPC::Message
& message
) override
;
55 // PasswordStoreConsumer implementation.
56 void OnGetPasswordStoreResults(
57 const std::vector
<autofill::PasswordForm
*>& results
) override
;
60 PasswordStore
* GetPasswordStore();
62 PasswordManagerClient
* client_
;
63 scoped_ptr
<CredentialManagerPasswordFormManager
> form_manager_
;
65 // When 'OnRequestCredential' is called, it in turn calls out to the
66 // PasswordStore; we store the request ID here in order to properly respond
67 // to the request once the PasswordStore gives us data.
68 int pending_request_id_
;
70 DISALLOW_COPY_AND_ASSIGN(ContentCredentialManagerDispatcher
);
73 } // namespace password_manager
75 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_DISPATCHER_H_