Chromium Code Reviews| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // GetTopLevelWebContents returns |web_contents| if it is not a guest. | 171 // GetTopLevelWebContents returns |web_contents| if it is not a guest. |
| 172 content::WebContents* top_level_web_contents = | 172 content::WebContents* top_level_web_contents = |
| 173 guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); | 173 guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); |
| 174 return web_modal::WebContentsModalDialogManager::FromWebContents( | 174 return web_modal::WebContentsModalDialogManager::FromWebContents( |
| 175 top_level_web_contents) != nullptr; | 175 top_level_web_contents) != nullptr; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void CertificateSelector::Show() { | 178 void CertificateSelector::Show() { |
| 179 constrained_window::ShowWebModalDialogViews(this, web_contents_); | 179 constrained_window::ShowWebModalDialogViews(this, web_contents_); |
| 180 | 180 |
| 181 // TODO(isandrk): A certificate that was previously provided by *both* the | |
|
msw
2016/08/29 17:08:29
What exactly is the TODO here? Will you try to fix
Ivan Šandrk
2016/08/30 14:23:22
So this is just a quick fix for the crash, the act
| |
| 182 // platform and an extension will get incorrectly filtered out if the | |
| 183 // extension stops providing it (both instances will be filtered out), hence | |
| 184 // the certificates_ array will be empty. Displaying a dialog with an empty | |
|
msw
2016/08/29 17:08:29
nit: |certificates_|
Ivan Šandrk
2016/08/30 14:23:22
Done.
| |
| 185 // list won't make much sense for the user, and also there are some CHECKs in | |
| 186 // the code that will fail when the list is empty and that's why an early exit | |
| 187 // is performed here. See crbug.com/641440 for more details. | |
|
msw
2016/08/29 17:08:29
nit: fix indent.
Ivan Šandrk
2016/08/30 14:23:23
Done.
| |
| 188 if (certificates_.empty()) { | |
| 189 GetWidget()->Close(); | |
|
msw
2016/08/29 17:08:28
How is this dialog triggered? If the user clicks a
Ivan Šandrk
2016/08/30 14:23:22
Chrome network stack requests the dialog to be ope
| |
| 190 return; | |
| 191 } | |
| 192 | |
| 181 // Select the first row automatically. This must be done after the dialog has | 193 // Select the first row automatically. This must be done after the dialog has |
| 182 // been created. | 194 // been created. |
| 183 table_->Select(0); | 195 table_->Select(0); |
| 184 } | 196 } |
| 185 | 197 |
| 186 void CertificateSelector::InitWithText( | 198 void CertificateSelector::InitWithText( |
| 187 std::unique_ptr<views::View> text_label) { | 199 std::unique_ptr<views::View> text_label) { |
| 188 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); | 200 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); |
| 189 SetLayoutManager(layout); | 201 SetLayoutManager(layout); |
| 190 | 202 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 void CertificateSelector::OnSelectionChanged() { | 285 void CertificateSelector::OnSelectionChanged() { |
| 274 GetDialogClientView()->ok_button()->SetEnabled(GetSelectedCert() != nullptr); | 286 GetDialogClientView()->ok_button()->SetEnabled(GetSelectedCert() != nullptr); |
| 275 } | 287 } |
| 276 | 288 |
| 277 void CertificateSelector::OnDoubleClick() { | 289 void CertificateSelector::OnDoubleClick() { |
| 278 if (GetSelectedCert()) | 290 if (GetSelectedCert()) |
| 279 GetDialogClientView()->AcceptWindow(); | 291 GetDialogClientView()->AcceptWindow(); |
| 280 } | 292 } |
| 281 | 293 |
| 282 } // namespace chrome | 294 } // namespace chrome |
| OLD | NEW |