From 13c8a0903376ff406151679d8673a6452d721290 Mon Sep 17 00:00:00 2001
From: "thestig@chromium.org"
 <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Thu, 29 Jul 2010 06:15:44 +0000
Subject: Net: Convert username and password to string16.

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3040016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54101 0039d316-1c4b-4281-b951-d872f2087c98
---
 net/socket_stream/socket_stream.cc          |  2 +-
 net/socket_stream/socket_stream.h           |  5 +++--
 net/socket_stream/socket_stream_job.h       |  5 +++--
 net/socket_stream/socket_stream_unittest.cc | 14 ++++++--------
 4 files changed, 13 insertions(+), 13 deletions(-)

(limited to 'net/socket_stream')

diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index c1216d7..6e7f270 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -196,7 +196,7 @@ void SocketStream::Close() {
 }
 
 void SocketStream::RestartWithAuth(
-    const std::wstring& username, const std::wstring& password) {
+    const string16& username, const string16& password) {
   DCHECK(MessageLoop::current()) <<
       "The current MessageLoop must exist";
   DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) <<
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index 74b87cf..860f785 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -14,6 +14,7 @@
 #include "base/linked_ptr.h"
 #include "base/ref_counted.h"
 #include "base/scoped_ptr.h"
+#include "base/string16.h"
 #include "base/task.h"
 #include "net/base/address_list.h"
 #include "net/base/completion_callback.h"
@@ -133,8 +134,8 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
   // Restarts with authentication info.
   // Should be used for response of OnAuthRequired.
   virtual void RestartWithAuth(
-      const std::wstring& username,
-      const std::wstring& password);
+      const string16& username,
+      const string16& password);
 
   // Detach delegate.  Call before delegate is deleted.
   // Once delegate is detached, close the socket stream and never call delegate
diff --git a/net/socket_stream/socket_stream_job.h b/net/socket_stream/socket_stream_job.h
index 086aa79..89e0c36 100644
--- a/net/socket_stream/socket_stream_job.h
+++ b/net/socket_stream/socket_stream_job.h
@@ -9,6 +9,7 @@
 #include <string>
 
 #include "base/ref_counted.h"
+#include "base/string16.h"
 #include "net/socket_stream/socket_stream.h"
 
 class GURL;
@@ -65,8 +66,8 @@ class SocketStreamJob : public base::RefCountedThreadSafe<SocketStreamJob> {
   }
 
   virtual void RestartWithAuth(
-      const std::wstring& username,
-      const std::wstring& password) {
+      const string16& username,
+      const string16& password) {
     socket_->RestartWithAuth(username, password);
   }
 
diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc
index d32654a..def766c 100644
--- a/net/socket_stream/socket_stream_unittest.cc
+++ b/net/socket_stream/socket_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -119,8 +119,8 @@ class SocketStreamEventRecorder : public net::SocketStream::Delegate {
               << " password=" << password_;
     event->socket->RestartWithAuth(username_, password_);
   }
-  void SetAuthInfo(const std::wstring& username,
-                   const std::wstring& password) {
+  void SetAuthInfo(const string16& username,
+                   const string16& password) {
     username_ = username;
     password_ = password;
   }
@@ -138,8 +138,8 @@ class SocketStreamEventRecorder : public net::SocketStream::Delegate {
   Callback1<SocketStreamEvent*>::Type* on_auth_required_;
   net::CompletionCallback* callback_;
 
-  std::wstring username_;
-  std::wstring password_;
+  string16 username_;
+  string16 password_;
 
   DISALLOW_COPY_AND_ASSIGN(SocketStreamEventRecorder);
 };
@@ -318,9 +318,7 @@ TEST_F(SocketStreamTest, BasicAuthProxy) {
       new SocketStreamEventRecorder(&callback));
   delegate->SetOnConnected(NewCallback(delegate.get(),
                                        &SocketStreamEventRecorder::DoClose));
-  const std::wstring kUsername = L"foo";
-  const std::wstring kPassword = L"bar";
-  delegate->SetAuthInfo(kUsername, kPassword);
+  delegate->SetAuthInfo(ASCIIToUTF16("foo"), ASCIIToUTF16("bar"));
   delegate->SetOnAuthRequired(
       NewCallback(delegate.get(),
                   &SocketStreamEventRecorder::DoRestartWithAuth));
-- 
cgit v1.1