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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 web_contents_(web_contents), | 80 web_contents_(web_contents), |
81 table_(nullptr), | 81 table_(nullptr), |
82 view_cert_button_(nullptr) { | 82 view_cert_button_(nullptr) { |
83 CHECK(web_contents_); | 83 CHECK(web_contents_); |
84 } | 84 } |
85 | 85 |
86 CertificateSelector::~CertificateSelector() { | 86 CertificateSelector::~CertificateSelector() { |
87 table_->SetModel(nullptr); | 87 table_->SetModel(nullptr); |
88 } | 88 } |
89 | 89 |
90 // Static. | |
91 bool CertificateSelector::CanShow(content::WebContents* web_contents) { | |
92 return constrained_window::HasTopLevelDialogManager(web_contents); | |
jochen (gone - plz use gerrit)
2015/07/15 13:34:01
not sure I understand why you can't inline this he
wjmaclean
2015/07/15 13:59:58
I guess we can. The first time I read through the
| |
93 } | |
94 | |
90 void CertificateSelector::Show() { | 95 void CertificateSelector::Show() { |
91 constrained_window::ShowWebModalDialogViews(this, web_contents_); | 96 constrained_window::ShowWebModalDialogViews(this, web_contents_); |
92 | 97 |
93 // Select the first row automatically. This must be done after the dialog has | 98 // Select the first row automatically. This must be done after the dialog has |
94 // been created. | 99 // been created. |
95 table_->Select(0); | 100 table_->Select(0); |
96 } | 101 } |
97 | 102 |
98 void CertificateSelector::InitWithText(scoped_ptr<views::View> text_label) { | 103 void CertificateSelector::InitWithText(scoped_ptr<views::View> text_label) { |
99 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); | 104 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 void CertificateSelector::OnSelectionChanged() { | 178 void CertificateSelector::OnSelectionChanged() { |
174 GetDialogClientView()->ok_button()->SetEnabled(GetSelectedCert() != nullptr); | 179 GetDialogClientView()->ok_button()->SetEnabled(GetSelectedCert() != nullptr); |
175 } | 180 } |
176 | 181 |
177 void CertificateSelector::OnDoubleClick() { | 182 void CertificateSelector::OnDoubleClick() { |
178 if (GetSelectedCert()) | 183 if (GetSelectedCert()) |
179 GetDialogClientView()->AcceptWindow(); | 184 GetDialogClientView()->AcceptWindow(); |
180 } | 185 } |
181 | 186 |
182 } // namespace chrome | 187 } // namespace chrome |
OLD | NEW |