summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-20 19:25:42 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-20 19:25:42 +0000
commit00e3f152083aea092353b3d284c368b48136f33c (patch)
tree081df57119ba9301bebd7c7091efc4acab5accc9 /chrome/browser
parent4e6f2f037e6d1956bc431ac37a72d8e6871586d8 (diff)
downloadchromium_src-00e3f152083aea092353b3d284c368b48136f33c.zip
chromium_src-00e3f152083aea092353b3d284c368b48136f33c.tar.gz
chromium_src-00e3f152083aea092353b3d284c368b48136f33c.tar.bz2
Convert some structures in webkit/glue to string16.
R=yaar BUG=none TEST=none Review URL: http://codereview.chromium.org/305002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gears_integration.cc10
-rw-r--r--chrome/browser/gears_integration.h5
-rw-r--r--chrome/browser/gtk/options/passwords_page_gtk.cc4
-rw-r--r--chrome/browser/importer/firefox_importer_unittest.cc20
-rw-r--r--chrome/browser/importer/firefox_importer_unittest_messages_internal.h2
-rw-r--r--chrome/browser/importer/firefox_importer_unittest_utils.h4
-rw-r--r--chrome/browser/importer/firefox_importer_unittest_utils_mac.cc10
-rw-r--r--chrome/browser/importer/nss_decryptor.cc16
-rw-r--r--chrome/browser/importer/nss_decryptor_linux.h2
-rw-r--r--chrome/browser/importer/nss_decryptor_mac.h2
-rw-r--r--chrome/browser/login_prompt_gtk.cc4
-rw-r--r--chrome/browser/login_prompt_mac.mm4
-rw-r--r--chrome/browser/password_manager/login_database.cc30
-rw-r--r--chrome/browser/password_manager/login_database.h5
-rw-r--r--chrome/browser/password_manager/login_database_mac.cc6
-rw-r--r--chrome/browser/password_manager/login_database_mac.h4
-rw-r--r--chrome/browser/password_manager/login_database_unittest.cc40
-rw-r--r--chrome/browser/password_manager/password_form_manager_unittest.cc17
-rw-r--r--chrome/browser/password_manager/password_manager.cc5
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc18
-rw-r--r--chrome/browser/password_manager/password_store_mac_unittest.cc43
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents.h2
-rw-r--r--chrome/browser/webdata/web_database.cc38
-rw-r--r--chrome/browser/webdata/web_database_unittest.cc39
25 files changed, 169 insertions, 165 deletions
diff --git a/chrome/browser/gears_integration.cc b/chrome/browser/gears_integration.cc
index 97c7de8..da08df3 100644
--- a/chrome/browser/gears_integration.cc
+++ b/chrome/browser/gears_integration.cc
@@ -233,17 +233,17 @@ struct RunnableMethodTraits<CreateShortcutCommand> {
void GearsCreateShortcut(
const webkit_glue::WebApplicationInfo& app_info,
- const std::wstring& fallback_name,
+ const string16& fallback_name,
const GURL& fallback_url,
const SkBitmap& fallback_icon,
GearsCreateShortcutCallback* callback) {
- std::wstring name =
+ string16 name =
!app_info.title.empty() ? app_info.title : fallback_name;
- std::string orig_name_utf8 = WideToUTF8(name);
+ std::string orig_name_utf8 = UTF16ToUTF8(name);
EnsureStringValidPathComponent(name);
- std::string name_utf8 = WideToUTF8(name);
- std::string description_utf8 = WideToUTF8(app_info.description);
+ std::string name_utf8 = UTF16ToUTF8(name);
+ std::string description_utf8 = UTF16ToUTF8(app_info.description);
const GURL& url =
!app_info.app_url.is_empty() ? app_info.app_url : fallback_url;
diff --git a/chrome/browser/gears_integration.h b/chrome/browser/gears_integration.h
index ac2c3ab..31d22e7 100644
--- a/chrome/browser/gears_integration.h
+++ b/chrome/browser/gears_integration.h
@@ -5,9 +5,8 @@
#ifndef CHROME_BROWSER_GEARS_INTEGRATION_H__
#define CHROME_BROWSER_GEARS_INTEGRATION_H__
-#include <string>
-
#include "app/gfx/native_widget_types.h"
+#include "base/string16.h"
#include "base/task.h"
#include "chrome/common/gears_api.h"
@@ -42,7 +41,7 @@ typedef Callback2<const GearsShortcutData2&, bool>::Type
void GearsCreateShortcut(
const webkit_glue::WebApplicationInfo& app_info,
- const std::wstring& fallback_name,
+ const string16& fallback_name,
const GURL& fallback_url,
const SkBitmap& fallback_icon,
GearsCreateShortcutCallback* callback);
diff --git a/chrome/browser/gtk/options/passwords_page_gtk.cc b/chrome/browser/gtk/options/passwords_page_gtk.cc
index 8b2203b..b2f6345 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.cc
+++ b/chrome/browser/gtk/options/passwords_page_gtk.cc
@@ -159,7 +159,7 @@ void PasswordsPageGtk::SetPasswordList(
false, UnescapeRule::NONE,
NULL, NULL);
std::string site = WideToUTF8(formatted);
- std::string user = WideToUTF8(result[i]->username_value);
+ std::string user = UTF16ToUTF8(result[i]->username_value);
GtkTreeIter iter;
gtk_list_store_insert_with_values(password_list_store_, &iter, (gint) i,
COL_SITE, site.c_str(),
@@ -265,7 +265,7 @@ void PasswordsPageGtk::OnShowPasswordButtonClicked(GtkButton* widget,
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
page->password_list_sort_, path);
gtk_tree_path_free(path);
- std::string pass = WideToUTF8(page->password_list_[index].password_value);
+ std::string pass = UTF16ToUTF8(page->password_list_[index].password_value);
gtk_label_set_text(GTK_LABEL(page->password_), pass.c_str());
gtk_button_set_label(GTK_BUTTON(page->show_password_button_),
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON).c_str());
diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc
index fa5086c..c2e0210 100644
--- a/chrome/browser/importer/firefox_importer_unittest.cc
+++ b/chrome/browser/importer/firefox_importer_unittest.cc
@@ -35,11 +35,13 @@ TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) {
EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path.ToWStringHack(),
db_path.ToWStringHack()));
- EXPECT_EQ(L"hello", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
- "wFAYIKoZIhvcNAwcECBJM63MpT9rtBAjMCm7qo/EhlA=="));
+ EXPECT_EQ(ASCIIToUTF16("hello"),
+ decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECBJ"
+ "M63MpT9rtBAjMCm7qo/EhlA=="));
// Test UTF-16 encoding.
- EXPECT_EQ(L"\x4E2D", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
- "wFAYIKoZIhvcNAwcECN9OQ5ZFmhb8BAiFo1Z+fUvaIQ=="));
+ EXPECT_EQ(WideToUTF16(L"\x4E2D"),
+ decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECN9"
+ "OQ5ZFmhb8BAiFo1Z+fUvaIQ=="));
}
TEST(FirefoxImporterTest, Firefox3NSS3Decryptor) {
@@ -59,11 +61,13 @@ TEST(FirefoxImporterTest, Firefox3NSS3Decryptor) {
EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path.ToWStringHack(),
db_path.ToWStringHack()));
- EXPECT_EQ(L"hello", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
- "wFAYIKoZIhvcNAwcECKajtRg4qFSHBAhv9luFkXgDJA=="));
+ EXPECT_EQ(ASCIIToUTF16("hello"),
+ decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECKa"
+ "jtRg4qFSHBAhv9luFkXgDJA=="));
// Test UTF-16 encoding.
- EXPECT_EQ(L"\x4E2D", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
- "wFAYIKoZIhvcNAwcECLWqqiccfQHWBAie74hxnULxlw=="));
+ EXPECT_EQ(WideToUTF16(L"\x4E2D"),
+ decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECLW"
+ "qqiccfQHWBAie74hxnULxlw=="));
}
TEST(FirefoxImporterTest, Firefox2BookmarkParse) {
diff --git a/chrome/browser/importer/firefox_importer_unittest_messages_internal.h b/chrome/browser/importer/firefox_importer_unittest_messages_internal.h
index 72eff6f..68b2582 100644
--- a/chrome/browser/importer/firefox_importer_unittest_messages_internal.h
+++ b/chrome/browser/importer/firefox_importer_unittest_messages_internal.h
@@ -25,7 +25,7 @@ IPC_MESSAGE_CONTROL1(Msg_Decrypt,
std::string /* crypt */)
// Child->Server: Decrypted String.
IPC_MESSAGE_CONTROL1(Msg_Decryptor_Response,
- std::wstring /* unencrypted_str */)
+ string16 /* unencrypted_str */)
// Server->Child: Die.
IPC_MESSAGE_CONTROL0(Msg_Decryptor_Quit)
diff --git a/chrome/browser/importer/firefox_importer_unittest_utils.h b/chrome/browser/importer/firefox_importer_unittest_utils.h
index c989bd6..6db8ee4 100644
--- a/chrome/browser/importer/firefox_importer_unittest_utils.h
+++ b/chrome/browser/importer/firefox_importer_unittest_utils.h
@@ -38,7 +38,7 @@ class FFUnitTestDecryptorProxy {
// This match the parallel functions in NSSDecryptor.
bool DecryptorInit(const std::wstring& dll_path, const std::wstring& db_path);
- std::wstring Decrypt(const std::string& crypt);
+ string16 Decrypt(const std::string& crypt);
private:
#if defined(OS_MACOSX)
@@ -76,7 +76,7 @@ bool FFUnitTestDecryptorProxy::DecryptorInit(const std::wstring& dll_path,
return decryptor_.Init(dll_path, db_path);
}
-std::wstring FFUnitTestDecryptorProxy::Decrypt(const std::string& crypt) {
+string16 FFUnitTestDecryptorProxy::Decrypt(const std::string& crypt) {
return decryptor_.Decrypt(crypt);
}
#endif // !OS_MACOSX
diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
index a6757f9..7b559bb 100644
--- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
+++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
@@ -84,7 +84,7 @@ class FFDecryptorServerChannelListener : public IPC::Channel::Listener {
MessageLoop::current()->Quit();
}
- void OnDecryptedTextResonse(std::wstring decrypted_text) {
+ void OnDecryptedTextResonse(const string16& decrypted_text) {
DCHECK(!got_result);
result_string = decrypted_text;
got_result = true;
@@ -110,7 +110,7 @@ class FFDecryptorServerChannelListener : public IPC::Channel::Listener {
}
// Results of IPC calls.
- std::wstring result_string;
+ string16 result_string;
bool result_bool;
// True if IPC call succeeded and data in above variables is valid.
bool got_result;
@@ -196,14 +196,14 @@ bool FFUnitTestDecryptorProxy::DecryptorInit(const std::wstring& dll_path,
return false;
}
-std::wstring FFUnitTestDecryptorProxy::Decrypt(const std::string& crypt) {
+string16 FFUnitTestDecryptorProxy::Decrypt(const std::string& crypt) {
channel_->Send(new Msg_Decrypt(crypt));
bool ok = WaitForClientResponse();
if (ok && listener_->got_result) {
listener_->got_result = false;
return listener_->result_string;
}
- return L"";
+ return string16();
}
//---------------------------- Child Process -----------------------
@@ -225,7 +225,7 @@ class FFDecryptorClientChannelListener : public IPC::Channel::Listener {
}
void OnDecrypt(std::string crypt) {
- std::wstring unencrypted_str = decryptor_.Decrypt(crypt);
+ string16 unencrypted_str = decryptor_.Decrypt(crypt);
sender_->Send(new Msg_Decryptor_Response(unencrypted_str));
}
diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc
index 13bb14b..db2c89f 100644
--- a/chrome/browser/importer/nss_decryptor.cc
+++ b/chrome/browser/importer/nss_decryptor.cc
@@ -59,10 +59,10 @@ using webkit_glue::PasswordForm;
*
* ***** END LICENSE BLOCK ***** */
-std::wstring NSSDecryptor::Decrypt(const std::string& crypt) const {
+string16 NSSDecryptor::Decrypt(const std::string& crypt) const {
// Do nothing if NSS is not loaded.
if (!is_nss_initialized_)
- return std::wstring();
+ return string16();
// The old style password is encoded in base64. They are identified
// by a leading '~'. Otherwise, we should decrypt the text.
@@ -74,7 +74,7 @@ std::wstring NSSDecryptor::Decrypt(const std::string& crypt) const {
SECStatus result = PK11_Authenticate(slot, PR_TRUE, NULL);
if (result != SECSuccess) {
FreeSlot(slot);
- return std::wstring();
+ return string16();
}
SECItem request;
@@ -99,7 +99,7 @@ std::wstring NSSDecryptor::Decrypt(const std::string& crypt) const {
net::Base64Decode(crypt.substr(1), &plain);
}
- return UTF8ToWide(plain);
+ return UTF8ToUTF16(plain);
}
// There are three versions of password filess. They store saved user
@@ -202,11 +202,11 @@ void NSSDecryptor::ParseSignons(const std::string& content,
// line (contains a dot).
while (begin + 4 < end) {
// The user name.
- form.username_element = UTF8ToWide(lines[begin++]);
+ form.username_element = UTF8ToUTF16(lines[begin++]);
form.username_value = Decrypt(lines[begin++]);
// The element name has a leading '*'.
if (lines[begin].at(0) == '*') {
- form.password_element = UTF8ToWide(lines[begin++].substr(1));
+ form.password_element = UTF8ToUTF16(lines[begin++].substr(1));
form.password_value = Decrypt(lines[begin++]);
} else {
// Maybe the file is bad, we skip to next block.
@@ -286,9 +286,9 @@ bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file,
form.signon_realm += realm;
form.ssl_valid = form.origin.SchemeIsSecure();
// The user name, password and action.
- form.username_element = UTF8ToWide(s2.column_string(3));
+ form.username_element = UTF8ToUTF16(s2.column_string(3));
form.username_value = Decrypt(s2.column_string(5));
- form.password_element = UTF8ToWide(s2.column_string(4));
+ form.password_element = UTF8ToUTF16(s2.column_string(4));
form.password_value = Decrypt(s2.column_string(6));
form.action = GURL(s2.column_string(2)).ReplaceComponents(rep);
forms->push_back(form);
diff --git a/chrome/browser/importer/nss_decryptor_linux.h b/chrome/browser/importer/nss_decryptor_linux.h
index d73c733..05684fd 100644
--- a/chrome/browser/importer/nss_decryptor_linux.h
+++ b/chrome/browser/importer/nss_decryptor_linux.h
@@ -28,7 +28,7 @@ class NSSDecryptor {
// Decrypts Firefox stored passwords. Before using this method,
// make sure Init() returns true.
- std::wstring Decrypt(const std::string& crypt) const;
+ string16 Decrypt(const std::string& crypt) const;
// Parses the Firefox password file content, decrypts the
// username/password and reads other related information.
diff --git a/chrome/browser/importer/nss_decryptor_mac.h b/chrome/browser/importer/nss_decryptor_mac.h
index 477cf53..af1b004 100644
--- a/chrome/browser/importer/nss_decryptor_mac.h
+++ b/chrome/browser/importer/nss_decryptor_mac.h
@@ -123,7 +123,7 @@ class NSSDecryptor {
// Decrypts Firefox stored passwords. Before using this method,
// make sure Init() returns true.
- std::wstring Decrypt(const std::string& crypt) const;
+ string16 Decrypt(const std::string& crypt) const;
// Parses the Firefox password file content, decrypts the
// username/password and reads other related information.
diff --git a/chrome/browser/login_prompt_gtk.cc b/chrome/browser/login_prompt_gtk.cc
index 54d683b..adb3f1a 100644
--- a/chrome/browser/login_prompt_gtk.cc
+++ b/chrome/browser/login_prompt_gtk.cc
@@ -159,8 +159,8 @@ class LoginHandlerGtk : public LoginHandler,
// 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_);
}
diff --git a/chrome/browser/login_prompt_mac.mm b/chrome/browser/login_prompt_mac.mm
index 8a9e93c..4c3809a 100644
--- a/chrome/browser/login_prompt_mac.mm
+++ b/chrome/browser/login_prompt_mac.mm
@@ -124,8 +124,8 @@ class LoginHandlerMac : public LoginHandler,
// 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_);
}
diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc
index c948db2..ac6540c 100644
--- a/chrome/browser/password_manager/login_database.cc
+++ b/chrome/browser/password_manager/login_database.cc
@@ -139,13 +139,13 @@ bool LoginDatabase::AddLogin(const PasswordForm& form) {
s.bind_string(COLUMN_ORIGIN_URL, form.origin.spec());
s.bind_string(COLUMN_ACTION_URL, form.action.spec());
- s.bind_wstring(COLUMN_USERNAME_ELEMENT, form.username_element);
- s.bind_wstring(COLUMN_USERNAME_VALUE, form.username_value);
- s.bind_wstring(COLUMN_PASSWORD_ELEMENT, form.password_element);
+ s.bind_string16(COLUMN_USERNAME_ELEMENT, form.username_element);
+ s.bind_string16(COLUMN_USERNAME_VALUE, form.username_value);
+ s.bind_string16(COLUMN_PASSWORD_ELEMENT, form.password_element);
std::string encrypted_password = EncryptedString(form.password_value);
s.bind_blob(COLUMN_PASSWORD_VALUE, encrypted_password.data(),
static_cast<int>(encrypted_password.length()));
- s.bind_wstring(COLUMN_SUBMIT_ELEMENT, form.submit_element);
+ s.bind_string16(COLUMN_SUBMIT_ELEMENT, form.submit_element);
s.bind_string(COLUMN_SIGNON_REALM, form.signon_realm);
s.bind_int(COLUMN_SSL_VALID, form.ssl_valid);
s.bind_int(COLUMN_PREFERRED, form.preferred);
@@ -182,9 +182,9 @@ bool LoginDatabase::UpdateLogin(const PasswordForm& form, int* items_changed) {
s.bind_int(2, form.ssl_valid);
s.bind_int(3, form.preferred);
s.bind_string(4, form.origin.spec());
- s.bind_wstring(5, form.username_element);
- s.bind_wstring(6, form.username_value);
- s.bind_wstring(7, form.password_element);
+ s.bind_string16(5, form.username_element);
+ s.bind_string16(6, form.username_value);
+ s.bind_string16(7, form.password_element);
s.bind_string(8, form.signon_realm);
if (s.step() != SQLITE_DONE) {
@@ -213,10 +213,10 @@ bool LoginDatabase::RemoveLogin(const PasswordForm& form) {
}
s.bind_string(0, form.origin.spec());
- s.bind_wstring(1, form.username_element);
- s.bind_wstring(2, form.username_value);
- s.bind_wstring(3, form.password_element);
- s.bind_wstring(4, form.submit_element);
+ s.bind_string16(1, form.username_element);
+ s.bind_string16(2, form.username_value);
+ s.bind_string16(3, form.password_element);
+ s.bind_string16(4, form.submit_element);
s.bind_string(5, form.signon_realm);
if (s.step() != SQLITE_DONE) {
@@ -249,13 +249,13 @@ void LoginDatabase::InitPasswordFormFromStatement(PasswordForm* form,
form->origin = GURL(tmp);
s->column_string(COLUMN_ACTION_URL, &tmp);
form->action = GURL(tmp);
- s->column_wstring(COLUMN_USERNAME_ELEMENT, &form->username_element);
- s->column_wstring(COLUMN_USERNAME_VALUE, &form->username_value);
- s->column_wstring(COLUMN_PASSWORD_ELEMENT, &form->password_element);
+ s->column_string16(COLUMN_USERNAME_ELEMENT, &form->username_element);
+ s->column_string16(COLUMN_USERNAME_VALUE, &form->username_value);
+ s->column_string16(COLUMN_PASSWORD_ELEMENT, &form->password_element);
std::string encrypted_password;
s->column_blob_as_string(COLUMN_PASSWORD_VALUE, &encrypted_password);
form->password_value = DecryptedString(encrypted_password);
- s->column_wstring(COLUMN_SUBMIT_ELEMENT, &form->submit_element);
+ s->column_string16(COLUMN_SUBMIT_ELEMENT, &form->submit_element);
s->column_string(COLUMN_SIGNON_REALM, &tmp);
form->signon_realm = tmp;
form->ssl_valid = (s->column_int(COLUMN_SSL_VALID) > 0);
diff --git a/chrome/browser/password_manager/login_database.h b/chrome/browser/password_manager/login_database.h
index 9e34192..3db5ce3 100644
--- a/chrome/browser/password_manager/login_database.h
+++ b/chrome/browser/password_manager/login_database.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/string16.h"
#include "chrome/browser/meta_table_helper.h"
#include "webkit/glue/password_form.h"
@@ -61,10 +62,10 @@ class LoginDatabase {
protected:
// Returns an encrypted version of plain_text.
- virtual std::string EncryptedString(const std::wstring& plain_text) const = 0;
+ virtual std::string EncryptedString(const string16& plain_text) const = 0;
// Returns a decrypted version of cipher_text.
- virtual std::wstring DecryptedString(const std::string& cipher_text)
+ virtual string16 DecryptedString(const std::string& cipher_text)
const = 0;
bool InitLoginsTable();
diff --git a/chrome/browser/password_manager/login_database_mac.cc b/chrome/browser/password_manager/login_database_mac.cc
index fbef3ac..731f114 100644
--- a/chrome/browser/password_manager/login_database_mac.cc
+++ b/chrome/browser/password_manager/login_database_mac.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/password_manager/login_database_mac.h"
-std::string LoginDatabaseMac::EncryptedString(const std::wstring& plain_text)
+std::string LoginDatabaseMac::EncryptedString(const string16& plain_text)
const {
return std::string();
}
-std::wstring LoginDatabaseMac::DecryptedString(const std::string& cipher_text)
+string16 LoginDatabaseMac::DecryptedString(const std::string& cipher_text)
const {
- return std::wstring();
+ return string16();
}
diff --git a/chrome/browser/password_manager/login_database_mac.h b/chrome/browser/password_manager/login_database_mac.h
index 8683179..9c6e93e 100644
--- a/chrome/browser/password_manager/login_database_mac.h
+++ b/chrome/browser/password_manager/login_database_mac.h
@@ -19,8 +19,8 @@ class LoginDatabaseMac : public LoginDatabase {
protected:
// Stub implementations that always return an empty string.
- virtual std::string EncryptedString(const std::wstring& plain_text) const;
- virtual std::wstring DecryptedString(const std::string& cipher_text) const;
+ virtual std::string EncryptedString(const string16& plain_text) const;
+ virtual string16 DecryptedString(const std::string& cipher_text) const;
};
diff --git a/chrome/browser/password_manager/login_database_unittest.cc b/chrome/browser/password_manager/login_database_unittest.cc
index 201c93f..beb439a 100644
--- a/chrome/browser/password_manager/login_database_unittest.cc
+++ b/chrome/browser/password_manager/login_database_unittest.cc
@@ -63,11 +63,11 @@ TEST_F(LoginDatabaseTest, Logins) {
PasswordForm form;
form.origin = GURL("http://www.google.com/accounts/LoginAuth");
form.action = GURL("http://www.google.com/accounts/Login");
- form.username_element = L"Email";
- form.username_value = L"test@gmail.com";
- form.password_element = L"Passwd";
- form.password_value = L"test";
- form.submit_element = L"signIn";
+ form.username_element = ASCIIToUTF16("Email");
+ form.username_value = ASCIIToUTF16("test@gmail.com");
+ form.password_element = ASCIIToUTF16("Passwd");
+ form.password_value = ASCIIToUTF16("test");
+ form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = "http://www.google.com/";
form.ssl_valid = false;
form.preferred = false;
@@ -89,7 +89,7 @@ TEST_F(LoginDatabaseTest, Logins) {
// The example site changes...
PasswordForm form2(form);
form2.origin = GURL("http://www.google.com/new/accounts/LoginAuth");
- form2.submit_element = L"reallySignIn";
+ form2.submit_element = ASCIIToUTF16("reallySignIn");
// Match against an inexact copy
EXPECT_TRUE(db->GetLogins(form2, &result));
@@ -154,7 +154,7 @@ TEST_F(LoginDatabaseTest, Logins) {
// User changes his password.
PasswordForm form6(form5);
- form6.password_value = L"test6";
+ form6.password_value = ASCIIToUTF16("test6");
form6.preferred = true;
// We update, and check to make sure it matches the
@@ -173,7 +173,7 @@ TEST_F(LoginDatabaseTest, Logins) {
// Password element was updated.
#if defined(OS_MACOSX)
// On the Mac we should never be storing passwords in the database.
- EXPECT_EQ(L"", result[0]->password_value);
+ EXPECT_EQ(string16(), result[0]->password_value);
#else
EXPECT_EQ(form6.password_value, result[0]->password_value);
#endif
@@ -189,15 +189,15 @@ TEST_F(LoginDatabaseTest, Logins) {
}
static bool AddTimestampedLogin(LoginDatabase* db, std::string url,
- std::wstring unique_string,
+ const std::string& unique_string,
const base::Time& time) {
// Example password form.
PasswordForm form;
form.origin = GURL(url + std::string("/LoginAuth"));
- form.username_element = unique_string.c_str();
- form.username_value = unique_string.c_str();
- form.password_element = unique_string.c_str();
- form.submit_element = L"signIn";
+ form.username_element = ASCIIToUTF16(unique_string);
+ form.username_value = ASCIIToUTF16(unique_string);
+ form.password_element = ASCIIToUTF16(unique_string);
+ form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = url;
form.date_created = time;
return db->AddLogin(form);
@@ -227,11 +227,11 @@ TEST_F(LoginDatabaseTest, ClearPrivateData_SavedPasswords) {
base::TimeDelta one_day = base::TimeDelta::FromDays(1);
// Create one with a 0 time.
- EXPECT_TRUE(AddTimestampedLogin(db.get(), "1", L"foo1", base::Time()));
+ EXPECT_TRUE(AddTimestampedLogin(db.get(), "1", "foo1", base::Time()));
// Create one for now and +/- 1 day.
- EXPECT_TRUE(AddTimestampedLogin(db.get(), "2", L"foo2", now - one_day));
- EXPECT_TRUE(AddTimestampedLogin(db.get(), "3", L"foo3", now));
- EXPECT_TRUE(AddTimestampedLogin(db.get(), "4", L"foo4", now + one_day));
+ EXPECT_TRUE(AddTimestampedLogin(db.get(), "2", "foo2", now - one_day));
+ EXPECT_TRUE(AddTimestampedLogin(db.get(), "3", "foo3", now));
+ EXPECT_TRUE(AddTimestampedLogin(db.get(), "4", "foo4", now + one_day));
// Verify inserts worked.
EXPECT_TRUE(db->GetAutofillableLogins(&result));
@@ -270,9 +270,9 @@ TEST_F(LoginDatabaseTest, BlacklistedLogins) {
PasswordForm form;
form.origin = GURL("http://www.google.com/accounts/LoginAuth");
form.action = GURL("http://www.google.com/accounts/Login");
- form.username_element = L"Email";
- form.password_element = L"Passwd";
- form.submit_element = L"signIn";
+ form.username_element = ASCIIToUTF16("Email");
+ form.password_element = ASCIIToUTF16("Passwd");
+ form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = "http://www.google.com/";
form.ssl_valid = false;
form.preferred = true;
diff --git a/chrome/browser/password_manager/password_form_manager_unittest.cc b/chrome/browser/password_manager/password_form_manager_unittest.cc
index 30c4faa..b3f4bb6 100644
--- a/chrome/browser/password_manager/password_form_manager_unittest.cc
+++ b/chrome/browser/password_manager/password_form_manager_unittest.cc
@@ -19,17 +19,17 @@ class PasswordFormManagerTest : public testing::Test {
virtual void SetUp() {
observed_form_.origin = GURL("http://www.google.com/a/LoginAuth");
observed_form_.action = GURL("http://www.google.com/a/Login");
- observed_form_.username_element = L"Email";
- observed_form_.password_element = L"Passwd";
- observed_form_.submit_element = L"signIn";
+ observed_form_.username_element = ASCIIToUTF16("Email");
+ observed_form_.password_element = ASCIIToUTF16("Passwd");
+ observed_form_.submit_element = ASCIIToUTF16("signIn");
observed_form_.signon_realm = "http://www.google.com";
saved_match_ = observed_form_;
saved_match_.origin = GURL("http://www.google.com/a/ServiceLoginAuth");
saved_match_.action = GURL("http://www.google.com/a/ServiceLogin");
saved_match_.preferred = true;
- saved_match_.username_value = L"test@gmail.com";
- saved_match_.password_value = L"test1";
+ saved_match_.username_value = ASCIIToUTF16("test@gmail.com");
+ saved_match_.password_value = ASCIIToUTF16("test1");
profile_ = new TestingProfile();
}
@@ -65,7 +65,6 @@ class PasswordFormManagerTest : public testing::Test {
private:
PasswordForm observed_form_;
PasswordForm saved_match_;
- std::wstring test_dir_;
Profile* profile_;
};
@@ -100,8 +99,8 @@ TEST_F(PasswordFormManagerTest, TestNewLogin) {
// will yield the previously saved login.
SimulateMatchingPhase(manager, true);
// Set up the new login.
- std::wstring new_user = L"newuser";
- std::wstring new_pass = L"newpass";
+ string16 new_user = ASCIIToUTF16("newuser");
+ string16 new_pass = ASCIIToUTF16("newpass");
credentials.username_value = new_user;
credentials.password_value = new_pass;
manager->ProvisionallySave(credentials);
@@ -134,7 +133,7 @@ TEST_F(PasswordFormManagerTest, TestUpdatePassword) {
// origin URL (as it does in this case) than the saved_match, but we want to
// make sure the updated password is reflected in saved_match, because that is
// what we autofilled.
- std::wstring new_pass = L"newpassword";
+ string16 new_pass = ASCIIToUTF16("newpassword");
PasswordForm credentials = *observed_form();
credentials.username_value = saved_match()->username_value;
credentials.password_value = new_pass;
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index 58c4afd..da00ed7 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -240,8 +240,9 @@ void PasswordManager::Autofill(
}
default:
if (observer_) {
- observer_->OnAutofillDataAvailable(preferred_match->username_value,
- preferred_match->password_value);
+ observer_->OnAutofillDataAvailable(
+ UTF16ToWideHack(preferred_match->username_value),
+ UTF16ToWideHack(preferred_match->password_value));
}
}
}
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 594478a..3102938 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -258,8 +258,8 @@ bool FillPasswordFormFromKeychainItem(const MacKeychain& keychain,
return false;
}
- UTF8ToWide(static_cast<const char *>(password_data), password_length,
- &(form->password_value));
+ UTF8ToUTF16(static_cast<const char *>(password_data), password_length,
+ &(form->password_value));
int port = kAnyPort;
std::string server;
@@ -272,8 +272,8 @@ bool FillPasswordFormFromKeychainItem(const MacKeychain& keychain,
}
switch (attr.tag) {
case kSecAccountItemAttr:
- UTF8ToWide(static_cast<const char *>(attr.data), attr.length,
- &(form->username_value));
+ UTF8ToUTF16(static_cast<const char *>(attr.data), attr.length,
+ &(form->username_value));
break;
case kSecServerItemAttr:
server.assign(static_cast<const char *>(attr.data), attr.length);
@@ -321,7 +321,7 @@ bool FillPasswordFormFromKeychainItem(const MacKeychain& keychain,
// kSecNegativeItemAttr doesn't seem to actually be in widespread use. In
// practice, other browsers seem to use a "" or " " password (and a special
// user name) to indicated blacklist entries.
- if (form->password_value.empty() || form->password_value == L" ") {
+ if (form->password_value.empty() || EqualsASCII(form->password_value, " ")) {
form->blacklisted_by_user = true;
}
@@ -477,7 +477,7 @@ std::vector<PasswordForm*>
std::vector<PasswordForm*>
MacKeychainPasswordFormAdapter::PasswordsMergeableWithForm(
const PasswordForm& query_form) {
- std::string username = WideToUTF8(query_form.username_value);
+ std::string username = UTF16ToUTF8(query_form.username_value);
std::vector<SecKeychainItemRef> keychain_items =
MatchingKeychainItems(query_form.signon_realm, query_form.scheme,
NULL, username.c_str());
@@ -530,8 +530,8 @@ bool MacKeychainPasswordFormAdapter::AddPassword(const PasswordForm& form) {
&is_secure, &security_domain)) {
return false;
}
- std::string username = WideToUTF8(form.username_value);
- std::string password = WideToUTF8(form.password_value);
+ std::string username = UTF16ToUTF8(form.username_value);
+ std::string password = UTF16ToUTF8(form.password_value);
std::string path = form.origin.path();
SecProtocolType protocol = is_secure ? kSecProtocolTypeHTTPS
: kSecProtocolTypeHTTP;
@@ -601,7 +601,7 @@ SecKeychainItemRef MacKeychainPasswordFormAdapter::KeychainItemForForm(
}
std::string path = form.origin.path();
- std::string username = WideToUTF8(form.username_value);
+ std::string username = UTF16ToUTF8(form.username_value);
std::vector<SecKeychainItemRef> matches = MatchingKeychainItems(
form.signon_realm, form.scheme, path.c_str(), username.c_str());
diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc
index 6eeeac7..8591b86 100644
--- a/chrome/browser/password_manager/password_store_mac_unittest.cc
+++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/stl_util-inl.h"
+#include "base/string_util.h"
#include "chrome/browser/keychain_mock_mac.h"
#include "chrome/browser/password_manager/password_store_mac.h"
#include "chrome/browser/password_manager/password_store_mac_internal.h"
@@ -123,15 +124,15 @@ static PasswordForm* CreatePasswordFormFromData(
if (form_data.action)
form->action = GURL(form_data.action);
if (form_data.submit_element)
- form->submit_element = std::wstring(form_data.submit_element);
+ form->submit_element = WideToUTF16(form_data.submit_element);
if (form_data.username_element)
- form->username_element = std::wstring(form_data.username_element);
+ form->username_element = WideToUTF16(form_data.username_element);
if (form_data.password_element)
- form->password_element = std::wstring(form_data.password_element);
+ form->password_element = WideToUTF16(form_data.password_element);
if (form_data.username_value) {
- form->username_value = std::wstring(form_data.username_value);
+ form->username_value = WideToUTF16(form_data.username_value);
if (form_data.password_value)
- form->password_value = std::wstring(form_data.password_value);
+ form->password_value = WideToUTF16(form_data.password_value);
} else {
form->blacklisted_by_user = true;
}
@@ -168,16 +169,16 @@ static void CheckFormsAgainstExpectations(
<< test_label;
EXPECT_EQ(GURL(expectation->origin), form->origin) << test_label;
EXPECT_EQ(GURL(expectation->action), form->action) << test_label;
- EXPECT_EQ(std::wstring(expectation->submit_element), form->submit_element)
+ EXPECT_EQ(WideToUTF16(expectation->submit_element), form->submit_element)
<< test_label;
- EXPECT_EQ(std::wstring(expectation->username_element),
+ EXPECT_EQ(WideToUTF16(expectation->username_element),
form->username_element) << test_label;
- EXPECT_EQ(std::wstring(expectation->password_element),
+ EXPECT_EQ(WideToUTF16(expectation->password_element),
form->password_element) << test_label;
if (expectation->username_value) {
- EXPECT_EQ(std::wstring(expectation->username_value),
+ EXPECT_EQ(WideToUTF16(expectation->username_value),
form->username_value) << test_label;
- EXPECT_EQ(std::wstring(expectation->password_value),
+ EXPECT_EQ(WideToUTF16(expectation->password_value),
form->password_value) << test_label;
} else {
EXPECT_TRUE(form->blacklisted_by_user) << test_label;
@@ -255,9 +256,9 @@ TEST_F(PasswordStoreMacTest, TestKeychainToFormTranslation) {
EXPECT_EQ(std::string(expected[i].signon_realm), form.signon_realm)
<< "In iteration " << i;
if (expected[i].username) {
- EXPECT_EQ(std::wstring(expected[i].username), form.username_value)
+ EXPECT_EQ(WideToUTF16(expected[i].username), form.username_value)
<< "In iteration " << i;
- EXPECT_EQ(std::wstring(expected[i].password), form.password_value)
+ EXPECT_EQ(WideToUTF16(expected[i].password), form.password_value)
<< "In iteration " << i;
EXPECT_FALSE(form.blacklisted_by_user) << "In iteration " << i;
} else {
@@ -423,7 +424,7 @@ TEST_F(PasswordStoreMacTest, TestKeychainExactSearch) {
std::vector<PasswordForm*> modified_forms;
modified_forms.push_back(new PasswordForm(*base_form));
- modified_forms.back()->username_value = std::wstring(L"wrong_user");
+ modified_forms.back()->username_value = ASCIIToUTF16("wrong_user");
modified_forms.push_back(new PasswordForm(*base_form));
SetPasswordFormPath(modified_forms.back(), "elsewhere.html");
@@ -565,15 +566,15 @@ TEST_F(PasswordStoreMacTest, TestFormMatch) {
PasswordForm base_form;
base_form.signon_realm = std::string("http://some.domain.com/");
base_form.origin = GURL("http://some.domain.com/page.html");
- base_form.username_value = std::wstring(L"joe_user");
+ base_form.username_value = ASCIIToUTF16("joe_user");
{
// Check that everything unimportant can be changed.
PasswordForm different_form(base_form);
- different_form.username_element = std::wstring(L"username");
- different_form.submit_element = std::wstring(L"submit");
- different_form.username_element = std::wstring(L"password");
- different_form.password_value = std::wstring(L"sekrit");
+ different_form.username_element = ASCIIToUTF16("username");
+ different_form.submit_element = ASCIIToUTF16("submit");
+ different_form.username_element = ASCIIToUTF16("password");
+ different_form.password_value = ASCIIToUTF16("sekrit");
different_form.action = GURL("http://some.domain.com/action.cgi");
different_form.ssl_valid = true;
different_form.preferred = true;
@@ -602,7 +603,7 @@ TEST_F(PasswordStoreMacTest, TestFormMatch) {
}
{
PasswordForm different_form(base_form);
- different_form.username_value = std::wstring(L"john.doe");
+ different_form.username_value = ASCIIToUTF16("john.doe");
EXPECT_FALSE(internal_keychain_helpers::FormsMatchForMerge(base_form,
different_form));
}
@@ -813,8 +814,8 @@ TEST_F(PasswordStoreMacTest, TestPasswordBulkLookup) {
&database_forms);
EXPECT_EQ(2U, database_forms.size());
ASSERT_EQ(3U, merged_forms.size());
- EXPECT_EQ(std::wstring(L"sekrit"), merged_forms[0]->password_value);
- EXPECT_EQ(std::wstring(L"sekrit"), merged_forms[1]->password_value);
+ EXPECT_EQ(ASCIIToUTF16("sekrit"), merged_forms[0]->password_value);
+ EXPECT_EQ(ASCIIToUTF16("sekrit"), merged_forms[1]->password_value);
EXPECT_EQ(true, merged_forms[2]->blacklisted_by_user);
STLDeleteElements(&database_forms);
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 43c7c27..a5ffec0 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -802,7 +802,7 @@ void TabContents::CreateShortcut() {
// effectively cancel the pending install request.
pending_install_.page_id = entry->page_id();
pending_install_.icon = GetFavIcon();
- pending_install_.title = UTF16ToWideHack(GetTitle());
+ pending_install_.title = GetTitle();
pending_install_.url = GetURL();
if (pending_install_.callback_functor) {
pending_install_.callback_functor->Cancel();
@@ -810,7 +810,7 @@ void TabContents::CreateShortcut() {
}
DCHECK(!pending_install_.icon.isNull()) << "Menu item should be disabled.";
if (pending_install_.title.empty())
- pending_install_.title = UTF8ToWide(GetURL().spec());
+ pending_install_.title = UTF8ToUTF16(GetURL().spec());
// Request the application info. When done OnDidGetApplicationInfo is invoked
// and we'll create the shortcut.
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 47b4243..7aa1f7f 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -670,7 +670,7 @@ class TabContents : public PageNavigator,
struct PendingInstall {
int32 page_id;
SkBitmap icon;
- std::wstring title;
+ string16 title;
GURL url;
// This object receives the GearsCreateShortcutCallback and routes the
// message back to the TabContents, if we haven't been deleted.
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index a1ba12d..3be6268 100644
--- a/chrome/browser/webdata/web_database.cc
+++ b/chrome/browser/webdata/web_database.cc
@@ -596,14 +596,13 @@ bool WebDatabase::AddLogin(const PasswordForm& form) {
std::string encrypted_password;
s.BindString(0, form.origin.spec());
s.BindString(1, form.action.spec());
- s.BindString(2, WideToUTF8(form.username_element));
- s.BindString(3, WideToUTF8(form.username_value));
- s.BindString(4, WideToUTF8(form.password_element));
- Encryptor::EncryptString16(WideToUTF16Hack(form.password_value),
- &encrypted_password);
+ s.BindString(2, UTF16ToUTF8(form.username_element));
+ s.BindString(3, UTF16ToUTF8(form.username_value));
+ s.BindString(4, UTF16ToUTF8(form.password_element));
+ Encryptor::EncryptString16(form.password_value, &encrypted_password);
s.BindBlob(5, encrypted_password.data(),
static_cast<int>(encrypted_password.length()));
- s.BindString(6, WideToUTF8(form.submit_element));
+ s.BindString(6, UTF16ToUTF8(form.submit_element));
s.BindString(7, form.signon_realm);
s.BindInt(8, form.ssl_valid);
s.BindInt(9, form.preferred);
@@ -636,16 +635,15 @@ bool WebDatabase::UpdateLogin(const PasswordForm& form) {
s.BindString(0, form.action.spec());
std::string encrypted_password;
- Encryptor::EncryptString16(WideToUTF16Hack(form.password_value),
- &encrypted_password);
+ Encryptor::EncryptString16(form.password_value, &encrypted_password);
s.BindBlob(1, encrypted_password.data(),
static_cast<int>(encrypted_password.length()));
s.BindInt(2, form.ssl_valid);
s.BindInt(3, form.preferred);
s.BindString(4, form.origin.spec());
- s.BindString(5, WideToUTF8(form.username_element));
- s.BindString(6, WideToUTF8(form.username_value));
- s.BindString(7, WideToUTF8(form.password_element));
+ s.BindString(5, UTF16ToUTF8(form.username_element));
+ s.BindString(6, UTF16ToUTF8(form.username_value));
+ s.BindString(7, UTF16ToUTF8(form.password_element));
s.BindString(8, form.signon_realm);
if (!s.Run()) {
@@ -670,10 +668,10 @@ bool WebDatabase::RemoveLogin(const PasswordForm& form) {
return false;
}
s.BindString(0, form.origin.spec());
- s.BindString(1, WideToUTF8(form.username_element));
- s.BindString(2, WideToUTF8(form.username_value));
- s.BindString(3, WideToUTF8(form.password_element));
- s.BindString(4, WideToUTF8(form.submit_element));
+ s.BindString(1, UTF16ToUTF8(form.username_element));
+ s.BindString(2, UTF16ToUTF8(form.username_value));
+ s.BindString(3, UTF16ToUTF8(form.password_element));
+ s.BindString(4, UTF16ToUTF8(form.submit_element));
s.BindString(5, form.signon_realm);
if (!s.Run()) {
@@ -725,9 +723,9 @@ static void InitPasswordFormFromStatement(PasswordForm* form,
form->origin = GURL(tmp);
tmp = s->ColumnString(1);
form->action = GURL(tmp);
- form->username_element = UTF8ToWide(s->ColumnString(2));
- form->username_value = UTF8ToWide(s->ColumnString(3));
- form->password_element = UTF8ToWide(s->ColumnString(4));
+ form->username_element = UTF8ToUTF16(s->ColumnString(2));
+ form->username_value = UTF8ToUTF16(s->ColumnString(3));
+ form->password_element = UTF8ToUTF16(s->ColumnString(4));
int encrypted_password_len = s->ColumnByteLength(5);
std::string encrypted_password;
@@ -737,8 +735,8 @@ static void InitPasswordFormFromStatement(PasswordForm* form,
Encryptor::DecryptString16(encrypted_password, &decrypted_password);
}
- form->password_value = UTF16ToWideHack(decrypted_password);
- form->submit_element = UTF8ToWide(s->ColumnString(6));
+ form->password_value = decrypted_password;
+ form->submit_element = UTF8ToUTF16(s->ColumnString(6));
tmp = s->ColumnString(7);
form->signon_realm = tmp;
form->ssl_valid = (s->ColumnInt(8) > 0);
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc
index fcfee84..1d7569b 100644
--- a/chrome/browser/webdata/web_database_unittest.cc
+++ b/chrome/browser/webdata/web_database_unittest.cc
@@ -264,11 +264,11 @@ TEST_F(WebDatabaseTest, Logins) {
PasswordForm form;
form.origin = GURL("http://www.google.com/accounts/LoginAuth");
form.action = GURL("http://www.google.com/accounts/Login");
- form.username_element = L"Email";
- form.username_value = L"test@gmail.com";
- form.password_element = L"Passwd";
- form.password_value = L"test";
- form.submit_element = L"signIn";
+ form.username_element = ASCIIToUTF16("Email");
+ form.username_value = ASCIIToUTF16("test@gmail.com");
+ form.password_element = ASCIIToUTF16("Passwd");
+ form.password_value = ASCIIToUTF16("test");
+ form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = "http://www.google.com/";
form.ssl_valid = false;
form.preferred = false;
@@ -290,7 +290,7 @@ TEST_F(WebDatabaseTest, Logins) {
// The example site changes...
PasswordForm form2(form);
form2.origin = GURL("http://www.google.com/new/accounts/LoginAuth");
- form2.submit_element = L"reallySignIn";
+ form2.submit_element = ASCIIToUTF16("reallySignIn");
// Match against an inexact copy
EXPECT_TRUE(db.GetLogins(form2, &result));
@@ -355,7 +355,7 @@ TEST_F(WebDatabaseTest, Logins) {
// User changes his password.
PasswordForm form6(form5);
- form6.password_value = L"test6";
+ form6.password_value = ASCIIToUTF16("test6");
form6.preferred = true;
// We update, and check to make sure it matches the
@@ -508,14 +508,15 @@ TEST_F(WebDatabaseTest, Autofill) {
}
static bool AddTimestampedLogin(WebDatabase* db, std::string url,
- std::wstring unique_string, const Time& time) {
+ const std::string& unique_string,
+ const Time& time) {
// Example password form.
PasswordForm form;
form.origin = GURL(url + std::string("/LoginAuth"));
- form.username_element = unique_string.c_str();
- form.username_value = unique_string.c_str();
- form.password_element = unique_string.c_str();
- form.submit_element = L"signIn";
+ form.username_element = ASCIIToUTF16(unique_string);
+ form.username_value = ASCIIToUTF16(unique_string);
+ form.password_element = ASCIIToUTF16(unique_string);
+ form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = url;
form.date_created = time;
return db->AddLogin(form);
@@ -543,11 +544,11 @@ TEST_F(WebDatabaseTest, ClearPrivateData_SavedPasswords) {
TimeDelta one_day = TimeDelta::FromDays(1);
// Create one with a 0 time.
- EXPECT_TRUE(AddTimestampedLogin(&db, "1", L"foo1", Time()));
+ EXPECT_TRUE(AddTimestampedLogin(&db, "1", "foo1", Time()));
// Create one for now and +/- 1 day.
- EXPECT_TRUE(AddTimestampedLogin(&db, "2", L"foo2", now - one_day));
- EXPECT_TRUE(AddTimestampedLogin(&db, "3", L"foo3", now));
- EXPECT_TRUE(AddTimestampedLogin(&db, "4", L"foo4", now + one_day));
+ EXPECT_TRUE(AddTimestampedLogin(&db, "2", "foo2", now - one_day));
+ EXPECT_TRUE(AddTimestampedLogin(&db, "3", "foo3", now));
+ EXPECT_TRUE(AddTimestampedLogin(&db, "4", "foo4", now + one_day));
// Verify inserts worked.
EXPECT_TRUE(db.GetAllLogins(&result, true));
@@ -584,9 +585,9 @@ TEST_F(WebDatabaseTest, BlacklistedLogins) {
PasswordForm form;
form.origin = GURL("http://www.google.com/accounts/LoginAuth");
form.action = GURL("http://www.google.com/accounts/Login");
- form.username_element = L"Email";
- form.password_element = L"Passwd";
- form.submit_element = L"signIn";
+ form.username_element = ASCIIToUTF16("Email");
+ form.password_element = ASCIIToUTF16("Passwd");
+ form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = "http://www.google.com/";
form.ssl_valid = false;
form.preferred = true;