| 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 if (!base::LaunchApp(cl, false, false, &ph)) | 148 base::LaunchOptions options; |
| 149 options.process_handle = &ph; |
| 150 if (!base::LaunchProcess(cl, options)) |
| 149 return false; | 151 return false; |
| 150 DWORD wr = ::WaitForSingleObject(ph, INFINITE); | 152 DWORD wr = ::WaitForSingleObject(ph, INFINITE); |
| 151 if (wr != WAIT_OBJECT_0) | 153 if (wr != WAIT_OBJECT_0) |
| 152 return false; | 154 return false; |
| 153 return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); | 155 return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); |
| 154 } | 156 } |
| 155 | 157 |
| 156 bool FirstRun::WriteEULAtoTempFile(FilePath* eula_path) { | 158 bool FirstRun::WriteEULAtoTempFile(FilePath* eula_path) { |
| 157 base::StringPiece terms = | 159 base::StringPiece terms = |
| 158 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); | 160 ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 skip_first_run_ui ? 1 : 0, NULL)); | 337 skip_first_run_ui ? 1 : 0, NULL)); |
| 336 } | 338 } |
| 337 | 339 |
| 338 if (!import_bookmarks_path.empty()) { | 340 if (!import_bookmarks_path.empty()) { |
| 339 import_cmd.CommandLine::AppendSwitchPath( | 341 import_cmd.CommandLine::AppendSwitchPath( |
| 340 switches::kImportFromFile, import_bookmarks_path); | 342 switches::kImportFromFile, import_bookmarks_path); |
| 341 } | 343 } |
| 342 | 344 |
| 343 // Time to launch the process that is going to do the import. | 345 // Time to launch the process that is going to do the import. |
| 344 base::ProcessHandle import_process; | 346 base::ProcessHandle import_process; |
| 345 if (!base::LaunchApp(import_cmd, false, false, &import_process)) | 347 base::LaunchOptions options; |
| 348 options.process_handle = &import_process; |
| 349 if (!base::LaunchProcess(import_cmd, options)) |
| 346 return false; | 350 return false; |
| 347 | 351 |
| 348 // We block inside the import_runner ctor, pumping messages until the | 352 // We block inside the import_runner ctor, pumping messages until the |
| 349 // importer process ends. This can happen either by completing the import | 353 // importer process ends. This can happen either by completing the import |
| 350 // or by hang_monitor killing it. | 354 // or by hang_monitor killing it. |
| 351 ImportProcessRunner import_runner(import_process); | 355 ImportProcessRunner import_runner(import_process); |
| 352 | 356 |
| 353 // Import process finished. Reload the prefs, because importer may set | 357 // Import process finished. Reload the prefs, because importer may set |
| 354 // the pref value. | 358 // the pref value. |
| 355 if (profile) | 359 if (profile) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 parent_window, | 407 parent_window, |
| 404 static_cast<uint16>(items_to_import), | 408 static_cast<uint16>(items_to_import), |
| 405 importer_host, | 409 importer_host, |
| 406 &importer_observer, | 410 &importer_observer, |
| 407 importer_list->GetSourceProfileForImporterType(importer_type), | 411 importer_list->GetSourceProfileForImporterType(importer_type), |
| 408 profile, | 412 profile, |
| 409 true); | 413 true); |
| 410 importer_observer.RunLoop(); | 414 importer_observer.RunLoop(); |
| 411 return importer_observer.import_result(); | 415 return importer_observer.import_result(); |
| 412 } | 416 } |
| OLD | NEW |