summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/ssl_client_certificate_selector.h
blob: 5f9c1e29773a29d001edaf76257aa2534ce137ee (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
51
52
// Copyright (c) 2012 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 CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_
#define CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_

#include "base/macros.h"
#include "chrome/browser/ssl/ssl_client_auth_observer.h"
#include "chrome/browser/ssl/ssl_client_certificate_selector.h"
#include "chrome/browser/ui/views/certificate_selector.h"

// This header file exists only for testing.  Chrome should access the
// certificate selector only through the cross-platform interface
// chrome/browser/ssl_client_certificate_selector.h.

namespace content {
class WebContents;
}

namespace net {
class SSLCertRequestInfo;
class X509Certificate;
}

class SSLClientCertificateSelector : public chrome::CertificateSelector,
                                     public SSLClientAuthObserver {
 public:
  SSLClientCertificateSelector(
      content::WebContents* web_contents,
      const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
      scoped_ptr<content::ClientCertificateDelegate> delegate);
  ~SSLClientCertificateSelector() override;

  void Init();

  // SSLClientAuthObserver:
  void OnCertSelectedByNotification() override;

  // chrome::CertificateSelector:
  bool Cancel() override;
  bool Accept() override;
  bool Close() override;

 private:
  // Callback after unlocking certificate slot.
  void Unlocked(net::X509Certificate* cert);

  DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector);
};

#endif  // CHROME_BROWSER_UI_VIEWS_SSL_CLIENT_CERTIFICATE_SELECTOR_H_