| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/platform_keys_certificate_selector_chromeos.h" | 5 #include "chrome/browser/ui/views/platform_keys_certificate_selector_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/ui/browser_dialogs.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/gfx/font.h" | 17 #include "ui/gfx/font.h" |
| 17 #include "ui/views/controls/styled_label.h" | 18 #include "ui/views/controls/styled_label.h" |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 PlatformKeysCertificateSelector::PlatformKeysCertificateSelector( | 22 PlatformKeysCertificateSelector::PlatformKeysCertificateSelector( |
| 22 const net::CertificateList& certificates, | 23 const net::CertificateList& certificates, |
| 23 const std::string& extension_name, | 24 const std::string& extension_name, |
| 24 const CertificateSelectedCallback& callback, | 25 const CertificateSelectedCallback& callback, |
| 25 content::WebContents* web_contents) | 26 content::WebContents* web_contents) |
| 26 : CertificateSelector(certificates, web_contents), | 27 : CertificateSelector(certificates, web_contents), |
| 27 extension_name_(extension_name), | 28 extension_name_(extension_name), |
| 28 callback_(callback) { | 29 callback_(callback) { |
| 29 DCHECK(!callback_.is_null()); | 30 DCHECK(!callback_.is_null()); |
| 31 chrome::RecordDialogCreation( |
| 32 chrome::DialogIdentifier::PLATFORM_KEYS_CERTIFICATE_SELECTOR); |
| 30 } | 33 } |
| 31 | 34 |
| 32 PlatformKeysCertificateSelector::~PlatformKeysCertificateSelector() { | 35 PlatformKeysCertificateSelector::~PlatformKeysCertificateSelector() { |
| 33 // Ensure to call back even if the dialog was closed because of the views | 36 // Ensure to call back even if the dialog was closed because of the views |
| 34 // hierarchy being destroyed. | 37 // hierarchy being destroyed. |
| 35 if (!callback_.is_null()) | 38 if (!callback_.is_null()) |
| 36 base::ResetAndReturn(&callback_).Run(nullptr); | 39 base::ResetAndReturn(&callback_).Run(nullptr); |
| 37 } | 40 } |
| 38 | 41 |
| 39 void PlatformKeysCertificateSelector::Init() { | 42 void PlatformKeysCertificateSelector::Init() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const base::Callback<void(const scoped_refptr<net::X509Certificate>&)>& | 77 const base::Callback<void(const scoped_refptr<net::X509Certificate>&)>& |
| 75 callback) { | 78 callback) { |
| 76 PlatformKeysCertificateSelector* selector = | 79 PlatformKeysCertificateSelector* selector = |
| 77 new PlatformKeysCertificateSelector(certificates, extension_name, | 80 new PlatformKeysCertificateSelector(certificates, extension_name, |
| 78 callback, web_contents); | 81 callback, web_contents); |
| 79 selector->Init(); | 82 selector->Init(); |
| 80 selector->Show(); | 83 selector->Show(); |
| 81 } | 84 } |
| 82 | 85 |
| 83 } // namespace chromeos | 86 } // namespace chromeos |
| OLD | NEW |