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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 base::ResetAndReturn(&callback_).Run(nullptr); | 36 base::ResetAndReturn(&callback_).Run(nullptr); |
37 } | 37 } |
38 | 38 |
39 void PlatformKeysCertificateSelector::Init() { | 39 void PlatformKeysCertificateSelector::Init() { |
40 const base::string16 name = base::ASCIIToUTF16(extension_name_); | 40 const base::string16 name = base::ASCIIToUTF16(extension_name_); |
41 | 41 |
42 size_t offset; | 42 size_t offset; |
43 const base::string16 text = l10n_util::GetStringFUTF16( | 43 const base::string16 text = l10n_util::GetStringFUTF16( |
44 IDS_PLATFORM_KEYS_SELECT_CERT_DIALOG_TEXT, name, &offset); | 44 IDS_PLATFORM_KEYS_SELECT_CERT_DIALOG_TEXT, name, &offset); |
45 | 45 |
46 scoped_ptr<views::StyledLabel> label( | 46 std::unique_ptr<views::StyledLabel> label( |
47 new views::StyledLabel(text, nullptr /* no listener */)); | 47 new views::StyledLabel(text, nullptr /* no listener */)); |
48 | 48 |
49 views::StyledLabel::RangeStyleInfo bold_style; | 49 views::StyledLabel::RangeStyleInfo bold_style; |
50 bold_style.font_style = gfx::Font::BOLD; | 50 bold_style.font_style = gfx::Font::BOLD; |
51 label->AddStyleRange(gfx::Range(offset, offset + name.size()), bold_style); | 51 label->AddStyleRange(gfx::Range(offset, offset + name.size()), bold_style); |
52 CertificateSelector::InitWithText(std::move(label)); | 52 CertificateSelector::InitWithText(std::move(label)); |
53 } | 53 } |
54 | 54 |
55 bool PlatformKeysCertificateSelector::Cancel() { | 55 bool PlatformKeysCertificateSelector::Cancel() { |
56 DCHECK(!callback_.is_null()); | 56 DCHECK(!callback_.is_null()); |
(...skipping 17 matching lines...) Expand all Loading... |
74 const base::Callback<void(const scoped_refptr<net::X509Certificate>&)>& | 74 const base::Callback<void(const scoped_refptr<net::X509Certificate>&)>& |
75 callback) { | 75 callback) { |
76 PlatformKeysCertificateSelector* selector = | 76 PlatformKeysCertificateSelector* selector = |
77 new PlatformKeysCertificateSelector(certificates, extension_name, | 77 new PlatformKeysCertificateSelector(certificates, extension_name, |
78 callback, web_contents); | 78 callback, web_contents); |
79 selector->Init(); | 79 selector->Init(); |
80 selector->Show(); | 80 selector->Show(); |
81 } | 81 } |
82 | 82 |
83 } // namespace chromeos | 83 } // namespace chromeos |
OLD | NEW |