| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signed_certificate_timestamps_views.h" | 5 #include "chrome/browser/ui/views/signed_certificate_timestamps_views.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const net::SignedCertificateTimestampAndStatusList& sct_list) | 72 const net::SignedCertificateTimestampAndStatusList& sct_list) |
| 73 : sct_list_(sct_list) {} | 73 : sct_list_(sct_list) {} |
| 74 | 74 |
| 75 SCTListModel::~SCTListModel() {} | 75 SCTListModel::~SCTListModel() {} |
| 76 | 76 |
| 77 int SCTListModel::GetItemCount() const { return sct_list_.size(); } | 77 int SCTListModel::GetItemCount() const { return sct_list_.size(); } |
| 78 | 78 |
| 79 base::string16 SCTListModel::GetItemAt(int index) { | 79 base::string16 SCTListModel::GetItemAt(int index) { |
| 80 DCHECK_LT(static_cast<size_t>(index), sct_list_.size()); | 80 DCHECK_LT(static_cast<size_t>(index), sct_list_.size()); |
| 81 std::string origin = l10n_util::GetStringUTF8( | 81 std::string origin = l10n_util::GetStringUTF8( |
| 82 chrome::ct::SCTOriginToResourceID(*(sct_list_[index].sct))); | 82 chrome::ct::SCTOriginToResourceID(*(sct_list_[index].sct.get()))); |
| 83 | 83 |
| 84 std::string status = l10n_util::GetStringUTF8( | 84 std::string status = l10n_util::GetStringUTF8( |
| 85 chrome::ct::StatusToResourceID(sct_list_[index].status)); | 85 chrome::ct::StatusToResourceID(sct_list_[index].status)); |
| 86 | 86 |
| 87 // This formatting string may be internationalized for RTL, etc. | 87 // This formatting string may be internationalized for RTL, etc. |
| 88 return l10n_util::GetStringFUTF16(IDS_SCT_CHOOSER_FORMAT, | 88 return l10n_util::GetStringFUTF16(IDS_SCT_CHOOSER_FORMAT, |
| 89 base::IntToString16(index + 1), | 89 base::IntToString16(index + 1), |
| 90 base::UTF8ToUTF16(origin), | 90 base::UTF8ToUTF16(origin), |
| 91 base::UTF8ToUTF16(status)); | 91 base::UTF8ToUTF16(status)); |
| 92 } | 92 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 sct_selector_box_->set_listener(this); | 145 sct_selector_box_->set_listener(this); |
| 146 sct_selector_box_->set_owned_by_client(); | 146 sct_selector_box_->set_owned_by_client(); |
| 147 layout->AddView(sct_selector_box_.get()); | 147 layout->AddView(sct_selector_box_.get()); |
| 148 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 148 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 149 | 149 |
| 150 // Add the SCT info view, displaying information about a specific SCT. | 150 // Add the SCT info view, displaying information about a specific SCT. |
| 151 layout->StartRow(0, kSelectorBoxLayoutId); | 151 layout->StartRow(0, kSelectorBoxLayoutId); |
| 152 sct_info_view_ = new SignedCertificateTimestampInfoView(); | 152 sct_info_view_ = new SignedCertificateTimestampInfoView(); |
| 153 layout->AddView(sct_info_view_); | 153 layout->AddView(sct_info_view_); |
| 154 | 154 |
| 155 sct_info_view_->SetSignedCertificateTimestamp(*(sct_list_[0].sct), | 155 sct_info_view_->SetSignedCertificateTimestamp(*(sct_list_[0].sct.get()), |
| 156 sct_list_[0].status); | 156 sct_list_[0].status); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SignedCertificateTimestampsViews::ShowSCTInfo(int sct_index) { | 159 void SignedCertificateTimestampsViews::ShowSCTInfo(int sct_index) { |
| 160 if ((sct_index < 0) || (static_cast<size_t>(sct_index) > sct_list_.size())) | 160 if ((sct_index < 0) || (static_cast<size_t>(sct_index) > sct_list_.size())) |
| 161 return; | 161 return; |
| 162 | 162 |
| 163 sct_info_view_->SetSignedCertificateTimestamp(*(sct_list_[sct_index].sct), | 163 sct_info_view_->SetSignedCertificateTimestamp( |
| 164 sct_list_[sct_index].status); | 164 *(sct_list_[sct_index].sct.get()), sct_list_[sct_index].status); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void SignedCertificateTimestampsViews::Observe( | 167 void SignedCertificateTimestampsViews::Observe( |
| 168 int type, | 168 int type, |
| 169 const content::NotificationSource& source, | 169 const content::NotificationSource& source, |
| 170 const content::NotificationDetails& details) { | 170 const content::NotificationDetails& details) { |
| 171 GetWidget()->Close(); | 171 GetWidget()->Close(); |
| 172 } | 172 } |
| OLD | NEW |