summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/configuration_policy_pref_store.cc6
-rw-r--r--chrome/browser/first_run/first_run_win.cc16
-rw-r--r--chrome/browser/profile_impl.cc19
-rw-r--r--chrome/browser/safe_browsing/filter_false_positive_perftest.cc25
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc8
-rw-r--r--chrome/browser/shell_integration.cc6
-rw-r--r--chrome/browser/shell_integration_win.cc5
-rw-r--r--chrome/browser/views/app_launcher.cc8
8 files changed, 47 insertions, 46 deletions
diff --git a/chrome/browser/configuration_policy_pref_store.cc b/chrome/browser/configuration_policy_pref_store.cc
index 34942af..979cb64 100644
--- a/chrome/browser/configuration_policy_pref_store.cc
+++ b/chrome/browser/configuration_policy_pref_store.cc
@@ -77,17 +77,17 @@ void ConfigurationPolicyPrefStore::ApplyProxySwitches() {
if (command_line_->HasSwitch(switches::kProxyServer)) {
has_explicit_proxy_config = true;
prefs_->Set(prefs::kProxyServer, Value::CreateStringValue(
- command_line_->GetSwitchValue(switches::kProxyServer)));
+ command_line_->GetSwitchValueASCII(switches::kProxyServer)));
}
if (command_line_->HasSwitch(switches::kProxyPacUrl)) {
has_explicit_proxy_config = true;
prefs_->Set(prefs::kProxyPacUrl, Value::CreateStringValue(
- command_line_->GetSwitchValue(switches::kProxyPacUrl)));
+ command_line_->GetSwitchValueASCII(switches::kProxyPacUrl)));
}
if (command_line_->HasSwitch(switches::kProxyBypassList)) {
has_explicit_proxy_config = true;
prefs_->Set(prefs::kProxyBypassList, Value::CreateStringValue(
- command_line_->GetSwitchValue(switches::kProxyBypassList)));
+ command_line_->GetSwitchValueASCII(switches::kProxyBypassList)));
}
// Warn about all the other proxy config switches we get if
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index afac507..4a94da6 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -586,21 +586,21 @@ std::string EncodeImportParams(int browser_type, int options, HWND window) {
return StringPrintf("%d@%d@%d", browser_type, options, window);
}
-bool DecodeImportParams(const std::wstring& encoded,
+bool DecodeImportParams(const std::string& encoded,
int* browser_type, int* options, HWND* window) {
- std::vector<std::wstring> v;
- SplitString(encoded, L'@', &v);
- if (v.size() != 3)
+ std::vector<std::string> parts;
+ SplitString(encoded, '@', &parts);
+ if (parts.size() != 3)
return false;
- if (!base::StringToInt(WideToUTF16Hack(v[0]), browser_type))
+ if (!base::StringToInt(parts[0], browser_type))
return false;
- if (!base::StringToInt(WideToUTF16Hack(v[1]), options))
+ if (!base::StringToInt(parts[1], options))
return false;
int64 window_int;
- base::StringToInt64(WideToUTF16Hack(v[2]), &window_int);
+ base::StringToInt64(parts[2], &window_int);
*window = reinterpret_cast<HWND>(window_int);
return true;
}
@@ -742,7 +742,7 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
int FirstRun::ImportFromBrowser(Profile* profile,
const CommandLine& cmdline) {
- std::wstring import_info = cmdline.GetSwitchValue(switches::kImport);
+ std::string import_info = cmdline.GetSwitchValueASCII(switches::kImport);
if (import_info.empty()) {
NOTREACHED();
return false;
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc
index 7e8f133..156a2c5 100644
--- a/chrome/browser/profile_impl.cc
+++ b/chrome/browser/profile_impl.cc
@@ -120,11 +120,9 @@ void GetCacheParameters(ContextType type, FilePath* cache_path,
DCHECK(max_size);
// Override the cache location if specified by the user.
- std::wstring user_path(CommandLine::ForCurrentProcess()->GetSwitchValue(
- switches::kDiskCacheDir));
-
- if (!user_path.empty()) {
- *cache_path = FilePath::FromWStringHack(user_path);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDiskCacheDir)) {
+ *cache_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(
+ switches::kDiskCacheDir);
}
const char* arg = kNormalContext == type ? switches::kDiskCacheSize :
@@ -856,13 +854,14 @@ void ProfileImpl::CreatePasswordStore() {
// the desktop environment currently running, allowing GNOME Keyring in XFCE.
// (In all cases we fall back on the default store in case of failure.)
base::DesktopEnvironment desktop_env;
- std::wstring store_type = CommandLine::ForCurrentProcess()->GetSwitchValue(
- switches::kPasswordStore);
- if (store_type == L"kwallet") {
+ std::string store_type =
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kPasswordStore);
+ if (store_type == "kwallet") {
desktop_env = base::DESKTOP_ENVIRONMENT_KDE4;
- } else if (store_type == L"gnome") {
+ } else if (store_type == "gnome") {
desktop_env = base::DESKTOP_ENVIRONMENT_GNOME;
- } else if (store_type == L"detect") {
+ } else if (store_type == "detect") {
scoped_ptr<base::Environment> env(base::Environment::Create());
desktop_env = base::GetDesktopEnvironment(env.get());
LOG(INFO) << "Password storage detected desktop environment: " <<
diff --git a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
index 6ce33330..3b16e2f 100644
--- a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
+++ b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc
@@ -313,18 +313,18 @@ TEST(SafeBrowsingBloomFilter, FalsePositives) {
FilePath data_dir = GetFullDataPath();
ASSERT_TRUE(ReadDatabase(data_dir, &prefix_list));
+ const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
+
int start = BloomFilter::kBloomFilterSizeRatio;
- if (CommandLine::ForCurrentProcess()->HasSwitch(kFilterStart)) {
- base::StringToInt(
- CommandLine::ForCurrentProcess()->GetSwitchValue(kFilterStart),
- &start);
+ if (cmd_line.HasSwitch(kFilterStart)) {
+ ASSERT_TRUE(base::StringToInt(cmd_line.GetSwitchValueASCII(kFilterStart),
+ &start));
}
int steps = 1;
- if (CommandLine::ForCurrentProcess()->HasSwitch(kFilterSteps)) {
- base::StringToInt(
- CommandLine::ForCurrentProcess()->GetSwitchValue(kFilterSteps),
- &steps);
+ if (cmd_line.HasSwitch(kFilterSteps)) {
+ ASSERT_TRUE(base::StringToInt(cmd_line.GetSwitchValueASCII(kFilterSteps),
+ &steps));
}
int stop = start + steps;
@@ -341,11 +341,12 @@ TEST(SafeBrowsingBloomFilter, HashTime) {
FilePath data_dir = GetFullDataPath();
ASSERT_TRUE(ReadDatabase(data_dir, &prefix_list));
+ const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
+
int num_checks = kNumHashChecks;
- if (CommandLine::ForCurrentProcess()->HasSwitch(kFilterNumChecks)) {
- base::StringToInt(
- CommandLine::ForCurrentProcess()->GetSwitchValue(kFilterNumChecks),
- &num_checks);
+ if (cmd_line.HasSwitch(kFilterNumChecks)) {
+ ASSERT_TRUE(base::StringToInt(cmd_line.GetSwitchValue(kFilterNumChecks),
+ &num_checks));
}
// Populate the bloom filter and measure the time.
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index 20bd8a9..0f10a6c 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -2738,11 +2738,11 @@ int GetCurrentCountryID() {
int GetCountryIDFromPrefs(PrefService* prefs) {
// See if the user overrode the country on the command line.
- const std::wstring country(
- CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kCountry));
+ const std::string country(
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kCountry));
if (country.length() == 2)
- return CountryCharsToCountryIDWithUpdate(static_cast<char>(country[0]),
- static_cast<char>(country[1]));
+ return CountryCharsToCountryIDWithUpdate(country[0], country[1]);
// Cache first run Country ID value in prefs, and use it afterwards. This
// ensures that just because the user moves around, we won't automatically
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 1c54eca..3ed45ae7 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -31,11 +31,11 @@ std::string ShellIntegration::GetCommandLineArgumentsCommon(const GURL& url,
}
}
-#if defined (OS_CHROMEOS)
- std::wstring profile = cmd.GetSwitchValue(switches::kLoginProfile);
+#if defined(OS_CHROMEOS)
+ FilePath profile = cmd.GetSwitchValuePath(switches::kLoginProfile);
if (!profile.empty()) {
arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kLoginProfile) +
- L"=\"" + profile + L"\" ";
+ L"=\"" + profile.ToWStringHack() + L"\" ";
}
#endif
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 4dd94dc..469fcbd 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -217,8 +217,9 @@ bool MigrateChromiumShortcutsTask::GetExpectedAppId(
FilePath profile_path;
if (command_line.HasSwitch(switches::kUserDataDir)) {
- profile_path = FilePath(command_line.GetSwitchValue(
- switches::kUserDataDir)).Append(chrome::kNotSignedInProfile);
+ profile_path =
+ command_line.GetSwitchValuePath(switches::kUserDataDir).Append(
+ chrome::kNotSignedInProfile);
}
std::wstring app_name;
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index 32bc5e9..7a4fcec 100644
--- a/chrome/browser/views/app_launcher.cc
+++ b/chrome/browser/views/app_launcher.cc
@@ -43,14 +43,14 @@ const SkColor kBorderColor = SkColorSetRGB(205, 201, 201);
// Command line switch for specifying url of the page.
// TODO: nuke when we convert to the real app page. Also nuke code in
// AddNewContents
-const wchar_t kURLSwitch[] = L"main-menu-url";
+const char kURLSwitch[] = "main-menu-url";
// Returns the URL of the menu.
static GURL GetMenuURL() {
- std::wstring url_string =
- CommandLine::ForCurrentProcess()->GetSwitchValue(kURLSwitch);
+ std::string url_string =
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kURLSwitch);
if (!url_string.empty())
- return GURL(WideToUTF8(url_string));
+ return GURL(url_string);
return GURL(chrome::kChromeUIAppLauncherURL);
}