OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ui/base/ui_base_switches.h" | 24 #include "ui/base/ui_base_switches.h" |
25 | 25 |
26 namespace first_run { | 26 namespace first_run { |
27 namespace internal { | 27 namespace internal { |
28 | 28 |
29 bool IsOrganicFirstRun() { | 29 bool IsOrganicFirstRun() { |
30 // We treat all installs as organic. | 30 // We treat all installs as organic. |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 // TODO(port): This is just a piece of the silent import functionality from | |
35 // ImportSettings for Windows. It would be nice to get the rest of it ported. | |
36 bool ImportBookmarks(const base::FilePath& import_bookmarks_path) { | |
37 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); | |
38 CommandLine import_cmd(cmdline.GetProgram()); | |
39 | |
40 // Propagate user data directory switch. | |
41 if (cmdline.HasSwitch(switches::kUserDataDir)) { | |
42 import_cmd.AppendSwitchPath(switches::kUserDataDir, | |
43 cmdline.GetSwitchValuePath(switches::kUserDataDir)); | |
44 } | |
45 // Since ImportSettings is called before the local state is stored on disk | |
46 // we pass the language as an argument. GetApplicationLocale checks the | |
47 // current command line as fallback. | |
48 import_cmd.AppendSwitchASCII(switches::kLang, | |
49 g_browser_process->GetApplicationLocale()); | |
50 | |
51 import_cmd.CommandLine::AppendSwitchPath(switches::kImportFromFile, | |
52 import_bookmarks_path); | |
53 | |
54 // The importer doesn't need to do any background networking tasks so disable | |
55 // them. | |
56 import_cmd.CommandLine::AppendSwitch(switches::kDisableBackgroundNetworking); | |
57 | |
58 // Time to launch the process that is going to do the import. We'll wait | |
59 // for the process to return. | |
60 base::LaunchOptions options; | |
61 options.wait = true; | |
62 return base::LaunchProcess(import_cmd, options, NULL); | |
63 } | |
64 | |
65 base::FilePath MasterPrefsPath() { | 34 base::FilePath MasterPrefsPath() { |
66 // The standard location of the master prefs is next to the chrome binary. | 35 // The standard location of the master prefs is next to the chrome binary. |
67 base::FilePath master_prefs; | 36 base::FilePath master_prefs; |
68 if (!PathService::Get(base::DIR_EXE, &master_prefs)) | 37 if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
69 return base::FilePath(); | 38 return base::FilePath(); |
70 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); | 39 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
71 } | 40 } |
72 | 41 |
73 } // namespace internal | 42 } // namespace internal |
74 } // namespace first_run | 43 } // namespace first_run |
OLD | NEW |