Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: chrome/browser/browser_init.cc

Issue 28281: Get rid of wstring variants of StringToFoo. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browser_init.h" 5 #include "chrome/browser/browser_init.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/event_recorder.h" 9 #include "base/event_recorder.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable)) 210 if (command_line_.HasSwitch(switches::kDnsPrefetchDisable))
211 chrome_browser_net::EnableDnsPrefetch(false); 211 chrome_browser_net::EnableDnsPrefetch(false);
212 212
213 if (command_line_.HasSwitch(switches::kDumpHistogramsOnExit)) 213 if (command_line_.HasSwitch(switches::kDumpHistogramsOnExit))
214 StatisticsRecorder::set_dump_on_exit(true); 214 StatisticsRecorder::set_dump_on_exit(true);
215 215
216 if (command_line_.HasSwitch(switches::kRemoteShellPort)) { 216 if (command_line_.HasSwitch(switches::kRemoteShellPort)) {
217 if (!RenderProcessHost::run_renderer_in_process()) { 217 if (!RenderProcessHost::run_renderer_in_process()) {
218 std::wstring port_str = 218 std::wstring port_str =
219 command_line_.GetSwitchValue(switches::kRemoteShellPort); 219 command_line_.GetSwitchValue(switches::kRemoteShellPort);
220 int64 port = StringToInt64(port_str); 220 int64 port = StringToInt64(WideToUTF16Hack(port_str));
221 if (port > 0 && port < 65535) { 221 if (port > 0 && port < 65535) {
222 g_browser_process->InitDebuggerWrapper(static_cast<int>(port)); 222 g_browser_process->InitDebuggerWrapper(static_cast<int>(port));
223 } else { 223 } else {
224 DLOG(WARNING) << "Invalid port number " << port; 224 DLOG(WARNING) << "Invalid port number " << port;
225 } 225 }
226 } 226 }
227 } 227 }
228 228
229 if (command_line_.HasSwitch(switches::kEnableFileCookies)) 229 if (command_line_.HasSwitch(switches::kEnableFileCookies))
230 net::CookieMonster::EnableFileScheme(); 230 net::CookieMonster::EnableFileScheme();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 bool BrowserInit::ProcessCommandLine( 414 bool BrowserInit::ProcessCommandLine(
415 const CommandLine& command_line, const std::wstring& cur_dir, 415 const CommandLine& command_line, const std::wstring& cur_dir,
416 PrefService* prefs, bool process_startup, Profile* profile, 416 PrefService* prefs, bool process_startup, Profile* profile,
417 int* return_code) { 417 int* return_code) {
418 DCHECK(profile); 418 DCHECK(profile);
419 if (process_startup) { 419 if (process_startup) {
420 const std::wstring popup_count_string = 420 const std::wstring popup_count_string =
421 command_line.GetSwitchValue(switches::kOmniBoxPopupCount); 421 command_line.GetSwitchValue(switches::kOmniBoxPopupCount);
422 if (!popup_count_string.empty()) { 422 if (!popup_count_string.empty()) {
423 int count = 0; 423 int count = 0;
424 if (StringToInt(popup_count_string, &count)) { 424 if (StringToInt(WideToUTF16Hack(popup_count_string), &count)) {
425 const int popup_count = std::max(0, count); 425 const int popup_count = std::max(0, count);
426 AutocompleteResult::set_max_matches(popup_count); 426 AutocompleteResult::set_max_matches(popup_count);
427 AutocompleteProvider::set_max_matches(popup_count / 2); 427 AutocompleteProvider::set_max_matches(popup_count / 2);
428 } 428 }
429 } 429 }
430 430
431 if (command_line.HasSwitch(switches::kDisablePromptOnRepost)) 431 if (command_line.HasSwitch(switches::kDisablePromptOnRepost))
432 NavigationController::DisablePromptOnRepost(); 432 NavigationController::DisablePromptOnRepost();
433 433
434 const std::wstring tab_count_string = 434 const std::wstring tab_count_string =
435 command_line.GetSwitchValue(switches::kTabCountToLoadOnSessionRestore); 435 command_line.GetSwitchValue(switches::kTabCountToLoadOnSessionRestore);
436 if (!tab_count_string.empty()) { 436 if (!tab_count_string.empty()) {
437 int count = 0; 437 int count = 0;
438 if (StringToInt(tab_count_string, &count)) { 438 if (StringToInt(WideToUTF16Hack(tab_count_string), &count)) {
439 const int tab_count = std::max(0, count); 439 const int tab_count = std::max(0, count);
440 SessionRestore::num_tabs_to_load_ = static_cast<size_t>(tab_count); 440 SessionRestore::num_tabs_to_load_ = static_cast<size_t>(tab_count);
441 } 441 }
442 } 442 }
443 443
444 #if defined(OS_WIN) 444 #if defined(OS_WIN)
445 // Look for the testing channel ID ONLY during process startup 445 // Look for the testing channel ID ONLY during process startup
446 if (command_line.HasSwitch(switches::kTestingChannelID)) { 446 if (command_line.HasSwitch(switches::kTestingChannelID)) {
447 std::wstring testing_channel_id = 447 std::wstring testing_channel_id =
448 command_line.GetSwitchValue(switches::kTestingChannelID); 448 command_line.GetSwitchValue(switches::kTestingChannelID);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 bool launched = lwp.Launch(profile, process_startup); 558 bool launched = lwp.Launch(profile, process_startup);
559 if (!launched) { 559 if (!launched) {
560 LOG(ERROR) << "launch error"; 560 LOG(ERROR) << "launch error";
561 if (return_code != NULL) 561 if (return_code != NULL)
562 *return_code = ResultCodes::INVALID_CMDLINE_URL; 562 *return_code = ResultCodes::INVALID_CMDLINE_URL;
563 return false; 563 return false;
564 } 564 }
565 565
566 return true; 566 return true;
567 } 567 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698