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/installer/util/auto_launch_util.h" | 5 #include "chrome/installer/util/auto_launch_util.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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (in_background) { | 178 if (in_background) { |
179 cmd_line += ASCIIToUTF16(" --"); | 179 cmd_line += ASCIIToUTF16(" --"); |
180 cmd_line += ASCIIToUTF16(switches::kNoStartupWindow); | 180 cmd_line += ASCIIToUTF16(switches::kNoStartupWindow); |
181 } | 181 } |
182 if (in_foreground) { | 182 if (in_foreground) { |
183 cmd_line += ASCIIToUTF16(" --"); | 183 cmd_line += ASCIIToUTF16(" --"); |
184 cmd_line += ASCIIToUTF16(switches::kAutoLaunchAtStartup); | 184 cmd_line += ASCIIToUTF16(switches::kAutoLaunchAtStartup); |
185 | 185 |
186 const base::CommandLine& command_line = | 186 const base::CommandLine& command_line = |
187 *base::CommandLine::ForCurrentProcess(); | 187 *base::CommandLine::ForCurrentProcess(); |
| 188 |
| 189 // Propagate --user-data-dir if it was specified on the command line. |
| 190 // Retrieve the value from the PathService since some sanitation may have |
| 191 // taken place. There is no need to add it to the command line in the |
| 192 // event that the dir was overridden by Group Policy since the GP override |
| 193 // will be in force when Chrome is launched. |
188 if (command_line.HasSwitch(switches::kUserDataDir)) { | 194 if (command_line.HasSwitch(switches::kUserDataDir)) { |
189 cmd_line += ASCIIToUTF16(" --"); | 195 cmd_line += ASCIIToUTF16(" --"); |
190 cmd_line += ASCIIToUTF16(switches::kUserDataDir); | 196 cmd_line += ASCIIToUTF16(switches::kUserDataDir); |
191 cmd_line += ASCIIToUTF16("=\""); | 197 cmd_line += ASCIIToUTF16("=\""); |
192 cmd_line += | 198 base::FilePath user_data_dir; |
193 command_line.GetSwitchValuePath(switches::kUserDataDir).value(); | 199 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 200 cmd_line += user_data_dir.value(); |
194 cmd_line += ASCIIToUTF16("\""); | 201 cmd_line += ASCIIToUTF16("\""); |
195 } | 202 } |
196 | 203 |
197 cmd_line += ASCIIToUTF16(" --"); | 204 cmd_line += ASCIIToUTF16(" --"); |
198 cmd_line += ASCIIToUTF16(switches::kProfileDirectory); | 205 cmd_line += ASCIIToUTF16(switches::kProfileDirectory); |
199 cmd_line += ASCIIToUTF16("=\""); | 206 cmd_line += ASCIIToUTF16("=\""); |
200 cmd_line += profile_directory; | 207 cmd_line += profile_directory; |
201 cmd_line += ASCIIToUTF16("\""); | 208 cmd_line += ASCIIToUTF16("\""); |
202 } | 209 } |
203 | 210 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 242 } |
236 | 243 |
237 void DisableBackgroundStartAtLogin() { | 244 void DisableBackgroundStartAtLogin() { |
238 SetWillLaunchAtLogin(base::FilePath(), | 245 SetWillLaunchAtLogin(base::FilePath(), |
239 ASCIIToUTF16(chrome::kInitialProfile), | 246 ASCIIToUTF16(chrome::kInitialProfile), |
240 FLAG_PRESERVE, | 247 FLAG_PRESERVE, |
241 FLAG_DISABLE); | 248 FLAG_DISABLE); |
242 } | 249 } |
243 | 250 |
244 } // namespace auto_launch_util | 251 } // namespace auto_launch_util |
OLD | NEW |