summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/login
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 19:56:14 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 19:56:14 +0000
commita771dc3feb97ae20170cf5617ba48d6340549698 (patch)
tree2482dd2533a3341ede166407b6eb3761a28ec4e7 /chrome/browser/ui/login
parent0f786468a0c44da5093c6759915e1c0384535adf (diff)
downloadchromium_src-a771dc3feb97ae20170cf5617ba48d6340549698.zip
chromium_src-a771dc3feb97ae20170cf5617ba48d6340549698.tar.gz
chromium_src-a771dc3feb97ae20170cf5617ba48d6340549698.tar.bz2
Revert 74118 - Remove wstring from RVH's run Javascript command.
BUG=23581 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6312154 TBR=avi@chromium.org Review URL: http://codereview.chromium.org/6459002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/login')
-rw-r--r--chrome/browser/ui/login/login_prompt.cc21
-rw-r--r--chrome/browser/ui/login/login_prompt.h24
-rw-r--r--chrome/browser/ui/login/login_prompt_browsertest.cc7
-rw-r--r--chrome/browser/ui/login/login_prompt_gtk.cc8
-rw-r--r--chrome/browser/ui/login/login_prompt_mac.mm13
-rw-r--r--chrome/browser/ui/login/login_prompt_uitest.cc43
-rw-r--r--chrome/browser/ui/login/login_prompt_win.cc6
7 files changed, 59 insertions, 63 deletions
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index 4f8189a..380f7b5 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -124,8 +124,8 @@ RenderViewHostDelegate* LoginHandler::GetRenderViewHostDelegate() const {
return rvh->delegate();
}
-void LoginHandler::SetAuth(const string16& username,
- const string16& password) {
+void LoginHandler::SetAuth(const std::wstring& username,
+ const std::wstring& password) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (TestAndSetAuthHandled())
@@ -133,8 +133,8 @@ void LoginHandler::SetAuth(const string16& username,
// Tell the password manager the credentials were submitted / accepted.
if (password_manager_) {
- password_form_.username_value = username;
- password_form_.password_value = password;
+ password_form_.username_value = WideToUTF16Hack(username);
+ password_form_.password_value = WideToUTF16Hack(password);
password_manager_->ProvisionallySavePassword(password_form_);
}
@@ -293,8 +293,8 @@ void LoginHandler::NotifyAuthCancelled() {
Details<LoginNotificationDetails>(&details));
}
-void LoginHandler::NotifyAuthSupplied(const string16& username,
- const string16& password) {
+void LoginHandler::NotifyAuthSupplied(const std::wstring& username,
+ const std::wstring& password) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(WasAuthHandled());
@@ -345,12 +345,12 @@ bool LoginHandler::TestAndSetAuthHandled() {
}
// Calls SetAuth from the IO loop.
-void LoginHandler::SetAuthDeferred(const string16& username,
- const string16& password) {
+void LoginHandler::SetAuthDeferred(const std::wstring& username,
+ const std::wstring& password) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (request_) {
- request_->SetAuth(username, password);
+ request_->SetAuth(WideToUTF16Hack(username), WideToUTF16Hack(password));
ResetLoginHandlerForRequest(request_);
}
}
@@ -421,7 +421,8 @@ class LoginDialogTask : public Task {
l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION,
host_and_port_hack16,
realm_hack16);
- handler_->BuildViewForPasswordManager(password_manager, explanation);
+ handler_->BuildViewForPasswordManager(password_manager,
+ UTF16ToWideHack(explanation));
}
private:
diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h
index 7742996..7c8ae9d 100644
--- a/chrome/browser/ui/login/login_prompt.h
+++ b/chrome/browser/ui/login/login_prompt.h
@@ -41,7 +41,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>,
// Initializes the underlying platform specific view.
virtual void BuildViewForPasswordManager(PasswordManager* manager,
- const string16& explanation) = 0;
+ std::wstring explanation) = 0;
// Sets information about the authentication type (|form|) and the
// |password_manager| for this profile.
@@ -56,7 +56,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>,
// Resend the request with authentication credentials.
// This function can be called from either thread.
- void SetAuth(const string16& username, const string16& password);
+ void SetAuth(const std::wstring& username, const std::wstring& password);
// Display the error page without asking for credentials again.
// This function can be called from either thread.
@@ -99,8 +99,8 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>,
void RemoveObservers();
// Notify observers that authentication is supplied.
- void NotifyAuthSupplied(const string16& username,
- const string16& password);
+ void NotifyAuthSupplied(const std::wstring& username,
+ const std::wstring& password);
// Notify observers that authentication is cancelled.
void NotifyAuthCancelled();
@@ -110,8 +110,8 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>,
bool TestAndSetAuthHandled();
// Calls SetAuth from the IO loop.
- void SetAuthDeferred(const string16& username,
- const string16& password);
+ void SetAuthDeferred(const std::wstring& username,
+ const std::wstring& password);
// Calls CancelAuth from the IO loop.
void CancelAuthDeferred();
@@ -179,20 +179,20 @@ class LoginNotificationDetails {
class AuthSuppliedLoginNotificationDetails : public LoginNotificationDetails {
public:
AuthSuppliedLoginNotificationDetails(LoginHandler* handler,
- const string16& username,
- const string16& password)
+ const std::wstring& username,
+ const std::wstring& password)
: LoginNotificationDetails(handler),
username_(username),
password_(password) {}
- const string16& username() const { return username_; }
- const string16& password() const { return password_; }
+ const std::wstring& username() const { return username_; }
+ const std::wstring& password() const { return password_; }
private:
// The username that was used for the authentication.
- const string16 username_;
+ const std::wstring username_;
// The password that was used for the authentication.
- const string16 password_;
+ const std::wstring password_;
DISALLOW_COPY_AND_ASSIGN(AuthSuppliedLoginNotificationDetails);
};
diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc
index bc52d66..8c2db99 100644
--- a/chrome/browser/ui/login/login_prompt_browsertest.cc
+++ b/chrome/browser/ui/login/login_prompt_browsertest.cc
@@ -6,7 +6,6 @@
#include <list>
#include <map>
-#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/ui/browser.h"
@@ -57,8 +56,7 @@ void LoginPromptBrowserTest::SetAuthFor(LoginHandler* handler) {
EXPECT_TRUE(auth_map_.end() != i);
if (i != auth_map_.end()) {
const AuthInfo& info = i->second;
- handler->SetAuth(WideToUTF16Hack(info.username_),
- WideToUTF16Hack(info.password_));
+ handler->SetAuth(info.username_, info.password_);
}
}
@@ -366,8 +364,7 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, DISABLED_IncorrectConfirmation) {
LoginHandler* handler = *observer.handlers_.begin();
ASSERT_TRUE(handler);
- handler->SetAuth(WideToUTF16Hack(bad_username_),
- WideToUTF16Hack(bad_password_));
+ handler->SetAuth(bad_username_, bad_password_);
LOG(INFO) << "Waiting for initial AUTH_SUPPLIED";
auth_supplied_waiter.Wait();
diff --git a/chrome/browser/ui/login/login_prompt_gtk.cc b/chrome/browser/ui/login/login_prompt_gtk.cc
index e6487a5..f070b65a 100644
--- a/chrome/browser/ui/login/login_prompt_gtk.cc
+++ b/chrome/browser/ui/login/login_prompt_gtk.cc
@@ -64,11 +64,11 @@ class LoginHandlerGtk : public LoginHandler,
// LoginHandler:
virtual void BuildViewForPasswordManager(PasswordManager* manager,
- const string16& explanation) {
+ std::wstring explanation) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
root_.Own(gtk_vbox_new(FALSE, gtk_util::kContentAreaBorder));
- GtkWidget* label = gtk_label_new(UTF16ToUTF8(explanation).c_str());
+ GtkWidget* label = gtk_label_new(WideToUTF8(explanation).c_str());
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(root_.get()), label, FALSE, FALSE, 0);
@@ -153,8 +153,8 @@ class LoginHandlerGtk : public LoginHandler,
void LoginHandlerGtk::OnOKClicked(GtkWidget* sender) {
SetAuth(
- UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(username_entry_))),
- UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(password_entry_))));
+ UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(username_entry_))),
+ UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(password_entry_))));
}
void LoginHandlerGtk::OnCancelClicked(GtkWidget* sender) {
diff --git a/chrome/browser/ui/login/login_prompt_mac.mm b/chrome/browser/ui/login/login_prompt_mac.mm
index 6036831..f663632 100644
--- a/chrome/browser/ui/login/login_prompt_mac.mm
+++ b/chrome/browser/ui/login/login_prompt_mac.mm
@@ -53,7 +53,7 @@ class LoginHandlerMac : public LoginHandler,
// LoginHandler:
virtual void BuildViewForPasswordManager(PasswordManager* manager,
- const string16& explanation) {
+ std::wstring explanation) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Load nib here instead of in constructor.
@@ -64,7 +64,7 @@ class LoginHandlerMac : public LoginHandler,
SetModel(manager);
- [sheet_controller_ setExplanation:base::SysUTF16ToNSString(explanation)];
+ [sheet_controller_ setExplanation:base::SysWideToNSString(explanation)];
// Scary thread safety note: This can potentially be called *after* SetAuth
// or CancelAuth (say, if the request was cancelled before the UI thread got
@@ -92,8 +92,8 @@ class LoginHandlerMac : public LoginHandler,
ReleaseSoon();
}
- void OnLoginPressed(const string16& username,
- const string16& password) {
+ void OnLoginPressed(const std::wstring& username,
+ const std::wstring& password) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
SetAuth(username, password);
@@ -147,9 +147,8 @@ LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info,
- (IBAction)loginPressed:(id)sender {
using base::SysNSStringToWide;
[NSApp endSheet:[self window]];
- handler_->OnLoginPressed(
- base::SysNSStringToUTF16([nameField_ stringValue]),
- base::SysNSStringToUTF16([passwordField_ stringValue]));
+ handler_->OnLoginPressed(SysNSStringToWide([nameField_ stringValue]),
+ SysNSStringToWide([passwordField_ stringValue]));
}
- (IBAction)cancelPressed:(id)sender {
diff --git a/chrome/browser/ui/login/login_prompt_uitest.cc b/chrome/browser/ui/login/login_prompt_uitest.cc
index 750e6c1..eabb682 100644
--- a/chrome/browser/ui/login/login_prompt_uitest.cc
+++ b/chrome/browser/ui/login/login_prompt_uitest.cc
@@ -4,7 +4,6 @@
#include <string>
-#include "base/utf_string_conversions.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -12,6 +11,8 @@
#include "chrome/test/ui/ui_test.h"
#include "net/test/test_server.h"
+using std::wstring;
+
namespace {
const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
@@ -21,10 +22,10 @@ const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
class LoginPromptTest : public UITest {
protected:
LoginPromptTest()
- : username_basic_(ASCIIToUTF16("basicuser")),
- username_digest_(ASCIIToUTF16("digestuser")),
- password_(ASCIIToUTF16("secret")),
- password_bad_(ASCIIToUTF16("denyme")),
+ : username_basic_(L"basicuser"),
+ username_digest_(L"digestuser"),
+ password_(L"secret"),
+ password_bad_(L"denyme"),
test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)) {
}
@@ -35,18 +36,18 @@ class LoginPromptTest : public UITest {
}
protected:
- string16 username_basic_;
- string16 username_digest_;
- string16 password_;
- string16 password_bad_;
+ wstring username_basic_;
+ wstring username_digest_;
+ wstring password_;
+ wstring password_bad_;
net::TestServer test_server_;
};
-string16 ExpectedTitleFromAuth(const string16& username,
- const string16& password) {
+wstring ExpectedTitleFromAuth(const wstring& username,
+ const wstring& password) {
// The TestServer sets the title to username/password on successful login.
- return username + char16('/') + password;
+ return username + L"/" + password;
}
#if defined(OS_WIN)
@@ -77,7 +78,7 @@ TEST_F(LoginPromptTest, MAYBE_TestBasicAuth) {
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->SetAuth(username_basic_, password_));
EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_),
- WideToUTF16Hack(GetActiveTabTitle()));
+ GetActiveTabTitle());
}
#if defined(OS_WIN)
@@ -107,7 +108,7 @@ TEST_F(LoginPromptTest, MAYBE_TestDigestAuth) {
EXPECT_TRUE(tab->NeedsAuth());
EXPECT_TRUE(tab->SetAuth(username_digest_, password_));
EXPECT_EQ(ExpectedTitleFromAuth(username_digest_, password_),
- WideToUTF16Hack(GetActiveTabTitle()));
+ GetActiveTabTitle());
}
#if defined(OS_WIN)
@@ -137,7 +138,7 @@ TEST_F(LoginPromptTest, MAYBE_TestTwoAuths) {
EXPECT_TRUE(digest_tab->NeedsAuth());
EXPECT_TRUE(digest_tab->SetAuth(username_digest_, password_));
- string16 title;
+ wstring title;
EXPECT_TRUE(basic_tab->GetTabTitle(&title));
EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), title);
@@ -229,10 +230,10 @@ TEST_F(LoginPromptTest, MAYBE_SupplyRedundantAuths) {
EXPECT_TRUE(basic_tab2->WaitForNavigation(last_navigation_time));
// Now both tabs have loaded.
- string16 title1;
+ wstring title1;
EXPECT_TRUE(basic_tab1->GetTabTitle(&title1));
EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), title1);
- string16 title2;
+ wstring title2;
EXPECT_TRUE(basic_tab2->GetTabTitle(&title2));
EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), title2);
}
@@ -269,10 +270,10 @@ TEST_F(LoginPromptTest, MAYBE_CancelRedundantAuths) {
EXPECT_TRUE(basic_tab2->WaitForNavigation(last_navigation_time));
// Now both tabs have been denied.
- string16 title1;
+ wstring title1;
EXPECT_TRUE(basic_tab1->GetTabTitle(&title1));
- EXPECT_EQ(ASCIIToUTF16("Denied: no auth"), title1);
- string16 title2;
+ EXPECT_EQ(L"Denied: no auth", title1);
+ wstring title2;
EXPECT_TRUE(basic_tab2->GetTabTitle(&title2));
- EXPECT_EQ(ASCIIToUTF16("Denied: no auth"), title2);
+ EXPECT_EQ(L"Denied: no auth", title2);
}
diff --git a/chrome/browser/ui/login/login_prompt_win.cc b/chrome/browser/ui/login/login_prompt_win.cc
index 019679c..cf111d1 100644
--- a/chrome/browser/ui/login/login_prompt_win.cc
+++ b/chrome/browser/ui/login/login_prompt_win.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/login/login_prompt.h"
-#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -102,15 +101,14 @@ class LoginHandlerWin : public LoginHandler,
// LoginHandler:
virtual void BuildViewForPasswordManager(PasswordManager* manager,
- const string16& explanation) {
+ std::wstring explanation) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
TabContents* tab_contents = GetTabContentsForLogin();
bool should_focus_view = !tab_contents->delegate() ||
tab_contents->delegate()->ShouldFocusConstrainedWindow();
- LoginView* view = new LoginView(UTF16ToWideHack(explanation),
- should_focus_view);
+ LoginView* view = new LoginView(explanation, should_focus_view);
// Set the model for the login view. The model (password manager) is owned
// by the view's parent TabContents, so natural destruction order means we