summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-16 07:13:53 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-16 07:13:53 +0000
commitdc9a67601b9d8c952bf399f0309519273f82bfd5 (patch)
treeb618c9da1cef3fa99718897cf523cb8768d4a273
parenta6dbaac4225f2fa5a170bdc657ab306390fdc439 (diff)
downloadchromium_src-dc9a67601b9d8c952bf399f0309519273f82bfd5.zip
chromium_src-dc9a67601b9d8c952bf399f0309519273f82bfd5.tar.gz
chromium_src-dc9a67601b9d8c952bf399f0309519273f82bfd5.tar.bz2
Remove deprecated wstring Get(As)String() methods from Value, etc.
BUG=23581 TEST=builds and passes tests Review URL: http://codereview.chromium.org/3117017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56187 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/json/json_reader_unittest.cc20
-rw-r--r--base/values.cc43
-rw-r--r--base/values.h13
-rw-r--r--base/values_unittest.cc434
-rw-r--r--chrome/browser/autocomplete/search_provider.cc24
-rw-r--r--chrome/browser/command_line_pref_store_unittest.cc12
-rw-r--r--chrome/browser/debugger/debugger_remote_service.cc80
-rw-r--r--chrome/browser/debugger/devtools_remote_service.cc37
-rw-r--r--chrome/browser/debugger/devtools_remote_service.h11
-rw-r--r--chrome/browser/debugger/extension_ports_remote_service.cc84
-rw-r--r--chrome/browser/dom_ui/core_options_handler.cc11
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc7
-rw-r--r--chrome/browser/extensions/extension_bookmarks_module.cc5
-rw-r--r--chrome/browser/first_run/first_run_gtk.cc7
-rw-r--r--chrome/browser/first_run/first_run_win.cc7
-rw-r--r--chrome/browser/history/top_sites.cc4
-rw-r--r--chrome/browser/importer/importer_bridge.cc10
-rw-r--r--chrome/browser/notifications/notifications_prefs_cache.cc4
-rw-r--r--chrome/browser/policy/config_dir_policy_provider_unittest.cc14
-rw-r--r--chrome/browser/pref_service.cc4
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.cc99
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc38
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc70
-rw-r--r--chrome/browser/sync/sync_setup_wizard_unittest.cc18
-rw-r--r--chrome/browser/tabs/pinned_tab_codec.cc4
-rw-r--r--chrome/browser/translate/translate_prefs.cc5
-rw-r--r--chrome/browser/views/select_file_dialog.cc18
-rw-r--r--chrome/common/automation_constants.cc10
-rw-r--r--chrome/common/automation_constants.h10
-rw-r--r--chrome/common/extensions/extension_message_bundle.cc15
-rw-r--r--chrome/common/extensions/extension_message_bundle.h6
-rw-r--r--chrome/common/extensions/extension_message_bundle_unittest.cc51
-rw-r--r--chrome/common/json_value_serializer_unittest.cc54
-rw-r--r--chrome/common/plugin_group_unittest.cc2
-rw-r--r--chrome/installer/util/master_preferences.cc25
-rw-r--r--chrome/installer/util/master_preferences.h12
-rw-r--r--chrome/installer/util/master_preferences_constants.cc62
-rw-r--r--chrome/installer/util/master_preferences_constants.h56
-rw-r--r--chrome/installer/util/master_preferences_dummy.cc6
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc26
-rw-r--r--chrome/service/cloud_print/cloud_print_consts.cc18
-rw-r--r--chrome/service/cloud_print/cloud_print_consts.h18
-rw-r--r--chrome/service/cloud_print/cloud_print_proxy_backend.cc6
-rw-r--r--chrome/service/cloud_print/print_system_cups.cc2
-rw-r--r--chrome/service/cloud_print/printer_job_handler.cc4
-rw-r--r--chrome/test/automation/tab_proxy.cc6
46 files changed, 497 insertions, 975 deletions
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc
index c05fcda..c00c976 100644
--- a/base/json/json_reader_unittest.cc
+++ b/base/json/json_reader_unittest.cc
@@ -1,10 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/gtest/include/gtest/gtest.h"
#include "base/json/json_reader.h"
#include "base/scoped_ptr.h"
+#include "base/string_piece.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -168,9 +170,9 @@ TEST(JSONReaderTest, Reading) {
root.reset(JSONReader().JsonToValue("\"hello world\"", false, false));
ASSERT_TRUE(root.get());
ASSERT_TRUE(root->IsType(Value::TYPE_STRING));
- std::wstring str_val;
+ std::string str_val;
ASSERT_TRUE(root->GetAsString(&str_val));
- ASSERT_EQ(L"hello world", str_val);
+ ASSERT_EQ("hello world", str_val);
// Empty string
root.reset(JSONReader().JsonToValue("\"\"", false, false));
@@ -178,7 +180,7 @@ TEST(JSONReaderTest, Reading) {
ASSERT_TRUE(root->IsType(Value::TYPE_STRING));
str_val.clear();
ASSERT_TRUE(root->GetAsString(&str_val));
- ASSERT_EQ(L"", str_val);
+ ASSERT_EQ("", str_val);
// Test basic string escapes
root.reset(JSONReader().JsonToValue("\" \\\"\\\\\\/\\b\\f\\n\\r\\t\\v\"",
@@ -187,7 +189,7 @@ TEST(JSONReaderTest, Reading) {
ASSERT_TRUE(root->IsType(Value::TYPE_STRING));
str_val.clear();
ASSERT_TRUE(root->GetAsString(&str_val));
- ASSERT_EQ(L" \"\\/\b\f\n\r\t\v", str_val);
+ ASSERT_EQ(" \"\\/\b\f\n\r\t\v", str_val);
// Test hex and unicode escapes including the null character.
root.reset(JSONReader().JsonToValue("\"\\x41\\x00\\u1234\"", false,
@@ -196,7 +198,7 @@ TEST(JSONReaderTest, Reading) {
ASSERT_TRUE(root->IsType(Value::TYPE_STRING));
str_val.clear();
ASSERT_TRUE(root->GetAsString(&str_val));
- ASSERT_EQ(std::wstring(L"A\0\x1234", 3), str_val);
+ ASSERT_EQ(std::wstring(L"A\0\x1234", 3), UTF8ToWide(str_val));
// Test invalid strings
root.reset(JSONReader().JsonToValue("\"no closing quote", false, false));
@@ -308,8 +310,8 @@ TEST(JSONReaderTest, Reading) {
ASSERT_TRUE(dict_val->Get("null", &null_val));
ASSERT_TRUE(null_val->IsType(Value::TYPE_NULL));
str_val.clear();
- ASSERT_TRUE(dict_val->GetString(L"S", &str_val));
- ASSERT_EQ(L"str", str_val);
+ ASSERT_TRUE(dict_val->GetString("S", &str_val));
+ ASSERT_EQ("str", str_val);
root2.reset(JSONReader::Read(
"{\"number\":9.87654321, \"null\":null , \"\\x53\" : \"str\", }", true));
@@ -444,7 +446,7 @@ TEST(JSONReaderTest, Reading) {
ASSERT_TRUE(root->IsType(Value::TYPE_STRING));
str_val.clear();
ASSERT_TRUE(root->GetAsString(&str_val));
- ASSERT_EQ(L"\x7f51\x9875", str_val);
+ ASSERT_EQ(L"\x7f51\x9875", UTF8ToWide(str_val));
// Test invalid utf8 encoded input
root.reset(JSONReader().JsonToValue("\"345\xb0\xa1\xb0\xa2\"",
diff --git a/base/values.cc b/base/values.cc
index 7e348dc..cd2738b 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -119,13 +119,6 @@ bool Value::GetAsString(string16* out_value) const {
return false;
}
-#if !defined(WCHAR_T_IS_UTF16)
-// TODO(viettrungluu): Deprecated and to be removed:
-bool Value::GetAsString(std::wstring* out_value) const {
- return false;
-}
-#endif
-
Value* Value::DeepCopy() const {
// This method should only be getting called for null Values--all subclasses
// need to provide their own implementation;.
@@ -254,15 +247,6 @@ bool StringValue::GetAsString(string16* out_value) const {
return true;
}
-#if !defined(WCHAR_T_IS_UTF16)
-// TODO(viettrungluu): Deprecated and to be removed:
-bool StringValue::GetAsString(std::wstring* out_value) const {
- if (out_value)
- *out_value = UTF8ToWide(value_);
- return true;
-}
-#endif
-
Value* StringValue::DeepCopy() const {
return CreateStringValue(value_);
}
@@ -631,22 +615,6 @@ bool DictionaryValue::GetReal(const std::wstring& path,
}
// TODO(viettrungluu): Deprecated and to be removed:
-bool DictionaryValue::GetString(const std::wstring& path,
- std::string* out_value) const {
- return GetString(WideToUTF8(path), out_value);
-}
-
-// TODO(viettrungluu): Deprecated and to be removed:
-bool DictionaryValue::GetString(const std::wstring& path,
- std::wstring* out_value) const {
- Value* value;
- if (!Get(WideToUTF8(path), &value))
- return false;
-
- return value->GetAsString(out_value);
-}
-
-// TODO(viettrungluu): Deprecated and to be removed:
bool DictionaryValue::GetBinary(const std::wstring& path,
BinaryValue** out_value) const {
return GetBinary(WideToUTF8(path), out_value);
@@ -985,17 +953,6 @@ bool ListValue::GetString(size_t index, string16* out_value) const {
return value->GetAsString(out_value);
}
-#if !defined(WCHAR_T_IS_UTF16)
-// TODO(viettrungluu): Deprecated and to be removed:
-bool ListValue::GetString(size_t index, std::wstring* out_value) const {
- Value* value;
- if (!Get(index, &value))
- return false;
-
- return value->GetAsString(out_value);
-}
-#endif
-
bool ListValue::GetBinary(size_t index, BinaryValue** out_value) const {
Value* value;
bool result = Get(index, &value);
diff --git a/base/values.h b/base/values.h
index 01a2cf4..7f607fd 100644
--- a/base/values.h
+++ b/base/values.h
@@ -92,9 +92,6 @@ class Value {
virtual bool GetAsReal(double* out_value) const;
virtual bool GetAsString(std::string* out_value) const;
virtual bool GetAsString(string16* out_value) const;
-#if !defined(WCHAR_T_IS_UTF16)
- /*DEPRECATED*/virtual bool GetAsString(std::wstring* out_value) const;
-#endif
// This creates a deep copy of the entire Value tree, and returns a pointer
// to the copy. The caller gets ownership of the copy, of course.
@@ -159,9 +156,6 @@ class StringValue : public Value {
// Subclassed methods
bool GetAsString(std::string* out_value) const;
bool GetAsString(string16* out_value) const;
-#if !defined(WCHAR_T_IS_UTF16)
- /*DEPRECATED*/bool GetAsString(std::wstring* out_value) const;
-#endif
Value* DeepCopy() const;
virtual bool Equals(const Value* other) const;
@@ -293,10 +287,6 @@ class DictionaryValue : public Value {
bool* out_value) const;
/*DEPRECATED*/bool GetInteger(const std::wstring& path, int* out_value) const;
/*DEPRECATED*/bool GetReal(const std::wstring& path, double* out_value) const;
- /*DEPRECATED*/bool GetString(const std::wstring& path,
- std::string* out_value) const;
- /*DEPRECATED*/bool GetString(const std::wstring& path,
- std::wstring* out_value) const;
/*DEPRECATED*/bool GetBinary(const std::wstring& path,
BinaryValue** out_value) const;
/*DEPRECATED*/bool GetDictionary(const std::wstring& path,
@@ -433,9 +423,6 @@ class ListValue : public Value {
bool GetReal(size_t index, double* out_value) const;
bool GetString(size_t index, std::string* out_value) const;
bool GetString(size_t index, string16* out_value) const;
-#if !defined(WCHAR_T_IS_UTF16)
- /*DEPRECATED*/bool GetString(size_t index, std::wstring* out_value) const;
-#endif
bool GetBinary(size_t index, BinaryValue** out_value) const;
bool GetDictionary(size_t index, DictionaryValue** out_value) const;
bool GetList(size_t index, ListValue** out_value) const;
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 3b78b5f..4b4016c 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -34,12 +34,6 @@ class ValuesTest: public testing::Test {
}
};
-// TODO(viettrungluu): I changed the keys for DictionaryValue from std::wstring
-// to std::string. I've temporarily kept the old methods taking std::wstring for
-// compatibility. The ...Deprecated tests are the old tests which use these
-// methods, and remain to test compatibility. They will be removed once the old
-// methods are removed.
-
TEST_F(ValuesTest, Basic) {
// Test basic dictionary getting/setting
DictionaryValue settings;
@@ -83,52 +77,6 @@ TEST_F(ValuesTest, Basic) {
ASSERT_EQ(std::string("http://froogle.com"), bookmark_url);
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, BasicDeprecated) {
- // Test basic dictionary getting/setting
- DictionaryValue settings;
- std::wstring homepage = L"http://google.com";
- ASSERT_FALSE(
- settings.GetString(L"global.homepage", &homepage));
- ASSERT_EQ(std::wstring(L"http://google.com"), homepage);
-
- ASSERT_FALSE(settings.Get(L"global", NULL));
- settings.Set(L"global", Value::CreateBooleanValue(true));
- ASSERT_TRUE(settings.Get(L"global", NULL));
- settings.SetString(L"global.homepage", L"http://scurvy.com");
- ASSERT_TRUE(settings.Get(L"global", NULL));
- homepage = L"http://google.com";
- ASSERT_TRUE(settings.GetString(L"global.homepage", &homepage));
- ASSERT_EQ(std::wstring(L"http://scurvy.com"), homepage);
-
- // Test storing a dictionary in a list.
- ListValue* toolbar_bookmarks;
- ASSERT_FALSE(
- settings.GetList(L"global.toolbar.bookmarks", &toolbar_bookmarks));
-
- toolbar_bookmarks = new ListValue;
- settings.Set(L"global.toolbar.bookmarks", toolbar_bookmarks);
- ASSERT_TRUE(
- settings.GetList(L"global.toolbar.bookmarks", &toolbar_bookmarks));
-
- DictionaryValue* new_bookmark = new DictionaryValue;
- new_bookmark->SetString(L"name", L"Froogle");
- new_bookmark->SetString(L"url", L"http://froogle.com");
- toolbar_bookmarks->Append(new_bookmark);
-
- ListValue* bookmark_list;
- ASSERT_TRUE(settings.GetList(L"global.toolbar.bookmarks", &bookmark_list));
- DictionaryValue* bookmark;
- ASSERT_EQ(1U, bookmark_list->GetSize());
- ASSERT_TRUE(bookmark_list->GetDictionary(0, &bookmark));
- std::wstring bookmark_name = L"Unnamed";
- ASSERT_TRUE(bookmark->GetString(L"name", &bookmark_name));
- ASSERT_EQ(std::wstring(L"Froogle"), bookmark_name);
- std::wstring bookmark_url;
- ASSERT_TRUE(bookmark->GetString(L"url", &bookmark_url));
- ASSERT_EQ(std::wstring(L"http://froogle.com"), bookmark_url);
-}
-
TEST_F(ValuesTest, List) {
scoped_ptr<ListValue> mixed_list(new ListValue());
mixed_list->Set(0, Value::CreateBooleanValue(true));
@@ -221,36 +169,6 @@ TEST_F(ValuesTest, StringValue) {
ASSERT_EQ(ASCIIToUTF16("utf16"), utf16);
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, StringValueDeprecated) {
- // Test overloaded CreateStringValue.
- scoped_ptr<Value> narrow_value(Value::CreateStringValue("narrow"));
- ASSERT_TRUE(narrow_value.get());
- ASSERT_TRUE(narrow_value->IsType(Value::TYPE_STRING));
- scoped_ptr<Value> utf16_value(
- Value::CreateStringValue(ASCIIToUTF16("utf16")));
- ASSERT_TRUE(utf16_value.get());
- ASSERT_TRUE(utf16_value->IsType(Value::TYPE_STRING));
-
- // Test overloaded GetString.
- std::string narrow = "http://google.com";
- std::wstring wide = L"http://google.com";
- string16 utf16 = ASCIIToUTF16("http://google.com");
- ASSERT_TRUE(narrow_value->GetAsString(&narrow));
- ASSERT_TRUE(narrow_value->GetAsString(&wide));
- ASSERT_TRUE(narrow_value->GetAsString(&utf16));
- ASSERT_EQ(std::string("narrow"), narrow);
- ASSERT_EQ(std::wstring(L"narrow"), wide);
- ASSERT_EQ(ASCIIToUTF16("narrow"), utf16);
-
- ASSERT_TRUE(utf16_value->GetAsString(&narrow));
- ASSERT_TRUE(utf16_value->GetAsString(&wide));
- ASSERT_TRUE(utf16_value->GetAsString(&utf16));
- ASSERT_EQ(std::string("utf16"), narrow);
- ASSERT_EQ(std::wstring(L"utf16"), wide);
- ASSERT_EQ(ASCIIToUTF16("utf16"), utf16);
-}
-
// This is a Value object that allows us to tell if it's been
// properly deleted by modifying the value of external flag on destruction.
class DeletionTestValue : public Value {
@@ -369,35 +287,6 @@ TEST_F(ValuesTest, DictionaryDeletion) {
}
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, DictionaryDeletionDeprecated) {
- std::wstring key = L"test";
- bool deletion_flag = true;
-
- {
- DictionaryValue dict;
- dict.Set(key, new DeletionTestValue(&deletion_flag));
- EXPECT_FALSE(deletion_flag);
- }
- EXPECT_TRUE(deletion_flag);
-
- {
- DictionaryValue dict;
- dict.Set(key, new DeletionTestValue(&deletion_flag));
- EXPECT_FALSE(deletion_flag);
- dict.Clear();
- EXPECT_TRUE(deletion_flag);
- }
-
- {
- DictionaryValue dict;
- dict.Set(key, new DeletionTestValue(&deletion_flag));
- EXPECT_FALSE(deletion_flag);
- dict.Set(key, Value::CreateNullValue());
- EXPECT_TRUE(deletion_flag);
- }
-}
-
TEST_F(ValuesTest, DictionaryRemoval) {
std::string key = "test";
bool deletion_flag = true;
@@ -429,38 +318,6 @@ TEST_F(ValuesTest, DictionaryRemoval) {
}
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, DictionaryRemovalDeprecated) {
- std::wstring key = L"test";
- bool deletion_flag = true;
- Value* removed_item = NULL;
-
- {
- DictionaryValue dict;
- dict.Set(key, new DeletionTestValue(&deletion_flag));
- EXPECT_FALSE(deletion_flag);
- EXPECT_TRUE(dict.HasKey(key));
- EXPECT_FALSE(dict.Remove(L"absent key", &removed_item));
- EXPECT_TRUE(dict.Remove(key, &removed_item));
- EXPECT_FALSE(dict.HasKey(key));
- ASSERT_TRUE(removed_item);
- }
- EXPECT_FALSE(deletion_flag);
- delete removed_item;
- removed_item = NULL;
- EXPECT_TRUE(deletion_flag);
-
- {
- DictionaryValue dict;
- dict.Set(key, new DeletionTestValue(&deletion_flag));
- EXPECT_FALSE(deletion_flag);
- EXPECT_TRUE(dict.HasKey(key));
- EXPECT_TRUE(dict.Remove(key, NULL));
- EXPECT_TRUE(deletion_flag);
- EXPECT_FALSE(dict.HasKey(key));
- }
-}
-
TEST_F(ValuesTest, DictionaryWithoutPathExpansion) {
DictionaryValue dict;
dict.Set("this.is.expanded", Value::CreateNullValue());
@@ -608,137 +465,6 @@ TEST_F(ValuesTest, DeepCopy) {
ASSERT_EQ(1, copy_list_element_1_value);
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, DeepCopyDeprecated) {
- DictionaryValue original_dict;
- Value* original_null = Value::CreateNullValue();
- original_dict.Set(L"null", original_null);
- Value* original_bool = Value::CreateBooleanValue(true);
- original_dict.Set(L"bool", original_bool);
- Value* original_int = Value::CreateIntegerValue(42);
- original_dict.Set(L"int", original_int);
- Value* original_real = Value::CreateRealValue(3.14);
- original_dict.Set(L"real", original_real);
- Value* original_string = Value::CreateStringValue("hello");
- original_dict.Set(L"string", original_string);
- Value* original_utf16 = Value::CreateStringValue(ASCIIToUTF16("hello16"));
- original_dict.Set(L"utf16", original_utf16);
-
- char* original_buffer = new char[42];
- memset(original_buffer, '!', 42);
- BinaryValue* original_binary = Value::CreateBinaryValue(original_buffer, 42);
- original_dict.Set(L"binary", original_binary);
-
- ListValue* original_list = new ListValue();
- Value* original_list_element_0 = Value::CreateIntegerValue(0);
- original_list->Append(original_list_element_0);
- Value* original_list_element_1 = Value::CreateIntegerValue(1);
- original_list->Append(original_list_element_1);
- original_dict.Set(L"list", original_list);
-
- scoped_ptr<DictionaryValue> copy_dict(
- static_cast<DictionaryValue*>(original_dict.DeepCopy()));
- ASSERT_TRUE(copy_dict.get());
- ASSERT_NE(copy_dict.get(), &original_dict);
-
- Value* copy_null = NULL;
- ASSERT_TRUE(copy_dict->Get(L"null", &copy_null));
- ASSERT_TRUE(copy_null);
- ASSERT_NE(copy_null, original_null);
- ASSERT_TRUE(copy_null->IsType(Value::TYPE_NULL));
-
- Value* copy_bool = NULL;
- ASSERT_TRUE(copy_dict->Get(L"bool", &copy_bool));
- ASSERT_TRUE(copy_bool);
- ASSERT_NE(copy_bool, original_bool);
- ASSERT_TRUE(copy_bool->IsType(Value::TYPE_BOOLEAN));
- bool copy_bool_value = false;
- ASSERT_TRUE(copy_bool->GetAsBoolean(&copy_bool_value));
- ASSERT_TRUE(copy_bool_value);
-
- Value* copy_int = NULL;
- ASSERT_TRUE(copy_dict->Get(L"int", &copy_int));
- ASSERT_TRUE(copy_int);
- ASSERT_NE(copy_int, original_int);
- ASSERT_TRUE(copy_int->IsType(Value::TYPE_INTEGER));
- int copy_int_value = 0;
- ASSERT_TRUE(copy_int->GetAsInteger(&copy_int_value));
- ASSERT_EQ(42, copy_int_value);
-
- Value* copy_real = NULL;
- ASSERT_TRUE(copy_dict->Get(L"real", &copy_real));
- ASSERT_TRUE(copy_real);
- ASSERT_NE(copy_real, original_real);
- ASSERT_TRUE(copy_real->IsType(Value::TYPE_REAL));
- double copy_real_value = 0;
- ASSERT_TRUE(copy_real->GetAsReal(&copy_real_value));
- ASSERT_EQ(3.14, copy_real_value);
-
- Value* copy_string = NULL;
- ASSERT_TRUE(copy_dict->Get(L"string", &copy_string));
- ASSERT_TRUE(copy_string);
- ASSERT_NE(copy_string, original_string);
- ASSERT_TRUE(copy_string->IsType(Value::TYPE_STRING));
- std::string copy_string_value;
- std::wstring copy_wstring_value;
- string16 copy_utf16_value;
- ASSERT_TRUE(copy_string->GetAsString(&copy_string_value));
- ASSERT_TRUE(copy_string->GetAsString(&copy_wstring_value));
- ASSERT_TRUE(copy_string->GetAsString(&copy_utf16_value));
- ASSERT_EQ(std::string("hello"), copy_string_value);
- ASSERT_EQ(std::wstring(L"hello"), copy_wstring_value);
- ASSERT_EQ(ASCIIToUTF16("hello"), copy_utf16_value);
-
- Value* copy_utf16 = NULL;
- ASSERT_TRUE(copy_dict->Get(L"utf16", &copy_utf16));
- ASSERT_TRUE(copy_utf16);
- ASSERT_NE(copy_utf16, original_utf16);
- ASSERT_TRUE(copy_utf16->IsType(Value::TYPE_STRING));
- ASSERT_TRUE(copy_utf16->GetAsString(&copy_string_value));
- ASSERT_TRUE(copy_utf16->GetAsString(&copy_wstring_value));
- ASSERT_TRUE(copy_utf16->GetAsString(&copy_utf16_value));
- ASSERT_EQ(std::string("hello16"), copy_string_value);
- ASSERT_EQ(std::wstring(L"hello16"), copy_wstring_value);
- ASSERT_EQ(ASCIIToUTF16("hello16"), copy_utf16_value);
-
- Value* copy_binary = NULL;
- ASSERT_TRUE(copy_dict->Get(L"binary", &copy_binary));
- ASSERT_TRUE(copy_binary);
- ASSERT_NE(copy_binary, original_binary);
- ASSERT_TRUE(copy_binary->IsType(Value::TYPE_BINARY));
- ASSERT_NE(original_binary->GetBuffer(),
- static_cast<BinaryValue*>(copy_binary)->GetBuffer());
- ASSERT_EQ(original_binary->GetSize(),
- static_cast<BinaryValue*>(copy_binary)->GetSize());
- ASSERT_EQ(0, memcmp(original_binary->GetBuffer(),
- static_cast<BinaryValue*>(copy_binary)->GetBuffer(),
- original_binary->GetSize()));
-
- Value* copy_value = NULL;
- ASSERT_TRUE(copy_dict->Get(L"list", &copy_value));
- ASSERT_TRUE(copy_value);
- ASSERT_NE(copy_value, original_list);
- ASSERT_TRUE(copy_value->IsType(Value::TYPE_LIST));
- ListValue* copy_list = static_cast<ListValue*>(copy_value);
- ASSERT_EQ(2U, copy_list->GetSize());
-
- Value* copy_list_element_0;
- ASSERT_TRUE(copy_list->Get(0, &copy_list_element_0));
- ASSERT_TRUE(copy_list_element_0);
- ASSERT_NE(copy_list_element_0, original_list_element_0);
- int copy_list_element_0_value;
- ASSERT_TRUE(copy_list_element_0->GetAsInteger(&copy_list_element_0_value));
- ASSERT_EQ(0, copy_list_element_0_value);
-
- Value* copy_list_element_1;
- ASSERT_TRUE(copy_list->Get(1, &copy_list_element_1));
- ASSERT_TRUE(copy_list_element_1);
- ASSERT_NE(copy_list_element_1, original_list_element_1);
- int copy_list_element_1_value;
- ASSERT_TRUE(copy_list_element_1->GetAsInteger(&copy_list_element_1_value));
- ASSERT_EQ(1, copy_list_element_1_value);
-}
-
TEST_F(ValuesTest, Equals) {
Value* null1 = Value::CreateNullValue();
Value* null2 = Value::CreateNullValue();
@@ -776,44 +502,6 @@ TEST_F(ValuesTest, Equals) {
delete copy;
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, EqualsDeprecated) {
- Value* null1 = Value::CreateNullValue();
- Value* null2 = Value::CreateNullValue();
- EXPECT_NE(null1, null2);
- EXPECT_TRUE(null1->Equals(null2));
-
- Value* boolean = Value::CreateBooleanValue(false);
- EXPECT_FALSE(null1->Equals(boolean));
- delete null1;
- delete null2;
- delete boolean;
-
- DictionaryValue dv;
- dv.SetBoolean(L"a", false);
- dv.SetInteger(L"b", 2);
- dv.SetReal(L"c", 2.5);
- dv.SetString(L"d1", "string");
- dv.SetString(L"d2", L"string");
- dv.Set(L"e", Value::CreateNullValue());
-
- DictionaryValue* copy = static_cast<DictionaryValue*>(dv.DeepCopy());
- EXPECT_TRUE(dv.Equals(copy));
-
- ListValue* list = new ListValue;
- list->Append(Value::CreateNullValue());
- list->Append(new DictionaryValue);
- dv.Set(L"f", list);
-
- EXPECT_FALSE(dv.Equals(copy));
- copy->Set(L"f", list->DeepCopy());
- EXPECT_TRUE(dv.Equals(copy));
-
- list->Append(Value::CreateBooleanValue(true));
- EXPECT_FALSE(dv.Equals(copy));
- delete copy;
-}
-
TEST_F(ValuesTest, RemoveEmptyChildren) {
scoped_ptr<DictionaryValue> root(new DictionaryValue);
// Remove empty lists and dictionaries.
@@ -889,82 +577,6 @@ TEST_F(ValuesTest, RemoveEmptyChildren) {
}
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, RemoveEmptyChildrenDeprecated) {
- scoped_ptr<DictionaryValue> root(new DictionaryValue);
- // Remove empty lists and dictionaries.
- root->Set(L"empty_dict", new DictionaryValue);
- root->Set(L"empty_list", new ListValue);
- root->SetWithoutPathExpansion("a.b.c.d.e", new DictionaryValue);
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_TRUE(root->empty());
-
- // Make sure we don't prune too much.
- root->SetBoolean(L"bool", true);
- root->Set(L"empty_dict", new DictionaryValue);
- root->SetString(L"empty_string", "");
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(2U, root->size());
-
- // Should do nothing.
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(2U, root->size());
-
- // Nested test cases. These should all reduce back to the bool and string
- // set above.
- {
- root->Set(L"a.b.c.d.e", new DictionaryValue);
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(2U, root->size());
- }
- {
- DictionaryValue* inner = new DictionaryValue;
- root->Set(L"dict_with_emtpy_children", inner);
- inner->Set(L"empty_dict", new DictionaryValue);
- inner->Set(L"empty_list", new ListValue);
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(2U, root->size());
- }
- {
- ListValue* inner = new ListValue;
- root->Set(L"list_with_empty_children", inner);
- inner->Append(new DictionaryValue);
- inner->Append(new ListValue);
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(2U, root->size());
- }
-
- // Nested with siblings.
- {
- ListValue* inner = new ListValue;
- root->Set(L"list_with_empty_children", inner);
- inner->Append(new DictionaryValue);
- inner->Append(new ListValue);
- DictionaryValue* inner2 = new DictionaryValue;
- root->Set(L"dict_with_empty_children", inner2);
- inner2->Set(L"empty_dict", new DictionaryValue);
- inner2->Set(L"empty_list", new ListValue);
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(2U, root->size());
- }
-
- // Make sure nested values don't get pruned.
- {
- ListValue* inner = new ListValue;
- root->Set(L"list_with_empty_children", inner);
- ListValue* inner2 = new ListValue;
- inner->Append(new DictionaryValue);
- inner->Append(inner2);
- inner2->Append(Value::CreateStringValue("hello"));
- root.reset(root->DeepCopyWithoutEmptyChildren());
- EXPECT_EQ(3U, root->size());
- EXPECT_TRUE(root->GetList(L"list_with_empty_children", &inner));
- EXPECT_EQ(1U, inner->GetSize()); // Dictionary was pruned.
- EXPECT_TRUE(inner->GetList(0, &inner2));
- EXPECT_EQ(1U, inner2->GetSize());
- }
-}
-
TEST_F(ValuesTest, MergeDictionary) {
scoped_ptr<DictionaryValue> base(new DictionaryValue);
base->SetString("base_key", "base_key_value_base");
@@ -1010,52 +622,6 @@ TEST_F(ValuesTest, MergeDictionary) {
EXPECT_EQ("sub_merge_key_value_merge", sub_merge_key_value); // Merged in.
}
-// TODO(viettrungluu): deprecate:
-TEST_F(ValuesTest, MergeDictionaryDeprecated) {
- scoped_ptr<DictionaryValue> base(new DictionaryValue);
- base->SetString(L"base_key", "base_key_value_base");
- base->SetString(L"collide_key", "collide_key_value_base");
- DictionaryValue* base_sub_dict = new DictionaryValue;
- base_sub_dict->SetString(L"sub_base_key", "sub_base_key_value_base");
- base_sub_dict->SetString(L"sub_collide_key", "sub_collide_key_value_base");
- base->Set(L"sub_dict_key", base_sub_dict);
-
- scoped_ptr<DictionaryValue> merge(new DictionaryValue);
- merge->SetString(L"merge_key", "merge_key_value_merge");
- merge->SetString(L"collide_key", "collide_key_value_merge");
- DictionaryValue* merge_sub_dict = new DictionaryValue;
- merge_sub_dict->SetString(L"sub_merge_key", "sub_merge_key_value_merge");
- merge_sub_dict->SetString(L"sub_collide_key", "sub_collide_key_value_merge");
- merge->Set(L"sub_dict_key", merge_sub_dict);
-
- base->MergeDictionary(merge.get());
-
- EXPECT_EQ(4U, base->size());
- std::string base_key_value;
- EXPECT_TRUE(base->GetString(L"base_key", &base_key_value));
- EXPECT_EQ("base_key_value_base", base_key_value); // Base value preserved.
- std::string collide_key_value;
- EXPECT_TRUE(base->GetString(L"collide_key", &collide_key_value));
- EXPECT_EQ("collide_key_value_merge", collide_key_value); // Replaced.
- std::string merge_key_value;
- EXPECT_TRUE(base->GetString(L"merge_key", &merge_key_value));
- EXPECT_EQ("merge_key_value_merge", merge_key_value); // Merged in.
-
- DictionaryValue* res_sub_dict;
- EXPECT_TRUE(base->GetDictionary(L"sub_dict_key", &res_sub_dict));
- EXPECT_EQ(3U, res_sub_dict->size());
- std::string sub_base_key_value;
- EXPECT_TRUE(res_sub_dict->GetString(L"sub_base_key", &sub_base_key_value));
- EXPECT_EQ("sub_base_key_value_base", sub_base_key_value); // Preserved.
- std::string sub_collide_key_value;
- EXPECT_TRUE(res_sub_dict->GetString(L"sub_collide_key",
- &sub_collide_key_value));
- EXPECT_EQ("sub_collide_key_value_merge", sub_collide_key_value); // Replaced.
- std::string sub_merge_key_value;
- EXPECT_TRUE(res_sub_dict->GetString(L"sub_merge_key", &sub_merge_key_value));
- EXPECT_EQ("sub_merge_key_value_merge", sub_merge_key_value); // Merged in.
-}
-
TEST_F(ValuesTest, GetDifferingPaths) {
scoped_ptr<DictionaryValue> dict1(new DictionaryValue());
scoped_ptr<DictionaryValue> dict2(new DictionaryValue());
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index b073aa6..6d3016c 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/i18n/icu_string_conversions.h"
#include "base/message_loop.h"
+#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/keyword_provider.h"
#include "chrome/browser/browser_process.h"
@@ -396,10 +397,11 @@ bool SearchProvider::ParseSuggestResults(Value* root_val,
ListValue* root_list = static_cast<ListValue*>(root_val);
Value* query_val;
- std::wstring query_str;
+ string16 query_str;
Value* result_val;
if ((root_list->GetSize() < 2) || !root_list->Get(0, &query_val) ||
- !query_val->GetAsString(&query_str) || (query_str != input_text) ||
+ !query_val->GetAsString(&query_str) ||
+ (query_str != WideToUTF16Hack(input_text)) ||
!root_list->Get(1, &result_val) || !result_val->IsType(Value::TYPE_LIST))
return false;
@@ -436,17 +438,17 @@ bool SearchProvider::ParseSuggestResults(Value* root_val,
ListValue* result_list = static_cast<ListValue*>(result_val);
for (size_t i = 0; i < result_list->GetSize(); ++i) {
Value* suggestion_val;
- std::wstring suggestion_str;
+ string16 suggestion_str;
if (!result_list->Get(i, &suggestion_val) ||
!suggestion_val->GetAsString(&suggestion_str))
return false;
Value* type_val;
- std::wstring type_str;
+ std::string type_str;
if (type_list && type_list->Get(i, &type_val) &&
- type_val->GetAsString(&type_str) && (type_str == L"NAVIGATION")) {
+ type_val->GetAsString(&type_str) && (type_str == "NAVIGATION")) {
Value* site_val;
- std::wstring site_name;
+ string16 site_name;
NavigationResults& navigation_results =
is_keyword ? keyword_navigation_results_ :
default_navigation_results_;
@@ -455,16 +457,18 @@ bool SearchProvider::ParseSuggestResults(Value* root_val,
site_val->IsType(Value::TYPE_STRING) &&
site_val->GetAsString(&site_name)) {
// We can't blindly trust the URL coming from the server to be valid.
- GURL result_url(URLFixerUpper::FixupURL(WideToUTF8(suggestion_str),
+ GURL result_url(URLFixerUpper::FixupURL(UTF16ToUTF8(suggestion_str),
std::string()));
- if (result_url.is_valid())
- navigation_results.push_back(NavigationResult(result_url, site_name));
+ if (result_url.is_valid()) {
+ navigation_results.push_back(NavigationResult(result_url,
+ UTF16ToWideHack(site_name)));
+ }
}
} else {
// TODO(kochi): Currently we treat a calculator result as a query, but it
// is better to have better presentation for caluculator results.
if (suggest_results->size() < kMaxMatches)
- suggest_results->push_back(suggestion_str);
+ suggest_results->push_back(UTF16ToWideHack(suggestion_str));
}
}
diff --git a/chrome/browser/command_line_pref_store_unittest.cc b/chrome/browser/command_line_pref_store_unittest.cc
index 115ab1d..4c4dda5 100644
--- a/chrome/browser/command_line_pref_store_unittest.cc
+++ b/chrome/browser/command_line_pref_store_unittest.cc
@@ -24,8 +24,8 @@ class TestCommandLinePrefStore : public CommandLinePrefStore {
}
};
-static const wchar_t* unknown_bool = L"unknown_switch";
-static const wchar_t* unknown_string = L"unknown_other_switch";
+const char unknown_bool[] = "unknown_switch";
+const char unknown_string[] = "unknown_other_switch";
} // namespace
@@ -56,8 +56,8 @@ TEST(CommandLinePrefStoreTest, SimpleBooleanPref) {
// Tests a command line with no recognized prefs.
TEST(CommandLinePrefStoreTest, NoPrefs) {
CommandLine cl(CommandLine::ARGUMENTS_ONLY);
- cl.AppendSwitch(WideToASCII(unknown_string));
- cl.AppendSwitchASCII(WideToASCII(unknown_bool), "a value");
+ cl.AppendSwitch(unknown_string);
+ cl.AppendSwitchASCII(unknown_bool, "a value");
CommandLinePrefStore store(&cl);
EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE);
@@ -73,11 +73,11 @@ TEST(CommandLinePrefStoreTest, NoPrefs) {
// Tests a complex command line with multiple known and unknown switches.
TEST(CommandLinePrefStoreTest, MultipleSwitches) {
CommandLine cl(CommandLine::ARGUMENTS_ONLY);
- cl.AppendSwitch(WideToASCII(unknown_string));
+ cl.AppendSwitch(unknown_string);
cl.AppendSwitch(switches::kProxyAutoDetect);
cl.AppendSwitchASCII(switches::kProxyServer, "proxy");
cl.AppendSwitchASCII(switches::kProxyBypassList, "list");
- cl.AppendSwitchASCII(WideToASCII(unknown_bool), "a value");
+ cl.AppendSwitchASCII(unknown_bool, "a value");
CommandLinePrefStore store(&cl);
EXPECT_EQ(store.ReadPrefs(), PrefStore::PREF_READ_ERROR_NONE);
diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc
index 0809564..d66896b 100644
--- a/chrome/browser/debugger/debugger_remote_service.cc
+++ b/chrome/browser/debugger/debugger_remote_service.cc
@@ -23,20 +23,10 @@
namespace {
-// A constant for the "data" JSON message field.
-// The type is wstring because the constant is used to get a
-// DictionaryValue field (which requires a wide string).
-static const std::wstring kDataWide = L"data";
-
-// A constant for the "result" JSON message field.
-// The type is wstring because the constant is used to get a
-// DictionaryValue field (which requires a wide string).
-static const std::wstring kResultWide = L"result";
-
-// A constant for the "command" JSON message field.
-// The type is wstring because the constant is used to get a
-// DictionaryValue field (which requires a wide string).
-static const std::wstring kCommandWide = L"command";
+// Constants for the "data", "result", and "command" JSON message fields.
+const char kDataKey[] = "data";
+const char kResultKey[] = "result";
+const char kCommandKey[] = "command";
} // namespace
@@ -78,20 +68,20 @@ void DebuggerRemoteService::HandleMessage(
return;
}
content = static_cast<DictionaryValue*>(request.get());
- if (!content->HasKey(kCommandWide)) {
+ if (!content->HasKey(kCommandKey)) {
NOTREACHED(); // Broken protocol :(
return;
}
std::string command;
DictionaryValue response;
- content->GetString(kCommandWide, &command);
- response.SetString(kCommandWide, command);
+ content->GetString(kCommandKey, &command);
+ response.SetString(kCommandKey, command);
bool send_response = true;
if (destination.size() == 0) {
// Unknown command (bad format?)
NOTREACHED();
- response.SetInteger(kResultWide, RESULT_UNKNOWN_COMMAND);
+ response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND);
SendResponse(response, message.tool(), message.destination());
return;
}
@@ -100,10 +90,10 @@ void DebuggerRemoteService::HandleMessage(
if (command == DebuggerRemoteServiceCommand::kAttach) {
// TODO(apavlov): handle 0 for a new tab
- response.SetString(kCommandWide, DebuggerRemoteServiceCommand::kAttach);
+ response.SetString(kCommandKey, DebuggerRemoteServiceCommand::kAttach);
AttachToTab(destination, &response);
} else if (command == DebuggerRemoteServiceCommand::kDetach) {
- response.SetString(kCommandWide, DebuggerRemoteServiceCommand::kDetach);
+ response.SetString(kCommandKey, DebuggerRemoteServiceCommand::kDetach);
DetachFromTab(destination, &response);
} else if (command == DebuggerRemoteServiceCommand::kDebuggerCommand) {
send_response = DispatchDebuggerCommand(tab_uid, content, &response);
@@ -112,7 +102,7 @@ void DebuggerRemoteService::HandleMessage(
} else {
// Unknown command
NOTREACHED();
- response.SetInteger(kResultWide, RESULT_UNKNOWN_COMMAND);
+ response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND);
}
if (send_response) {
@@ -183,9 +173,9 @@ void DebuggerRemoteService::DebuggerOutput(int32 tab_uid,
void DebuggerRemoteService::FrameNavigate(int32 tab_uid,
const std::string& url) {
DictionaryValue value;
- value.SetString(kCommandWide, DebuggerRemoteServiceCommand::kFrameNavigate);
- value.SetInteger(kResultWide, RESULT_OK);
- value.SetString(kDataWide, url);
+ value.SetString(kCommandKey, DebuggerRemoteServiceCommand::kFrameNavigate);
+ value.SetInteger(kResultKey, RESULT_OK);
+ value.SetString(kDataKey, url);
SendResponse(value, kToolName, base::IntToString(tab_uid));
}
@@ -194,8 +184,8 @@ void DebuggerRemoteService::FrameNavigate(int32 tab_uid,
// Sends the corresponding message to the remote debugger.
void DebuggerRemoteService::TabClosed(int32 tab_id) {
DictionaryValue value;
- value.SetString(kCommandWide, DebuggerRemoteServiceCommand::kTabClosed);
- value.SetInteger(kResultWide, RESULT_OK);
+ value.SetString(kCommandKey, DebuggerRemoteServiceCommand::kTabClosed);
+ value.SetInteger(kResultKey, RESULT_OK);
SendResponse(value, kToolName, base::IntToString(tab_id));
}
@@ -208,20 +198,20 @@ void DebuggerRemoteService::AttachToTab(const std::string& destination,
base::StringToInt(destination, &tab_uid);
if (tab_uid < 0) {
// Bad tab_uid received from remote debugger (perhaps NaN)
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return;
}
if (tab_uid == 0) { // single tab_uid
// We've been asked to open a new tab with URL
// TODO(apavlov): implement
NOTIMPLEMENTED();
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return;
}
TabContents* tab_contents = ToTabContents(tab_uid);
if (tab_contents == NULL) {
// No active tab contents with tab_uid
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return;
}
RenderViewHost* target_host = tab_contents->render_view_host();
@@ -233,13 +223,13 @@ void DebuggerRemoteService::AttachToTab(const std::string& destination,
DevToolsManager* manager = DevToolsManager::GetInstance();
if (manager != NULL) {
manager->RegisterDevToolsClientHostFor(target_host, client_host);
- response->SetInteger(kResultWide, RESULT_OK);
+ response->SetInteger(kResultKey, RESULT_OK);
} else {
- response->SetInteger(kResultWide, RESULT_DEBUGGER_ERROR);
+ response->SetInteger(kResultKey, RESULT_DEBUGGER_ERROR);
}
} else {
// DevToolsClientHost for this tab is already registered
- response->SetInteger(kResultWide, RESULT_ILLEGAL_TAB_STATE);
+ response->SetInteger(kResultKey, RESULT_ILLEGAL_TAB_STATE);
}
}
@@ -253,7 +243,7 @@ void DebuggerRemoteService::DetachFromTab(const std::string& destination,
if (tab_uid == -1) {
// Bad tab_uid received from remote debugger (NaN)
if (response != NULL) {
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
}
return;
}
@@ -268,7 +258,7 @@ void DebuggerRemoteService::DetachFromTab(const std::string& destination,
result_code = RESULT_UNKNOWN_TAB;
}
if (response != NULL) {
- response->SetInteger(kResultWide, result_code);
+ response->SetInteger(kResultKey, result_code);
}
}
@@ -281,30 +271,30 @@ bool DebuggerRemoteService::DispatchDebuggerCommand(int tab_uid,
DictionaryValue* response) {
if (tab_uid == -1) {
// Invalid tab_uid from remote debugger (perhaps NaN)
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return true;
}
DevToolsManager* manager = DevToolsManager::GetInstance();
if (manager == NULL) {
- response->SetInteger(kResultWide, RESULT_DEBUGGER_ERROR);
+ response->SetInteger(kResultKey, RESULT_DEBUGGER_ERROR);
return true;
}
TabContents* tab_contents = ToTabContents(tab_uid);
if (tab_contents == NULL) {
// Unknown tab_uid from remote debugger
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return true;
}
DevToolsClientHost* client_host =
manager->GetDevToolsClientHostFor(tab_contents->render_view_host());
if (client_host == NULL) {
// tab_uid is not being debugged (Attach has not been invoked)
- response->SetInteger(kResultWide, RESULT_ILLEGAL_TAB_STATE);
+ response->SetInteger(kResultKey, RESULT_ILLEGAL_TAB_STATE);
return true;
}
std::string v8_command;
DictionaryValue* v8_command_value;
- content->GetDictionary(kDataWide, &v8_command_value);
+ content->GetDictionary(kDataKey, &v8_command_value);
base::JSONWriter::Write(v8_command_value, false, &v8_command);
manager->ForwardToDevToolsAgent(
client_host, DevToolsAgentMsg_DebuggerCommand(v8_command));
@@ -322,26 +312,26 @@ bool DebuggerRemoteService::DispatchEvaluateJavascript(
DictionaryValue* response) {
if (tab_uid == -1) {
// Invalid tab_uid from remote debugger (perhaps NaN)
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return true;
}
TabContents* tab_contents = ToTabContents(tab_uid);
if (tab_contents == NULL) {
// Unknown tab_uid from remote debugger
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return true;
}
RenderViewHost* render_view_host = tab_contents->render_view_host();
if (render_view_host == NULL) {
// No RenderViewHost
- response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_TAB);
return true;
}
- std::wstring javascript;
- content->GetString(kDataWide, &javascript);
+ std::string javascript;
+ content->GetString(kDataKey, &javascript);
render_view_host->Send(
new ViewMsg_ScriptEvalRequest(render_view_host->routing_id(),
L"",
- javascript));
+ UTF8ToWide(javascript)));
return false;
}
diff --git a/chrome/browser/debugger/devtools_remote_service.cc b/chrome/browser/debugger/devtools_remote_service.cc
index 3f786af9..d67174c 100644
--- a/chrome/browser/debugger/devtools_remote_service.cc
+++ b/chrome/browser/debugger/devtools_remote_service.cc
@@ -16,14 +16,17 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/common/devtools_messages.h"
-const std::string DevToolsRemoteServiceCommand::kPing = "ping";
-const std::string DevToolsRemoteServiceCommand::kVersion = "version";
-const std::string DevToolsRemoteServiceCommand::kListTabs = "list_tabs";
+const char DevToolsRemoteServiceCommand::kPing[] = "ping";
+const char DevToolsRemoteServiceCommand::kVersion[] = "version";
+const char DevToolsRemoteServiceCommand::kListTabs[] = "list_tabs";
-const std::wstring DevToolsRemoteService::kCommandWide = L"command";
-const std::wstring DevToolsRemoteService::kDataWide = L"data";
-const std::wstring DevToolsRemoteService::kResultWide = L"result";
-const std::string DevToolsRemoteService::kToolName = "DevToolsService";
+const char DevToolsRemoteService::kToolName[] = "DevToolsService";
+
+namespace {
+const char kCommandKey[] = "command";
+const char kDataKey[] = "data";
+const char kResultKey[] = "result";
+} // namespace
DevToolsRemoteService::DevToolsRemoteService(DevToolsProtocolHandler* delegate)
: delegate_(delegate) {}
@@ -41,7 +44,7 @@ void DevToolsRemoteService::HandleMessage(
DictionaryValue* json;
if (request->IsType(Value::TYPE_DICTIONARY)) {
json = static_cast<DictionaryValue*>(request.get());
- if (!json->HasKey(kCommandWide)) {
+ if (!json->HasKey(kCommandKey)) {
NOTREACHED(); // Broken protocol - no "command" specified
return;
}
@@ -59,15 +62,15 @@ void DevToolsRemoteService::ProcessJson(DictionaryValue* json,
std::string command;
DictionaryValue response;
- json->GetString(kCommandWide, &command);
- response.SetString(kCommandWide, command);
+ json->GetString(kCommandKey, &command);
+ response.SetString(kCommandKey, command);
if (command == DevToolsRemoteServiceCommand::kPing) {
- response.SetInteger(kResultWide, Result::kOk);
- response.SetString(kDataWide, kOkResponse);
+ response.SetInteger(kResultKey, Result::kOk);
+ response.SetString(kDataKey, kOkResponse);
} else if (command == DevToolsRemoteServiceCommand::kVersion) {
- response.SetInteger(kResultWide, Result::kOk);
- response.SetString(kDataWide, kVersion);
+ response.SetInteger(kResultKey, Result::kOk);
+ response.SetString(kDataKey, kVersion);
} else if (command == DevToolsRemoteServiceCommand::kListTabs) {
ListValue* data = new ListValue();
const InspectableTabProxy::ControllersMap& navcon_map =
@@ -86,12 +89,12 @@ void DevToolsRemoteService::ProcessJson(DictionaryValue* json,
data->Append(tab);
}
}
- response.SetInteger(kResultWide, Result::kOk);
- response.Set(kDataWide, data);
+ response.SetInteger(kResultKey, Result::kOk);
+ response.Set(kDataKey, data);
} else {
// Unknown protocol command.
NOTREACHED();
- response.SetInteger(kResultWide, Result::kUnknownCommand);
+ response.SetInteger(kResultKey, Result::kUnknownCommand);
}
std::string response_json;
base::JSONWriter::Write(&response, false, &response_json);
diff --git a/chrome/browser/debugger/devtools_remote_service.h b/chrome/browser/debugger/devtools_remote_service.h
index cc99ce3..8ad17ba 100644
--- a/chrome/browser/debugger/devtools_remote_service.h
+++ b/chrome/browser/debugger/devtools_remote_service.h
@@ -18,9 +18,9 @@ class Value;
// Contains constants for DevToolsRemoteService tool protocol commands.
struct DevToolsRemoteServiceCommand {
- static const std::string kPing;
- static const std::string kVersion;
- static const std::string kListTabs;
+ static const char kPing[];
+ static const char kVersion[];
+ static const char kListTabs[];
};
// Handles Chrome remote debugger protocol service commands.
@@ -32,7 +32,7 @@ class DevToolsRemoteService : public DevToolsRemoteListener {
virtual void HandleMessage(const DevToolsRemoteMessage& message);
virtual void OnConnectionLost() {}
- static const std::string kToolName;
+ static const char kToolName[];
private:
// Operation result returned in the "result" field.
@@ -42,9 +42,6 @@ class DevToolsRemoteService : public DevToolsRemoteListener {
};
virtual ~DevToolsRemoteService();
void ProcessJson(DictionaryValue* json, const DevToolsRemoteMessage& message);
- static const std::wstring kCommandWide;
- static const std::wstring kDataWide;
- static const std::wstring kResultWide;
DevToolsProtocolHandler* delegate_;
DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteService);
};
diff --git a/chrome/browser/debugger/extension_ports_remote_service.cc b/chrome/browser/debugger/extension_ports_remote_service.cc
index 04302f1..ad9f3b6 100644
--- a/chrome/browser/debugger/extension_ports_remote_service.cc
+++ b/chrome/browser/debugger/extension_ports_remote_service.cc
@@ -74,38 +74,38 @@ namespace {
// "data" field in this case.
// Commands:
-static const std::string kConnect = "connect";
-static const std::string kDisconnect = "disconnect";
-static const std::string kPostMessage = "postMessage";
+const char kConnect[] = "connect";
+const char kDisconnect[] = "disconnect";
+const char kPostMessage[] = "postMessage";
// Events:
-static const std::string kOnMessage = "onMessage";
-static const std::string kOnDisconnect = "onDisconnect";
+const char kOnMessage[] = "onMessage";
+const char kOnDisconnect[] = "onDisconnect";
// Constants for the JSON message fields.
// The type is wstring because the constant is used to get a
// DictionaryValue field (which requires a wide string).
// Mandatory.
-static const std::wstring kCommandWide = L"command";
+const char kCommandKey[] = "command";
// Always present in messages sent to the external client.
-static const std::wstring kResultWide = L"result";
+const char kResultKey[] = "result";
// Field for command-specific parameters. Not strictly necessary, but
// makes it more similar to the remote debugger protocol, which should
// allow easier reuse of client code.
-static const std::wstring kDataWide = L"data";
+const char kDataKey[] = "data";
// Fields within the "data" dictionary:
// Required for "connect":
-static const std::wstring kExtensionIdWide = L"extensionId";
+const char kExtensionIdKey[] = "extensionId";
// Optional in "connect":
-static const std::wstring kChannelNameWide = L"channelName";
-static const std::wstring kTabIdWide = L"tabId";
+const char kChannelNameKey[] = "channelName";
+const char kTabIdKey[] = "tabId";
// Present under "data" in replies to a successful "connect" .
-static const std::wstring kPortIdWide = L"portId";
+const char kPortIdKey[] = "portId";
} // namespace
@@ -159,21 +159,21 @@ void ExtensionPortsRemoteService::HandleMessage(
return;
}
content = static_cast<DictionaryValue*>(request.get());
- if (!content->HasKey(kCommandWide)) {
+ if (!content->HasKey(kCommandKey)) {
NOTREACHED(); // Broken protocol :(
return;
}
std::string command;
DictionaryValue response;
- content->GetString(kCommandWide, &command);
- response.SetString(kCommandWide, command);
+ content->GetString(kCommandKey, &command);
+ response.SetString(kCommandKey, command);
if (!service_) {
// This happens if we failed to obtain an ExtensionMessageService
// during initialization.
NOTREACHED();
- response.SetInteger(kResultWide, RESULT_NO_SERVICE);
+ response.SetInteger(kResultKey, RESULT_NO_SERVICE);
SendResponse(response, message.tool(), message.destination());
return;
}
@@ -184,23 +184,23 @@ void ExtensionPortsRemoteService::HandleMessage(
if (command == kConnect) {
if (destination != -1) // destination should be empty for this command.
- response.SetInteger(kResultWide, RESULT_UNKNOWN_COMMAND);
+ response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND);
else
ConnectCommand(content, &response);
} else if (command == kDisconnect) {
if (destination == -1) // Destination required for this command.
- response.SetInteger(kResultWide, RESULT_UNKNOWN_COMMAND);
+ response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND);
else
DisconnectCommand(destination, &response);
} else if (command == kPostMessage) {
if (destination == -1) // Destination required for this command.
- response.SetInteger(kResultWide, RESULT_UNKNOWN_COMMAND);
+ response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND);
else
PostMessageCommand(destination, content, &response);
} else {
// Unknown command
NOTREACHED();
- response.SetInteger(kResultWide, RESULT_UNKNOWN_COMMAND);
+ response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND);
}
SendResponse(response, message.tool(), message.destination());
}
@@ -271,15 +271,15 @@ void ExtensionPortsRemoteService::OnExtensionMessage(
<< ", < " << message << ">";
// Transpose the information into a JSON message for the external client.
DictionaryValue content;
- content.SetString(kCommandWide, kOnMessage);
- content.SetInteger(kResultWide, RESULT_OK);
+ content.SetString(kCommandKey, kOnMessage);
+ content.SetInteger(kResultKey, RESULT_OK);
// Turn the stringified message body back into JSON.
Value* data = base::JSONReader::Read(message, false);
if (!data) {
NOTREACHED();
return;
}
- content.Set(kDataWide, data);
+ content.Set(kDataKey, data);
SendResponse(content, kToolName, base::IntToString(port_id));
}
@@ -287,8 +287,8 @@ void ExtensionPortsRemoteService::OnExtensionPortDisconnected(int port_id) {
LOG(INFO) << "Disconnect event for port " << port_id;
openPortIds_.erase(port_id);
DictionaryValue content;
- content.SetString(kCommandWide, kOnDisconnect);
- content.SetInteger(kResultWide, RESULT_OK);
+ content.SetString(kCommandKey, kOnDisconnect);
+ content.SetInteger(kResultKey, RESULT_OK);
SendResponse(content, kToolName, base::IntToString(port_id));
}
@@ -296,19 +296,19 @@ void ExtensionPortsRemoteService::ConnectCommand(
DictionaryValue* content, DictionaryValue* response) {
// Parse out the parameters.
DictionaryValue* data;
- if (!content->GetDictionary(kDataWide, &data)) {
- response->SetInteger(kResultWide, RESULT_PARAMETER_ERROR);
+ if (!content->GetDictionary(kDataKey, &data)) {
+ response->SetInteger(kResultKey, RESULT_PARAMETER_ERROR);
return;
}
std::string extension_id;
- if (!data->GetString(kExtensionIdWide, &extension_id)) {
- response->SetInteger(kResultWide, RESULT_PARAMETER_ERROR);
+ if (!data->GetString(kExtensionIdKey, &extension_id)) {
+ response->SetInteger(kResultKey, RESULT_PARAMETER_ERROR);
return;
}
std::string channel_name = "";
- data->GetString(kChannelNameWide, &channel_name); // optional.
+ data->GetString(kChannelNameKey, &channel_name); // optional.
int tab_id = -1;
- data->GetInteger(kTabIdWide, &tab_id); // optional.
+ data->GetInteger(kTabIdKey, &tab_id); // optional.
int port_id;
if (tab_id != -1) { // Resolve the tab ID.
const InspectableTabProxy::ControllersMap& navcon_map =
@@ -320,7 +320,7 @@ void ExtensionPortsRemoteService::ConnectCommand(
tab_contents = it->second->tab_contents();
if (!tab_contents) {
LOG(INFO) << "tab not found: " << tab_id;
- response->SetInteger(kResultWide, RESULT_TAB_NOT_FOUND);
+ response->SetInteger(kResultKey, RESULT_TAB_NOT_FOUND);
return;
}
// Ask the ExtensionMessageService to open the channel.
@@ -341,16 +341,16 @@ void ExtensionPortsRemoteService::ConnectCommand(
if (port_id == -1) {
// Failure: probably the extension ID doesn't exist.
LOG(INFO) << "Connect failed";
- response->SetInteger(kResultWide, RESULT_CONNECT_FAILED);
+ response->SetInteger(kResultKey, RESULT_CONNECT_FAILED);
return;
}
LOG(INFO) << "Connected: port " << port_id;
openPortIds_.insert(port_id);
// Reply to external client with the port ID assigned to the new channel.
DictionaryValue* reply_data = new DictionaryValue();
- reply_data->SetInteger(kPortIdWide, port_id);
- response->Set(kDataWide, reply_data);
- response->SetInteger(kResultWide, RESULT_OK);
+ reply_data->SetInteger(kPortIdKey, port_id);
+ response->Set(kDataKey, reply_data);
+ response->SetInteger(kResultKey, RESULT_OK);
}
void ExtensionPortsRemoteService::DisconnectCommand(
@@ -359,20 +359,20 @@ void ExtensionPortsRemoteService::DisconnectCommand(
PortIdSet::iterator portEntry = openPortIds_.find(port_id);
if (portEntry == openPortIds_.end()) { // unknown port ID.
LOG(INFO) << "unknown port: " << port_id;
- response->SetInteger(kResultWide, RESULT_UNKNOWN_PORT);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_PORT);
return;
}
DCHECK(service_);
service_->CloseChannel(port_id);
openPortIds_.erase(portEntry);
- response->SetInteger(kResultWide, RESULT_OK);
+ response->SetInteger(kResultKey, RESULT_OK);
}
void ExtensionPortsRemoteService::PostMessageCommand(
int port_id, DictionaryValue* content, DictionaryValue* response) {
Value* data;
- if (!content->Get(kDataWide, &data)) {
- response->SetInteger(kResultWide, RESULT_PARAMETER_ERROR);
+ if (!content->Get(kDataKey, &data)) {
+ response->SetInteger(kResultKey, RESULT_PARAMETER_ERROR);
return;
}
std::string message;
@@ -383,12 +383,12 @@ void ExtensionPortsRemoteService::PostMessageCommand(
PortIdSet::iterator portEntry = openPortIds_.find(port_id);
if (portEntry == openPortIds_.end()) { // Unknown port ID.
LOG(INFO) << "unknown port: " << port_id;
- response->SetInteger(kResultWide, RESULT_UNKNOWN_PORT);
+ response->SetInteger(kResultKey, RESULT_UNKNOWN_PORT);
return;
}
// Post the message through the ExtensionMessageService.
DCHECK(service_);
service_->PostMessageFromRenderer(port_id, message);
// Confirm to the external client that we sent its message.
- response->SetInteger(kResultWide, RESULT_OK);
+ response->SetInteger(kResultKey, RESULT_OK);
}
diff --git a/chrome/browser/dom_ui/core_options_handler.cc b/chrome/browser/dom_ui/core_options_handler.cc
index f01a726..4276281 100644
--- a/chrome/browser/dom_ui/core_options_handler.cc
+++ b/chrome/browser/dom_ui/core_options_handler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/dom_ui/core_options_handler.h"
#include "app/l10n_util.h"
+#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -170,7 +171,7 @@ void CoreOptionsHandler::HandleFetchPrefs(const Value* value) {
if (!param_values->Get(0, &callback) || !callback->IsType(Value::TYPE_STRING))
return;
- std::wstring callback_function;
+ string16 callback_function;
if (!callback->GetAsString(&callback_function))
return;
@@ -191,7 +192,8 @@ void CoreOptionsHandler::HandleFetchPrefs(const Value* value) {
result_value.Set(pref_name.c_str(), FetchPref(pref_name));
}
- dom_ui_->CallJavascriptFunction(callback_function.c_str(), result_value);
+ dom_ui_->CallJavascriptFunction(UTF16ToWideHack(callback_function).c_str(),
+ result_value);
}
void CoreOptionsHandler::HandleObservePrefs(const Value* value) {
@@ -208,7 +210,7 @@ void CoreOptionsHandler::HandleObservePrefs(const Value* value) {
return;
// Get preference change callback function name.
- std::wstring callback_func_name;
+ string16 callback_func_name;
if (!list_value->GetString(0, &callback_func_name))
return;
@@ -228,7 +230,8 @@ void CoreOptionsHandler::HandleObservePrefs(const Value* value) {
ObservePref(pref_name);
pref_callback_map_.insert(
- PreferenceCallbackMap::value_type(pref_name, callback_func_name));
+ PreferenceCallbackMap::value_type(pref_name,
+ UTF16ToWideHack(callback_func_name)));
}
}
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 8d441b0..118e262 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -176,12 +176,13 @@ bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) {
return false;
}
+// TODO(viettrungluu): convert to string16 (or UTF-8 std::string?).
std::wstring DOMMessageHandler::ExtractStringValue(const Value* value) {
if (value && value->GetType() == Value::TYPE_LIST) {
const ListValue* list_value = static_cast<const ListValue*>(value);
- std::wstring wstring_value;
- if (list_value->GetString(0, &wstring_value))
- return wstring_value;
+ string16 string16_value;
+ if (list_value->GetString(0, &string16_value))
+ return UTF16ToWideHack(string16_value);
}
return std::wstring();
}
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index b8f9119..12da5f7 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -9,6 +9,7 @@
#include "base/stl_util-inl.h"
#include "base/string16.h"
#include "base/string_number_conversions.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_codec.h"
#include "chrome/browser/bookmarks/bookmark_html_writer.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -321,7 +322,7 @@ bool GetBookmarkTreeFunction::RunImpl() {
}
bool SearchBookmarksFunction::RunImpl() {
- std::wstring query;
+ string16 query;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &query));
BookmarkModel* model = profile()->GetBookmarkModel();
@@ -329,7 +330,7 @@ bool SearchBookmarksFunction::RunImpl() {
std::wstring lang =
UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
std::vector<const BookmarkNode*> nodes;
- bookmark_utils::GetBookmarksContainingText(model, query,
+ bookmark_utils::GetBookmarksContainingText(model, UTF16ToWideHack(query),
std::numeric_limits<int>::max(),
lang, &nodes);
std::vector<const BookmarkNode*>::iterator i = nodes.begin();
diff --git a/chrome/browser/first_run/first_run_gtk.cc b/chrome/browser/first_run/first_run_gtk.cc
index 725cdd0..0f6e7db 100644
--- a/chrome/browser/first_run/first_run_gtk.cc
+++ b/chrome/browser/first_run/first_run_gtk.cc
@@ -9,7 +9,9 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/process_util.h"
+#include "base/string_piece.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/gtk/first_run_dialog.h"
#include "chrome/browser/profile_manager.h"
@@ -103,14 +105,15 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
if (!FirstRun::CreateSentinel())
return false;
- std::wstring import_bookmarks_path;
+ std::string import_bookmarks_path;
installer_util::GetDistroStringPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksFromFilePref,
&import_bookmarks_path);
if (!import_bookmarks_path.empty()) {
// There are bookmarks to import from a file.
- FilePath path = FilePath::FromWStringHack(import_bookmarks_path);
+ FilePath path = FilePath::FromWStringHack(
+ UTF8ToWide(import_bookmarks_path));
if (!FirstRun::ImportBookmarks(path)) {
LOG(WARNING) << "silent bookmark import failed";
}
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 6cfc233..57a15c2 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -391,7 +391,7 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
value)
FirstRun::SetShowWelcomePagePref();
- std::wstring import_bookmarks_path;
+ std::string import_bookmarks_path;
installer_util::GetDistroStringPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksFromFilePref,
&import_bookmarks_path);
@@ -401,8 +401,9 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
// the importer process and blocks until done or until it fails.
scoped_refptr<ImporterHost> importer_host = new ImporterHost();
if (!FirstRun::ImportSettings(NULL,
- importer_host->GetSourceProfileInfoAt(0).browser_type,
- import_items, FilePath(import_bookmarks_path), true, NULL)) {
+ importer_host->GetSourceProfileInfoAt(0).browser_type, import_items,
+ FilePath::FromWStringHack(UTF8ToWide(import_bookmarks_path)),
+ true, NULL)) {
LOG(WARNING) << "silent import failed";
}
}
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index 97a2155..ad49b64 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -374,8 +374,8 @@ void TopSites::MigratePinnedURLs() {
DictionaryValue* dict = static_cast<DictionaryValue*>(value);
std::string url_string;
int index;
- if (dict->GetString(L"url", &url_string) &&
- dict->GetInteger(L"index", &index))
+ if (dict->GetString("url", &url_string) &&
+ dict->GetInteger("index", &index))
tmp_map[GURL(url_string)] = index;
}
}
diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc
index 53d99f7..9034305 100644
--- a/chrome/browser/importer/importer_bridge.cc
+++ b/chrome/browser/importer/importer_bridge.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/scoped_ptr.h"
+#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/chrome_thread.h"
@@ -182,11 +183,10 @@ void ExternalProcessImporterBridge::NotifyEnded() {
// The internal process detects import end when all items have been received.
}
+// TODO(viettrungluu): convert to string16.
std::wstring ExternalProcessImporterBridge::GetLocalizedString(
int message_id) {
- std::wstring message;
- localized_strings_->GetString(ASCIIToWide(base::IntToString(message_id)),
- &message);
- return message;
+ string16 message;
+ localized_strings_->GetString(base::IntToString(message_id), &message);
+ return UTF16ToWideHack(message);
}
-
diff --git a/chrome/browser/notifications/notifications_prefs_cache.cc b/chrome/browser/notifications/notifications_prefs_cache.cc
index 2fec1e8..4a60a95 100644
--- a/chrome/browser/notifications/notifications_prefs_cache.cc
+++ b/chrome/browser/notifications/notifications_prefs_cache.cc
@@ -55,10 +55,10 @@ void NotificationsPrefsCache::ListValueToGurlVector(
const ListValue& origin_list,
std::vector<GURL>* origin_vector) {
ListValue::const_iterator i;
- std::wstring origin;
+ std::string origin;
for (i = origin_list.begin(); i != origin_list.end(); ++i) {
(*i)->GetAsString(&origin);
- origin_vector->push_back(GURL(WideToUTF8(origin)));
+ origin_vector->push_back(GURL(origin));
}
}
diff --git a/chrome/browser/policy/config_dir_policy_provider_unittest.cc b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
index 987a50b..9e3d25b 100644
--- a/chrome/browser/policy/config_dir_policy_provider_unittest.cc
+++ b/chrome/browser/policy/config_dir_policy_provider_unittest.cc
@@ -67,7 +67,7 @@ TEST_F(ConfigDirPolicyProviderTest, ReadPrefsNonExistentDirectory) {
// Test reading back a single preference value.
TEST_F(ConfigDirPolicyProviderTest, ReadPrefsSinglePref) {
DictionaryValue test_dict;
- test_dict.SetString(L"HomepageLocation", L"http://www.google.com");
+ test_dict.SetString("HomepageLocation", "http://www.google.com");
WriteConfigFile(test_dict, "config_file");
ConfigDirPolicyProvider provider(test_dir_);
@@ -79,9 +79,9 @@ TEST_F(ConfigDirPolicyProviderTest, ReadPrefsSinglePref) {
policy_map.find(ConfigurationPolicyStore::kPolicyHomePage);
ASSERT_TRUE(entry != policy_map.end());
- std::wstring str_value;
+ std::string str_value;
EXPECT_TRUE(entry->second->GetAsString(&str_value));
- EXPECT_EQ(L"http://www.google.com", str_value);
+ EXPECT_EQ("http://www.google.com", str_value);
}
// Test merging values from different files.
@@ -91,11 +91,11 @@ TEST_F(ConfigDirPolicyProviderTest, ReadPrefsMergePrefs) {
// filesystem may return files in arbitrary order, there is no way to be sure,
// but this is better than nothing.
DictionaryValue test_dict_bar;
- test_dict_bar.SetString(L"HomepageLocation", L"http://bar.com");
+ test_dict_bar.SetString("HomepageLocation", "http://bar.com");
for (unsigned int i = 1; i <= 4; ++i)
WriteConfigFile(test_dict_bar, base::IntToString(i));
DictionaryValue test_dict_foo;
- test_dict_foo.SetString(L"HomepageLocation", L"http://foo.com");
+ test_dict_foo.SetString("HomepageLocation", "http://foo.com");
WriteConfigFile(test_dict_foo, "9");
for (unsigned int i = 5; i <= 8; ++i)
WriteConfigFile(test_dict_bar, base::IntToString(i));
@@ -109,7 +109,7 @@ TEST_F(ConfigDirPolicyProviderTest, ReadPrefsMergePrefs) {
policy_map.find(ConfigurationPolicyStore::kPolicyHomePage);
ASSERT_TRUE(entry != policy_map.end());
- std::wstring str_value;
+ std::string str_value;
EXPECT_TRUE(entry->second->GetAsString(&str_value));
- EXPECT_EQ(L"http://foo.com", str_value);
+ EXPECT_EQ("http://foo.com", str_value);
}
diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc
index 4535528..9e3ad7e 100644
--- a/chrome/browser/pref_service.cc
+++ b/chrome/browser/pref_service.cc
@@ -667,12 +667,12 @@ int64 PrefService::GetInt64(const char* path) const {
NOTREACHED() << "Trying to read an unregistered pref: " << path;
return 0;
}
- std::wstring result(L"0");
+ std::string result("0");
bool rv = pref->GetValue()->GetAsString(&result);
DCHECK(rv);
int64 val;
- base::StringToInt64(WideToUTF8(result), &val);
+ base::StringToInt64(result, &val);
return val;
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index be75c6d..72532af 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -146,11 +146,11 @@ void SafeBrowsingBlockingPage::PopulateStringDictionary(
const std::wstring& description1,
const std::wstring& description2,
const std::wstring& description3) {
- strings->SetString(L"title", title);
- strings->SetString(L"headLine", headline);
- strings->SetString(L"description1", description1);
- strings->SetString(L"description2", description2);
- strings->SetString(L"description3", description3);
+ strings->SetString("title", WideToUTF16Hack(title));
+ strings->SetString("headLine", WideToUTF16Hack(headline));
+ strings->SetString("description1", WideToUTF16Hack(description1));
+ strings->SetString("description2", WideToUTF16Hack(description2));
+ strings->SetString("description3", WideToUTF16Hack(description3));
}
void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
@@ -158,14 +158,14 @@ void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
bool malware = false;
bool phishing = false;
- std::wstring phishing_label =
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_LABEL);
- std::wstring phishing_link =
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR);
- std::wstring malware_label =
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_LABEL);
- std::wstring malware_link =
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE);
+ string16 malware_label =
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_LABEL);
+ string16 malware_link =
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE);
+ string16 phishing_label =
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_LABEL);
+ string16 phishing_link =
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR);
ListValue* error_strings = new ListValue;
for (UnsafeResourceList::const_iterator iter = unsafe_resources_.begin();
@@ -174,20 +174,20 @@ void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
DictionaryValue* current_error_strings = new DictionaryValue;
if (resource.threat_type == SafeBrowsingService::URL_MALWARE) {
malware = true;
- current_error_strings->SetString(L"type", L"malware");
- current_error_strings->SetString(L"typeLabel", malware_label);
- current_error_strings->SetString(L"errorLink", malware_link);
+ current_error_strings->SetString("type", "malware");
+ current_error_strings->SetString("typeLabel", malware_label);
+ current_error_strings->SetString("errorLink", malware_link);
} else {
DCHECK(resource.threat_type == SafeBrowsingService::URL_PHISHING);
phishing = true;
- current_error_strings->SetString(L"type", L"phishing");
- current_error_strings->SetString(L"typeLabel", phishing_label);
- current_error_strings->SetString(L"errorLink", phishing_link);
+ current_error_strings->SetString("type", "phishing");
+ current_error_strings->SetString("typeLabel", phishing_label);
+ current_error_strings->SetString("errorLink", phishing_link);
}
- current_error_strings->SetString(L"url", UTF8ToWide(resource.url.spec()));
+ current_error_strings->SetString("url", resource.url.spec());
error_strings->Append(current_error_strings);
}
- strings->Set(L"errors", error_strings);
+ strings->Set("errors", error_strings);
DCHECK(phishing || malware);
if (malware && phishing) {
@@ -221,13 +221,13 @@ void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
L"", L"");
}
- strings->SetString(L"confirm_text",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
- strings->SetString(L"continue_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
- strings->SetString(L"back_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
- strings->SetString(L"textdirection", base::i18n::IsRTL() ? L"rtl" : L"ltr");
+ strings->SetString("confirm_text",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
+ strings->SetString("continue_button",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
+ strings->SetString("back_button",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
+ strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
}
void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
@@ -235,7 +235,7 @@ void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
std::wstring link = StringPrintf(kSbDiagnosticHtml,
l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
- strings->SetString(L"badURL", UTF8ToWide(url().host()));
+ strings->SetString("badURL", url().host());
// Check to see if we're blocking the main page, or a sub-resource on the
// main page.
std::wstring description1, description2;
@@ -261,13 +261,13 @@ void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
description1, description2,
l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3));
- strings->SetString(L"confirm_text",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
- strings->SetString(L"continue_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
- strings->SetString(L"back_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
- strings->SetString(L"textdirection", base::i18n::IsRTL() ? L"rtl" : L"ltr");
+ strings->SetString("confirm_text",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
+ strings->SetString("continue_button",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
+ strings->SetString("back_button",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
+ strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
}
void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
@@ -282,13 +282,13 @@ void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
UTF8ToWide(url().host())),
L"");
- strings->SetString(L"continue_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_PROCEED_BUTTON));
- strings->SetString(L"back_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_BACK_BUTTON));
- strings->SetString(L"report_error",
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR));
- strings->SetString(L"textdirection", base::i18n::IsRTL() ? L"rtl" : L"ltr");
+ strings->SetString("continue_button",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_PROCEED_BUTTON));
+ strings->SetString("back_button",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_BACK_BUTTON));
+ strings->SetString("report_error",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR));
+ strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
}
void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
@@ -443,16 +443,19 @@ void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) {
DictionaryValue strings;
PopulateMultipleThreatStringDictionary(&strings);
- std::wstring title;
- DCHECK(strings.GetString(L"title", &title));
+ string16 title;
+ DCHECK(strings.GetString("title", &title));
std::string action = "SBInterstitial";
- if (title == l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_THREAT_TITLE)) {
+ if (title ==
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MULTI_THREAT_TITLE)) {
action.append("Multiple");
- } else if (title == l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE)) {
+ } else if (title ==
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_TITLE)) {
action.append("Malware");
} else {
- DCHECK_EQ(title, l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE));
+ DCHECK_EQ(title,
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_TITLE));
action.append("Phishing");
}
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index 99b584a..c5dbdf5 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -9,6 +9,7 @@
#endif
#include "base/command_line.h"
+#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/pref_service.h"
@@ -3189,10 +3190,10 @@ void GetPrepopulatedTemplatefromPrefs(PrefService* prefs,
if (!list)
return;
- std::wstring name;
- std::wstring keyword;
- std::wstring search_url;
- std::wstring suggest_url;
+ string16 name;
+ string16 keyword;
+ std::string search_url;
+ std::string suggest_url;
std::string favicon_url;
std::string encoding;
int search_engine_type;
@@ -3204,16 +3205,16 @@ void GetPrepopulatedTemplatefromPrefs(PrefService* prefs,
Value* val;
DictionaryValue* engine;
list->GetDictionary(i, &engine);
- if (engine->Get(L"name", &val) && val->GetAsString(&name) &&
- engine->Get(L"keyword", &val) && val->GetAsString(&keyword) &&
- engine->Get(L"search_url", &val) && val->GetAsString(&search_url) &&
- engine->Get(L"suggest_url", &val) && val->GetAsString(&suggest_url) &&
- engine->Get(L"favicon_url", &val) && val->GetAsString(&favicon_url) &&
- engine->Get(L"encoding", &val) && val->GetAsString(&encoding) &&
- engine->Get(L"search_engine_type", &val) && val->GetAsInteger(
+ if (engine->Get("name", &val) && val->GetAsString(&name) &&
+ engine->Get("keyword", &val) && val->GetAsString(&keyword) &&
+ engine->Get("search_url", &val) && val->GetAsString(&search_url) &&
+ engine->Get("suggest_url", &val) && val->GetAsString(&suggest_url) &&
+ engine->Get("favicon_url", &val) && val->GetAsString(&favicon_url) &&
+ engine->Get("encoding", &val) && val->GetAsString(&encoding) &&
+ engine->Get("search_engine_type", &val) && val->GetAsInteger(
&search_engine_type) &&
- engine->Get(L"logo_id", &val) && val->GetAsInteger(&logo_id) &&
- engine->Get(L"id", &val) && val->GetAsInteger(&id)) {
+ engine->Get("logo_id", &val) && val->GetAsInteger(&logo_id) &&
+ engine->Get("id", &val) && val->GetAsInteger(&id)) {
// These next fields are not allowed to be empty.
if (search_url.empty() || favicon_url.empty() || encoding.empty())
return;
@@ -3221,11 +3222,14 @@ void GetPrepopulatedTemplatefromPrefs(PrefService* prefs,
// Got a parsing error. No big deal.
continue;
}
- t_urls->push_back(MakePrepopulatedTemplateURL(name.c_str(),
- keyword.c_str(),
- search_url.c_str(),
+ // TODO(viettrungluu): convert |MakePrepopulatedTemplateURL()| and get rid
+ // of conversions.
+ t_urls->push_back(MakePrepopulatedTemplateURL(
+ UTF16ToWideHack(name).c_str(),
+ UTF16ToWideHack(keyword).c_str(),
+ UTF8ToWide(search_url).c_str(),
favicon_url.c_str(),
- suggest_url.c_str(),
+ UTF8ToWide(suggest_url).c_str(),
encoding.c_str(),
static_cast<SearchEngineType>(search_engine_type),
logo_id,
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 75497e6..d3b048f 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -50,9 +50,9 @@ static bool GetAuthData(const std::string& json,
return false;
DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
- if (!result->GetString(L"user", username) ||
- !result->GetString(L"pass", password) ||
- !result->GetString(L"captcha", captcha)) {
+ if (!result->GetString("user", username) ||
+ !result->GetString("pass", password) ||
+ !result->GetString("captcha", captcha)) {
return false;
}
return true;
@@ -65,49 +65,49 @@ static bool GetDataTypeChoiceData(const std::string& json,
return false;
DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
- if (!result->GetBoolean(L"keepEverythingSynced", sync_everything))
+ if (!result->GetBoolean("keepEverythingSynced", sync_everything))
return false;
// These values need to be kept in sync with where they are written in
// choose_datatypes.html.
bool sync_bookmarks;
- if (!result->GetBoolean(L"syncBookmarks", &sync_bookmarks))
+ if (!result->GetBoolean("syncBookmarks", &sync_bookmarks))
return false;
if (sync_bookmarks)
data_types->insert(syncable::BOOKMARKS);
bool sync_preferences;
- if (!result->GetBoolean(L"syncPreferences", &sync_preferences))
+ if (!result->GetBoolean("syncPreferences", &sync_preferences))
return false;
if (sync_preferences)
data_types->insert(syncable::PREFERENCES);
bool sync_themes;
- if (!result->GetBoolean(L"syncThemes", &sync_themes))
+ if (!result->GetBoolean("syncThemes", &sync_themes))
return false;
if (sync_themes)
data_types->insert(syncable::THEMES);
bool sync_passwords;
- if (!result->GetBoolean(L"syncPasswords", &sync_passwords))
+ if (!result->GetBoolean("syncPasswords", &sync_passwords))
return false;
if (sync_passwords)
data_types->insert(syncable::PASSWORDS);
bool sync_autofill;
- if (!result->GetBoolean(L"syncAutofill", &sync_autofill))
+ if (!result->GetBoolean("syncAutofill", &sync_autofill))
return false;
if (sync_autofill)
data_types->insert(syncable::AUTOFILL);
bool sync_extensions;
- if (!result->GetBoolean(L"syncExtensions", &sync_extensions))
+ if (!result->GetBoolean("syncExtensions", &sync_extensions))
return false;
if (sync_extensions)
data_types->insert(syncable::EXTENSIONS);
bool sync_typed_urls;
- if (!result->GetBoolean(L"syncTypedUrls", &sync_typed_urls))
+ if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls))
return false;
if (sync_typed_urls)
data_types->insert(syncable::TYPED_URLS);
@@ -318,55 +318,55 @@ void SyncSetupFlow::OnDialogClosed(const std::string& json_retval) {
// static
void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service,
DictionaryValue* args) {
- args->SetString(L"iframeToShow", "login");
+ args->SetString("iframeToShow", "login");
const GoogleServiceAuthError& error = service->GetAuthError();
if (!service->last_attempted_user_email().empty()) {
- args->SetString(L"user", service->last_attempted_user_email());
- args->SetInteger(L"error", error.state());
- args->SetBoolean(L"editable_user", true);
+ args->SetString("user", service->last_attempted_user_email());
+ args->SetInteger("error", error.state());
+ args->SetBoolean("editable_user", true);
} else {
- std::wstring user(UTF16ToWide(service->GetAuthenticatedUsername()));
- args->SetString(L"user", user);
- args->SetInteger(L"error", 0);
- args->SetBoolean(L"editable_user", user.empty());
+ string16 user(service->GetAuthenticatedUsername());
+ args->SetString("user", user);
+ args->SetInteger("error", 0);
+ args->SetBoolean("editable_user", user.empty());
}
- args->SetString(L"captchaUrl", error.captcha().image_url.spec());
+ args->SetString("captchaUrl", error.captcha().image_url.spec());
}
// static
void SyncSetupFlow::GetArgsForChooseDataTypes(ProfileSyncService* service,
DictionaryValue* args) {
- args->SetString(L"iframeToShow", "choose_data_types");
- args->SetBoolean(L"keepEverythingSynced",
+ args->SetString("iframeToShow", "choose_data_types");
+ args->SetBoolean("keepEverythingSynced",
service->profile()->GetPrefs()->GetBoolean(prefs::kKeepEverythingSynced));
// Bookmarks, Preferences, and Themes are launched for good, there's no
// going back now. Check if the other data types are registered though.
syncable::ModelTypeSet registered_types;
service->GetRegisteredDataTypes(&registered_types);
- args->SetBoolean(L"passwordsRegistered",
+ args->SetBoolean("passwordsRegistered",
registered_types.count(syncable::PASSWORDS) > 0);
- args->SetBoolean(L"autofillRegistered",
+ args->SetBoolean("autofillRegistered",
registered_types.count(syncable::AUTOFILL) > 0);
- args->SetBoolean(L"extensionsRegistered",
+ args->SetBoolean("extensionsRegistered",
registered_types.count(syncable::EXTENSIONS) > 0);
- args->SetBoolean(L"typedUrlsRegistered",
+ args->SetBoolean("typedUrlsRegistered",
registered_types.count(syncable::TYPED_URLS) > 0);
- args->SetBoolean(L"syncBookmarks",
+ args->SetBoolean("syncBookmarks",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks));
- args->SetBoolean(L"syncPreferences",
+ args->SetBoolean("syncPreferences",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences));
- args->SetBoolean(L"syncThemes",
+ args->SetBoolean("syncThemes",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes));
- args->SetBoolean(L"syncPasswords",
+ args->SetBoolean("syncPasswords",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords));
- args->SetBoolean(L"syncAutofill",
+ args->SetBoolean("syncAutofill",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill));
- args->SetBoolean(L"syncExtensions",
+ args->SetBoolean("syncExtensions",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions));
- args->SetBoolean(L"syncTypedUrls",
+ args->SetBoolean("syncTypedUrls",
service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls));
}
@@ -427,7 +427,7 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) {
case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR: {
DictionaryValue args;
SyncSetupFlow::GetArgsForChooseDataTypes(service_, &args);
- args.SetBoolean(L"was_aborted", true);
+ args.SetBoolean("was_aborted", true);
flow_handler_->ShowChooseDataTypes(args);
break;
}
@@ -436,7 +436,7 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) {
// TODO(sync): Update this error messaging.
DictionaryValue args;
SyncSetupFlow::GetArgsForGaiaLogin(service_, &args);
- args.SetInteger(L"error", GoogleServiceAuthError::CONNECTION_FAILED);
+ args.SetInteger("error", GoogleServiceAuthError::CONNECTION_FAILED);
flow_handler_->ShowGaiaLogin(args);
break;
}
diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc
index 3f18400..e784231 100644
--- a/chrome/browser/sync/sync_setup_wizard_unittest.cc
+++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc
@@ -252,13 +252,13 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) {
SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
EXPECT_EQ(5U, dialog_args.size());
std::string iframe_to_show;
- dialog_args.GetString(L"iframeToShow", &iframe_to_show);
+ dialog_args.GetString("iframeToShow", &iframe_to_show);
EXPECT_EQ("login", iframe_to_show);
std::string actual_user;
- dialog_args.GetString(L"user", &actual_user);
+ dialog_args.GetString("user", &actual_user);
EXPECT_EQ(kTestUser, actual_user);
int error = -1;
- dialog_args.GetInteger(L"error", &error);
+ dialog_args.GetInteger("error", &error);
EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
service_->set_auth_state(kTestUser, AuthError::None());
@@ -269,13 +269,13 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) {
wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
EXPECT_EQ(5U, dialog_args.size());
- dialog_args.GetString(L"iframeToShow", &iframe_to_show);
+ dialog_args.GetString("iframeToShow", &iframe_to_show);
EXPECT_EQ("login", iframe_to_show);
std::string captcha_url;
- dialog_args.GetString(L"captchaUrl", &captcha_url);
+ dialog_args.GetString("captchaUrl", &captcha_url);
EXPECT_EQ(kTestCaptchaUrl, GURL(captcha_url).spec());
error = -1;
- dialog_args.GetInteger(L"error", &error);
+ dialog_args.GetInteger("error", &error);
EXPECT_EQ(static_cast<int>(AuthError::CAPTCHA_REQUIRED), error);
service_->set_auth_state(kTestUser, AuthError::None());
@@ -474,13 +474,13 @@ TEST_F(SyncSetupWizardTest, DiscreteRunGaiaLogin) {
SyncSetupFlow::GetArgsForGaiaLogin(service_, &dialog_args);
EXPECT_EQ(5U, dialog_args.size());
std::string iframe_to_show;
- dialog_args.GetString(L"iframeToShow", &iframe_to_show);
+ dialog_args.GetString("iframeToShow", &iframe_to_show);
EXPECT_EQ("login", iframe_to_show);
std::string actual_user;
- dialog_args.GetString(L"user", &actual_user);
+ dialog_args.GetString("user", &actual_user);
EXPECT_EQ(kTestUser, actual_user);
int error = -1;
- dialog_args.GetInteger(L"error", &error);
+ dialog_args.GetInteger("error", &error);
EXPECT_EQ(static_cast<int>(AuthError::INVALID_GAIA_CREDENTIALS), error);
service_->set_auth_state(kTestUser, AuthError::None());
diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc
index 3473343..5d00fe4 100644
--- a/chrome/browser/tabs/pinned_tab_codec.cc
+++ b/chrome/browser/tabs/pinned_tab_codec.cc
@@ -19,10 +19,10 @@
typedef BrowserInit::LaunchWithProfile::Tab Tab;
// Key used in dictionaries for the app id.
-static const wchar_t kAppID[] = L"app_id";
+static const char kAppID[] = "app_id";
// Key used in dictionaries for the url.
-static const wchar_t kURL[] = L"url";
+static const char kURL[] = "url";
// Returns true if |browser| has any pinned tabs.
static bool HasPinnedTabs(Browser* browser) {
diff --git a/chrome/browser/translate/translate_prefs.cc b/chrome/browser/translate/translate_prefs.cc
index 5ca8879..aa139b0 100644
--- a/chrome/browser/translate/translate_prefs.cc
+++ b/chrome/browser/translate/translate_prefs.cc
@@ -62,7 +62,7 @@ bool TranslatePrefs::IsLanguagePairWhitelisted(
const DictionaryValue* dict = prefs_->GetDictionary(kPrefTranslateWhitelists);
if (dict && !dict->empty()) {
std::string auto_target_lang;
- if (dict->GetString(ASCIIToWide(original_language), &auto_target_lang) &&
+ if (dict->GetString(original_language, &auto_target_lang) &&
auto_target_lang == target_language)
return true;
}
@@ -258,8 +258,7 @@ void TranslatePrefs::RemoveValueFromBlacklist(const char* pref_id,
bool TranslatePrefs::IsLanguageWhitelisted(
const std::string& original_language, std::string* target_language) {
const DictionaryValue* dict = prefs_->GetDictionary(kPrefTranslateWhitelists);
- if (dict &&
- dict->GetString(ASCIIToWide(original_language), target_language)) {
+ if (dict && dict->GetString(original_language, target_language)) {
DCHECK(!target_language->empty());
return !target_language->empty();
}
diff --git a/chrome/browser/views/select_file_dialog.cc b/chrome/browser/views/select_file_dialog.cc
index 0d523a8..0f2aaaa 100644
--- a/chrome/browser/views/select_file_dialog.cc
+++ b/chrome/browser/views/select_file_dialog.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/html_dialog_ui.h"
+#include "chrome/browser/profile_manager.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/browser_dialogs.h"
@@ -25,14 +26,12 @@
#include "views/window/non_client_view.h"
#include "views/window/window.h"
-#include "chrome/browser/profile_manager.h"
-
namespace {
-static const wchar_t* kKeyNamePath = L"path";
-static const int kSaveCompletePageIndex = 2;
+const char kKeyNamePath[] = "path";
+const int kSaveCompletePageIndex = 2;
-}; // namespace
+} // namespace
// Implementation of SelectFileDialog that shows an UI for choosing a file
// or folder using FileBrowseUI.
@@ -257,10 +256,10 @@ void SelectFileDialogImpl::OnDialogClosed(FileBrowseDelegate* delegate,
if (delegate->type_ == SELECT_OPEN_FILE ||
delegate->type_ == SELECT_SAVEAS_FILE ||
delegate->type_ == SELECT_FOLDER) {
- std::wstring path_string;
+ std::string path_string;
if (dict->HasKey(kKeyNamePath) &&
dict->GetString(kKeyNamePath, &path_string)) {
- FilePath path = FilePath::FromWStringHack(path_string);
+ FilePath path = FilePath::FromWStringHack(UTF8ToWide(path_string));
listener_->FileSelected(path, kSaveCompletePageIndex,
delegate->params_);
@@ -274,10 +273,11 @@ void SelectFileDialogImpl::OnDialogClosed(FileBrowseDelegate* delegate,
std::vector<FilePath> paths;
paths.reserve(paths_value->GetSize());
for (size_t i = 0; i < paths_value->GetSize(); ++i) {
- std::wstring path_string;
+ std::string path_string;
if (paths_value->GetString(i, &path_string) &&
!path_string.empty()) {
- paths.push_back(FilePath::FromWStringHack(path_string));
+ paths.push_back(FilePath::FromWStringHack(
+ UTF8ToWide(path_string)));
}
}
diff --git a/chrome/common/automation_constants.cc b/chrome/common/automation_constants.cc
index 185d57b..c253871 100644
--- a/chrome/common/automation_constants.cc
+++ b/chrome/common/automation_constants.cc
@@ -7,9 +7,9 @@
namespace automation {
// JSON value labels for proxy settings that are passed in via
// AutomationMsg_SetProxyConfig.
-const wchar_t kJSONProxyAutoconfig[] = L"proxy.autoconfig";
-const wchar_t kJSONProxyNoProxy[] = L"proxy.no_proxy";
-const wchar_t kJSONProxyPacUrl[] = L"proxy.pac_url";
-const wchar_t kJSONProxyBypassList[] = L"proxy.bypass_list";
-const wchar_t kJSONProxyServer[] = L"proxy.server";
+const char kJSONProxyAutoconfig[] = "proxy.autoconfig";
+const char kJSONProxyNoProxy[] = "proxy.no_proxy";
+const char kJSONProxyPacUrl[] = "proxy.pac_url";
+const char kJSONProxyBypassList[] = "proxy.bypass_list";
+const char kJSONProxyServer[] = "proxy.server";
}
diff --git a/chrome/common/automation_constants.h b/chrome/common/automation_constants.h
index 1b48e82..6959af7 100644
--- a/chrome/common/automation_constants.h
+++ b/chrome/common/automation_constants.h
@@ -10,11 +10,11 @@ namespace automation {
// JSON value labels for proxy settings that are passed in via
// AutomationMsg_SetProxyConfig. These are here since they are used by both
// AutomationProvider and AutomationProxy.
-extern const wchar_t kJSONProxyAutoconfig[];
-extern const wchar_t kJSONProxyNoProxy[];
-extern const wchar_t kJSONProxyPacUrl[];
-extern const wchar_t kJSONProxyBypassList[];
-extern const wchar_t kJSONProxyServer[];
+extern const char kJSONProxyAutoconfig[];
+extern const char kJSONProxyNoProxy[];
+extern const char kJSONProxyPacUrl[];
+extern const char kJSONProxyBypassList[];
+extern const char kJSONProxyServer[];
}
#endif // CHROME_COMMON_AUTOMATION_CONSTANTS_H__
diff --git a/chrome/common/extensions/extension_message_bundle.cc b/chrome/common/extensions/extension_message_bundle.cc
index 04022cd..8dd5275 100644
--- a/chrome/common/extensions/extension_message_bundle.cc
+++ b/chrome/common/extensions/extension_message_bundle.cc
@@ -22,9 +22,9 @@
namespace errors = extension_manifest_errors;
-const wchar_t* ExtensionMessageBundle::kContentKey = L"content";
-const wchar_t* ExtensionMessageBundle::kMessageKey = L"message";
-const wchar_t* ExtensionMessageBundle::kPlaceholdersKey = L"placeholders";
+const char* ExtensionMessageBundle::kContentKey = "content";
+const char* ExtensionMessageBundle::kMessageKey = "message";
+const char* ExtensionMessageBundle::kPlaceholdersKey = "placeholders";
const char* ExtensionMessageBundle::kPlaceholderBegin = "$";
const char* ExtensionMessageBundle::kPlaceholderEnd = "$";
@@ -138,8 +138,7 @@ bool ExtensionMessageBundle::GetMessageValue(const std::string& key,
}
// Extract message from it.
if (!name_tree->GetString(kMessageKey, value)) {
- *error = StringPrintf("There is no \"%s\" element for key %s.",
- WideToUTF8(kMessageKey).c_str(),
+ *error = StringPrintf("There is no \"%s\" element for key %s.", kMessageKey,
key.c_str());
return false;
}
@@ -167,8 +166,7 @@ bool ExtensionMessageBundle::GetPlaceholders(const DictionaryValue& name_tree,
DictionaryValue* placeholders_tree;
if (!name_tree.GetDictionary(kPlaceholdersKey, &placeholders_tree)) {
*error = StringPrintf("Not a valid \"%s\" element for key %s.",
- WideToUTF8(kPlaceholdersKey).c_str(),
- name_key.c_str());
+ kPlaceholdersKey, name_key.c_str());
return false;
}
@@ -188,8 +186,7 @@ bool ExtensionMessageBundle::GetPlaceholders(const DictionaryValue& name_tree,
std::string content;
if (!placeholder->GetString(kContentKey, &content)) {
*error = StringPrintf("Invalid \"%s\" element for key %s.",
- WideToUTF8(kContentKey).c_str(),
- name_key.c_str());
+ kContentKey, name_key.c_str());
return false;
}
(*placeholders)[StringToLowerASCII(content_key)] = content;
diff --git a/chrome/common/extensions/extension_message_bundle.h b/chrome/common/extensions/extension_message_bundle.h
index 3c80356..3a49021 100644
--- a/chrome/common/extensions/extension_message_bundle.h
+++ b/chrome/common/extensions/extension_message_bundle.h
@@ -22,9 +22,9 @@ class ExtensionMessageBundle {
typedef std::vector<linked_ptr<DictionaryValue> > CatalogVector;
// JSON keys of interest for messages file.
- static const wchar_t* kContentKey;
- static const wchar_t* kMessageKey;
- static const wchar_t* kPlaceholdersKey;
+ static const char* kContentKey;
+ static const char* kMessageKey;
+ static const char* kPlaceholdersKey;
// Begin/end markers for placeholders and messages
static const char* kPlaceholderBegin;
diff --git a/chrome/common/extensions/extension_message_bundle_unittest.cc b/chrome/common/extensions/extension_message_bundle_unittest.cc
index 81ae30c..dd87406 100644
--- a/chrome/common/extensions/extension_message_bundle_unittest.cc
+++ b/chrome/common/extensions/extension_message_bundle_unittest.cc
@@ -34,14 +34,14 @@ class ExtensionMessageBundleTest : public testing::Test {
};
// Helper method for dictionary building.
- void SetDictionary(const std::wstring name,
+ void SetDictionary(const std::string& name,
DictionaryValue* subtree,
DictionaryValue* target) {
target->Set(name, static_cast<Value*>(subtree));
}
- void CreateContentTree(const std::wstring& name,
- const std::string content,
+ void CreateContentTree(const std::string& name,
+ const std::string& content,
DictionaryValue* dict) {
DictionaryValue* content_tree = new DictionaryValue;
content_tree->SetString(ExtensionMessageBundle::kContentKey, content);
@@ -50,15 +50,15 @@ class ExtensionMessageBundleTest : public testing::Test {
void CreatePlaceholdersTree(DictionaryValue* dict) {
DictionaryValue* placeholders_tree = new DictionaryValue;
- CreateContentTree(L"a", "A", placeholders_tree);
- CreateContentTree(L"b", "B", placeholders_tree);
- CreateContentTree(L"c", "C", placeholders_tree);
+ CreateContentTree("a", "A", placeholders_tree);
+ CreateContentTree("b", "B", placeholders_tree);
+ CreateContentTree("c", "C", placeholders_tree);
SetDictionary(ExtensionMessageBundle::kPlaceholdersKey,
placeholders_tree,
dict);
}
- void CreateMessageTree(const std::wstring& name,
+ void CreateMessageTree(const std::string& name,
const std::string& message,
bool create_placeholder_subtree,
DictionaryValue* dict) {
@@ -72,9 +72,9 @@ class ExtensionMessageBundleTest : public testing::Test {
// Caller owns the memory.
DictionaryValue* CreateGoodDictionary() {
DictionaryValue* dict = new DictionaryValue;
- CreateMessageTree(L"n1", "message1 $a$ $b$", true, dict);
- CreateMessageTree(L"n2", "message2 $c$", true, dict);
- CreateMessageTree(L"n3", "message3", false, dict);
+ CreateMessageTree("n1", "message1 $a$ $b$", true, dict);
+ CreateMessageTree("n2", "message2 $c$", true, dict);
+ CreateMessageTree("n3", "message3", false, dict);
return dict;
}
@@ -84,35 +84,35 @@ class ExtensionMessageBundleTest : public testing::Test {
// Now remove/break things.
switch (what_is_bad) {
case INVALID_NAME:
- CreateMessageTree(L"n 5", "nevermind", false, dict);
+ CreateMessageTree("n 5", "nevermind", false, dict);
break;
case NAME_NOT_A_TREE:
- dict->SetString(L"n4", "whatever");
+ dict->SetString("n4", "whatever");
break;
case EMPTY_NAME_TREE: {
DictionaryValue* empty_tree = new DictionaryValue;
- SetDictionary(L"n4", empty_tree, dict);
+ SetDictionary("n4", empty_tree, dict);
}
break;
case MISSING_MESSAGE:
- dict->Remove(L"n1.message", NULL);
+ dict->Remove("n1.message", NULL);
break;
case PLACEHOLDER_NOT_A_TREE:
- dict->SetString(L"n1.placeholders", "whatever");
+ dict->SetString("n1.placeholders", "whatever");
break;
case EMPTY_PLACEHOLDER_TREE: {
DictionaryValue* empty_tree = new DictionaryValue;
- SetDictionary(L"n1.placeholders", empty_tree, dict);
+ SetDictionary("n1.placeholders", empty_tree, dict);
}
break;
case CONTENT_MISSING:
- dict->Remove(L"n1.placeholders.a.content", NULL);
+ dict->Remove("n1.placeholders.a.content", NULL);
break;
case MESSAGE_PLACEHOLDER_DOESNT_MATCH:
DictionaryValue* value;
- dict->Remove(L"n1.placeholders.a", NULL);
- dict->GetDictionary(L"n1.placeholders", &value);
- CreateContentTree(L"x", "X", value);
+ dict->Remove("n1.placeholders.a", NULL);
+ dict->GetDictionary("n1.placeholders", &value);
+ CreateContentTree("x", "X", value);
break;
}
@@ -189,12 +189,12 @@ TEST_F(ExtensionMessageBundleTest, InitAppDictConsultedFirst) {
DictionaryValue* app_dict = catalogs_[0].get();
// Flip placeholders in message of n1 tree.
- app_dict->SetString(L"n1.message", "message1 $b$ $a$");
+ app_dict->SetString("n1.message", "message1 $b$ $a$");
// Remove one message from app dict.
- app_dict->Remove(L"n2", NULL);
+ app_dict->Remove("n2", NULL);
// Replace n3 with N3.
- app_dict->Remove(L"n3", NULL);
- CreateMessageTree(L"N3", "message3_app_dict", false, app_dict);
+ app_dict->Remove("n3", NULL);
+ CreateMessageTree("N3", "message3_app_dict", false, app_dict);
CreateMessageBundle();
@@ -258,8 +258,7 @@ TEST_F(ExtensionMessageBundleTest, ReservedMessagesOverrideDeveloperMessages) {
catalogs_.push_back(linked_ptr<DictionaryValue>(CreateGoodDictionary()));
DictionaryValue* dict = catalogs_[0].get();
- CreateMessageTree(
- ASCIIToWide(ExtensionMessageBundle::kUILocaleKey), "x", false, dict);
+ CreateMessageTree(ExtensionMessageBundle::kUILocaleKey, "x", false, dict);
std::string error = CreateMessageBundle();
diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc
index 3f40dcc..b3f3e0d 100644
--- a/chrome/common/json_value_serializer_unittest.cc
+++ b/chrome/common/json_value_serializer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,9 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
+#include "base/string16.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/json_value_serializer.h"
@@ -24,20 +26,20 @@ TEST(JSONValueSerializerTest, Roundtrip) {
DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get());
Value* null_value = NULL;
- ASSERT_TRUE(root_dict->Get(L"null", &null_value));
+ ASSERT_TRUE(root_dict->Get("null", &null_value));
ASSERT_TRUE(null_value);
ASSERT_TRUE(null_value->IsType(Value::TYPE_NULL));
bool bool_value = false;
- ASSERT_TRUE(root_dict->GetBoolean(L"bool", &bool_value));
+ ASSERT_TRUE(root_dict->GetBoolean("bool", &bool_value));
ASSERT_TRUE(bool_value);
int int_value = 0;
- ASSERT_TRUE(root_dict->GetInteger(L"int", &int_value));
+ ASSERT_TRUE(root_dict->GetInteger("int", &int_value));
ASSERT_EQ(42, int_value);
double real_value = 0.0;
- ASSERT_TRUE(root_dict->GetReal(L"real", &real_value));
+ ASSERT_TRUE(root_dict->GetReal("real", &real_value));
ASSERT_DOUBLE_EQ(3.14, real_value);
// We shouldn't be able to write using this serializer, since it was
@@ -71,9 +73,9 @@ TEST(JSONValueSerializerTest, Roundtrip) {
}
TEST(JSONValueSerializerTest, StringEscape) {
- std::wstring all_chars;
+ string16 all_chars;
for (int i = 1; i < 256; ++i) {
- all_chars += static_cast<wchar_t>(i);
+ all_chars += static_cast<char16>(i);
}
// Generated in in Firefox using the following js (with an extra backslash for
// double quote):
@@ -105,7 +107,7 @@ TEST(JSONValueSerializerTest, StringEscape) {
// Test JSONWriter interface
std::string output_js;
DictionaryValue valueRoot;
- valueRoot.SetString(L"all_chars", all_chars);
+ valueRoot.SetString("all_chars", all_chars);
base::JSONWriter::Write(&valueRoot, false, &output_js);
ASSERT_EQ(expected_output, output_js);
@@ -118,8 +120,8 @@ TEST(JSONValueSerializerTest, StringEscape) {
TEST(JSONValueSerializerTest, UnicodeStrings) {
// unicode string json -> escaped ascii text
DictionaryValue root;
- std::wstring test(L"\x7F51\x9875");
- root.SetString(L"web", test);
+ string16 test(WideToUTF16(L"\x7F51\x9875"));
+ root.SetString("web", test);
std::string expected = "{\"web\":\"\\u7F51\\u9875\"}";
@@ -134,16 +136,16 @@ TEST(JSONValueSerializerTest, UnicodeStrings) {
ASSERT_TRUE(deserial_root.get());
DictionaryValue* dict_root =
static_cast<DictionaryValue*>(deserial_root.get());
- std::wstring web_value;
- ASSERT_TRUE(dict_root->GetString(L"web", &web_value));
+ string16 web_value;
+ ASSERT_TRUE(dict_root->GetString("web", &web_value));
ASSERT_EQ(test, web_value);
}
TEST(JSONValueSerializerTest, HexStrings) {
// hex string json -> escaped ascii text
DictionaryValue root;
- std::wstring test(L"\x01\x02");
- root.SetString(L"test", test);
+ string16 test(WideToUTF16(L"\x01\x02"));
+ root.SetString("test", test);
std::string expected = "{\"test\":\"\\u0001\\u0002\"}";
@@ -158,8 +160,8 @@ TEST(JSONValueSerializerTest, HexStrings) {
ASSERT_TRUE(deserial_root.get());
DictionaryValue* dict_root =
static_cast<DictionaryValue*>(deserial_root.get());
- std::wstring test_value;
- ASSERT_TRUE(dict_root->GetString(L"test", &test_value));
+ string16 test_value;
+ ASSERT_TRUE(dict_root->GetString("test", &test_value));
ASSERT_EQ(test, test_value);
// Test converting escaped regular chars
@@ -168,8 +170,8 @@ TEST(JSONValueSerializerTest, HexStrings) {
deserial_root.reset(deserializer2.Deserialize(NULL, NULL));
ASSERT_TRUE(deserial_root.get());
dict_root = static_cast<DictionaryValue*>(deserial_root.get());
- ASSERT_TRUE(dict_root->GetString(L"test", &test_value));
- ASSERT_EQ(std::wstring(L"go"), test_value);
+ ASSERT_TRUE(dict_root->GetString("test", &test_value));
+ ASSERT_EQ(ASCIIToUTF16("go"), test_value);
}
TEST(JSONValueSerializerTest, AllowTrailingComma) {
@@ -221,9 +223,9 @@ TEST(JSONValueSerializerTest, JSONReaderComments) {
ASSERT_EQ(1U, list->GetSize());
Value* elt = NULL;
ASSERT_TRUE(list->Get(0, &elt));
- std::wstring value;
+ std::string value;
ASSERT_TRUE(elt && elt->GetAsString(&value));
- ASSERT_EQ(L"// ok\n /* foo */ ", value);
+ ASSERT_EQ("// ok\n /* foo */ ", value);
// You can't nest comments.
root.reset(base::JSONReader::Read("/* /* inner */ outer */ [ 1 ]", false));
@@ -275,21 +277,21 @@ TEST_F(JSONFileValueSerializerTest, Roundtrip) {
DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get());
Value* null_value = NULL;
- ASSERT_TRUE(root_dict->Get(L"null", &null_value));
+ ASSERT_TRUE(root_dict->Get("null", &null_value));
ASSERT_TRUE(null_value);
ASSERT_TRUE(null_value->IsType(Value::TYPE_NULL));
bool bool_value = false;
- ASSERT_TRUE(root_dict->GetBoolean(L"bool", &bool_value));
+ ASSERT_TRUE(root_dict->GetBoolean("bool", &bool_value));
ASSERT_TRUE(bool_value);
int int_value = 0;
- ASSERT_TRUE(root_dict->GetInteger(L"int", &int_value));
+ ASSERT_TRUE(root_dict->GetInteger("int", &int_value));
ASSERT_EQ(42, int_value);
- std::wstring string_value;
- ASSERT_TRUE(root_dict->GetString(L"string", &string_value));
- ASSERT_EQ(L"hello", string_value);
+ std::string string_value;
+ ASSERT_TRUE(root_dict->GetString("string", &string_value));
+ ASSERT_EQ("hello", string_value);
// Now try writing.
const FilePath written_file_path =
diff --git a/chrome/common/plugin_group_unittest.cc b/chrome/common/plugin_group_unittest.cc
index 879ad70..33cc8ea 100644
--- a/chrome/common/plugin_group_unittest.cc
+++ b/chrome/common/plugin_group_unittest.cc
@@ -151,7 +151,7 @@ TEST(PluginGroupTest, VersionExtraction) {
group->AddPlugin(plugin, 0);
scoped_ptr<DictionaryValue> data(group->GetDataForUI());
std::string version;
- data->GetString(L"version", &version);
+ data->GetString("version", &version);
EXPECT_EQ(versions[i][1], version);
}
}
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 293d35b..d3bd7e1 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,8 @@
namespace {
-const wchar_t* kDistroDict = L"distribution";
+
+const char kDistroDict[] = "distribution";
bool GetGURLFromValue(const Value* in_value, GURL* out_value) {
if (!in_value || !out_value)
@@ -26,7 +27,7 @@ bool GetGURLFromValue(const Value* in_value, GURL* out_value) {
return true;
}
-std::vector<GURL> GetNamedList(const wchar_t* name,
+std::vector<GURL> GetNamedList(const char* name,
const DictionaryValue* prefs) {
std::vector<GURL> list;
if (!prefs)
@@ -46,12 +47,12 @@ std::vector<GURL> GetNamedList(const wchar_t* name,
return list;
}
-}
+} // namespace
namespace installer_util {
bool GetDistroBooleanPreference(const DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
bool* value) {
if (!prefs || !value)
return false;
@@ -67,8 +68,8 @@ bool GetDistroBooleanPreference(const DictionaryValue* prefs,
}
bool GetDistroStringPreference(const DictionaryValue* prefs,
- const std::wstring& name,
- std::wstring* value) {
+ const std::string& name,
+ std::string* value) {
if (!prefs || !value)
return false;
@@ -76,7 +77,7 @@ bool GetDistroStringPreference(const DictionaryValue* prefs,
if (!prefs->GetDictionary(kDistroDict, &distro) || !distro)
return false;
- std::wstring str_value;
+ std::string str_value;
if (!distro->GetString(name, &str_value))
return false;
@@ -88,7 +89,7 @@ bool GetDistroStringPreference(const DictionaryValue* prefs,
}
bool GetDistroIntegerPreference(const DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
int* value) {
if (!prefs || !value)
return false;
@@ -186,15 +187,15 @@ DictionaryValue* ParseDistributionPreferences(
}
std::vector<GURL> GetFirstRunTabs(const DictionaryValue* prefs) {
- return GetNamedList(L"first_run_tabs", prefs);
+ return GetNamedList("first_run_tabs", prefs);
}
bool SetDistroBooleanPreference(DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
bool value) {
if (!prefs || name.empty())
return false;
- prefs->SetBoolean(std::wstring(kDistroDict) + L"." + name, value);
+ prefs->SetBoolean(std::string(kDistroDict) + "." + name, value);
return true;
}
diff --git a/chrome/installer/util/master_preferences.h b/chrome/installer/util/master_preferences.h
index b623c3a..22de943 100644
--- a/chrome/installer/util/master_preferences.h
+++ b/chrome/installer/util/master_preferences.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -32,19 +32,19 @@ DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line);
// which is assumed to contain a dictionary named "distribution". Returns
// true if the value is read successfully, otherwise false.
bool GetDistroBooleanPreference(const DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
bool* value);
// This function gets value of a string preference from master
// preferences. Returns true if the value is read successfully, otherwise false.
bool GetDistroStringPreference(const DictionaryValue* prefs,
- const std::wstring& name,
- std::wstring* value);
+ const std::string& name,
+ std::string* value);
// This function gets value of an integer preference from master
// preferences. Returns true if the value is read successfully, otherwise false.
bool GetDistroIntegerPreference(const DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
int* value);
// The master preferences is a JSON file with the same entries as the
@@ -114,7 +114,7 @@ std::vector<GURL> GetFirstRunTabs(const DictionaryValue* prefs);
// Sets the value of given boolean preference |name| in "distribution"
// dictionary inside |prefs| dictionary.
bool SetDistroBooleanPreference(DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
bool value);
// The master preferences can also contain a regular extensions
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
index 54ff03f..3ac6b92 100644
--- a/chrome/installer/util/master_preferences_constants.cc
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -6,34 +6,34 @@
namespace installer_util {
namespace master_preferences {
- const wchar_t kAltFirstRunBubble[] = L"oem_bubble";
- const wchar_t kAltShortcutText[] = L"alternate_shortcut_text";
- const wchar_t kChromeFrame[] = L"chrome_frame";
- const wchar_t kChromeShortcutIconIndex[] = L"chrome_shortcut_icon_index";
- const wchar_t kCreateAllShortcuts[] = L"create_all_shortcuts";
- const wchar_t kDistroImportBookmarksPref[] = L"import_bookmarks";
- const wchar_t kDistroImportBookmarksFromFilePref[] =
- L"import_bookmarks_from_file";
- const wchar_t kDistroImportHistoryPref[] = L"import_history";
- const wchar_t kDistroImportHomePagePref[] = L"import_home_page";
- const wchar_t kDistroImportSearchPref[] = L"import_search_engine";
- const wchar_t kDistroPingDelay[] = L"ping_delay";
- const wchar_t kDistroShowWelcomePage[] = L"show_welcome_page";
- const wchar_t kDistroSkipFirstRunPref[] = L"skip_first_run_ui";
- const wchar_t kDistroSuppressFirstRunBubble[] = L"suppress_first_run_bubble";
- const wchar_t kDoNotCreateShortcuts[] = L"do_not_create_shortcuts";
- const wchar_t kDoNotLaunchChrome[] = L"do_not_launch_chrome";
- const wchar_t kDoNotRegisterForUpdateLaunch[] =
- L"do_not_register_for_update_launch";
- const wchar_t kMakeChromeDefault[] = L"make_chrome_default";
- const wchar_t kMakeChromeDefaultForUser[] = L"make_chrome_default_for_user";
- const wchar_t kMsi[] = L"msi";
- const wchar_t kRequireEula[] = L"require_eula";
- const wchar_t kSearchEngineExperimentPref[] = L"search_engine_experiment";
- const wchar_t kSearchEngineExperimentRandomizePref[] =
- L"search_engine_experiment_randomize";
- const wchar_t kSystemLevel[] = L"system_level";
- const wchar_t kVerboseLogging[] = L"verbose_logging";
- const wchar_t kExtensionsBlock[] = L"extensions.settings";
-}
-}
+ const char kAltFirstRunBubble[] = "oem_bubble";
+ const char kAltShortcutText[] = "alternate_shortcut_text";
+ const char kChromeFrame[] = "chrome_frame";
+ const char kChromeShortcutIconIndex[] = "chrome_shortcut_icon_index";
+ const char kCreateAllShortcuts[] = "create_all_shortcuts";
+ const char kDistroImportBookmarksPref[] = "import_bookmarks";
+ const char kDistroImportBookmarksFromFilePref[] =
+ "import_bookmarks_from_file";
+ const char kDistroImportHistoryPref[] = "import_history";
+ const char kDistroImportHomePagePref[] = "import_home_page";
+ const char kDistroImportSearchPref[] = "import_search_engine";
+ const char kDistroPingDelay[] = "ping_delay";
+ const char kDistroShowWelcomePage[] = "show_welcome_page";
+ const char kDistroSkipFirstRunPref[] = "skip_first_run_ui";
+ const char kDistroSuppressFirstRunBubble[] = "suppress_first_run_bubble";
+ const char kDoNotCreateShortcuts[] = "do_not_create_shortcuts";
+ const char kDoNotLaunchChrome[] = "do_not_launch_chrome";
+ const char kDoNotRegisterForUpdateLaunch[] =
+ "do_not_register_for_update_launch";
+ const char kMakeChromeDefault[] = "make_chrome_default";
+ const char kMakeChromeDefaultForUser[] = "make_chrome_default_for_user";
+ const char kMsi[] = "msi";
+ const char kRequireEula[] = "require_eula";
+ const char kSearchEngineExperimentPref[] = "search_engine_experiment";
+ const char kSearchEngineExperimentRandomizePref[] =
+ "search_engine_experiment_randomize";
+ const char kSystemLevel[] = "system_level";
+ const char kVerboseLogging[] = "verbose_logging";
+ const char kExtensionsBlock[] = "extensions.settings";
+} // namespace master_preferences
+} // namespace installer_util
diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h
index 9e626f2..f6adedd 100644
--- a/chrome/installer/util/master_preferences_constants.h
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -17,60 +17,60 @@ namespace master_preferences {
// value takes precedence.
// Boolean. Use alternate text for the shortcut. Cmd line override present.
-extern const wchar_t kAltShortcutText[];
+extern const char kAltShortcutText[];
// Boolean. Use alternate smaller first run info bubble.
-extern const wchar_t kAltFirstRunBubble[];
+extern const char kAltFirstRunBubble[];
// Boolean. This is to be a Chrome Frame install.
-extern const wchar_t kChromeFrame[];
+extern const char kChromeFrame[];
// Integer. Icon index from chrome.exe to use for shortcuts.
-extern const wchar_t kChromeShortcutIconIndex[];
+extern const char kChromeShortcutIconIndex[];
// Boolean. Create Desktop and QuickLaunch shortcuts. Cmd line override present.
-extern const wchar_t kCreateAllShortcuts[];
+extern const char kCreateAllShortcuts[];
// Boolean pref that triggers silent import of the default browser bookmarks.
-extern const wchar_t kDistroImportBookmarksPref[];
+extern const char kDistroImportBookmarksPref[];
// String pref that triggers silent import of bookmarks from the html file at
// given path.
-extern const wchar_t kDistroImportBookmarksFromFilePref[];
+extern const char kDistroImportBookmarksFromFilePref[];
// Boolean pref that triggers silent import of the default browser history.
-extern const wchar_t kDistroImportHistoryPref[];
+extern const char kDistroImportHistoryPref[];
// Boolean pref that triggers silent import of the default browser homepage.
-extern const wchar_t kDistroImportHomePagePref[];
+extern const char kDistroImportHomePagePref[];
// Boolean pref that triggers silent import of the default search engine.
-extern const wchar_t kDistroImportSearchPref[];
+extern const char kDistroImportSearchPref[];
// Integer. RLZ ping delay in seconds.
-extern const wchar_t kDistroPingDelay[];
+extern const char kDistroPingDelay[];
// Boolean pref that triggers loading the welcome page.
-extern const wchar_t kDistroShowWelcomePage[];
+extern const char kDistroShowWelcomePage[];
// Boolean pref that triggers skipping the first run dialogs.
-extern const wchar_t kDistroSkipFirstRunPref[];
+extern const char kDistroSkipFirstRunPref[];
// Boolean. Do not show first run bubble, even if it would otherwise be shown.
-extern const wchar_t kDistroSuppressFirstRunBubble[];
+extern const char kDistroSuppressFirstRunBubble[];
// Boolean. Do not create Chrome desktop shortcuts. Cmd line override present.
-extern const wchar_t kDoNotCreateShortcuts[];
+extern const char kDoNotCreateShortcuts[];
// Boolean. Do not launch Chrome after first install. Cmd line override present.
-extern const wchar_t kDoNotLaunchChrome[];
+extern const char kDoNotLaunchChrome[];
// Boolean. Do not register with Google Update to have Chrome launched after
// install. Cmd line override present.
-extern const wchar_t kDoNotRegisterForUpdateLaunch[];
+extern const char kDoNotRegisterForUpdateLaunch[];
// Boolean. Register Chrome as default browser. Cmd line override present.
-extern const wchar_t kMakeChromeDefault[];
+extern const char kMakeChromeDefault[];
// Boolean. Register Chrome as default browser for the current user.
-extern const wchar_t kMakeChromeDefaultForUser[];
+extern const char kMakeChromeDefaultForUser[];
// Boolean. Expect to be run by an MSI installer. Cmd line override present.
-extern const wchar_t kMsi[];
+extern const char kMsi[];
// Boolean. Show EULA dialog before install.
-extern const wchar_t kRequireEula[];
+extern const char kRequireEula[];
// Boolean. Use experimental search engine selection dialog.
-extern const wchar_t kSearchEngineExperimentPref[];
+extern const char kSearchEngineExperimentPref[];
// Boolean. Randomize logos in experimental search engine selection dialog.
-extern const wchar_t kSearchEngineExperimentRandomizePref[];
+extern const char kSearchEngineExperimentRandomizePref[];
// Boolean. Install Chrome to system wise location. Cmd line override present.
-extern const wchar_t kSystemLevel[];
+extern const char kSystemLevel[];
// Boolean. Run installer in verbose mode. Cmd line override present.
-extern const wchar_t kVerboseLogging[];
+extern const char kVerboseLogging[];
// Name of the block that contains the extensions on the master preferences.
-extern const wchar_t kExtensionsBlock[];
-}
-}
+extern const char kExtensionsBlock[];
+} // namespace master_preferences
+} // namespace installer_util
#endif // CHROME_INSTALLER_UTIL_MASTER_PREFERENCES_CONSTANTS_H_
diff --git a/chrome/installer/util/master_preferences_dummy.cc b/chrome/installer/util/master_preferences_dummy.cc
index 4413187..f11a445 100644
--- a/chrome/installer/util/master_preferences_dummy.cc
+++ b/chrome/installer/util/master_preferences_dummy.cc
@@ -19,7 +19,7 @@
namespace installer_util {
bool GetDistroBooleanPreference(const DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
bool* value) {
// This function is called by InstallUtil::IsChromeFrameProcess()
// We return false because GetInstallPreferences returns an empty value below.
@@ -27,7 +27,7 @@ bool GetDistroBooleanPreference(const DictionaryValue* prefs,
}
bool GetDistroIntegerPreference(const DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
int* value) {
NOTREACHED();
return false;
@@ -56,7 +56,7 @@ std::vector<GURL> GetDefaultBookmarks(const DictionaryValue* prefs) {
}
bool SetDistroBooleanPreference(DictionaryValue* prefs,
- const std::wstring& name,
+ const std::string& name,
bool value) {
NOTREACHED();
return false;
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index 80da133..87b8358 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -81,11 +81,11 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksPref, &value) &&
value);
- std::wstring str_value;
+ std::string str_value;
EXPECT_TRUE(installer_util::GetDistroStringPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksFromFilePref,
&str_value));
- EXPECT_STREQ(L"c:\\foo", str_value.c_str());
+ EXPECT_STREQ("c:\\foo", str_value.c_str());
EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportHomePagePref, &value) &&
value);
@@ -166,7 +166,7 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) {
EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksPref, &value));
EXPECT_FALSE(value);
- std::wstring str_value;
+ std::string str_value;
EXPECT_FALSE(installer_util::GetDistroStringPreference(prefs.get(),
installer_util::master_preferences::kDistroImportBookmarksFromFilePref,
&str_value));
@@ -241,22 +241,22 @@ TEST(MasterPrefsExtension, ValidateExtensionJSON) {
EXPECT_TRUE(installer_util::HasExtensionsBlock(prefs.get(), &extensions));
int location = 0;
EXPECT_TRUE(extensions->GetInteger(
- L"behllobkkfkfnphdnhnkndlbkcpglgmj.location", &location));
+ "behllobkkfkfnphdnhnkndlbkcpglgmj.location", &location));
int state = 0;
EXPECT_TRUE(extensions->GetInteger(
- L"behllobkkfkfnphdnhnkndlbkcpglgmj.state", &state));
- std::wstring path;
+ "behllobkkfkfnphdnhnkndlbkcpglgmj.state", &state));
+ std::string path;
EXPECT_TRUE(extensions->GetString(
- L"behllobkkfkfnphdnhnkndlbkcpglgmj.path", &path));
- std::wstring key;
+ "behllobkkfkfnphdnhnkndlbkcpglgmj.path", &path));
+ std::string key;
EXPECT_TRUE(extensions->GetString(
- L"behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.key", &key));
- std::wstring name;
+ "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.key", &key));
+ std::string name;
EXPECT_TRUE(extensions->GetString(
- L"behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.name", &name));
- std::wstring version;
+ "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.name", &name));
+ std::string version;
EXPECT_TRUE(extensions->GetString(
- L"behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.version", &version));
+ "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.version", &version));
}
// Test that we are parsing master preferences correctly.
diff --git a/chrome/service/cloud_print/cloud_print_consts.cc b/chrome/service/cloud_print/cloud_print_consts.cc
index a3dbe6f..2099ba6 100644
--- a/chrome/service/cloud_print/cloud_print_consts.cc
+++ b/chrome/service/cloud_print/cloud_print_consts.cc
@@ -15,15 +15,15 @@ const char kPrinterStatusValue[] = "status";
const char kPrinterTagValue[] = "tag";
// Values in the respone JSON from the cloud print server
-const wchar_t kPrinterListValue[] = L"printers";
-const wchar_t kSuccessValue[] = L"success";
-const wchar_t kNameValue[] = L"name";
-const wchar_t kIdValue[] = L"id";
-const wchar_t kTicketUrlValue[] = L"ticketUrl";
-const wchar_t kFileUrlValue[] = L"fileUrl";
-const wchar_t kJobListValue[] = L"jobs";
-const wchar_t kTitleValue[] = L"title";
-const wchar_t kPrinterCapsHashValue[] = L"capsHash";
+const char kPrinterListValue[] = "printers";
+const char kSuccessValue[] = "success";
+const char kNameValue[] = "name";
+const char kIdValue[] = "id";
+const char kTicketUrlValue[] = "ticketUrl";
+const char kFileUrlValue[] = "fileUrl";
+const char kJobListValue[] = "jobs";
+const char kTitleValue[] = "title";
+const char kPrinterCapsHashValue[] = "capsHash";
const char kDefaultCloudPrintServerUrl[] = "https://www.google.com/cloudprint";
const char kCloudPrintTalkServiceUrl[] = "http://www.google.com/cloudprint";
diff --git a/chrome/service/cloud_print/cloud_print_consts.h b/chrome/service/cloud_print/cloud_print_consts.h
index f4dbd04..517687f 100644
--- a/chrome/service/cloud_print/cloud_print_consts.h
+++ b/chrome/service/cloud_print/cloud_print_consts.h
@@ -17,15 +17,15 @@ extern const char kPrinterDefaultsValue[];
extern const char kPrinterStatusValue[];
extern const char kPrinterTagValue[];
// Values in the respone JSON from the cloud print server
-extern const wchar_t kPrinterListValue[];
-extern const wchar_t kSuccessValue[];
-extern const wchar_t kNameValue[];
-extern const wchar_t kIdValue[];
-extern const wchar_t kTicketUrlValue[];
-extern const wchar_t kFileUrlValue[];
-extern const wchar_t kJobListValue[];
-extern const wchar_t kTitleValue[];
-extern const wchar_t kPrinterCapsHashValue[];
+extern const char kPrinterListValue[];
+extern const char kSuccessValue[];
+extern const char kNameValue[];
+extern const char kIdValue[];
+extern const char kTicketUrlValue[];
+extern const char kFileUrlValue[];
+extern const char kJobListValue[];
+extern const char kTitleValue[];
+extern const char kPrinterCapsHashValue[];
extern const char kDefaultCloudPrintServerUrl[];
extern const char kCloudPrintTalkServiceUrl[];
diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
index 257371d..07c40bc 100644
--- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
@@ -441,7 +441,7 @@ void CloudPrintProxyBackend::Core::RegisterNextPrinter() {
// Send a hash of the printer capabilities to the server. We will use this
// later to check if the capabilities have changed
CloudPrintHelpers::AddMultipartValueForUpload(
- WideToUTF8(kPrinterCapsHashValue).c_str(),
+ kPrinterCapsHashValue,
MD5String(last_uploaded_printer_info_.printer_capabilities),
mime_boundary, std::string(), &post_data);
// Terminate the request body
@@ -557,9 +557,9 @@ void CloudPrintProxyBackend::Core::InitJobHandlerForPrinter(
cloud_print::PrinterBasicInfo printer_info;
printer_data->GetString(kNameValue, &printer_info.printer_name);
DCHECK(!printer_info.printer_name.empty());
- printer_data->GetString(UTF8ToWide(kPrinterDescValue),
+ printer_data->GetString(kPrinterDescValue,
&printer_info.printer_description);
- printer_data->GetInteger(UTF8ToWide(kPrinterStatusValue),
+ printer_data->GetInteger(kPrinterStatusValue,
&printer_info.printer_status);
std::string caps_hash;
printer_data->GetString(kPrinterCapsHashValue, &caps_hash);
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc
index 404e8df..d4d5a9a 100644
--- a/chrome/service/cloud_print/print_system_cups.cc
+++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -83,7 +83,7 @@ namespace cloud_print {
static const char kCUPSPrinterInfoOpt[] = "printer-info";
static const char kCUPSPrinterStateOpt[] = "printer-state";
-static const wchar_t kCUPSPrintServerURL[] = L"print_server_url";
+static const char kCUPSPrintServerURL[] = "print_server_url";
// Default port for IPP print servers.
static const int kDefaultIPPServerPort = 631;
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc
index d5cef62..8abb152 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -154,8 +154,8 @@ bool PrinterJobHandler::UpdatePrinterInfo() {
mime_boundary, printer_caps.defaults_mime_type,
&post_data);
CloudPrintHelpers::AddMultipartValueForUpload(
- WideToUTF8(kPrinterCapsHashValue).c_str(), caps_hash, mime_boundary,
- std::string(), &post_data);
+ kPrinterCapsHashValue, caps_hash, mime_boundary, std::string(),
+ &post_data);
}
}
if (printer_info.printer_name != printer_info_.printer_name) {
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 15d00d0..cf37561 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/logging.h"
+#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/test/automation/automation_constants.h"
@@ -256,14 +257,15 @@ bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath,
if (!succeeded)
return false;
- std::wstring read_value;
DCHECK(root->IsType(Value::TYPE_LIST));
Value* value = NULL;
succeeded = static_cast<ListValue*>(root)->Get(0, &value);
if (succeeded) {
+ string16 read_value;
succeeded = value->GetAsString(&read_value);
if (succeeded) {
- string_value->swap(read_value);
+ // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?)
+ *string_value = UTF16ToWideHack(read_value);
}
}