| 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/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Open the required browser windows and tabs. | 189 // Open the required browser windows and tabs. |
| 190 // First, see if we're being run as a web application (thin frame window). | 190 // First, see if we're being run as a web application (thin frame window). |
| 191 if (!OpenApplicationURL(profile)) { | 191 if (!OpenApplicationURL(profile)) { |
| 192 std::vector<GURL> urls_to_open = GetURLsFromCommandLine(profile_); | 192 std::vector<GURL> urls_to_open = GetURLsFromCommandLine(profile_); |
| 193 // Always attempt to restore the last session. OpenStartupURLs only opens | 193 // Always attempt to restore the last session. OpenStartupURLs only opens |
| 194 // the home pages if no additional URLs were passed on the command line. | 194 // the home pages if no additional URLs were passed on the command line. |
| 195 if (!OpenStartupURLs(process_startup, urls_to_open)) { | 195 if (!OpenStartupURLs(process_startup, urls_to_open)) { |
| 196 // Add the home page and any special first run URLs. | 196 // Add the home page and any special first run URLs. |
| 197 AddStartupURLs(&urls_to_open); | 197 Browser* browser = NULL; |
| 198 OpenURLsInBrowser(BrowserList::GetLastActive(), process_startup, | 198 if (urls_to_open.empty()) |
| 199 urls_to_open); | 199 AddStartupURLs(&urls_to_open); |
| 200 else |
| 201 browser = BrowserList::GetLastActive(); |
| 202 OpenURLsInBrowser(browser, process_startup, urls_to_open); |
| 200 } | 203 } |
| 201 } | 204 } |
| 202 | 205 |
| 203 // If we're recording or playing back, startup the EventRecorder now | 206 // If we're recording or playing back, startup the EventRecorder now |
| 204 // unless otherwise specified. | 207 // unless otherwise specified. |
| 205 if (!command_line_.HasSwitch(switches::kNoEvents)) { | 208 if (!command_line_.HasSwitch(switches::kNoEvents)) { |
| 206 std::wstring script_path; | 209 std::wstring script_path; |
| 207 PathService::Get(chrome::FILE_RECORDED_SCRIPT, &script_path); | 210 PathService::Get(chrome::FILE_RECORDED_SCRIPT, &script_path); |
| 208 | 211 |
| 209 bool record_mode = command_line_.HasSwitch(switches::kRecordMode); | 212 bool record_mode = command_line_.HasSwitch(switches::kRecordMode); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 bool launched = lwp.Launch(profile, process_startup); | 492 bool launched = lwp.Launch(profile, process_startup); |
| 490 if (!launched) { | 493 if (!launched) { |
| 491 LOG(ERROR) << "launch error"; | 494 LOG(ERROR) << "launch error"; |
| 492 if (return_code != NULL) | 495 if (return_code != NULL) |
| 493 *return_code = ResultCodes::INVALID_CMDLINE_URL; | 496 *return_code = ResultCodes::INVALID_CMDLINE_URL; |
| 494 return false; | 497 return false; |
| 495 } | 498 } |
| 496 | 499 |
| 497 return true; | 500 return true; |
| 498 } | 501 } |
| OLD | NEW |