diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 22:23:40 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 22:23:40 +0000 |
commit | 41fc0320689c888625b5f13b5540a85590d6f830 (patch) | |
tree | 121dc85682d85da5eb8ff3ef645985a9bb61d635 | |
parent | fe2c7f0cb1d2513e357f3c840bb1aa00739aafdf (diff) | |
download | chromium_src-41fc0320689c888625b5f13b5540a85590d6f830.zip chromium_src-41fc0320689c888625b5f13b5540a85590d6f830.tar.gz chromium_src-41fc0320689c888625b5f13b5540a85590d6f830.tar.bz2 |
Convert std::wstring encoding names to std::string in a bunch of files.
BUG=8647 (http://crbug.com/8647)
TEST=run unit_tests.exe and ui_tests.exe
Original patch by Thiago Farina <thiago.farina@gmail.com> at
http://codereview.chromium.org/179057/show
Some linux related fixes by me.
Review URL: http://codereview.chromium.org/192017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25529 0039d316-1c4b-4281-b951-d872f2087c98
40 files changed, 273 insertions, 258 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 93aad4d..b0c09ac 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1831,7 +1831,7 @@ void AutomationProvider::SetBooleanPreference(int handle, // Gets the current used encoding name of the page in the specified tab. void AutomationProvider::GetPageCurrentEncoding( - int tab_handle, std::wstring* current_encoding) { + int tab_handle, std::string* current_encoding) { if (tab_tracker_->ContainsHandle(tab_handle)) { NavigationController* nav = tab_tracker_->GetResource(tab_handle); Browser* browser = FindAndActivateTab(nav); @@ -1844,7 +1844,7 @@ void AutomationProvider::GetPageCurrentEncoding( // Gets the current used encoding name of the page in the specified tab. void AutomationProvider::OverrideEncoding(int tab_handle, - const std::wstring& encoding_name, + const std::string& encoding_name, bool* success) { *success = false; #if defined(OS_WIN) diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index ca2d611..6543a2f 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -432,12 +432,12 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, bool* success); // Gets the current used encoding name of the page in the specified tab. - void GetPageCurrentEncoding(int tab_handle, std::wstring* current_encoding); + void GetPageCurrentEncoding(int tab_handle, std::string* current_encoding); // Uses the specified encoding to override the encoding of the page in the // specified tab. void OverrideEncoding(int tab_handle, - const std::wstring& encoding_name, + const std::string& encoding_name, bool* success); void SavePackageShouldPromptUser(bool should_prompt); diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 514d0ff..dfeb73c 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1013,19 +1013,20 @@ void Browser::ToggleEncodingAutoDetect() { void Browser::OverrideEncoding(int encoding_id) { UserMetrics::RecordAction(L"OverrideEncoding", profile_); - const std::wstring selected_encoding = + const std::string selected_encoding = CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id); TabContents* contents = GetSelectedTabContents(); if (!selected_encoding.empty() && contents) contents->override_encoding(selected_encoding); // Update the list of recently selected encodings. - std::wstring new_selected_encoding_list; + std::string new_selected_encoding_list; if (CharacterEncoding::UpdateRecentlySelectdEncoding( - profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), - encoding_id, - &new_selected_encoding_list)) { + WideToASCII(profile_->GetPrefs()->GetString( + prefs::kRecentlySelectedEncoding)), + encoding_id, + &new_selected_encoding_list)) { profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, - new_selected_encoding_list); + ASCIIToWide(new_selected_encoding_list)); } } diff --git a/chrome/browser/browser_encoding_uitest.cc b/chrome/browser/browser_encoding_uitest.cc index 80ed566..8e72071 100644 --- a/chrome/browser/browser_encoding_uitest.cc +++ b/chrome/browser/browser_encoding_uitest.cc @@ -55,40 +55,40 @@ class BrowserEncodingTest : public UITest { TEST_F(BrowserEncodingTest, TestEncodingAliasMapping) { struct EncodingTestData { const char* file_name; - const wchar_t* encoding_name; + const char* encoding_name; }; const EncodingTestData kEncodingTestDatas[] = { - { "Big5.html", L"Big5" }, - { "EUC-JP.html", L"EUC-JP" }, - { "gb18030.html", L"gb18030" }, - { "iso-8859-1.html", L"ISO-8859-1" }, - { "ISO-8859-2.html", L"ISO-8859-2" }, - { "ISO-8859-4.html", L"ISO-8859-4" }, - { "ISO-8859-5.html", L"ISO-8859-5" }, - { "ISO-8859-6.html", L"ISO-8859-6" }, - { "ISO-8859-7.html", L"ISO-8859-7" }, - { "ISO-8859-8.html", L"ISO-8859-8" }, - { "ISO-8859-13.html", L"ISO-8859-13" }, - { "ISO-8859-15.html", L"ISO-8859-15" }, - { "KOI8-R.html", L"KOI8-R" }, - { "KOI8-U.html", L"KOI8-U" }, - { "macintosh.html", L"macintosh" }, - { "Shift-JIS.html", L"Shift_JIS" }, - { "US-ASCII.html", L"ISO-8859-1" }, // http://crbug.com/15801 - { "UTF-8.html", L"UTF-8" }, - { "UTF-16LE.html", L"UTF-16LE" }, - { "windows-874.html", L"windows-874" }, - { "windows-949.html", L"windows-949" }, - { "windows-1250.html", L"windows-1250" }, - { "windows-1251.html", L"windows-1251" }, - { "windows-1252.html", L"windows-1252" }, - { "windows-1253.html", L"windows-1253" }, - { "windows-1254.html", L"windows-1254" }, - { "windows-1255.html", L"windows-1255" }, - { "windows-1256.html", L"windows-1256" }, - { "windows-1257.html", L"windows-1257" }, - { "windows-1258.html", L"windows-1258" } + { "Big5.html", "Big5" }, + { "EUC-JP.html", "EUC-JP" }, + { "gb18030.html", "gb18030" }, + { "iso-8859-1.html", "ISO-8859-1" }, + { "ISO-8859-2.html", "ISO-8859-2" }, + { "ISO-8859-4.html", "ISO-8859-4" }, + { "ISO-8859-5.html", "ISO-8859-5" }, + { "ISO-8859-6.html", "ISO-8859-6" }, + { "ISO-8859-7.html", "ISO-8859-7" }, + { "ISO-8859-8.html", "ISO-8859-8" }, + { "ISO-8859-13.html", "ISO-8859-13" }, + { "ISO-8859-15.html", "ISO-8859-15" }, + { "KOI8-R.html", "KOI8-R" }, + { "KOI8-U.html", "KOI8-U" }, + { "macintosh.html", "macintosh" }, + { "Shift-JIS.html", "Shift_JIS" }, + { "US-ASCII.html", "ISO-8859-1" }, // http://crbug.com/15801 + { "UTF-8.html", "UTF-8" }, + { "UTF-16LE.html", "UTF-16LE" }, + { "windows-874.html", "windows-874" }, + { "windows-949.html", "windows-949" }, + { "windows-1250.html", "windows-1250" }, + { "windows-1251.html", "windows-1251" }, + { "windows-1252.html", "windows-1252" }, + { "windows-1253.html", "windows-1253" }, + { "windows-1254.html", "windows-1254" }, + { "windows-1255.html", "windows-1255" }, + { "windows-1256.html", "windows-1256" }, + { "windows-1257.html", "windows-1257" }, + { "windows-1258.html", "windows-1258" } }; const char* const kAliasTestDir = "alias_mapping"; @@ -105,7 +105,7 @@ TEST_F(BrowserEncodingTest, TestEncodingAliasMapping) { ASSERT_TRUE(tab_proxy->NavigateToURL(url)); WaitUntilTabCount(1); - std::wstring encoding; + std::string encoding; EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding)); EXPECT_EQ(encoding, kEncodingTestDatas[i].encoding_name); } @@ -130,19 +130,19 @@ TEST_F(BrowserEncodingTest, TestOverrideEncoding) { WaitUntilTabCount(1); // Get the encoding declared in the page. - std::wstring encoding; + std::string encoding; EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding)); - EXPECT_EQ(encoding, L"ISO-8859-1"); + EXPECT_EQ(encoding, "ISO-8859-1"); // Override the encoding to "gb18030". int64 last_nav_time = 0; EXPECT_TRUE(tab_proxy->GetLastNavigationTime(&last_nav_time)); - EXPECT_TRUE(tab_proxy->OverrideEncoding(L"gb18030")); + EXPECT_TRUE(tab_proxy->OverrideEncoding("gb18030")); EXPECT_TRUE(tab_proxy->WaitForNavigation(last_nav_time)); // Re-get the encoding of page. It should be gb18030. EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding)); - EXPECT_EQ(encoding, L"gb18030"); + EXPECT_EQ(encoding, "gb18030"); // Dump the page, the content of dump page should be identical to the // expected result file. @@ -180,54 +180,54 @@ TEST_F(BrowserEncodingTest, TestEncodingAutoDetect) { struct EncodingAutoDetectTestData { const char* test_file_name; // File name of test data. const char* expected_result; // File name of expected results. - const wchar_t* expected_encoding; // expected encoding. + const char* expected_encoding; // expected encoding. }; const EncodingAutoDetectTestData kTestDatas[] = { { "Big5_with_no_encoding_specified.html", "expected_Big5_saved_from_no_encoding_specified.html", - L"Big5" }, + "Big5" }, { "gb18030_with_no_encoding_specified.html", "expected_gb18030_saved_from_no_encoding_specified.html", - L"gb18030" }, + "gb18030" }, { "iso-8859-1_with_no_encoding_specified.html", "expected_iso-8859-1_saved_from_no_encoding_specified.html", - L"ISO-8859-1" }, + "ISO-8859-1" }, { "ISO-8859-5_with_no_encoding_specified.html", "expected_ISO-8859-5_saved_from_no_encoding_specified.html", - L"ISO-8859-5" }, + "ISO-8859-5" }, { "ISO-8859-6_with_no_encoding_specified.html", "expected_ISO-8859-6_saved_from_no_encoding_specified.html", - L"ISO-8859-6" }, + "ISO-8859-6" }, { "ISO-8859-7_with_no_encoding_specified.html", "expected_ISO-8859-7_saved_from_no_encoding_specified.html", - L"ISO-8859-7" }, + "ISO-8859-7" }, { "ISO-8859-8_with_no_encoding_specified.html", "expected_ISO-8859-8_saved_from_no_encoding_specified.html", - L"ISO-8859-8-I" }, + "ISO-8859-8-I" }, { "KOI8-R_with_no_encoding_specified.html", "expected_KOI8-R_saved_from_no_encoding_specified.html", - L"KOI8-R" }, + "KOI8-R" }, { "Shift-JIS_with_no_encoding_specified.html", "expected_Shift-JIS_saved_from_no_encoding_specified.html", - L"Shift_JIS" }, + "Shift_JIS" }, { "UTF-8_with_no_encoding_specified.html", "expected_UTF-8_saved_from_no_encoding_specified.html", - L"UTF-8" }, + "UTF-8" }, { "windows-949_with_no_encoding_specified.html", "expected_windows-949_saved_from_no_encoding_specified.html", - L"windows-949" }, + "windows-949" }, { "windows-1251_with_no_encoding_specified.html", "expected_windows-1251_saved_from_no_encoding_specified.html", - L"windows-1251" }, + "windows-1251" }, { "windows-1254_with_no_encoding_specified.html", "expected_windows-1254_saved_from_no_encoding_specified.html", - L"windows-1254" }, + "windows-1254" }, { "windows-1255_with_no_encoding_specified.html", "expected_windows-1255_saved_from_no_encoding_specified.html", - L"windows-1255" }, + "windows-1255" }, { "windows-1256_with_no_encoding_specified.html", "expected_windows-1256_saved_from_no_encoding_specified.html", - L"windows-1256" } + "windows-1256" } }; const char* const kAutoDetectDir = "auto_detect"; // Directory of the files of expected results. @@ -263,9 +263,9 @@ TEST_F(BrowserEncodingTest, TestEncodingAutoDetect) { // Get the encoding used for the page, it must be the default charset we // just set. - std::wstring encoding; + std::string encoding; EXPECT_TRUE(tab->GetPageCurrentEncoding(&encoding)); - EXPECT_EQ(encoding, L"ISO-8859-4"); + EXPECT_EQ(encoding, "ISO-8859-4"); // Enable the encoding auto detection. EXPECT_TRUE(browser->SetBooleanPreference( diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 64cc686..f9dd85d 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -375,7 +375,7 @@ int BrowserMain(const MainFunctionParams& parameters) { } #endif - std::wstring local_state_path; + FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); bool local_state_file_exists = file_util::PathExists(local_state_path); diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc index dd15587..83f7a45 100644 --- a/chrome/browser/character_encoding.cc +++ b/chrome/browser/character_encoding.cc @@ -23,57 +23,57 @@ const size_t kUserSelectedEncodingsMaxLength = 3; typedef struct { int resource_id; - const wchar_t* name; + const char* name; int category_string_id; } CanonicalEncodingData; // An array of all supported canonical encoding names. static CanonicalEncodingData canonical_encoding_names[] = { - { IDC_ENCODING_UTF8, L"UTF-8", IDS_ENCODING_UNICODE }, - { IDC_ENCODING_UTF16LE, L"UTF-16LE", IDS_ENCODING_UNICODE }, - { IDC_ENCODING_ISO88591, L"ISO-8859-1", IDS_ENCODING_WESTERN }, - { IDC_ENCODING_WINDOWS1252, L"windows-1252", IDS_ENCODING_WESTERN }, - { IDC_ENCODING_GBK, L"GBK", IDS_ENCODING_SIMP_CHINESE }, - { IDC_ENCODING_GB18030, L"gb18030", IDS_ENCODING_SIMP_CHINESE }, - { IDC_ENCODING_BIG5, L"Big5", IDS_ENCODING_TRAD_CHINESE }, - { IDC_ENCODING_BIG5HKSCS, L"Big5-HKSCS", IDS_ENCODING_TRAD_CHINESE }, - { IDC_ENCODING_KOREAN, L"windows-949", IDS_ENCODING_KOREAN }, - { IDC_ENCODING_SHIFTJIS, L"Shift_JIS", IDS_ENCODING_JAPANESE }, - { IDC_ENCODING_EUCJP, L"EUC-JP", IDS_ENCODING_JAPANESE }, - { IDC_ENCODING_ISO2022JP, L"ISO-2022-JP", IDS_ENCODING_JAPANESE }, - { IDC_ENCODING_THAI, L"windows-874", IDS_ENCODING_THAI }, - { IDC_ENCODING_ISO885915, L"ISO-8859-15", IDS_ENCODING_WESTERN }, - { IDC_ENCODING_MACINTOSH, L"macintosh", IDS_ENCODING_WESTERN }, - { IDC_ENCODING_ISO88592, L"ISO-8859-2", IDS_ENCODING_CENTRAL_EUROPEAN }, - { IDC_ENCODING_WINDOWS1250, L"windows-1250", IDS_ENCODING_CENTRAL_EUROPEAN }, - { IDC_ENCODING_ISO88595, L"ISO-8859-5", IDS_ENCODING_CYRILLIC }, - { IDC_ENCODING_WINDOWS1251, L"windows-1251", IDS_ENCODING_CYRILLIC }, - { IDC_ENCODING_KOI8R, L"KOI8-R", IDS_ENCODING_CYRILLIC }, - { IDC_ENCODING_KOI8U, L"KOI8-U", IDS_ENCODING_CYRILLIC }, - { IDC_ENCODING_ISO88597, L"ISO-8859-7", IDS_ENCODING_GREEK }, - { IDC_ENCODING_WINDOWS1253, L"windows-1253", IDS_ENCODING_GREEK }, - { IDC_ENCODING_WINDOWS1254, L"windows-1254", IDS_ENCODING_TURKISH }, - { IDC_ENCODING_WINDOWS1256, L"windows-1256", IDS_ENCODING_ARABIC }, - { IDC_ENCODING_ISO88596, L"ISO-8859-6", IDS_ENCODING_ARABIC }, - { IDC_ENCODING_WINDOWS1255, L"windows-1255", IDS_ENCODING_HEBREW }, - { IDC_ENCODING_ISO88598I, L"ISO-8859-8-I", IDS_ENCODING_HEBREW }, - { IDC_ENCODING_ISO88598, L"ISO-8859-8", IDS_ENCODING_HEBREW }, - { IDC_ENCODING_WINDOWS1258, L"windows-1258", IDS_ENCODING_VIETNAMESE }, - { IDC_ENCODING_ISO88594, L"ISO-8859-4", IDS_ENCODING_BALTIC }, - { IDC_ENCODING_ISO885913, L"ISO-8859-13", IDS_ENCODING_BALTIC }, - { IDC_ENCODING_WINDOWS1257, L"windows-1257", IDS_ENCODING_BALTIC }, - { IDC_ENCODING_ISO88593, L"ISO-8859-3", IDS_ENCODING_SOUTH_EUROPEAN }, - { IDC_ENCODING_ISO885910, L"ISO-8859-10", IDS_ENCODING_NORDIC }, - { IDC_ENCODING_ISO885914, L"ISO-8859-14", IDS_ENCODING_CELTIC }, - { IDC_ENCODING_ISO885916, L"ISO-8859-16", IDS_ENCODING_ROMANIAN }, + { IDC_ENCODING_UTF8, "UTF-8", IDS_ENCODING_UNICODE }, + { IDC_ENCODING_UTF16LE, "UTF-16LE", IDS_ENCODING_UNICODE }, + { IDC_ENCODING_ISO88591, "ISO-8859-1", IDS_ENCODING_WESTERN }, + { IDC_ENCODING_WINDOWS1252, "windows-1252", IDS_ENCODING_WESTERN }, + { IDC_ENCODING_GBK, "GBK", IDS_ENCODING_SIMP_CHINESE }, + { IDC_ENCODING_GB18030, "gb18030", IDS_ENCODING_SIMP_CHINESE }, + { IDC_ENCODING_BIG5, "Big5", IDS_ENCODING_TRAD_CHINESE }, + { IDC_ENCODING_BIG5HKSCS, "Big5-HKSCS", IDS_ENCODING_TRAD_CHINESE }, + { IDC_ENCODING_KOREAN, "windows-949", IDS_ENCODING_KOREAN }, + { IDC_ENCODING_SHIFTJIS, "Shift_JIS", IDS_ENCODING_JAPANESE }, + { IDC_ENCODING_EUCJP, "EUC-JP", IDS_ENCODING_JAPANESE }, + { IDC_ENCODING_ISO2022JP, "ISO-2022-JP", IDS_ENCODING_JAPANESE }, + { IDC_ENCODING_THAI, "windows-874", IDS_ENCODING_THAI }, + { IDC_ENCODING_ISO885915, "ISO-8859-15", IDS_ENCODING_WESTERN }, + { IDC_ENCODING_MACINTOSH, "macintosh", IDS_ENCODING_WESTERN }, + { IDC_ENCODING_ISO88592, "ISO-8859-2", IDS_ENCODING_CENTRAL_EUROPEAN }, + { IDC_ENCODING_WINDOWS1250, "windows-1250", IDS_ENCODING_CENTRAL_EUROPEAN }, + { IDC_ENCODING_ISO88595, "ISO-8859-5", IDS_ENCODING_CYRILLIC }, + { IDC_ENCODING_WINDOWS1251, "windows-1251", IDS_ENCODING_CYRILLIC }, + { IDC_ENCODING_KOI8R, "KOI8-R", IDS_ENCODING_CYRILLIC }, + { IDC_ENCODING_KOI8U, "KOI8-U", IDS_ENCODING_CYRILLIC }, + { IDC_ENCODING_ISO88597, "ISO-8859-7", IDS_ENCODING_GREEK }, + { IDC_ENCODING_WINDOWS1253, "windows-1253", IDS_ENCODING_GREEK }, + { IDC_ENCODING_WINDOWS1254, "windows-1254", IDS_ENCODING_TURKISH }, + { IDC_ENCODING_WINDOWS1256, "windows-1256", IDS_ENCODING_ARABIC }, + { IDC_ENCODING_ISO88596, "ISO-8859-6", IDS_ENCODING_ARABIC }, + { IDC_ENCODING_WINDOWS1255, "windows-1255", IDS_ENCODING_HEBREW }, + { IDC_ENCODING_ISO88598I, "ISO-8859-8-I", IDS_ENCODING_HEBREW }, + { IDC_ENCODING_ISO88598, "ISO-8859-8", IDS_ENCODING_HEBREW }, + { IDC_ENCODING_WINDOWS1258, "windows-1258", IDS_ENCODING_VIETNAMESE }, + { IDC_ENCODING_ISO88594, "ISO-8859-4", IDS_ENCODING_BALTIC }, + { IDC_ENCODING_ISO885913, "ISO-8859-13", IDS_ENCODING_BALTIC }, + { IDC_ENCODING_WINDOWS1257, "windows-1257", IDS_ENCODING_BALTIC }, + { IDC_ENCODING_ISO88593, "ISO-8859-3", IDS_ENCODING_SOUTH_EUROPEAN }, + { IDC_ENCODING_ISO885910, "ISO-8859-10", IDS_ENCODING_NORDIC }, + { IDC_ENCODING_ISO885914, "ISO-8859-14", IDS_ENCODING_CELTIC }, + { IDC_ENCODING_ISO885916, "ISO-8859-16", IDS_ENCODING_ROMANIAN }, }; static const int canonical_encoding_names_length = arraysize(canonical_encoding_names); -typedef std::map<int, std::pair<const wchar_t*, int> > +typedef std::map<int, std::pair<const char*, int> > IdToCanonicalEncodingNameMapType; -typedef std::map<const std::wstring, int> CanonicalEncodingNameToIdMapType; +typedef std::map<const std::string, int> CanonicalEncodingNameToIdMapType; class CanonicalEncodingMap { public: @@ -97,7 +97,7 @@ class CanonicalEncodingMap { std::vector<int> locale_dependent_encoding_ids_; std::vector<CharacterEncoding::EncodingInfo> current_display_encodings_; - DISALLOW_EVIL_CONSTRUCTORS(CanonicalEncodingMap); + DISALLOW_COPY_AND_ASSIGN(CanonicalEncodingMap); }; const IdToCanonicalEncodingNameMapType* @@ -179,9 +179,9 @@ const int default_encoding_menus_length = arraysize(default_encoding_menus); // The parameter |maximum_size| indicates maximum size of encoding items we // want to get from the |encoding_list|. void ParseEncodingListSeparatedWithComma( - const std::wstring& encoding_list, std::vector<int>* const available_list, + const std::string& encoding_list, std::vector<int>* const available_list, size_t maximum_size) { - WStringTokenizer tokenizer(encoding_list, L","); + StringTokenizer tokenizer(encoding_list, ","); while (tokenizer.GetNext()) { int id = CharacterEncoding::GetCommandIdByCanonicalEncodingName( tokenizer.token()); @@ -194,15 +194,15 @@ void ParseEncodingListSeparatedWithComma( } } -std::wstring GetEncodingDisplayName(std::wstring encoding_name, - int category_string_id) { - std::wstring category_name = l10n_util::GetString(category_string_id); +string16 GetEncodingDisplayName(std::string encoding_name, + int category_string_id) { + string16 category_name = l10n_util::GetStringUTF16(category_string_id); if (category_string_id != IDS_ENCODING_KOREAN && category_string_id != IDS_ENCODING_THAI && category_string_id != IDS_ENCODING_TURKISH) { - return l10n_util::GetStringF(IDS_ENCODING_DISPLAY_TEMPLATE, - category_name, - encoding_name); + return l10n_util::GetStringFUTF16(IDS_ENCODING_DISPLAY_TEMPLATE, + category_name, + ASCIIToUTF16(encoding_name)); } return category_name; } @@ -219,24 +219,25 @@ int GetEncodingCategoryStringIdByCommandId(int id) { return 0; } -std::wstring GetEncodingCategoryStringByCommandId(int id) { +std::string GetEncodingCategoryStringByCommandId(int id) { int category_id = GetEncodingCategoryStringIdByCommandId(id); if (category_id) - return l10n_util::GetString(category_id); - return std::wstring(); + return l10n_util::GetStringUTF8(category_id); + return std::string(); } } // namespace CharacterEncoding::EncodingInfo::EncodingInfo(int id) : encoding_id(id) { - encoding_category_name = GetEncodingCategoryStringByCommandId(id), - encoding_display_name = GetCanonicalEncodingDisplayNameByCommandId(id); + encoding_category_name = UTF8ToWide(GetEncodingCategoryStringByCommandId(id)); + encoding_display_name = UTF16ToWideHack( + GetCanonicalEncodingDisplayNameByCommandId(id)); } // Static. int CharacterEncoding::GetCommandIdByCanonicalEncodingName( - const std::wstring& encoding_name) { + const std::string& encoding_name) { const CanonicalEncodingNameToIdMapType* map = canonical_encoding_name_map_singleton. GetCanonicalEncodingNameToIdMapData(); @@ -250,7 +251,7 @@ int CharacterEncoding::GetCommandIdByCanonicalEncodingName( } // Static. -std::wstring CharacterEncoding::GetCanonicalEncodingNameByCommandId(int id) { +std::string CharacterEncoding::GetCanonicalEncodingNameByCommandId(int id) { const IdToCanonicalEncodingNameMapType* map = canonical_encoding_name_map_singleton. GetIdToCanonicalEncodingNameMapData(); @@ -259,11 +260,11 @@ std::wstring CharacterEncoding::GetCanonicalEncodingNameByCommandId(int id) { IdToCanonicalEncodingNameMapType::const_iterator found_name = map->find(id); if (found_name != map->end()) return found_name->second.first; - return std::wstring(); + return std::string(); } // Static. -std::wstring CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId( +string16 CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId( int id) { const IdToCanonicalEncodingNameMapType* map = canonical_encoding_name_map_singleton. @@ -274,7 +275,7 @@ std::wstring CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId( if (found_name != map->end()) return GetEncodingDisplayName(found_name->second.first, found_name->second.second); - return std::wstring(); + return string16(); } // Static. @@ -284,19 +285,19 @@ int CharacterEncoding::GetSupportCanonicalEncodingCount() { } // Static. -std::wstring CharacterEncoding::GetCanonicalEncodingNameByIndex(int index) { +std::string CharacterEncoding::GetCanonicalEncodingNameByIndex(int index) { if (index < canonical_encoding_names_length) return canonical_encoding_names[index].name; - return std::wstring(); + return std::string(); } // Static. -std::wstring CharacterEncoding::GetCanonicalEncodingDisplayNameByIndex( +string16 CharacterEncoding::GetCanonicalEncodingDisplayNameByIndex( int index) { if (index < canonical_encoding_names_length) return GetEncodingDisplayName(canonical_encoding_names[index].name, canonical_encoding_names[index].category_string_id); - return std::wstring(); + return string16(); } // Static. @@ -307,8 +308,8 @@ int CharacterEncoding::GetEncodingCommandIdByIndex(int index) { } // Static. -std::wstring CharacterEncoding::GetCanonicalEncodingNameByAliasName( - const std::wstring& alias_name) { +std::string CharacterEncoding::GetCanonicalEncodingNameByAliasName( + const std::string& alias_name) { // If the input alias_name is already canonical encoding name, just return it. const CanonicalEncodingNameToIdMapType* map = canonical_encoding_name_map_singleton. @@ -323,12 +324,12 @@ std::wstring CharacterEncoding::GetCanonicalEncodingNameByAliasName( UErrorCode error_code = U_ZERO_ERROR; const char* canonical_name = ucnv_getCanonicalName( - WideToASCII(alias_name).c_str(), "MIME", &error_code); + alias_name.c_str(), "MIME", &error_code); // If failed, then try IANA next. if (U_FAILURE(error_code) || !canonical_name) { error_code = U_ZERO_ERROR; canonical_name = ucnv_getCanonicalName( - WideToASCII(alias_name).c_str(), "IANA", &error_code); + alias_name.c_str(), "IANA", &error_code); } if (canonical_name) { @@ -337,11 +338,11 @@ std::wstring CharacterEncoding::GetCanonicalEncodingNameByAliasName( // We don't want to add an unnecessary charset to the encoding menu, so we // alias 'US-ASCII' to 'ISO-8859-1' in our UI without touching WebKit. // http://crbug.com/15801. - if (alias_name == L"US-ASCII") + if (alias_name == "US-ASCII") return GetCanonicalEncodingNameByCommandId(IDC_ENCODING_ISO88591); - return ASCIIToWide(canonical_name); + return canonical_name; } else { - return std::wstring(); + return std::string(); } } @@ -353,8 +354,8 @@ std::wstring CharacterEncoding::GetCanonicalEncodingNameByAliasName( const std::vector<CharacterEncoding::EncodingInfo>* CharacterEncoding::GetCurrentDisplayEncodings( const std::string& locale, - const std::wstring& locale_encodings, - const std::wstring& recently_select_encodings) { + const std::string& locale_encodings, + const std::string& recently_select_encodings) { std::vector<int>* const locale_dependent_encoding_list = canonical_encoding_name_map_singleton.locale_dependent_encoding_ids(); std::vector<CharacterEncoding::EncodingInfo>* const encoding_list = @@ -366,7 +367,7 @@ const std::vector<CharacterEncoding::EncodingInfo>* locale_dependent_encoding_list, kUserSelectedEncodingsMaxLength); - static std::wstring cached_user_selected_encodings; + static std::string cached_user_selected_encodings; // Build current display encoding list. if (encoding_list->empty() || cached_user_selected_encodings != recently_select_encodings) { @@ -439,11 +440,11 @@ const std::vector<CharacterEncoding::EncodingInfo>* // Static bool CharacterEncoding::UpdateRecentlySelectdEncoding( - const std::wstring& original_selected_encodings, + const std::string& original_selected_encodings, int new_selected_encoding_id, - std::wstring* selected_encodings) { + std::string* selected_encodings) { // Get encoding name. - std::wstring encoding_name = + std::string encoding_name = GetCanonicalEncodingNameByCommandId(new_selected_encoding_id); DCHECK(!encoding_name.empty()); // Check whether the new encoding is in local dependent encodings or original diff --git a/chrome/browser/character_encoding.h b/chrome/browser/character_encoding.h index e1b6d9e..1f72fe4 100644 --- a/chrome/browser/character_encoding.h +++ b/chrome/browser/character_encoding.h @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHARACTER_ENCODING_H__ -#define CHROME_BROWSER_CHARACTER_ENCODING_H__ +#ifndef CHROME_BROWSER_CHARACTER_ENCODING_H_ +#define CHROME_BROWSER_CHARACTER_ENCODING_H_ #include <string> #include <vector> #include "base/basictypes.h" +#include "base/string16.h" class CharacterEncoding { public: @@ -36,12 +37,12 @@ class CharacterEncoding { // Return canonical encoding name according to the command ID. // THIS FUNCTION IS NOT THREADSAFE. You must run this function // only in UI thread. - static std::wstring GetCanonicalEncodingNameByCommandId(int id); + static std::string GetCanonicalEncodingNameByCommandId(int id); // Return display name of canonical encoding according to the command // ID. THIS FUNCTION IS NOT THREADSAFE. You must run this function // only in UI thread. - static std::wstring GetCanonicalEncodingDisplayNameByCommandId(int id); + static string16 GetCanonicalEncodingDisplayNameByCommandId(int id); // Return count number of all supported canonical encoding. static int GetSupportCanonicalEncodingCount(); @@ -49,13 +50,13 @@ class CharacterEncoding { // Return canonical encoding name according to the index, which starts // from zero to GetSupportCanonicalEncodingCount() - 1. THIS FUNCTION // IS NOT THREADSAFE. You must run this function only in UI thread. - static std::wstring GetCanonicalEncodingNameByIndex(int index); + static std::string GetCanonicalEncodingNameByIndex(int index); // Return display name of canonical encoding according to the index, // which starts from zero to GetSupportCanonicalEncodingCount() - 1. // THIS FUNCTION IS NOT THREADSAFE. You must run this function // only in UI thread. - static std::wstring GetCanonicalEncodingDisplayNameByIndex(int index); + static string16 GetCanonicalEncodingDisplayNameByIndex(int index); // Return encoding command id according to the index, which starts from // zero to GetSupportCanonicalEncodingCount() - 1. Otherwise returns 0. @@ -63,8 +64,8 @@ class CharacterEncoding { // Return canonical encoding name according to the encoding alias name. THIS // FUNCTION IS NOT THREADSAFE. You must run this function only in UI thread. - static std::wstring GetCanonicalEncodingNameByAliasName( - const std::wstring& alias_name); + static std::string GetCanonicalEncodingNameByAliasName( + const std::string& alias_name); // Returns the pointer of a vector of EncodingInfos corresponding to // encodings to display in the encoding menu. The locale-dependent static @@ -80,26 +81,26 @@ class CharacterEncoding { // run this function only in UI thread. static const std::vector<EncodingInfo>* GetCurrentDisplayEncodings( const std::string& locale, - const std::wstring& locale_encodings, - const std::wstring& recently_select_encodings); + const std::string& locale_encodings, + const std::string& recently_select_encodings); // This function is for updating |original_selected_encoding_list| with a // |new_selected_encoding_id|. If the encoding is already in the original // list, then returns false. Otherwise |selected_encoding_list| will return a // new string for user selected encoding short list and function returns true. static bool UpdateRecentlySelectdEncoding( - const std::wstring& original_selected_encodings, + const std::string& original_selected_encodings, int new_selected_encoding_id, - std::wstring* selected_encodings); + std::string* selected_encodings); // Get encoding command id according to input encoding name. If the name is // valid, return corresponding encoding command id. Otherwise return 0; static int GetCommandIdByCanonicalEncodingName( - const std::wstring& encoding_name); + const std::string& encoding_name); private: // Disallow instantiating it since this class only contains static methods. DISALLOW_IMPLICIT_CONSTRUCTORS(CharacterEncoding); }; -#endif // CHROME_BROWSER_CHARACTER_ENCODING_H__ +#endif // CHROME_BROWSER_CHARACTER_ENCODING_H_ diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index f71b0ff..8971cea 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -519,7 +519,7 @@ willPositionSheet:(NSWindow*)sheet if (!current_tab) { return; } - const std::wstring encoding = current_tab->encoding(); + const std::string encoding = current_tab->encoding(); bool toggled = encoding_controller.IsItemChecked(profile, encoding, tag); NSInteger oldState = [item state]; diff --git a/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm b/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm index 4f9468f..92e576e 100644 --- a/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm +++ b/chrome/browser/cocoa/encoding_menu_controller_delegate_mac.mm @@ -6,6 +6,7 @@ #import <Cocoa/Cocoa.h> +#include "base/string16.h" #include "base/sys_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser.h" @@ -49,13 +50,13 @@ void EncodingMenuControllerDelegate::BuildEncodingMenu(Profile *profile) { it != menuItems.end(); ++it) { int item_id = it->first; - std::wstring &localized_title_wstring = it->second; + string16 &localized_title_string16 = it->second; if (item_id == 0) { AddSeparatorToMenu(encoding_menu); } else { using base::SysWideToNSString; - NSString *localized_title = SysWideToNSString(localized_title_wstring); + NSString *localized_title = SysUTF16ToNSString(localized_title_string16); AppendMenuItem(encoding_menu, item_id, localized_title); } } diff --git a/chrome/browser/encoding_menu_controller.cc b/chrome/browser/encoding_menu_controller.cc index 042ff9a..72b086f 100644 --- a/chrome/browser/encoding_menu_controller.cc +++ b/chrome/browser/encoding_menu_controller.cc @@ -77,15 +77,16 @@ int EncodingMenuController::NumValidGUIEncodingIDs() { bool EncodingMenuController::IsItemChecked( Profile* browser_profile, - const std::wstring& current_tab_encoding, + const std::string& current_tab_encoding, int item_id) { if (!DoesCommandBelongToEncodingMenu(item_id)) { return false; } - std::wstring encoding = current_tab_encoding; + std::string encoding = current_tab_encoding; if (encoding.empty()) { - encoding = browser_profile->GetPrefs()->GetString(prefs::kDefaultCharset); + encoding = WideToASCII(browser_profile->GetPrefs()->GetString( + prefs::kDefaultCharset)); } if (item_id == IDC_ENCODING_AUTO_DETECT) { @@ -105,12 +106,12 @@ void EncodingMenuController::GetEncodingMenuItems(Profile* profile, EncodingMenuItemList* menuItems) { DCHECK(menuItems); - EncodingMenuItem separator(0, L""); + EncodingMenuItem separator(0, string16()); menuItems->clear(); menuItems->push_back( EncodingMenuItem(IDC_ENCODING_AUTO_DETECT, - l10n_util::GetString(IDS_ENCODING_AUTO_DETECT))); + l10n_util::GetStringUTF16(IDS_ENCODING_AUTO_DETECT))); menuItems->push_back(separator); // Create current display encoding list. @@ -121,8 +122,9 @@ void EncodingMenuController::GetEncodingMenuItems(Profile* profile, // encodings and other encodings. encodings = CharacterEncoding::GetCurrentDisplayEncodings( g_browser_process->GetApplicationLocale(), - profile->GetPrefs()->GetString(prefs::kStaticEncodings), - profile->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding)); + WideToASCII(profile->GetPrefs()->GetString(prefs::kStaticEncodings)), + WideToASCII(profile->GetPrefs()->GetString( + prefs::kRecentlySelectedEncoding))); DCHECK(encodings); DCHECK(!encodings->empty()); @@ -135,10 +137,10 @@ void EncodingMenuController::GetEncodingMenuItems(Profile* profile, if (l10n_util::AdjustStringForLocaleDirection(encoding, &bidi_safe_encoding)) encoding.swap(bidi_safe_encoding); - menuItems->push_back(EncodingMenuItem(it->encoding_id, encoding)); + menuItems->push_back(EncodingMenuItem(it->encoding_id, + WideToUTF16(encoding))); } else { menuItems->push_back(separator); } } - } diff --git a/chrome/browser/encoding_menu_controller.h b/chrome/browser/encoding_menu_controller.h index 24eab64..d362f68 100644 --- a/chrome/browser/encoding_menu_controller.h +++ b/chrome/browser/encoding_menu_controller.h @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHORME_BROWSER_ENCODING_MENU_CONTROLLER_H_ -#define CHORME_BROWSER_ENCODING_MENU_CONTROLLER_H_ +#ifndef CHROME_BROWSER_ENCODING_MENU_CONTROLLER_H_ +#define CHROME_BROWSER_ENCODING_MENU_CONTROLLER_H_ +#include <utility> #include <string> #include <vector> -#include "base/basictypes.h" // For DISALLOW_IMPLICIT_CONSTRUCTORS +#include "base/basictypes.h" // For DISALLOW_COPY_AND_ASSIGN +#include "base/string16.h" #include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST class Browser; @@ -21,7 +23,7 @@ class EncodingMenuController { FRIEND_TEST(EncodingMenuControllerTest, IsItemChecked); public: - typedef std::pair<int, std::wstring> EncodingMenuItem; + typedef std::pair<int, string16> EncodingMenuItem; typedef std::vector<EncodingMenuItem> EncodingMenuItemList; public: @@ -34,7 +36,7 @@ class EncodingMenuController { // is checked. Note that this header is included from objc, where the name // "id" is reserved. bool IsItemChecked(Profile* browser_profile, - const std::wstring& current_tab_encoding, + const std::string& current_tab_encoding, int item_id); // Fills in a list of menu items in the order they should appear in the menu. @@ -47,8 +49,8 @@ class EncodingMenuController { static const int kValidEncodingIds[]; const int* ValidGUIEncodingIDs(); int NumValidGUIEncodingIDs(); - private: + DISALLOW_COPY_AND_ASSIGN(EncodingMenuController); }; -#endif // CHORME_BROWSER_ENCODING_MENU_CONTROLLER_H_ +#endif // CHROME_BROWSER_ENCODING_MENU_CONTROLLER_H_ diff --git a/chrome/browser/encoding_menu_controller_unittest.cc b/chrome/browser/encoding_menu_controller_unittest.cc index a8258bd6..e7a7fef 100644 --- a/chrome/browser/encoding_menu_controller_unittest.cc +++ b/chrome/browser/encoding_menu_controller_unittest.cc @@ -58,7 +58,7 @@ TEST_F(EncodingMenuControllerTest, ListEncodingMenuItems) { TEST_F(EncodingMenuControllerTest, IsItemChecked) { TestingProfile profile_en; - std::wstring encoding(L"UTF-8"); + std::string encoding("UTF-8"); // Check that enabling and disabling autodetect works. bool autodetect_enabed[] = {true, false}; @@ -86,7 +86,7 @@ TEST_F(EncodingMenuControllerTest, IsItemChecked) { ASSERT_FALSE(on && encoding_is_enabled); encoding_is_enabled |= on; } - + // Make sure at least one encoding is enabled. ASSERT_TRUE(encoding_is_enabled); } diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc index 808e5c2..ec25a9f 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_toolbar_gtk.cc @@ -119,13 +119,13 @@ static MenuGtk* BuildEncodingsMenu(Profile* profile, items.begin(); i != items.end(); ++i) { if (i == items.begin()) { - menu->AppendCheckMenuItemWithLabel(i->first, WideToUTF8(i->second)); + menu->AppendCheckMenuItemWithLabel(i->first, UTF16ToUTF8(i->second)); } else if (i->first == 0) { menu->AppendSeparator(); } else { GtkWidget* item = gtk_radio_menu_item_new_with_label(radio_group, - WideToUTF8(i->second).c_str()); + UTF16ToUTF8(i->second).c_str()); radio_group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item)); menu->AppendMenuItem(i->first, item); } diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc index 3f4941f..7fa7285 100644 --- a/chrome/browser/gtk/options/fonts_page_gtk.cc +++ b/chrome/browser/gtk/options/fonts_page_gtk.cc @@ -140,7 +140,8 @@ void FontsPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { fixed_width_size_.GetValue()).c_str()); } if (!pref_name || *pref_name == prefs::kDefaultCharset) { - const std::wstring current_encoding = default_encoding_.GetValue(); + const std::string current_encoding = + WideToASCII(default_encoding_.GetValue()); for (size_t i = 0; i < sorted_encoding_list_.size(); i++) { if (CharacterEncoding::GetCanonicalEncodingNameByCommandId( sorted_encoding_list_[i].encoding_id) == current_encoding) { @@ -201,6 +202,6 @@ void FontsPageGtk::OnDefaultEncodingChanged(GtkComboBox* combo_box, return; } fonts_page->default_encoding_.SetValue( - CharacterEncoding::GetCanonicalEncodingNameByCommandId( - fonts_page->sorted_encoding_list_[index].encoding_id)); + ASCIIToWide(CharacterEncoding::GetCanonicalEncodingNameByCommandId( + fonts_page->sorted_encoding_list_[index].encoding_id))); } diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index 76fc303..88912ec 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -320,14 +320,14 @@ class MetricsService : public NotificationObserver, // creation time. void LogRendererInSandbox(bool on_sandbox_desktop); - // Set the value in preferences for for the number of bookmarks and folders + // Set the value in preferences for the number of bookmarks and folders // in node. The pref key for the number of bookmarks in num_bookmarks_key and // the pref key for number of folders in num_folders_key. void LogBookmarks(const BookmarkNode* node, const wchar_t* num_bookmarks_key, const wchar_t* num_folders_key); - // Sets preferences for the for the number of bookmarks in model. + // Sets preferences for the number of bookmarks in model. void LogBookmarks(BookmarkModel* model); // Records a child process related notification. These are recorded to an diff --git a/chrome/browser/parsers/metadata_parser_filebase.cc b/chrome/browser/parsers/metadata_parser_filebase.cc index 2d515c6..7bcbe2c 100644 --- a/chrome/browser/parsers/metadata_parser_filebase.cc +++ b/chrome/browser/parsers/metadata_parser_filebase.cc @@ -30,7 +30,7 @@ bool FileMetadataParser::Parse() { return true; } -bool FileMetadataParser::GetProperty(const std::string&key, +bool FileMetadataParser::GetProperty(const std::string& key, std::string* value) { PropertyMap::iterator it = properties_.find(key.c_str()); if (it == properties_.end()) { diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 95a53dd..ba82b80 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -440,7 +440,7 @@ void RenderViewHost::Zoom(PageZoom::Function function) { Send(new ViewMsg_Zoom(routing_id(), function)); } -void RenderViewHost::SetPageEncoding(const std::wstring& encoding_name) { +void RenderViewHost::SetPageEncoding(const std::string& encoding_name) { Send(new ViewMsg_SetPageEncoding(routing_id(), encoding_name)); } @@ -975,7 +975,7 @@ void RenderViewHost::OnMsgUpdateTitle(int32 page_id, delegate_->UpdateTitle(this, page_id, title); } -void RenderViewHost::OnMsgUpdateEncoding(const std::wstring& encoding_name) { +void RenderViewHost::OnMsgUpdateEncoding(const std::string& encoding_name) { delegate_->UpdateEncoding(this, encoding_name); } diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 0fe33e8..f733f7b 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -221,7 +221,7 @@ class RenderViewHost : public RenderWidgetHost, void Zoom(PageZoom::Function function); // Change the encoding of the page. - void SetPageEncoding(const std::wstring& encoding); + void SetPageEncoding(const std::string& encoding); // Change the alternate error page URL. An empty GURL disables the use of // alternate error pages. @@ -458,7 +458,7 @@ class RenderViewHost : public RenderWidgetHost, void OnMsgUpdateState(int32 page_id, const std::string& state); void OnMsgUpdateTitle(int32 page_id, const std::wstring& title); - void OnMsgUpdateEncoding(const std::wstring& encoding); + void OnMsgUpdateEncoding(const std::string& encoding); void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); void OnMsgThumbnail(const GURL& url, const ThumbnailScore& score, diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index 2727879..6e62289 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -415,7 +415,7 @@ class RenderViewHostDelegate { // The page's encoding was changed and should be updated. virtual void UpdateEncoding(RenderViewHost* render_view_host, - const std::wstring& encoding) {} + const std::string& encoding) {} // The destination URL has changed should be updated virtual void UpdateTargetURL(int32 page_id, const GURL& url) {} diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 4f1a5aa..9a5d1a7 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -135,7 +135,8 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( web_prefs.minimum_logical_font_size = prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); - web_prefs.default_encoding = prefs->GetString(prefs::kDefaultCharset); + web_prefs.default_encoding = + WideToASCII(prefs->GetString(prefs::kDefaultCharset)); web_prefs.javascript_can_open_windows_automatically = prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); @@ -202,8 +203,8 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( web_prefs.default_encoding); if (web_prefs.default_encoding.empty()) { prefs->ClearPref(prefs::kDefaultCharset); - web_prefs.default_encoding = prefs->GetString( - prefs::kDefaultCharset); + web_prefs.default_encoding = WideToASCII( + prefs->GetString(prefs::kDefaultCharset)); } DCHECK(!web_prefs.default_encoding.empty()); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index c76b733..29ccbc4 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -2017,7 +2017,7 @@ void TabContents::UpdateTitle(RenderViewHost* rvh, } void TabContents::UpdateEncoding(RenderViewHost* render_view_host, - const std::wstring& encoding) { + const std::string& encoding) { set_encoding(encoding); } @@ -2505,7 +2505,7 @@ void TabContents::Observe(NotificationType type, } } -void TabContents::set_encoding(const std::wstring& encoding) { +void TabContents::set_encoding(const std::string& encoding) { encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); } diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 51b8954..3f0546b 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -232,8 +232,8 @@ class TabContents : public PageNavigator, bool is_starred() const { return is_starred_; } - const std::wstring& encoding() const { return encoding_; } - void set_encoding(const std::wstring& encoding); + const std::string& encoding() const { return encoding_; } + void set_encoding(const std::string& encoding); // Internal state ------------------------------------------------------------ @@ -574,7 +574,7 @@ class TabContents : public PageNavigator, // the opposite of this, by which 'browser' is notified of // the encoding of the current tab from 'renderer' (determined by // auto-detect, http header, meta, bom detection, etc). - void override_encoding(const std::wstring& encoding) { + void override_encoding(const std::string& encoding) { set_encoding(encoding); render_view_host()->SetPageEncoding(encoding); } @@ -828,7 +828,7 @@ class TabContents : public PageNavigator, int32 page_id, const std::wstring& title); virtual void UpdateEncoding(RenderViewHost* render_view_host, - const std::wstring& encoding); + const std::string& encoding); virtual void UpdateTargetURL(int32 page_id, const GURL& url); virtual void UpdateThumbnail(const GURL& url, const SkBitmap& bitmap, @@ -1020,7 +1020,7 @@ class TabContents : public PageNavigator, std::string contents_mime_type_; // Character encoding. TODO(jungshik) : convert to std::string - std::wstring encoding_; + std::string encoding_; // Data for shelves and stuff ------------------------------------------------ diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 47426c4..b5a8048 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -572,7 +572,7 @@ TEST_F(TabContentsTest, WebKitPrefs) { WebPreferences webkit_prefs = contents()->TestGetWebkitPrefs(); // These values have been overridden by the profile preferences. - EXPECT_EQ(L"UTF-8", webkit_prefs.default_encoding); + EXPECT_EQ("UTF-8", webkit_prefs.default_encoding); EXPECT_EQ(20, webkit_prefs.default_font_size); EXPECT_EQ(false, webkit_prefs.text_areas_are_resizable); EXPECT_EQ(true, webkit_prefs.uses_universal_detector); diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 16836e6..a6e2d91 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -68,7 +68,7 @@ class DefaultEncodingComboboxModel : public ComboboxModel { return sorted_encoding_list[index].encoding_display_name; } - std::wstring GetEncodingCharsetByIndex(int index) { + std::string GetEncodingCharsetByIndex(int index) { DCHECK(index >= 0 && canonical_encoding_names_length_ > index); int encoding_id = sorted_encoding_list[index].encoding_id; return CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id); @@ -81,7 +81,7 @@ class DefaultEncodingComboboxModel : public ComboboxModel { NULL); const std::wstring current_encoding = current_encoding_string.GetValue(); for (int i = 0; i < canonical_encoding_names_length_; i++) { - if (GetEncodingCharsetByIndex(i) == current_encoding) + if (GetEncodingCharsetByIndex(i) == WideToASCII(current_encoding)) return i; } @@ -90,7 +90,7 @@ class DefaultEncodingComboboxModel : public ComboboxModel { private: int canonical_encoding_names_length_; - DISALLOW_EVIL_CONSTRUCTORS(DefaultEncodingComboboxModel); + DISALLOW_COPY_AND_ASSIGN(DefaultEncodingComboboxModel); }; //////////////////////////////////////////////////////////////////////////////// @@ -308,7 +308,7 @@ void FontsPageView::SaveChanges() { } // Set Encoding. if (default_encoding_changed_) - default_encoding_.SetValue(default_encoding_selected_); + default_encoding_.SetValue(ASCIIToWide(default_encoding_selected_)); } void FontsPageView::InitControlLayout() { diff --git a/chrome/browser/views/options/fonts_page_view.h b/chrome/browser/views/options/fonts_page_view.h index d85d8ff..193a5e7 100644 --- a/chrome/browser/views/options/fonts_page_view.h +++ b/chrome/browser/views/options/fonts_page_view.h @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H__ -#define CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H__ +#ifndef CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_ +#define CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_ + +#include <string> #include "chrome/browser/views/options/options_page_view.h" #include "chrome/browser/shell_dialogs.h" @@ -12,7 +14,6 @@ #include "views/controls/button/button.h" #include "views/view.h" - namespace views { class GroupboxView; class Label; @@ -118,10 +119,10 @@ class FontsPageView : public OptionsPageView, scoped_ptr<DefaultEncodingComboboxModel> default_encoding_combobox_model_; views::Label* default_encoding_combobox_label_; views::Combobox* default_encoding_combobox_; - std::wstring default_encoding_selected_; + std::string default_encoding_selected_; bool default_encoding_changed_; - DISALLOW_EVIL_CONSTRUCTORS(FontsPageView); + DISALLOW_COPY_AND_ASSIGN(FontsPageView); }; -#endif // #ifndef CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H__ +#endif // CHROME_BROWSER_VIEWS_OPTIONS_FONTS_PAGE_VIEW_H_ diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 73d57a7..df46370 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -98,17 +98,17 @@ void EncodingMenuModel::Build() { encoding_menu_items.begin(); for (; it != encoding_menu_items.end(); ++it) { int id = it->first; - std::wstring& label = it->second; + string16& label = it->second; if (id == 0) { AddSeparator(); } else { if (id == IDC_ENCODING_AUTO_DETECT) { - AddCheckItem(id, WideToUTF16Hack(label)); + AddCheckItem(id, label); } else { // Use the id of the first radio command as the id of the group. if (group_id <= 0) group_id = id; - AddRadioItem(id, WideToUTF16Hack(label), group_id); + AddRadioItem(id, label, group_id); } } } diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index a624b47..293ce43 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -315,7 +315,7 @@ IPC_BEGIN_MESSAGES(View) // Change encoding of page in the renderer. IPC_MESSAGE_ROUTED1(ViewMsg_SetPageEncoding, - std::wstring /*new encoding name*/) + std::string /*new encoding name*/) // Requests the renderer to reserve a range of page ids. IPC_MESSAGE_ROUTED1(ViewMsg_ReservePageIDRange, @@ -798,7 +798,7 @@ IPC_BEGIN_MESSAGES(ViewHost) // Change the encoding name of the page in UI when the page has detected // proper encoding name. IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateEncoding, - std::wstring /* new encoding name */) + std::string /* new encoding name */) // Notifies the browser that we want to show a destination url for a potential // action (e.g. when the user is hovering over a link). diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 324d95b..339c092 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1001,7 +1001,7 @@ void RenderView::UpdateTitle(WebFrame* frame, const std::wstring& title) { } void RenderView::UpdateEncoding(WebFrame* frame, - const std::wstring& encoding_name) { + const std::string& encoding_name) { // Only update main frame's encoding_name. if (webview()->GetMainFrame() == frame && last_encoding_name_ != encoding_name) { @@ -2575,7 +2575,7 @@ void RenderView::OnInsertText(const string16& text) { frame->insertText(text); } -void RenderView::OnSetPageEncoding(const std::wstring& encoding_name) { +void RenderView::OnSetPageEncoding(const std::string& encoding_name) { webview()->SetPageEncoding(encoding_name); } diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index c076bc6..aa6bc74 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -5,6 +5,7 @@ #ifndef CHROME_RENDERER_RENDER_VIEW_H_ #define CHROME_RENDERER_RENDER_VIEW_H_ +#include <set> #include <string> #include <queue> #include <vector> @@ -217,17 +218,15 @@ class RenderView : public RenderWidget, virtual void DidFailLoadWithError(WebView* webview, const WebKit::WebURLError& error, WebKit::WebFrame* forFrame); - virtual void DidFinishDocumentLoadForFrame( - WebView* webview, - WebKit::WebFrame* frame); + virtual void DidFinishDocumentLoadForFrame(WebView* webview, + WebKit::WebFrame* frame); virtual bool DidLoadResourceFromMemoryCache( WebView* webview, const WebKit::WebURLRequest& request, const WebKit::WebURLResponse& response, WebKit::WebFrame* frame); - virtual void DidHandleOnloadEventsForFrame( - WebView* webview, - WebKit::WebFrame* frame); + virtual void DidHandleOnloadEventsForFrame(WebView* webview, + WebKit::WebFrame* frame); virtual void DidChangeLocationWithinPageForFrame(WebView* webview, WebKit::WebFrame* frame, bool is_new_navigation); @@ -476,7 +475,8 @@ class RenderView : public RenderWidget, // c) function:DidFinishDocumentLoadForFrame. When this function is // called, that means we have got whole html page. In here we should // finally get right encoding of page. - void UpdateEncoding(WebKit::WebFrame* frame, const std::wstring& encoding_name); + void UpdateEncoding(WebKit::WebFrame* frame, + const std::string& encoding_name); // Captures the thumbnail and text contents for indexing for the given load // ID. If the view's load ID is different than the parameter, this call is @@ -540,7 +540,7 @@ class RenderView : public RenderWidget, void OnDeterminePageText(); void OnZoom(int function); void OnInsertText(const string16& text); - void OnSetPageEncoding(const std::wstring& encoding_name); + void OnSetPageEncoding(const std::string& encoding_name); void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( const std::vector<GURL>& links, @@ -712,7 +712,7 @@ class RenderView : public RenderWidget, ExternalHostBindings external_host_bindings_; // The last gotten main frame's encoding. - std::wstring last_encoding_name_; + std::string last_encoding_name_; // The URL we think the user's mouse is hovering over. We use this to // determine if we want to send a new one (we do not need to send diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index facb5d4..396b924 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -439,7 +439,7 @@ bool AutomatedUITest::ChangeEncoding() { std::string cur_locale = g_browser_process->GetApplicationLocale(); const std::vector<CharacterEncoding::EncodingInfo>* encodings = CharacterEncoding::GetCurrentDisplayEncodings( - cur_locale, L"ISO-8859-1,windows-1252", L""); + cur_locale, "ISO-8859-1,windows-1252", ""); DCHECK(encodings); DCHECK(!encodings->empty()); unsigned len = static_cast<unsigned>(encodings->size()); diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 472a244..2c42449 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -214,18 +214,18 @@ IPC_BEGIN_MESSAGES(Automation) // This message asks the AutomationProvider whether a tab is waiting for // login info. IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_NeedsAuth, - int, // tab handle - bool) // status + int, // tab handle + bool) // status // This message requests the AutomationProvider to apply a certain // accelerator. It is completely asynchronous with the resulting accelerator // action. IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_ApplyAccelerator, - int, // window handle - int) // accelerator id like (IDC_BACK, - // IDC_FORWARD, etc) - // The list can be found at - // chrome/app/chrome_dll_resource.h + int, // window handle + int) // accelerator id like (IDC_BACK, + // IDC_FORWARD, etc) + // The list can be found at + // chrome/app/chrome_dll_resource.h // This message requests that the AutomationProvider executes a JavaScript, // which is sent embedded in a 'javascript:' URL. @@ -843,13 +843,13 @@ IPC_BEGIN_MESSAGES(Automation) // web content tab. IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetPageCurrentEncoding, int /* tab handle */, - std::wstring /* current used encoding name */) + std::string /* current used encoding name */) // Uses the specified encoding to override the encoding of the page in the // specified web content tab. IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_OverrideEncoding, int /* tab handle */, - std::wstring /* overrided encoding name */, + std::string /* overrided encoding name */, bool /* success */) // Used to disable the dialog box that prompts the user for a path when diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index 6a1cb0a..85ab3fc 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -645,7 +645,7 @@ bool TabProxy::WaitForNavigation(int64 last_navigation_time) { result == AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED; } -bool TabProxy::GetPageCurrentEncoding(std::wstring* encoding) { +bool TabProxy::GetPageCurrentEncoding(std::string* encoding) { if (!is_valid()) return false; @@ -654,7 +654,7 @@ bool TabProxy::GetPageCurrentEncoding(std::wstring* encoding) { return succeeded; } -bool TabProxy::OverrideEncoding(const std::wstring& encoding) { +bool TabProxy::OverrideEncoding(const std::string& encoding) { if (!is_valid()) return false; diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index c8bb83e..e8dbe49 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -304,10 +304,10 @@ class TabProxy : public AutomationResourceProxy { bool WaitForNavigation(int64 last_navigation_time); // Gets the current used encoding of the page in the tab. - bool GetPageCurrentEncoding(std::wstring* encoding); + bool GetPageCurrentEncoding(std::string* encoding); // Uses the specified encoding to override encoding of the page in the tab. - bool OverrideEncoding(const std::wstring& encoding); + bool OverrideEncoding(const std::string& encoding); #if defined(OS_WIN) // Resizes the tab window. diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index 785bdbf..9b822fa 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -27,7 +27,7 @@ void WebPreferences::Apply(WebView* web_view) const { settings->setDefaultFixedFontSize(default_fixed_font_size); settings->setMinimumFontSize(minimum_font_size); settings->setMinimumLogicalFontSize(minimum_logical_font_size); - settings->setDefaultTextEncodingName(WideToUTF16Hack(default_encoding)); + settings->setDefaultTextEncodingName(ASCIIToUTF16(default_encoding)); settings->setJavaScriptEnabled(javascript_enabled); settings->setWebSecurityEnabled(web_security_enabled); settings->setJavaScriptCanOpenWindowsAutomatically( diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h index f0ab0bb..8c9a649 100644 --- a/webkit/glue/webpreferences.h +++ b/webkit/glue/webpreferences.h @@ -27,7 +27,7 @@ struct WebPreferences { int default_fixed_font_size; int minimum_font_size; int minimum_logical_font_size; - std::wstring default_encoding; + std::string default_encoding; bool javascript_enabled; bool web_security_enabled; bool javascript_can_open_windows_automatically; @@ -68,7 +68,7 @@ struct WebPreferences { default_fixed_font_size(13), minimum_font_size(1), minimum_logical_font_size(6), - default_encoding(L"ISO-8859-1"), + default_encoding("ISO-8859-1"), javascript_enabled(true), web_security_enabled(true), javascript_can_open_windows_automatically(true), diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 7346c1c..0b55232 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -156,10 +156,10 @@ class WebView : public WebKit::WebWidget { // Set the encoding of the current main frame. The value comes from // the encoding menu. WebKit uses the function named // SetCustomTextEncodingName to do override encoding job. - virtual void SetPageEncoding(const std::wstring& encoding_name) = 0; + virtual void SetPageEncoding(const std::string& encoding_name) = 0; // Return the canonical encoding name of current main webframe in webview. - virtual std::wstring GetMainFrameEncodingName() = 0; + virtual std::string GetMainFrameEncodingName() = 0; // Change the text zoom level. It will make the zoom level 20% larger or // smaller. If text_only is set, the text size will be changed. When unset, diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index bbf7d29..2103ba5 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1403,25 +1403,25 @@ void WebViewImpl::SetInspectorSettings(const std::wstring& settings) { // Set the encoding of the current main frame to the one selected by // a user in the encoding menu. -void WebViewImpl::SetPageEncoding(const std::wstring& encoding_name) { +void WebViewImpl::SetPageEncoding(const std::string& encoding_name) { if (!page_.get()) return; if (!encoding_name.empty()) { // only change override encoding, don't change default encoding // TODO(brettw) use std::string for encoding names. - String new_encoding_name(webkit_glue::StdWStringToString(encoding_name)); + String new_encoding_name(webkit_glue::StdStringToString(encoding_name)); page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name); } } // Return the canonical encoding name of current main webframe in webview. -std::wstring WebViewImpl::GetMainFrameEncodingName() { +std::string WebViewImpl::GetMainFrameEncodingName() { if (!page_.get()) - return std::wstring(); + return std::string(); String encoding_name = page_->mainFrame()->loader()->encoding(); - return webkit_glue::StringToStdWString(encoding_name); + return webkit_glue::StringToStdString(encoding_name); } void WebViewImpl::ZoomIn(bool text_only) { diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 132f7b2..ef181f0 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -6,6 +6,8 @@ #define WEBKIT_GLUE_WEBVIEW_IMPL_H_ #include <set> +#include <string> +#include <vector> #include "Page.h" @@ -85,8 +87,10 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual WebKit::WebFrame* GetFocusedFrame(); virtual void SetFocusedFrame(WebKit::WebFrame* frame); virtual WebKit::WebFrame* GetFrameWithName(const WebKit::WebString& name); - virtual WebKit::WebFrame* GetPreviousFrameBefore(WebKit::WebFrame* frame, bool wrap); - virtual WebKit::WebFrame* GetNextFrameAfter(WebKit::WebFrame* frame, bool wrap); + virtual WebKit::WebFrame* GetPreviousFrameBefore(WebKit::WebFrame* frame, + bool wrap); + virtual WebKit::WebFrame* GetNextFrameAfter(WebKit::WebFrame* frame, + bool wrap); virtual void ClearFocusedNode(); virtual void StopLoading(); virtual void SetBackForwardListSize(int size); @@ -95,8 +99,8 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual WebKit::WebSettings* GetSettings(); virtual const std::wstring& GetInspectorSettings() const; virtual void SetInspectorSettings(const std::wstring& settings); - virtual void SetPageEncoding(const std::wstring& encoding_name); - virtual std::wstring GetMainFrameEncodingName(); + virtual void SetPageEncoding(const std::string& encoding_name); + virtual std::string GetMainFrameEncodingName(); virtual void ZoomIn(bool text_only); virtual void ZoomOut(bool text_only); virtual void ResetZoom(); @@ -386,11 +390,11 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // HACK: current_input_event is for ChromeClientImpl::show(), until we can fix // WebKit to pass enough information up into ChromeClient::show() so we can // decide if the window.open event was caused by a middle-mouse click -public: + public: static const WebKit::WebInputEvent* current_input_event() { return g_current_input_event; } -private: + private: static const WebKit::WebInputEvent* g_current_input_event; DISALLOW_COPY_AND_ASSIGN(WebViewImpl); diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index be19c95..fbfda9f 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -894,7 +894,7 @@ void LayoutTestController::overridePreference( else if (key == "WebKitMinimumLogicalFontSize") preferences->minimum_logical_font_size = CppVariantToInt32(value); else if (key == "WebKitDefaultTextEncodingName") - preferences->default_encoding = CppVariantToWstring(value); + preferences->default_encoding = value.ToString(); else if (key == "WebKitJavaScriptEnabled") preferences->javascript_enabled = CppVariantToBool(value); else if (key == "WebKitWebSecurityEnabled") diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 317a746..3ebb1bc 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -402,7 +402,7 @@ void TestShell::ResetWebPreferences() { web_prefs_->fixed_font_family = L"Courier"; web_prefs_->sans_serif_font_family = L"Helvetica"; - web_prefs_->default_encoding = L"ISO-8859-1"; + web_prefs_->default_encoding = "ISO-8859-1"; web_prefs_->default_font_size = 16; web_prefs_->default_fixed_font_size = 13; web_prefs_->minimum_font_size = 1; |