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/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/password_manager/password_manager.h" | 10 #include "chrome/browser/password_manager/password_manager.h" |
11 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" | 11 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
12 #include "chrome/browser/tab_contents/tab_util.h" | 12 #include "chrome/browser/tab_contents/tab_util.h" |
13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
14 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
15 #include "chrome/browser/ui/login/login_model.h" | 15 #include "chrome/browser/ui/login/login_model.h" |
16 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
17 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 17 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
18 #include "content/browser/tab_contents/navigation_controller.h" | 18 #include "content/browser/tab_contents/navigation_controller.h" |
19 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
20 #include "content/browser/tab_contents/tab_contents_delegate.h" | 20 #include "content/browser/tab_contents/tab_contents_delegate.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
| 23 #include "ui/base/gtk/gtk_hig_constants.h" |
23 #include "ui/base/gtk/gtk_signal.h" | 24 #include "ui/base/gtk/gtk_signal.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
25 | 26 |
26 using webkit_glue::PasswordForm; | 27 using webkit_glue::PasswordForm; |
27 | 28 |
28 // ---------------------------------------------------------------------------- | 29 // ---------------------------------------------------------------------------- |
29 // LoginHandlerGtk | 30 // LoginHandlerGtk |
30 | 31 |
31 // This class simply forwards the authentication from the LoginView (on | 32 // This class simply forwards the authentication from the LoginView (on |
32 // the UI thread) to the net::URLRequest (on the I/O thread). | 33 // the UI thread) to the net::URLRequest (on the I/O thread). |
(...skipping 27 matching lines...) Expand all Loading... |
60 WideToUTF8(password).c_str()); | 61 WideToUTF8(password).c_str()); |
61 gtk_editable_select_region(GTK_EDITABLE(username_entry_), 0, -1); | 62 gtk_editable_select_region(GTK_EDITABLE(username_entry_), 0, -1); |
62 } | 63 } |
63 } | 64 } |
64 | 65 |
65 // LoginHandler: | 66 // LoginHandler: |
66 virtual void BuildViewForPasswordManager(PasswordManager* manager, | 67 virtual void BuildViewForPasswordManager(PasswordManager* manager, |
67 const string16& explanation) { | 68 const string16& explanation) { |
68 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
69 | 70 |
70 root_.Own(gtk_vbox_new(FALSE, gtk_util::kContentAreaBorder)); | 71 root_.Own(gtk_vbox_new(FALSE, ui::kContentAreaBorder)); |
71 GtkWidget* label = gtk_label_new(UTF16ToUTF8(explanation).c_str()); | 72 GtkWidget* label = gtk_label_new(UTF16ToUTF8(explanation).c_str()); |
72 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | 73 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
73 gtk_box_pack_start(GTK_BOX(root_.get()), label, FALSE, FALSE, 0); | 74 gtk_box_pack_start(GTK_BOX(root_.get()), label, FALSE, FALSE, 0); |
74 | 75 |
75 username_entry_ = gtk_entry_new(); | 76 username_entry_ = gtk_entry_new(); |
76 gtk_entry_set_activates_default(GTK_ENTRY(username_entry_), TRUE); | 77 gtk_entry_set_activates_default(GTK_ENTRY(username_entry_), TRUE); |
77 | 78 |
78 password_entry_ = gtk_entry_new(); | 79 password_entry_ = gtk_entry_new(); |
79 gtk_entry_set_activates_default(GTK_ENTRY(password_entry_), TRUE); | 80 gtk_entry_set_activates_default(GTK_ENTRY(password_entry_), TRUE); |
80 gtk_entry_set_visibility(GTK_ENTRY(password_entry_), FALSE); | 81 gtk_entry_set_visibility(GTK_ENTRY(password_entry_), FALSE); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // button the default action and mess with the focus. | 179 // button the default action and mess with the focus. |
179 gtk_widget_set_can_default(ok_, TRUE); | 180 gtk_widget_set_can_default(ok_, TRUE); |
180 gtk_widget_grab_default(ok_); | 181 gtk_widget_grab_default(ok_); |
181 } | 182 } |
182 | 183 |
183 // static | 184 // static |
184 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 185 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
185 net::URLRequest* request) { | 186 net::URLRequest* request) { |
186 return new LoginHandlerGtk(auth_info, request); | 187 return new LoginHandlerGtk(auth_info, request); |
187 } | 188 } |
OLD | NEW |