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