summaryrefslogtreecommitdiffstats
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
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
-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
-rw-r--r--chrome/common/sqlite_utils.cc14
-rw-r--r--chrome/common/sqlite_utils.h10
-rw-r--r--webkit/glue/dom_operations.cc29
-rw-r--r--webkit/glue/dom_operations.h6
-rw-r--r--webkit/glue/dom_operations_unittest.cc36
-rw-r--r--webkit/glue/form_data.h6
-rw-r--r--webkit/glue/password_autocomplete_listener.cc26
-rw-r--r--webkit/glue/password_autocomplete_listener_unittest.cc7
-rw-r--r--webkit/glue/password_form.h16
-rw-r--r--webkit/glue/password_form_dom_manager.cc16
-rw-r--r--webkit/glue/password_form_dom_manager.h2
36 files changed, 262 insertions, 240 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;
diff --git a/chrome/common/sqlite_utils.cc b/chrome/common/sqlite_utils.cc
index 4b47acd..0fd8397 100644
--- a/chrome/common/sqlite_utils.cc
+++ b/chrome/common/sqlite_utils.cc
@@ -475,6 +475,20 @@ const char16* SQLStatement::column_text16(int index) {
return static_cast<const char16*>(sqlite3_column_text16(stmt_, index));
}
+bool SQLStatement::column_string16(int index, string16* str) {
+ DCHECK(stmt_);
+ DCHECK(str);
+ const char* s = column_text(index);
+ str->assign(s ? UTF8ToUTF16(s) : string16());
+ return (s != NULL);
+}
+
+string16 SQLStatement::column_string16(int index) {
+ string16 str;
+ column_string16(index, &str);
+ return str;
+}
+
bool SQLStatement::column_wstring(int index, std::wstring* str) {
DCHECK(stmt_);
DCHECK(str);
diff --git a/chrome/common/sqlite_utils.h b/chrome/common/sqlite_utils.h
index 615708f..ece02f1 100644
--- a/chrome/common/sqlite_utils.h
+++ b/chrome/common/sqlite_utils.h
@@ -291,6 +291,14 @@ class SQLStatement : public scoped_sqlite3_stmt_ptr {
static_cast<int>(value.length()), SQLITE_TRANSIENT);
}
+ int bind_string16(int index, const string16& value) {
+ // don't use c_str so it doesn't have to fix up the null terminator
+ // (sqlite just uses the length)
+ std::string value_utf8(UTF16ToUTF8(value));
+ return bind_text(index, value_utf8.data(),
+ static_cast<int>(value_utf8.length()), SQLITE_TRANSIENT);
+ }
+
int bind_wstring(int index, const std::wstring& value) {
// don't use c_str so it doesn't have to fix up the null terminator
// (sqlite just uses the length)
@@ -350,6 +358,8 @@ class SQLStatement : public scoped_sqlite3_stmt_ptr {
bool column_string(int index, std::string* str);
std::string column_string(int index);
const char16* column_text16(int index);
+ bool column_string16(int index, string16* str);
+ string16 column_string16(int index);
bool column_wstring(int index, std::wstring* str);
std::wstring column_wstring(int index);
diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc
index 9e99d0d..31862d1 100644
--- a/webkit/glue/dom_operations.cc
+++ b/webkit/glue/dom_operations.cc
@@ -179,7 +179,7 @@ namespace webkit_glue {
// Map element name to a list of pointers to corresponding elements to simplify
// form filling.
-typedef std::map<std::wstring, RefPtr<WebCore::HTMLInputElement> >
+typedef std::map<string16, RefPtr<WebCore::HTMLInputElement> >
FormElementRefMap;
// Utility struct for form lookup and autofill. When we parse the DOM to lookup
@@ -201,7 +201,7 @@ static bool FillFormImpl(FormElements* fe, const FormData& data, bool submit) {
if (!fe->form_element->autoComplete())
return false;
- std::map<std::wstring, std::wstring> data_map;
+ std::map<string16, string16> data_map;
for (unsigned int i = 0; i < data.elements.size(); i++) {
data_map[data.elements[i]] = data.values[i];
}
@@ -216,7 +216,7 @@ static bool FillFormImpl(FormElements* fe, const FormData& data, bool submit) {
}
if (!it->second->value().isEmpty()) // Don't overwrite pre-filled values.
continue;
- it->second->setValue(StdWStringToString(data_map[it->first]));
+ it->second->setValue(String16ToString(data_map[it->first]));
it->second->setAutofilled(true);
it->second->dispatchFormControlChangeEvent();
}
@@ -238,8 +238,7 @@ static bool FindFormInputElements(WebCore::HTMLFormElement* fe,
// order to autofill it. If we don't find any one of them, abort
// processing this form; it can't be the right one.
for (size_t j = 0; j < data.elements.size(); j++, temp_elements.clear()) {
- fe->getNamedElements(StdWStringToString(data.elements[j]),
- temp_elements);
+ fe->getNamedElements(String16ToString(data.elements[j]), temp_elements);
if (temp_elements.isEmpty()) {
// We didn't find a required element. This is not the right form.
// Make sure no input elements from a partially matched form
@@ -587,7 +586,7 @@ bool GetAllSavableResourceLinksForCurrentPage(WebView* view,
// Sizes a single size (the width or height) from a 'sizes' attribute. A size
// matches must match the following regex: [1-9][0-9]*.
-static int ParseSingleIconSize(const std::wstring& text) {
+static int ParseSingleIconSize(const string16& text) {
// Size must not start with 0, and be between 0 and 9.
if (text.empty() || !(text[0] >= L'1' && text[0] <= L'9'))
return 0;
@@ -597,7 +596,7 @@ static int ParseSingleIconSize(const std::wstring& text) {
return 0;
}
int output;
- if (!StringToInt(WideToUTF16Hack(text), &output))
+ if (!StringToInt(text, &output))
return 0;
return output;
}
@@ -605,8 +604,8 @@ static int ParseSingleIconSize(const std::wstring& text) {
// Parses an icon size. An icon size must match the following regex:
// [1-9][0-9]*x[1-9][0-9]*.
// If the input couldn't be parsed, a size with a width/height < 0 is returned.
-static gfx::Size ParseIconSize(const std::wstring& text) {
- std::vector<std::wstring> sizes;
+static gfx::Size ParseIconSize(const string16& text) {
+ std::vector<string16> sizes;
SplitStringDontTrim(text, L'x', &sizes);
if (sizes.size() != 2)
return gfx::Size();
@@ -615,14 +614,14 @@ static gfx::Size ParseIconSize(const std::wstring& text) {
ParseSingleIconSize(sizes[1]));
}
-bool ParseIconSizes(const std::wstring& text,
+bool ParseIconSizes(const string16& text,
std::vector<gfx::Size>* sizes,
bool* is_any) {
*is_any = false;
- std::vector<std::wstring> size_strings;
+ std::vector<string16> size_strings;
SplitStringAlongWhitespace(text, &size_strings);
for (size_t i = 0; i < size_strings.size(); ++i) {
- if (size_strings[i] == L"any") {
+ if (EqualsASCII(size_strings[i], "any")) {
*is_any = true;
} else {
gfx::Size size = ParseIconSize(size_strings[i]);
@@ -654,7 +653,7 @@ static void AddInstallIcon(WebCore::HTMLLinkElement* link,
bool is_any = false;
std::vector<gfx::Size> icon_sizes;
- if (!ParseIconSizes(webkit_glue::StringToStdWString(
+ if (!ParseIconSizes(webkit_glue::StringToString16(
link->getAttribute(sizes_attr)), &icon_sizes, &is_any) || is_any ||
icon_sizes.size() != 1) {
return;
@@ -692,10 +691,10 @@ void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info) {
child, WebCore::HTMLNames::metaTag);
if (meta) {
if (meta->name() == String("application-name")) {
- app_info->title = webkit_glue::StringToStdWString(meta->content());
+ app_info->title = webkit_glue::StringToString16(meta->content());
} else if (meta->name() == String("description")) {
app_info->description =
- webkit_glue::StringToStdWString(meta->content());
+ webkit_glue::StringToString16(meta->content());
} else if (meta->name() == String("application-url")) {
std::string url = webkit_glue::StringToStdString(meta->content());
GURL main_url = main_frame->url();
diff --git a/webkit/glue/dom_operations.h b/webkit/glue/dom_operations.h
index 26dbabe..af61698 100644
--- a/webkit/glue/dom_operations.h
+++ b/webkit/glue/dom_operations.h
@@ -74,11 +74,11 @@ struct WebApplicationInfo {
// Title of the application. This is set from the meta tag whose name is
// 'application-name'.
- std::wstring title;
+ string16 title;
// Description of the application. This is set from the meta tag whose name
// is 'description'.
- std::wstring description;
+ string16 description;
// URL for the app. This is set from the meta tag whose name is
// 'application-url'.
@@ -94,7 +94,7 @@ struct WebApplicationInfo {
// the attribute are added to sizes, or is_any is set to true.
//
// You shouldn't have a need to invoke this directly, it's public for testing.
-bool ParseIconSizes(const std::wstring& text,
+bool ParseIconSizes(const string16& text,
std::vector<gfx::Size>* sizes,
bool* is_any);
diff --git a/webkit/glue/dom_operations_unittest.cc b/webkit/glue/dom_operations_unittest.cc
index 5cfd9d3..e744c14 100644
--- a/webkit/glue/dom_operations_unittest.cc
+++ b/webkit/glue/dom_operations_unittest.cc
@@ -130,7 +130,7 @@ TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasInvalidLinks) {
// Tests ParseIconSizes with various input.
TEST_F(DomOperationsTests, ParseIconSizes) {
struct TestData {
- const std::wstring input;
+ const char* input;
const bool expected_result;
const bool is_any;
const size_t expected_size_count;
@@ -140,31 +140,31 @@ TEST_F(DomOperationsTests, ParseIconSizes) {
const int height2;
} data[] = {
// Bogus input cases.
- { L"10", false, false, 0, 0, 0, 0, 0 },
- { L"10 10", false, false, 0, 0, 0, 0, 0 },
- { L"010", false, false, 0, 0, 0, 0, 0 },
- { L" 010 ", false, false, 0, 0, 0, 0, 0 },
- { L" 10x ", false, false, 0, 0, 0, 0, 0 },
- { L" x10 ", false, false, 0, 0, 0, 0, 0 },
- { L"any 10x10", false, false, 0, 0, 0, 0, 0 },
- { L"", false, false, 0, 0, 0, 0, 0 },
- { L"10ax11", false, false, 0, 0, 0, 0, 0 },
+ { "10", false, false, 0, 0, 0, 0, 0 },
+ { "10 10", false, false, 0, 0, 0, 0, 0 },
+ { "010", false, false, 0, 0, 0, 0, 0 },
+ { " 010 ", false, false, 0, 0, 0, 0, 0 },
+ { " 10x ", false, false, 0, 0, 0, 0, 0 },
+ { " x10 ", false, false, 0, 0, 0, 0, 0 },
+ { "any 10x10", false, false, 0, 0, 0, 0, 0 },
+ { "", false, false, 0, 0, 0, 0, 0 },
+ { "10ax11", false, false, 0, 0, 0, 0, 0 },
// Any.
- { L"any", true, true, 0, 0, 0, 0, 0 },
- { L" any", true, true, 0, 0, 0, 0, 0 },
- { L" any ", true, true, 0, 0, 0, 0, 0 },
+ { "any", true, true, 0, 0, 0, 0, 0 },
+ { " any", true, true, 0, 0, 0, 0, 0 },
+ { " any ", true, true, 0, 0, 0, 0, 0 },
// Sizes.
- { L"10x11", true, false, 1, 10, 11, 0, 0 },
- { L" 10x11 ", true, false, 1, 10, 11, 0, 0 },
- { L" 10x11 1x2", true, false, 2, 10, 11, 1, 2 },
+ { "10x11", true, false, 1, 10, 11, 0, 0 },
+ { " 10x11 ", true, false, 1, 10, 11, 0, 0 },
+ { " 10x11 1x2", true, false, 2, 10, 11, 1, 2 },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
bool is_any;
std::vector<gfx::Size> sizes;
- const bool result =
- webkit_glue::ParseIconSizes(data[i].input, &sizes, &is_any);
+ bool result = webkit_glue::ParseIconSizes(
+ ASCIIToUTF16(data[i].input), &sizes, &is_any);
ASSERT_EQ(result, data[i].expected_result);
if (result) {
ASSERT_EQ(data[i].is_any, is_any);
diff --git a/webkit/glue/form_data.h b/webkit/glue/form_data.h
index 0223e6c..8c5876c 100644
--- a/webkit/glue/form_data.h
+++ b/webkit/glue/form_data.h
@@ -16,11 +16,11 @@ struct FormData {
// The action target of the form
GURL action;
// A list of element names to be filled
- std::vector<std::wstring> elements;
+ std::vector<string16> elements;
// A list of element values to be filled
- std::vector<std::wstring> values;
+ std::vector<string16> values;
// The name of the submit button to be used to submit (optional)
- std::wstring submit;
+ string16 submit;
};
#endif // WEBKIT_GLUE_FORM_DATA_H__
diff --git a/webkit/glue/password_autocomplete_listener.cc b/webkit/glue/password_autocomplete_listener.cc
index 5acf579..2ddb26b 100644
--- a/webkit/glue/password_autocomplete_listener.cc
+++ b/webkit/glue/password_autocomplete_listener.cc
@@ -80,14 +80,13 @@ void PasswordAutocompleteListener::OnBlur(WebCore::HTMLInputElement* element,
DCHECK(data_.basic_data.values.size() == 2);
// Set the password field to match the current username.
- if (WideToUTF16Hack(data_.basic_data.values[0]) == user_input) {
+ if (data_.basic_data.values[0] == user_input) {
// Preferred username/login is selected.
- password_delegate_->SetValue(WideToUTF16Hack(data_.basic_data.values[1]));
- } else if (data_.additional_logins.find(UTF16ToWideHack(user_input)) !=
+ password_delegate_->SetValue(data_.basic_data.values[1]);
+ } else if (data_.additional_logins.find(user_input) !=
data_.additional_logins.end()) {
// One of the extra username/logins is selected.
- password_delegate_->SetValue(
- WideToUTF16Hack(data_.additional_logins[UTF16ToWideHack(user_input)]));
+ password_delegate_->SetValue(data_.additional_logins[user_input]);
}
password_delegate_->OnFinishedAutocompleting();
}
@@ -120,8 +119,8 @@ void PasswordAutocompleteListener::OnInlineAutocompleteNeeded(
// conversions (see SetValue) on each successful call to
// OnInlineAutocompleteNeeded.
if (TryToMatch(user_input,
- WideToUTF16Hack(data_.basic_data.values[0]),
- WideToUTF16Hack(data_.basic_data.values[1]))) {
+ data_.basic_data.values[0],
+ data_.basic_data.values[1])) {
return;
}
@@ -130,9 +129,7 @@ void PasswordAutocompleteListener::OnInlineAutocompleteNeeded(
data_.additional_logins.begin();
it != data_.additional_logins.end();
++it) {
- if (TryToMatch(user_input,
- WideToUTF16Hack(it->first),
- WideToUTF16Hack(it->second)))
+ if (TryToMatch(user_input, it->first, it->second))
return;
}
}
@@ -154,16 +151,15 @@ bool PasswordAutocompleteListener::TryToMatch(const string16& input,
void PasswordAutocompleteListener::GetSuggestions(
const string16& input, std::vector<string16>* suggestions) {
- std::wstring wide_input = UTF16ToWideHack(input);
- if (StartsWith(data_.basic_data.values[0], wide_input, false))
- suggestions->push_back(WideToUTF16Hack(data_.basic_data.values[0]));
+ if (StartsWith(data_.basic_data.values[0], input, false))
+ suggestions->push_back(data_.basic_data.values[0]);
for (PasswordFormDomManager::LoginCollection::iterator it =
data_.additional_logins.begin();
it != data_.additional_logins.end();
++it) {
- if (StartsWith(it->first, wide_input, false))
- suggestions->push_back(WideToUTF16Hack(it->first));
+ if (StartsWith(it->first, input, false))
+ suggestions->push_back(it->first);
}
}
diff --git a/webkit/glue/password_autocomplete_listener_unittest.cc b/webkit/glue/password_autocomplete_listener_unittest.cc
index 7c05243..268cdaf 100644
--- a/webkit/glue/password_autocomplete_listener_unittest.cc
+++ b/webkit/glue/password_autocomplete_listener_unittest.cc
@@ -107,10 +107,9 @@ class PasswordManagerAutocompleteTests : public testing::Test {
password1_ = ASCIIToUTF16("password");
username2_ = ASCIIToUTF16("bob");
password2_ = ASCIIToUTF16("bobsyouruncle");
- data_.basic_data.values.push_back(UTF16ToWideHack(username1_));
- data_.basic_data.values.push_back(UTF16ToWideHack(password1_));
- data_.additional_logins[UTF16ToWideHack(username2_)] =
- UTF16ToWideHack(password2_);
+ data_.basic_data.values.push_back(username1_);
+ data_.basic_data.values.push_back(password1_);
+ data_.additional_logins[username2_] = password2_;
testing::Test::SetUp();
}
diff --git a/webkit/glue/password_form.h b/webkit/glue/password_form.h
index df41be8..b07576d 100644
--- a/webkit/glue/password_form.h
+++ b/webkit/glue/password_form.h
@@ -75,35 +75,35 @@ struct PasswordForm {
// possible.
//
// When parsing an HTML form, this must always be set.
- std::wstring submit_element;
+ string16 submit_element;
// The name of the username input element. Optional (improves scoring).
//
// When parsing an HTML form, this must always be set.
- std::wstring username_element;
+ string16 username_element;
// The username. Optional.
//
// When parsing an HTML form, this is typically empty unless the site
// has implemented some form of autofill.
- std::wstring username_value;
+ string16 username_value;
// The name of the password input element, Optional (improves scoring).
//
// When parsing an HTML form, this must always be set.
- std::wstring password_element;
+ string16 password_element;
// The password. Required.
//
// When parsing an HTML form, this is typically empty.
- std::wstring password_value;
+ string16 password_value;
// If the form was a change password form, the name of the
// 'old password' input element. Optional.
- std::wstring old_password_element;
+ string16 old_password_element;
// The old password. Optional.
- std::wstring old_password_value;
+ string16 old_password_value;
// Whether or not this login was saved under an HTTPS session with a valid
// SSL cert. We will never match or autofill a PasswordForm where
@@ -143,7 +143,7 @@ struct PasswordForm {
};
// Map username to PasswordForm* for convenience. See password_form_manager.h.
-typedef std::map<std::wstring, PasswordForm*> PasswordFormMap;
+typedef std::map<string16, PasswordForm*> PasswordFormMap;
} // namespace webkit_glue
diff --git a/webkit/glue/password_form_dom_manager.cc b/webkit/glue/password_form_dom_manager.cc
index ceef5b4..8bd3231 100644
--- a/webkit/glue/password_form_dom_manager.cc
+++ b/webkit/glue/password_form_dom_manager.cc
@@ -186,7 +186,7 @@ PasswordForm* AssemblePasswordFormResult(
WebCore::HTMLInputElement* username,
WebCore::HTMLInputElement* old_password,
WebCore::HTMLInputElement* password) {
- std::wstring empty;
+ string16 empty;
PasswordForm* result = new PasswordForm();
// Ignore the query and ref components
GURL::Replacements rep;
@@ -205,19 +205,19 @@ PasswordForm* AssemblePasswordFormResult(
result->signon_realm = full_origin.GetOrigin().spec();
// Note PasswordManager sets ssl_valid by asking the WebContents' SSLManager.
result->submit_element =
- submit == NULL ? empty : StringToStdWString(submit->name());
+ submit == NULL ? empty : StringToString16(submit->name());
result->username_element =
- username == NULL ? empty : StringToStdWString(username->name());
+ username == NULL ? empty : StringToString16(username->name());
result->username_value =
- username == NULL ? empty : StringToStdWString(username->value());
+ username == NULL ? empty : StringToString16(username->value());
result->password_element =
- password == NULL ? empty : StringToStdWString(password->name());
+ password == NULL ? empty : StringToString16(password->name());
result->password_value =
- password == NULL ? empty : StringToStdWString(password->value());
+ password == NULL ? empty : StringToString16(password->value());
result->old_password_element =
- old_password == NULL ? empty : StringToStdWString(old_password->name());
+ old_password == NULL ? empty : StringToString16(old_password->name());
result->old_password_value =
- old_password == NULL ? empty : StringToStdWString(old_password->value());
+ old_password == NULL ? empty : StringToString16(old_password->value());
return result;
}
diff --git a/webkit/glue/password_form_dom_manager.h b/webkit/glue/password_form_dom_manager.h
index 9963a5d..772e0a3 100644
--- a/webkit/glue/password_form_dom_manager.h
+++ b/webkit/glue/password_form_dom_manager.h
@@ -18,7 +18,7 @@ namespace webkit_glue {
class PasswordFormDomManager {
public:
- typedef std::map<std::wstring, std::wstring> LoginCollection;
+ typedef std::map<string16, string16> LoginCollection;
// Structure used for autofilling password forms.
// basic_data identifies the HTML form on the page and preferred username/