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

Side by Side Diff: chrome/installer/util/auto_launch_util.cc

Issue 1010923002: If possible, use the PathService instead of the --user-data-dir flag directly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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
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 if (command_line.HasSwitch(switches::kUserDataDir)) { 188 if (command_line.HasSwitch(switches::kUserDataDir)) {
grt (UTC plus 2) 2015/03/26 18:36:22 this is subtle, so i think it needs a comment. i s
noms (inactive) 2015/03/30 14:06:32 Done.
189 cmd_line += ASCIIToUTF16(" --"); 189 cmd_line += ASCIIToUTF16(" --");
190 cmd_line += ASCIIToUTF16(switches::kUserDataDir); 190 cmd_line += ASCIIToUTF16(switches::kUserDataDir);
191 cmd_line += ASCIIToUTF16("=\""); 191 cmd_line += ASCIIToUTF16("=\"");
192 cmd_line += 192 base::FilePath user_data_dir;
193 command_line.GetSwitchValuePath(switches::kUserDataDir).value(); 193 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
194 cmd_line += user_data_dir.value();
194 cmd_line += ASCIIToUTF16("\""); 195 cmd_line += ASCIIToUTF16("\"");
195 } 196 }
196 197
197 cmd_line += ASCIIToUTF16(" --"); 198 cmd_line += ASCIIToUTF16(" --");
198 cmd_line += ASCIIToUTF16(switches::kProfileDirectory); 199 cmd_line += ASCIIToUTF16(switches::kProfileDirectory);
199 cmd_line += ASCIIToUTF16("=\""); 200 cmd_line += ASCIIToUTF16("=\"");
200 cmd_line += profile_directory; 201 cmd_line += profile_directory;
201 cmd_line += ASCIIToUTF16("\""); 202 cmd_line += ASCIIToUTF16("\"");
202 } 203 }
203 204
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 236 }
236 237
237 void DisableBackgroundStartAtLogin() { 238 void DisableBackgroundStartAtLogin() {
238 SetWillLaunchAtLogin(base::FilePath(), 239 SetWillLaunchAtLogin(base::FilePath(),
239 ASCIIToUTF16(chrome::kInitialProfile), 240 ASCIIToUTF16(chrome::kInitialProfile),
240 FLAG_PRESERVE, 241 FLAG_PRESERVE,
241 FLAG_DISABLE); 242 FLAG_DISABLE);
242 } 243 }
243 244
244 } // namespace auto_launch_util 245 } // namespace auto_launch_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698