| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 449 // TODO(sanjeevr) Check if we need to make this a singleton for | 449 // TODO(sanjeevr) Check if we need to make this a singleton for |
| 450 // compatibility with the old testing code | 450 // compatibility with the old testing code |
| 451 // If there are any loose parameters, we expect each one to generate a | 451 // If there are any loose parameters, we expect each one to generate a |
| 452 // new tab; if there are none then we get one homepage tab. | 452 // new tab; if there are none then we get one homepage tab. |
| 453 int expected_tab_count = 1; |
| 454 if (command_line.HasSwitch(switches::kRestoreLastSession)) { |
| 455 StringToInt(command_line.GetSwitchValue(switches::kRestoreLastSession), |
| 456 &expected_tab_count); |
| 457 } else { |
| 458 expected_tab_count = |
| 459 std::max(1, static_cast<int>(command_line.GetLooseValues().size())); |
| 460 } |
| 453 CreateAutomationProvider<TestingAutomationProvider>( | 461 CreateAutomationProvider<TestingAutomationProvider>( |
| 454 testing_channel_id, | 462 testing_channel_id, |
| 455 profile, | 463 profile, |
| 456 std::max(static_cast<int>(command_line.GetLooseValues().size()), | 464 static_cast<size_t>(expected_tab_count)); |
| 457 1)); | |
| 458 } | 465 } |
| 459 #endif | 466 #endif |
| 460 } | 467 } |
| 461 | 468 |
| 462 // Allow the command line to override the persisted setting of home page. | 469 // Allow the command line to override the persisted setting of home page. |
| 463 SetOverrideHomePage(command_line, profile->GetPrefs()); | 470 SetOverrideHomePage(command_line, profile->GetPrefs()); |
| 464 | 471 |
| 465 if (command_line.HasSwitch(switches::kBrowserStartRenderersManually)) | 472 if (command_line.HasSwitch(switches::kBrowserStartRenderersManually)) |
| 466 prefs->transient()->SetBoolean(prefs::kStartRenderersManually, true); | 473 prefs->transient()->SetBoolean(prefs::kStartRenderersManually, true); |
| 467 | 474 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 bool launched = lwp.Launch(profile, process_startup); | 555 bool launched = lwp.Launch(profile, process_startup); |
| 549 if (!launched) { | 556 if (!launched) { |
| 550 LOG(ERROR) << "launch error"; | 557 LOG(ERROR) << "launch error"; |
| 551 if (return_code != NULL) | 558 if (return_code != NULL) |
| 552 *return_code = ResultCodes::INVALID_CMDLINE_URL; | 559 *return_code = ResultCodes::INVALID_CMDLINE_URL; |
| 553 return false; | 560 return false; |
| 554 } | 561 } |
| 555 | 562 |
| 556 return true; | 563 return true; |
| 557 } | 564 } |
| OLD | NEW |