summaryrefslogtreecommitdiff
path: root/chromium/components/password_manager/content/browser/content_credential_manager.h
blob: 1c048683c9cb1483d32ab31a448baf22b31658c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_H_
#define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_H_

#include "components/password_manager/core/browser/credential_manager_impl.h"
#include "components/password_manager/core/common/credential_manager_types.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "third_party/blink/public/platform/modules/credentialmanager/credential_manager.mojom.h"

class GURL;

namespace password_manager {
class PasswordManagerClient;
struct CredentialInfo;

// Implements blink::mojom::CredentialManager using core class
// CredentialManagerImpl. Methods Store, PreventSilentAccess and Get are invoked
// from the renderer with callbacks as arguments. PasswordManagerClient is used
// to invoke UI.
class ContentCredentialManager : public blink::mojom::CredentialManager {
 public:
  explicit ContentCredentialManager(PasswordManagerClient* client);
  ~ContentCredentialManager() override;

  void BindRequest(blink::mojom::CredentialManagerRequest request);
  bool HasBinding() const;
  void DisconnectBinding();

  // blink::mojom::CredentialManager methods:
  void Store(const CredentialInfo& credential, StoreCallback callback) override;
  void PreventSilentAccess(PreventSilentAccessCallback callback) override;
  void Get(CredentialMediationRequirement mediation,
           bool include_passwords,
           const std::vector<GURL>& federations,
           GetCallback callback) override;

 private:
  CredentialManagerImpl impl_;

  mojo::Binding<blink::mojom::CredentialManager> binding_;

  DISALLOW_COPY_AND_ASSIGN(ContentCredentialManager);
};

}  // namespace password_manager

#endif  // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_H_