Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/ui/login/login_prompt_gtk.cc

Issue 8413022: wstring cleanup in browser/ui/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/string16.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/password_manager/password_manager.h" 11 #include "chrome/browser/password_manager/password_manager.h"
11 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" 12 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h"
12 #include "chrome/browser/tab_contents/tab_util.h" 13 #include "chrome/browser/tab_contents/tab_util.h"
13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" 14 #include "chrome/browser/ui/gtk/constrained_window_gtk.h"
14 #include "chrome/browser/ui/gtk/gtk_util.h" 15 #include "chrome/browser/ui/gtk/gtk_util.h"
15 #include "chrome/browser/ui/login/login_model.h" 16 #include "chrome/browser/ui/login/login_model.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "content/browser/renderer_host/resource_dispatcher_host.h" 18 #include "content/browser/renderer_host/resource_dispatcher_host.h"
18 #include "content/browser/tab_contents/navigation_controller.h" 19 #include "content/browser/tab_contents/navigation_controller.h"
(...skipping 23 matching lines...) Expand all
42 username_entry_(NULL), 43 username_entry_(NULL),
43 password_entry_(NULL), 44 password_entry_(NULL),
44 ok_(NULL) { 45 ok_(NULL) {
45 } 46 }
46 47
47 virtual ~LoginHandlerGtk() { 48 virtual ~LoginHandlerGtk() {
48 root_.Destroy(); 49 root_.Destroy();
49 } 50 }
50 51
51 // LoginModelObserver implementation. 52 // LoginModelObserver implementation.
52 virtual void OnAutofillDataAvailable(const std::wstring& username, 53 virtual void OnAutofillDataAvailable(const string16& username,
53 const std::wstring& password) { 54 const string16& password) {
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
55 56
56 // NOTE: Would be nice to use gtk_entry_get_text_length, but it is fairly 57 // NOTE: Would be nice to use gtk_entry_get_text_length, but it is fairly
57 // new and not always in our GTK version. 58 // new and not always in our GTK version.
58 if (strlen(gtk_entry_get_text(GTK_ENTRY(username_entry_))) == 0) { 59 if (strlen(gtk_entry_get_text(GTK_ENTRY(username_entry_))) == 0) {
59 gtk_entry_set_text(GTK_ENTRY(username_entry_), 60 gtk_entry_set_text(GTK_ENTRY(username_entry_),
60 WideToUTF8(username).c_str()); 61 UTF16ToUTF8(username).c_str());
61 gtk_entry_set_text(GTK_ENTRY(password_entry_), 62 gtk_entry_set_text(GTK_ENTRY(password_entry_),
62 WideToUTF8(password).c_str()); 63 UTF16ToUTF8(password).c_str());
63 gtk_editable_select_region(GTK_EDITABLE(username_entry_), 0, -1); 64 gtk_editable_select_region(GTK_EDITABLE(username_entry_), 0, -1);
64 } 65 }
65 } 66 }
66 67
67 // LoginHandler: 68 // LoginHandler:
68 virtual void BuildViewForPasswordManager(PasswordManager* manager, 69 virtual void BuildViewForPasswordManager(PasswordManager* manager,
69 const string16& explanation) { 70 const string16& explanation) {
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
71 72
72 root_.Own(gtk_vbox_new(FALSE, ui::kContentAreaBorder)); 73 root_.Own(gtk_vbox_new(FALSE, ui::kContentAreaBorder));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // button the default action and mess with the focus. 183 // button the default action and mess with the focus.
183 gtk_widget_set_can_default(ok_, TRUE); 184 gtk_widget_set_can_default(ok_, TRUE);
184 gtk_widget_grab_default(ok_); 185 gtk_widget_grab_default(ok_);
185 } 186 }
186 187
187 // static 188 // static
188 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, 189 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info,
189 net::URLRequest* request) { 190 net::URLRequest* request) {
190 return new LoginHandlerGtk(auth_info, request); 191 return new LoginHandlerGtk(auth_info, request);
191 } 192 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/login/login_prompt_browsertest.cc ('k') | chrome/browser/ui/login/login_prompt_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698