summaryrefslogtreecommitdiffstats
path: root/chrome/installer
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 /chrome/installer
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
Diffstat (limited to 'chrome/installer')
-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
6 files changed, 94 insertions, 93 deletions
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.