| 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/certificate_selector.h" | 5 #include "chrome/browser/ui/views/certificate_selector.h" |
| 6 | 6 |
| 7 #include <stddef.h> // For size_t. | 7 #include <stddef.h> // For size_t. |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 void CertificateSelector::Show() { | 170 void CertificateSelector::Show() { |
| 171 constrained_window::ShowWebModalDialogViews(this, web_contents_); | 171 constrained_window::ShowWebModalDialogViews(this, web_contents_); |
| 172 | 172 |
| 173 // Select the first row automatically. This must be done after the dialog has | 173 // Select the first row automatically. This must be done after the dialog has |
| 174 // been created. | 174 // been created. |
| 175 table_->Select(0); | 175 table_->Select(0); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void CertificateSelector::InitWithText(scoped_ptr<views::View> text_label) { | 178 void CertificateSelector::InitWithText( |
| 179 std::unique_ptr<views::View> text_label) { |
| 179 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); | 180 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); |
| 180 SetLayoutManager(layout); | 181 SetLayoutManager(layout); |
| 181 | 182 |
| 182 const int kColumnSetId = 0; | 183 const int kColumnSetId = 0; |
| 183 views::ColumnSet* const column_set = layout->AddColumnSet(kColumnSetId); | 184 views::ColumnSet* const column_set = layout->AddColumnSet(kColumnSetId); |
| 184 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 185 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 185 views::GridLayout::USE_PREF, 0, 0); | 186 views::GridLayout::USE_PREF, 0, 0); |
| 186 | 187 |
| 187 layout->StartRow(0, kColumnSetId); | 188 layout->StartRow(0, kColumnSetId); |
| 188 layout->AddView(text_label.release()); | 189 layout->AddView(text_label.release()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return button != ui::DIALOG_BUTTON_OK || GetSelectedCert() != nullptr; | 230 return button != ui::DIALOG_BUTTON_OK || GetSelectedCert() != nullptr; |
| 230 } | 231 } |
| 231 | 232 |
| 232 views::View* CertificateSelector::GetInitiallyFocusedView() { | 233 views::View* CertificateSelector::GetInitiallyFocusedView() { |
| 233 DCHECK(table_); | 234 DCHECK(table_); |
| 234 return table_; | 235 return table_; |
| 235 } | 236 } |
| 236 | 237 |
| 237 views::View* CertificateSelector::CreateExtraView() { | 238 views::View* CertificateSelector::CreateExtraView() { |
| 238 DCHECK(!view_cert_button_); | 239 DCHECK(!view_cert_button_); |
| 239 scoped_ptr<views::LabelButton> button(new views::LabelButton( | 240 std::unique_ptr<views::LabelButton> button(new views::LabelButton( |
| 240 this, l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); | 241 this, l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); |
| 241 button->SetStyle(views::Button::STYLE_BUTTON); | 242 button->SetStyle(views::Button::STYLE_BUTTON); |
| 242 view_cert_button_ = button.get(); | 243 view_cert_button_ = button.get(); |
| 243 return button.release(); | 244 return button.release(); |
| 244 } | 245 } |
| 245 | 246 |
| 246 ui::ModalType CertificateSelector::GetModalType() const { | 247 ui::ModalType CertificateSelector::GetModalType() const { |
| 247 return ui::MODAL_TYPE_CHILD; | 248 return ui::MODAL_TYPE_CHILD; |
| 248 } | 249 } |
| 249 | 250 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 260 void CertificateSelector::OnSelectionChanged() { | 261 void CertificateSelector::OnSelectionChanged() { |
| 261 GetDialogClientView()->ok_button()->SetEnabled(GetSelectedCert() != nullptr); | 262 GetDialogClientView()->ok_button()->SetEnabled(GetSelectedCert() != nullptr); |
| 262 } | 263 } |
| 263 | 264 |
| 264 void CertificateSelector::OnDoubleClick() { | 265 void CertificateSelector::OnDoubleClick() { |
| 265 if (GetSelectedCert()) | 266 if (GetSelectedCert()) |
| 266 GetDialogClientView()->AcceptWindow(); | 267 GetDialogClientView()->AcceptWindow(); |
| 267 } | 268 } |
| 268 | 269 |
| 269 } // namespace chrome | 270 } // namespace chrome |
| OLD | NEW |