| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
| 6 | 6 |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 exe_path = exe_path.Append(installer::kSetupExe); | 138 exe_path = exe_path.Append(installer::kSetupExe); |
| 139 base::ProcessHandle ph; | 139 base::ProcessHandle ph; |
| 140 CommandLine cl(exe_path); | 140 CommandLine cl(exe_path); |
| 141 cl.AppendSwitchNative(param, value); | 141 cl.AppendSwitchNative(param, value); |
| 142 | 142 |
| 143 CommandLine* browser_command_line = CommandLine::ForCurrentProcess(); | 143 CommandLine* browser_command_line = CommandLine::ForCurrentProcess(); |
| 144 if (browser_command_line->HasSwitch(switches::kChromeFrame)) { | 144 if (browser_command_line->HasSwitch(switches::kChromeFrame)) { |
| 145 cl.AppendSwitch(switches::kChromeFrame); | 145 cl.AppendSwitch(switches::kChromeFrame); |
| 146 } | 146 } |
| 147 | 147 |
| 148 base::LaunchOptions options; | 148 // TODO(evan): should this use options.wait = true? |
| 149 options.process_handle = &ph; | 149 if (!base::LaunchProcess(cl, base::LaunchOptions(), &ph)) |
| 150 if (!base::LaunchProcess(cl, options)) | |
| 151 return false; | 150 return false; |
| 152 DWORD wr = ::WaitForSingleObject(ph, INFINITE); | 151 DWORD wr = ::WaitForSingleObject(ph, INFINITE); |
| 153 if (wr != WAIT_OBJECT_0) | 152 if (wr != WAIT_OBJECT_0) |
| 154 return false; | 153 return false; |
| 155 return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); | 154 return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool FirstRun::WriteEULAtoTempFile(FilePath* eula_path) { | 157 bool FirstRun::WriteEULAtoTempFile(FilePath* eula_path) { |
| 159 base::StringPiece terms = | 158 base::StringPiece terms = |
| 160 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); | 159 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 skip_first_run_ui ? 1 : 0, NULL)); | 336 skip_first_run_ui ? 1 : 0, NULL)); |
| 338 } | 337 } |
| 339 | 338 |
| 340 if (!import_bookmarks_path.empty()) { | 339 if (!import_bookmarks_path.empty()) { |
| 341 import_cmd.CommandLine::AppendSwitchPath( | 340 import_cmd.CommandLine::AppendSwitchPath( |
| 342 switches::kImportFromFile, import_bookmarks_path); | 341 switches::kImportFromFile, import_bookmarks_path); |
| 343 } | 342 } |
| 344 | 343 |
| 345 // Time to launch the process that is going to do the import. | 344 // Time to launch the process that is going to do the import. |
| 346 base::ProcessHandle import_process; | 345 base::ProcessHandle import_process; |
| 347 base::LaunchOptions options; | 346 if (!base::LaunchProcess(import_cmd, base::LaunchOptions(), &import_process)) |
| 348 options.process_handle = &import_process; | |
| 349 if (!base::LaunchProcess(import_cmd, options)) | |
| 350 return false; | 347 return false; |
| 351 | 348 |
| 352 // We block inside the import_runner ctor, pumping messages until the | 349 // We block inside the import_runner ctor, pumping messages until the |
| 353 // importer process ends. This can happen either by completing the import | 350 // importer process ends. This can happen either by completing the import |
| 354 // or by hang_monitor killing it. | 351 // or by hang_monitor killing it. |
| 355 ImportProcessRunner import_runner(import_process); | 352 ImportProcessRunner import_runner(import_process); |
| 356 | 353 |
| 357 // Import process finished. Reload the prefs, because importer may set | 354 // Import process finished. Reload the prefs, because importer may set |
| 358 // the pref value. | 355 // the pref value. |
| 359 if (profile) | 356 if (profile) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 parent_window, | 404 parent_window, |
| 408 static_cast<uint16>(items_to_import), | 405 static_cast<uint16>(items_to_import), |
| 409 importer_host, | 406 importer_host, |
| 410 &importer_observer, | 407 &importer_observer, |
| 411 importer_list->GetSourceProfileForImporterType(importer_type), | 408 importer_list->GetSourceProfileForImporterType(importer_type), |
| 412 profile, | 409 profile, |
| 413 true); | 410 true); |
| 414 importer_observer.RunLoop(); | 411 importer_observer.RunLoop(); |
| 415 return importer_observer.import_result(); | 412 return importer_observer.import_result(); |
| 416 } | 413 } |
| OLD | NEW |