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 <atlbase.h> | 5 #include <atlbase.h> |
6 #include <atlcom.h> | 6 #include <atlcom.h> |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 *browser = static_cast<int>(StringToInt64(v[0])); | 443 *browser = static_cast<int>(StringToInt64(v[0])); |
444 *options = static_cast<int>(StringToInt64(v[1])); | 444 *options = static_cast<int>(StringToInt64(v[1])); |
445 *window = reinterpret_cast<HWND>(StringToInt64(v[2])); | 445 *window = reinterpret_cast<HWND>(StringToInt64(v[2])); |
446 return true; | 446 return true; |
447 } | 447 } |
448 | 448 |
449 } // namespace | 449 } // namespace |
450 | 450 |
451 bool FirstRun::ImportSettings(Profile* profile, int browser, | 451 bool FirstRun::ImportSettings(Profile* profile, int browser, |
452 int items_to_import, HWND parent_window) { | 452 int items_to_import, HWND parent_window) { |
453 CommandLine cmdline; | 453 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); |
454 std::wstring import_cmd(cmdline.program()); | 454 CommandLine import_cmd(cmdline.program()); |
455 // Propagate the following switches to the importer command line. | 455 // Propagate the following switches to the importer command line. |
456 static const wchar_t* const switch_names[] = { | 456 static const wchar_t* const switch_names[] = { |
457 switches::kUserDataDir, | 457 switches::kUserDataDir, |
458 switches::kLang, | 458 switches::kLang, |
459 }; | 459 }; |
460 for (int i = 0; i < arraysize(switch_names); ++i) { | 460 for (int i = 0; i < arraysize(switch_names); ++i) { |
461 if (cmdline.HasSwitch(switch_names[i])) { | 461 if (cmdline.HasSwitch(switch_names[i])) { |
462 CommandLine::AppendSwitchWithValue( | 462 import_cmd.AppendSwitchWithValue( |
463 &import_cmd, switch_names[i], | 463 switch_names[i], |
464 cmdline.GetSwitchValue(switch_names[i])); | 464 cmdline.GetSwitchValue(switch_names[i])); |
465 } | 465 } |
466 } | 466 } |
467 CommandLine::AppendSwitchWithValue(&import_cmd, switches::kImport, | 467 import_cmd.CommandLine::AppendSwitchWithValue(switches::kImport, |
468 EncodeImportParams(browser, items_to_import, parent_window)); | 468 EncodeImportParams(browser, items_to_import, parent_window)); |
469 | 469 |
470 // Time to launch the process that is going to do the import. | 470 // Time to launch the process that is going to do the import. |
471 base::ProcessHandle import_process; | 471 base::ProcessHandle import_process; |
472 if (!base::LaunchApp(import_cmd, false, false, &import_process)) | 472 if (!base::LaunchApp(import_cmd, false, false, &import_process)) |
473 return false; | 473 return false; |
474 | 474 |
475 // Activate the importer monitor. It awakes periodically in another thread | 475 // Activate the importer monitor. It awakes periodically in another thread |
476 // and checks that the importer UI is still pumping messages. | 476 // and checks that the importer UI is still pumping messages. |
477 if (parent_window) | 477 if (parent_window) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 bool FirstRun::SetShowWelcomePagePref() { | 539 bool FirstRun::SetShowWelcomePagePref() { |
540 PrefService* local_state = g_browser_process->local_state(); | 540 PrefService* local_state = g_browser_process->local_state(); |
541 if (!local_state) | 541 if (!local_state) |
542 return false; | 542 return false; |
543 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { | 543 if (!local_state->IsPrefRegistered(prefs::kShouldShowWelcomePage)) { |
544 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); | 544 local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); |
545 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); | 545 local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); |
546 } | 546 } |
547 return true; | 547 return true; |
548 } | 548 } |
OLD | NEW |