Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/first_run_win.cc

Issue 3012021: CommandLine: add a CopySwitchesFrom() for copying from another CommandLine (Closed)
Patch Set: minor cleanups Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/extension_uitest.cc ('k') | chrome/browser/gpu_process_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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.h" 5 #include "chrome/browser/first_run.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 process_singleton->Unlock(); 675 process_singleton->Unlock();
676 FirstRun::CreateSentinel(); 676 FirstRun::CreateSentinel();
677 } 677 }
678 678
679 bool FirstRun::ImportSettings(Profile* profile, int browser_type, 679 bool FirstRun::ImportSettings(Profile* profile, int browser_type,
680 int items_to_import, 680 int items_to_import,
681 const std::wstring& import_bookmarks_path, 681 const std::wstring& import_bookmarks_path,
682 HWND parent_window) { 682 HWND parent_window) {
683 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); 683 const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
684 CommandLine import_cmd(cmdline.GetProgram()); 684 CommandLine import_cmd(cmdline.GetProgram());
685 // Propagate user data directory switch. 685
686 if (cmdline.HasSwitch(switches::kUserDataDir)) { 686 const char* kSwitchNames[] = {
687 import_cmd.AppendSwitchWithValue( 687 switches::kUserDataDir,
688 switches::kUserDataDir, 688 switches::kChromeFrame,
689 cmdline.GetSwitchValueASCII(switches::kUserDataDir)); 689 switches::kCountry,
690 } 690 };
691 import_cmd.CopySwitchesFrom(cmdline, kSwitchNames, arraysize(kSwitchNames));
691 692
692 // Since ImportSettings is called before the local state is stored on disk 693 // Since ImportSettings is called before the local state is stored on disk
693 // we pass the language as an argument. GetApplicationLocale checks the 694 // we pass the language as an argument. GetApplicationLocale checks the
694 // current command line as fallback. 695 // current command line as fallback.
695 import_cmd.AppendSwitchWithValue( 696 import_cmd.AppendSwitchWithValue(
696 switches::kLang, 697 switches::kLang,
697 ASCIIToWide(g_browser_process->GetApplicationLocale())); 698 ASCIIToWide(g_browser_process->GetApplicationLocale()));
698 699
699 if (items_to_import) { 700 if (items_to_import) {
700 import_cmd.CommandLine::AppendSwitchWithValue(switches::kImport, 701 import_cmd.CommandLine::AppendSwitchWithValue(switches::kImport,
701 EncodeImportParams(browser_type, items_to_import, parent_window)); 702 EncodeImportParams(browser_type, items_to_import, parent_window));
702 } 703 }
703 704
704 if (!import_bookmarks_path.empty()) { 705 if (!import_bookmarks_path.empty()) {
705 import_cmd.CommandLine::AppendSwitchWithValue( 706 import_cmd.CommandLine::AppendSwitchWithValue(
706 switches::kImportFromFile, import_bookmarks_path.c_str()); 707 switches::kImportFromFile, import_bookmarks_path.c_str());
707 } 708 }
708 709
709 if (cmdline.HasSwitch(switches::kChromeFrame)) {
710 import_cmd.AppendSwitch(switches::kChromeFrame);
711 }
712
713 if (cmdline.HasSwitch(switches::kCountry)) {
714 import_cmd.AppendSwitchWithValue(switches::kCountry,
715 cmdline.GetSwitchValueASCII(switches::kCountry));
716 }
717
718 // Time to launch the process that is going to do the import. 710 // Time to launch the process that is going to do the import.
719 base::ProcessHandle import_process; 711 base::ProcessHandle import_process;
720 if (!base::LaunchApp(import_cmd, false, false, &import_process)) 712 if (!base::LaunchApp(import_cmd, false, false, &import_process))
721 return false; 713 return false;
722 714
723 // Activate the importer monitor. It awakes periodically in another thread 715 // Activate the importer monitor. It awakes periodically in another thread
724 // and checks that the importer UI is still pumping messages. 716 // and checks that the importer UI is still pumping messages.
725 if (parent_window) 717 if (parent_window)
726 HungImporterMonitor hang_monitor(parent_window, import_process); 718 HungImporterMonitor hang_monitor(parent_window, import_process);
727 719
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1054
1063 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { 1055 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
1064 if (version > 10000) { 1056 if (version > 10000) {
1065 // This is a test value. We want to make sure we exercise 1057 // This is a test value. We want to make sure we exercise
1066 // returning this early. See EarlyReturnTest test harness. 1058 // returning this early. See EarlyReturnTest test harness.
1067 return Upgrade::TD_NOT_NOW; 1059 return Upgrade::TD_NOT_NOW;
1068 } 1060 }
1069 TryChromeDialog td; 1061 TryChromeDialog td;
1070 return td.ShowModal(); 1062 return td.ShowModal();
1071 } 1063 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_uitest.cc ('k') | chrome/browser/gpu_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698