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_internal.h" | 5 #include "chrome/browser/first_run/first_run_internal.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // For metro Windows, it launches setup via ShellExecuteEx and returns in order | 40 // For metro Windows, it launches setup via ShellExecuteEx and returns in order |
41 // to bounce the user back to the desktop, then returns immediately. | 41 // to bounce the user back to the desktop, then returns immediately. |
42 bool LaunchSetupForEula(const base::FilePath::StringType& value, | 42 bool LaunchSetupForEula(const base::FilePath::StringType& value, |
43 int* ret_code) { | 43 int* ret_code) { |
44 base::FilePath exe_dir; | 44 base::FilePath exe_dir; |
45 if (!PathService::Get(base::DIR_MODULE, &exe_dir)) | 45 if (!PathService::Get(base::DIR_MODULE, &exe_dir)) |
46 return false; | 46 return false; |
47 exe_dir = exe_dir.Append(installer::kInstallerDir); | 47 exe_dir = exe_dir.Append(installer::kInstallerDir); |
48 base::FilePath exe_path = exe_dir.Append(installer::kSetupExe); | 48 base::FilePath exe_path = exe_dir.Append(installer::kSetupExe); |
49 | 49 |
50 CommandLine cl(CommandLine::NO_PROGRAM); | 50 base::CommandLine cl(base::CommandLine::NO_PROGRAM); |
51 cl.AppendSwitchNative(installer::switches::kShowEula, value); | 51 cl.AppendSwitchNative(installer::switches::kShowEula, value); |
52 | 52 |
53 if (base::win::IsMetroProcess()) { | 53 if (base::win::IsMetroProcess()) { |
54 cl.AppendSwitch(installer::switches::kShowEulaForMetro); | 54 cl.AppendSwitch(installer::switches::kShowEulaForMetro); |
55 | 55 |
56 // This obscure use of the 'log usage' mask for windows 8 is documented here | 56 // This obscure use of the 'log usage' mask for windows 8 is documented here |
57 // http://go.microsoft.com/fwlink/?LinkID=243079. It causes the desktop | 57 // http://go.microsoft.com/fwlink/?LinkID=243079. It causes the desktop |
58 // process to receive focus. Pass SEE_MASK_FLAG_NO_UI to avoid hangs if an | 58 // process to receive focus. Pass SEE_MASK_FLAG_NO_UI to avoid hangs if an |
59 // error occurs since the UI can't be shown from a metro process. | 59 // error occurs since the UI can't be shown from a metro process. |
60 ui::win::OpenAnyViaShell(exe_path.value(), | 60 ui::win::OpenAnyViaShell(exe_path.value(), |
61 exe_dir.value(), | 61 exe_dir.value(), |
62 cl.GetCommandLineString(), | 62 cl.GetCommandLineString(), |
63 SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_FLAG_NO_UI); | 63 SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_FLAG_NO_UI); |
64 return false; | 64 return false; |
65 } else { | 65 } else { |
66 CommandLine setup_path(exe_path); | 66 base::CommandLine setup_path(exe_path); |
67 setup_path.AppendArguments(cl, false); | 67 setup_path.AppendArguments(cl, false); |
68 | 68 |
69 base::Process process = | 69 base::Process process = |
70 base::LaunchProcess(setup_path, base::LaunchOptions()); | 70 base::LaunchProcess(setup_path, base::LaunchOptions()); |
71 int exit_code = 0; | 71 int exit_code = 0; |
72 if (!process.IsValid() || !process.WaitForExit(&exit_code)) | 72 if (!process.IsValid() || !process.WaitForExit(&exit_code)) |
73 return false; | 73 return false; |
74 | 74 |
75 *ret_code = exit_code; | 75 *ret_code = exit_code; |
76 return true; | 76 return true; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 base::FilePath MasterPrefsPath() { | 194 base::FilePath MasterPrefsPath() { |
195 // The standard location of the master prefs is next to the chrome binary. | 195 // The standard location of the master prefs is next to the chrome binary. |
196 base::FilePath master_prefs; | 196 base::FilePath master_prefs; |
197 if (!PathService::Get(base::DIR_EXE, &master_prefs)) | 197 if (!PathService::Get(base::DIR_EXE, &master_prefs)) |
198 return base::FilePath(); | 198 return base::FilePath(); |
199 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); | 199 return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); |
200 } | 200 } |
201 | 201 |
202 } // namespace internal | 202 } // namespace internal |
203 } // namespace first_run | 203 } // namespace first_run |
OLD | NEW |