OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ssl_client_certificate_selector.h" | 5 #include "chrome/browser/ssl_client_certificate_selector.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/certificate_viewer.h" | 16 #include "chrome/browser/certificate_viewer.h" |
17 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 17 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
18 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 18 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
19 #include "chrome/browser/ui/gtk/gtk_util.h" | 19 #include "chrome/browser/ui/gtk/gtk_util.h" |
20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
21 #include "chrome/common/net/x509_certificate_model.h" | 21 #include "chrome/common/net/x509_certificate_model.h" |
22 #include "content/browser/ssl/ssl_client_auth_handler.h" | 22 #include "content/browser/ssl/ssl_client_auth_handler.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 23 #include "content/browser/tab_contents/tab_contents.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
26 #include "net/base/x509_certificate.h" | 26 #include "net/base/x509_certificate.h" |
| 27 #include "ui/base/gtk/gtk_compat.h" |
27 #include "ui/base/gtk/gtk_hig_constants.h" | 28 #include "ui/base/gtk/gtk_hig_constants.h" |
28 #include "ui/base/gtk/gtk_signal.h" | 29 #include "ui/base/gtk/gtk_signal.h" |
29 #include "ui/base/gtk/owned_widget_gtk.h" | 30 #include "ui/base/gtk/owned_widget_gtk.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
32 | 33 |
33 using content::BrowserThread; | 34 using content::BrowserThread; |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 cert, | 377 cert, |
377 browser::kCryptoModulePasswordClientAuth, | 378 browser::kCryptoModulePasswordClientAuth, |
378 cert_request_info_->host_and_port, | 379 cert_request_info_->host_and_port, |
379 base::Bind(&SSLClientCertificateSelector::Unlocked, | 380 base::Bind(&SSLClientCertificateSelector::Unlocked, |
380 base::Unretained(this))); | 381 base::Unretained(this))); |
381 } | 382 } |
382 | 383 |
383 void SSLClientCertificateSelector::OnPromptShown(GtkWidget* widget, | 384 void SSLClientCertificateSelector::OnPromptShown(GtkWidget* widget, |
384 GtkWidget* previous_toplevel) { | 385 GtkWidget* previous_toplevel) { |
385 if (!root_widget_.get() || | 386 if (!root_widget_.get() || |
386 !GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(root_widget_.get()))) | 387 !gtk_widget_is_toplevel(gtk_widget_get_toplevel(root_widget_.get()))) |
387 return; | 388 return; |
388 gtk_widget_set_can_default(select_button_, TRUE); | 389 gtk_widget_set_can_default(select_button_, TRUE); |
389 gtk_widget_grab_default(select_button_); | 390 gtk_widget_grab_default(select_button_); |
390 } | 391 } |
391 | 392 |
392 } // namespace | 393 } // namespace |
393 | 394 |
394 /////////////////////////////////////////////////////////////////////////////// | 395 /////////////////////////////////////////////////////////////////////////////// |
395 // SSLClientAuthHandler platform specific implementation: | 396 // SSLClientAuthHandler platform specific implementation: |
396 | 397 |
397 namespace browser { | 398 namespace browser { |
398 | 399 |
399 void ShowNativeSSLClientCertificateSelector( | 400 void ShowNativeSSLClientCertificateSelector( |
400 TabContentsWrapper* wrapper, | 401 TabContentsWrapper* wrapper, |
401 net::SSLCertRequestInfo* cert_request_info, | 402 net::SSLCertRequestInfo* cert_request_info, |
402 SSLClientAuthHandler* delegate) { | 403 SSLClientAuthHandler* delegate) { |
403 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
404 (new SSLClientCertificateSelector(wrapper, | 405 (new SSLClientCertificateSelector(wrapper, |
405 cert_request_info, | 406 cert_request_info, |
406 delegate))->Show(); | 407 delegate))->Show(); |
407 } | 408 } |
408 | 409 |
409 } // namespace browser | 410 } // namespace browser |
OLD | NEW |