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

Side by Side Diff: chrome/browser/ui/views/platform_keys_certificate_selector_chromeos.cc

Issue 927293002: platformKeys: Hook up the certificate selection dialog to selectClientCertificates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_perms
Patch Set: Created 5 years, 10 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 2015 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 #include "chrome/browser/ui/views/platform_keys_certificate_selector_chromeos.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/platform_keys_certificate_selector.h"
9 #include "chrome/grit/generated_resources.h"
10 #include "net/cert/x509_certificate.h"
11 #include "ui/base/l10n/l10n_util.h"
12
13 namespace chromeos {
14
15 PlatformKeysCertificateSelector::PlatformKeysCertificateSelector(
16 const net::CertificateList& certificates,
17 const std::string& extension_name,
18 const CertificateSelectedCallback& callback,
19 content::WebContents* web_contents)
20 : CertificateSelector(certificates, web_contents),
21 extension_name_(extension_name),
22 callback_(callback) {
23 }
24
25 PlatformKeysCertificateSelector::~PlatformKeysCertificateSelector() {
26 }
27
28 void PlatformKeysCertificateSelector::Init() {
29 const base::string16 text =
bartfab (slow) 2015/02/19 18:55:42 Nit: #include "base/strings/string16.h"
pneubeck (no reviews) 2015/02/19 21:51:41 Done.
30 l10n_util::GetStringFUTF16(IDS_PLATFORM_KEYS_SELECT_CERT_DIALOG_TEXT,
31 base::ASCIIToUTF16(extension_name_));
32 CertificateSelector::Init(text);
33 }
34
35 bool PlatformKeysCertificateSelector::Cancel() {
36 callback_.Run(nullptr);
37 return true;
38 }
39
40 bool PlatformKeysCertificateSelector::Accept() {
41 scoped_refptr<net::X509Certificate> cert = GetSelectedCert();
42 if (!cert.get())
bartfab (slow) 2015/02/19 18:55:42 Nit: Are scoped-refptrs not testable, i.e. |if(!ce
pneubeck (no reviews) 2015/02/19 21:51:41 Done.
43 return false;
44 callback_.Run(cert);
45 return true;
46 }
47
48 void ShowPlatformKeysCertificateSelector(
49 content::WebContents* web_contents,
50 const std::string& extension_name,
51 const net::CertificateList& certificates,
52 const base::Callback<void(const scoped_refptr<net::X509Certificate>&)>&
53 callback) {
54 (new PlatformKeysCertificateSelector(certificates, extension_name, callback,
55 web_contents))->Init();
56 }
57
58 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698