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/ui/crypto_module_password_dialog.h" | 5 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "crypto/crypto_module_blocking_password_delegate.h" | 13 #include "crypto/crypto_module_blocking_password_delegate.h" |
14 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
15 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "ui/base/gtk/gtk_hig_constants.h" | |
19 #include "ui/base/gtk/gtk_signal.h" | 18 #include "ui/base/gtk/gtk_signal.h" |
20 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 class CryptoModuleBlockingDialogDelegate | 23 class CryptoModuleBlockingDialogDelegate |
25 : public crypto::CryptoModuleBlockingPasswordDelegate { | 24 : public crypto::CryptoModuleBlockingPasswordDelegate { |
26 public: | 25 public: |
27 CryptoModuleBlockingDialogDelegate(browser::CryptoModulePasswordReason reason, | 26 CryptoModuleBlockingDialogDelegate(browser::CryptoModulePasswordReason reason, |
28 const std::string& server) | 27 const std::string& server) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 GtkWidget* label = gtk_label_new(text.c_str()); | 160 GtkWidget* label = gtk_label_new(text.c_str()); |
162 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 161 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
163 gtk_util::LeftAlignMisc(label); | 162 gtk_util::LeftAlignMisc(label); |
164 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), label, | 163 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), label, |
165 FALSE, FALSE, 0); | 164 FALSE, FALSE, 0); |
166 | 165 |
167 password_entry_ = gtk_entry_new(); | 166 password_entry_ = gtk_entry_new(); |
168 gtk_entry_set_activates_default(GTK_ENTRY(password_entry_), TRUE); | 167 gtk_entry_set_activates_default(GTK_ENTRY(password_entry_), TRUE); |
169 gtk_entry_set_visibility(GTK_ENTRY(password_entry_), FALSE); | 168 gtk_entry_set_visibility(GTK_ENTRY(password_entry_), FALSE); |
170 | 169 |
171 GtkWidget* password_box = gtk_hbox_new(FALSE, ui::kLabelSpacing); | 170 GtkWidget* password_box = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing); |
172 gtk_box_pack_start(GTK_BOX(password_box), | 171 gtk_box_pack_start(GTK_BOX(password_box), |
173 gtk_label_new(l10n_util::GetStringUTF8( | 172 gtk_label_new(l10n_util::GetStringUTF8( |
174 IDS_CRYPTO_MODULE_AUTH_DIALOG_PASSWORD_FIELD).c_str()), | 173 IDS_CRYPTO_MODULE_AUTH_DIALOG_PASSWORD_FIELD).c_str()), |
175 FALSE, FALSE, 0); | 174 FALSE, FALSE, 0); |
176 gtk_box_pack_start(GTK_BOX(password_box), password_entry_, | 175 gtk_box_pack_start(GTK_BOX(password_box), password_entry_, |
177 TRUE, TRUE, 0); | 176 TRUE, TRUE, 0); |
178 | 177 |
179 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), password_box, | 178 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), password_box, |
180 FALSE, FALSE, 0); | 179 FALSE, FALSE, 0); |
181 | 180 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 223 } |
225 | 224 |
226 crypto::CryptoModuleBlockingPasswordDelegate* | 225 crypto::CryptoModuleBlockingPasswordDelegate* |
227 NewCryptoModuleBlockingDialogDelegate( | 226 NewCryptoModuleBlockingDialogDelegate( |
228 CryptoModulePasswordReason reason, | 227 CryptoModulePasswordReason reason, |
229 const std::string& server) { | 228 const std::string& server) { |
230 return new CryptoModuleBlockingDialogDelegate(reason, server); | 229 return new CryptoModuleBlockingDialogDelegate(reason, server); |
231 } | 230 } |
232 | 231 |
233 } // namespace browser | 232 } // namespace browser |
OLD | NEW |