| OLD | NEW |
| 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 #else | 410 #else |
| 411 // TODO(port): implement welcome page. | 411 // TODO(port): implement welcome page. |
| 412 NOTIMPLEMENTED(); | 412 NOTIMPLEMENTED(); |
| 413 #endif | 413 #endif |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 bool BrowserInit::ProcessCommandLine( | 418 bool BrowserInit::ProcessCommandLine( |
| 419 const CommandLine& command_line, const std::wstring& cur_dir, | 419 const CommandLine& command_line, const std::wstring& cur_dir, |
| 420 PrefService* prefs, bool process_startup, Profile* profile, | 420 bool process_startup, Profile* profile, int* return_code) { |
| 421 int* return_code) { | |
| 422 DCHECK(profile); | 421 DCHECK(profile); |
| 423 if (process_startup) { | 422 if (process_startup) { |
| 424 const std::wstring popup_count_string = | 423 const std::wstring popup_count_string = |
| 425 command_line.GetSwitchValue(switches::kOmniBoxPopupCount); | 424 command_line.GetSwitchValue(switches::kOmniBoxPopupCount); |
| 426 if (!popup_count_string.empty()) { | 425 if (!popup_count_string.empty()) { |
| 427 int count = 0; | 426 int count = 0; |
| 428 if (StringToInt(WideToUTF16Hack(popup_count_string), &count)) { | 427 if (StringToInt(WideToUTF16Hack(popup_count_string), &count)) { |
| 429 const int popup_count = std::max(0, count); | 428 const int popup_count = std::max(0, count); |
| 430 AutocompleteResult::set_max_matches(popup_count); | 429 AutocompleteResult::set_max_matches(popup_count); |
| 431 AutocompleteProvider::set_max_matches(popup_count / 2); | 430 AutocompleteProvider::set_max_matches(popup_count / 2); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 CreateAutomationProvider<TestingAutomationProvider>( | 465 CreateAutomationProvider<TestingAutomationProvider>( |
| 467 testing_channel_id, | 466 testing_channel_id, |
| 468 profile, | 467 profile, |
| 469 static_cast<size_t>(expected_tab_count)); | 468 static_cast<size_t>(expected_tab_count)); |
| 470 } | 469 } |
| 471 } | 470 } |
| 472 | 471 |
| 473 // Allow the command line to override the persisted setting of home page. | 472 // Allow the command line to override the persisted setting of home page. |
| 474 SetOverrideHomePage(command_line, profile->GetPrefs()); | 473 SetOverrideHomePage(command_line, profile->GetPrefs()); |
| 475 | 474 |
| 476 if (command_line.HasSwitch(switches::kBrowserStartRenderersManually)) | |
| 477 prefs->transient()->SetBoolean(prefs::kStartRenderersManually, true); | |
| 478 | |
| 479 bool silent_launch = false; | 475 bool silent_launch = false; |
| 480 if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { | 476 if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { |
| 481 std::wstring automation_channel_id = | 477 std::wstring automation_channel_id = |
| 482 command_line.GetSwitchValue(switches::kAutomationClientChannelID); | 478 command_line.GetSwitchValue(switches::kAutomationClientChannelID); |
| 483 // If there are any loose parameters, we expect each one to generate a | 479 // If there are any loose parameters, we expect each one to generate a |
| 484 // new tab; if there are none then we have no tabs | 480 // new tab; if there are none then we have no tabs |
| 485 size_t expected_tabs = | 481 size_t expected_tabs = |
| 486 std::max(static_cast<int>(command_line.GetLooseValues().size()), | 482 std::max(static_cast<int>(command_line.GetLooseValues().size()), |
| 487 0); | 483 0); |
| 488 if (expected_tabs == 0) | 484 if (expected_tabs == 0) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 bool launched = lwp.Launch(profile, process_startup); | 555 bool launched = lwp.Launch(profile, process_startup); |
| 560 if (!launched) { | 556 if (!launched) { |
| 561 LOG(ERROR) << "launch error"; | 557 LOG(ERROR) << "launch error"; |
| 562 if (return_code != NULL) | 558 if (return_code != NULL) |
| 563 *return_code = ResultCodes::INVALID_CMDLINE_URL; | 559 *return_code = ResultCodes::INVALID_CMDLINE_URL; |
| 564 return false; | 560 return false; |
| 565 } | 561 } |
| 566 | 562 |
| 567 return true; | 563 return true; |
| 568 } | 564 } |
| OLD | NEW |