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