blob: f46c6f31f95dfaaad32a7819008d4a7faf79b775 (
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
53
54
55
56
57
58
|
// Copyright (c) 2009 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.
#include "chrome/browser/ssl/ssl_client_auth_handler.h"
#include "app/l10n_util.h"
#include "base/string_util.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/chrome_thread.h"
#include "grit/generated_resources.h"
#include "net/url_request/url_request.h"
SSLClientAuthHandler::SSLClientAuthHandler(
URLRequest* request,
net::SSLCertRequestInfo* cert_request_info)
: request_(request),
cert_request_info_(cert_request_info) {
// Keep us alive until a cert is selected.
AddRef();
}
SSLClientAuthHandler::~SSLClientAuthHandler() {
}
void SSLClientAuthHandler::OnRequestCancelled() {
request_ = NULL;
}
void SSLClientAuthHandler::SelectCertificate() {
// Let's move the request to the UI thread.
ChromeThread::PostTask(
ChromeThread::UI, FROM_HERE,
NewRunnableMethod(this, &SSLClientAuthHandler::DoSelectCertificate));
}
// Looking for DoSelectCertificate()?
// It's implemented in a separate source file for each platform.
// Notify the IO thread that we have selected a cert.
void SSLClientAuthHandler::CertificateSelected(net::X509Certificate* cert) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
this, &SSLClientAuthHandler::DoCertificateSelected, cert));
}
void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) {
// request_ could have been NULLed if the request was cancelled while the user
// was choosing a cert.
if (request_)
request_->ContinueWithCertificate(cert);
// We are done.
Release();
}
|