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

Side by Side Diff: chrome/browser/user_data_manager.cc

Issue 654013: Deprecate file_util::AppendToPath() on non-Windows. (Closed)
Patch Set: ok Created 10 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
« no previous file with comments | « chrome/browser/chrome_plugin_host.cc ('k') | chrome/common/chrome_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/user_data_manager.h" 7 #include "chrome/browser/user_data_manager.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (profile_name != chrome::kNotSignedInProfile) { 214 if (profile_name != chrome::kNotSignedInProfile) {
215 folder_name += kProfileFolderSeparator; 215 folder_name += kProfileFolderSeparator;
216 folder_name += profile_name; 216 folder_name += profile_name;
217 } 217 }
218 return folder_name; 218 return folder_name;
219 } 219 }
220 220
221 std::wstring UserDataManager::GetUserDataFolderForProfile( 221 std::wstring UserDataManager::GetUserDataFolderForProfile(
222 const std::wstring& profile_name) const { 222 const std::wstring& profile_name) const {
223 std::wstring folder_name = GetFolderNameFromProfileName(profile_name); 223 std::wstring folder_name = GetFolderNameFromProfileName(profile_name);
224 std::wstring folder_path(user_data_root_); 224 FilePath folder_path =
225 file_util::AppendToPath(&folder_path, folder_name); 225 FilePath::FromWStringHack(user_data_root_)
226 return folder_path; 226 .Append(FilePath::FromWStringHack(folder_name));
227 return folder_path.ToWStringHack();
227 } 228 }
228 229
229 void UserDataManager::LaunchChromeForProfile( 230 void UserDataManager::LaunchChromeForProfile(
230 const std::wstring& profile_name) const { 231 const std::wstring& profile_name) const {
231 std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); 232 std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name);
232 FilePath command; 233 FilePath command;
233 PathService::Get(base::FILE_EXE, &command); 234 PathService::Get(base::FILE_EXE, &command);
234 CommandLine command_line(command); 235 CommandLine command_line(command);
235 command_line.AppendSwitch(switches::kEnableUserDataDirProfiles); 236 command_line.AppendSwitch(switches::kEnableUserDataDirProfiles);
236 command_line.AppendSwitchWithValue(switches::kUserDataDir, 237 command_line.AppendSwitchWithValue(switches::kUserDataDir,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 std::wstring args = CommandLine::PrefixedSwitchStringWithValue( 283 std::wstring args = CommandLine::PrefixedSwitchStringWithValue(
283 switches::kUserDataDir, 284 switches::kUserDataDir,
284 user_data_dir); 285 user_data_dir);
285 args = StringPrintf(L"\"%ls\"", args.c_str()); 286 args = StringPrintf(L"\"%ls\"", args.c_str());
286 287
287 // Shortcut path. 288 // Shortcut path.
288 std::wstring shortcut_name = l10n_util::GetStringF( 289 std::wstring shortcut_name = l10n_util::GetStringF(
289 IDS_START_IN_PROFILE_SHORTCUT_NAME, 290 IDS_START_IN_PROFILE_SHORTCUT_NAME,
290 profile_name); 291 profile_name);
291 shortcut_name.append(L".lnk"); 292 shortcut_name.append(L".lnk");
292 293 FilePath shortcut_path = folder.Append(shortcut_name);
293 std::wstring shortcut_path = folder.Append(shortcut_name).ToWStringHack();
294 294
295 // Profile path from user_data_dir. 295 // Profile path from user_data_dir.
296 FilePath profile_path = FilePath(user_data_dir).Append( 296 FilePath profile_path = FilePath(user_data_dir).Append(
297 chrome::kNotSignedInProfile); 297 chrome::kNotSignedInProfile);
298 298
299 return file_util::CreateShortcutLink( 299 return file_util::CreateShortcutLink(
300 cmd.c_str(), 300 cmd.c_str(),
301 shortcut_path.c_str(), 301 shortcut_path.value().c_str(),
302 exe_folder.c_str(), 302 exe_folder.c_str(),
303 args.c_str(), 303 args.c_str(),
304 NULL, 304 NULL,
305 exe_path.c_str(), 305 exe_path.c_str(),
306 0, 306 0,
307 ShellIntegration::GetChromiumAppId(profile_path).c_str()); 307 ShellIntegration::GetChromiumAppId(profile_path).c_str());
308 #else 308 #else
309 // TODO(port): should probably use freedesktop.org standard for desktop files.
310 // See shell_integration.h for an implementation; but this code is reportedly
311 // obsolete.
309 NOTIMPLEMENTED(); 312 NOTIMPLEMENTED();
310 return false; 313 return false;
311 #endif 314 #endif
312 } 315 }
313 316
314 bool UserDataManager::CreateDesktopShortcutForProfile( 317 bool UserDataManager::CreateDesktopShortcutForProfile(
315 const std::wstring& profile_name) const { 318 const std::wstring& profile_name) const {
316 #if defined(OS_WIN) 319 #if defined(OS_WIN)
317 std::wstring desktop_path; 320 std::wstring desktop_path;
318 if (!ShellUtil::GetDesktopPath(false, &desktop_path)) 321 if (!ShellUtil::GetDesktopPath(false, &desktop_path))
319 return false; 322 return false;
320 323
321 return CreateShortcutForProfileInFolder(FilePath(desktop_path), profile_name); 324 return CreateShortcutForProfileInFolder(FilePath(desktop_path), profile_name);
322 #else 325 #else
323 // TODO(port): should probably use freedesktop.org standard for desktop files. 326 // TODO(port): should probably use freedesktop.org standard for desktop files.
327 // See shell_integration.h for an implementation; but this code is reportedly
328 // obsolete.
324 NOTIMPLEMENTED(); 329 NOTIMPLEMENTED();
325 return false; 330 return false;
326 #endif 331 #endif
327 } 332 }
328 333
329 void UserDataManager::RefreshUserDataDirProfiles() const { 334 void UserDataManager::RefreshUserDataDirProfiles() const {
330 // UserDataDirProfilesUpdater will delete itself when done. 335 // UserDataDirProfilesUpdater will delete itself when done.
331 UserDataDirProfilesUpdater* updater = new UserDataDirProfilesUpdater(); 336 UserDataDirProfilesUpdater* updater = new UserDataDirProfilesUpdater();
332 updater->Run(); 337 updater->Run();
333 } 338 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 &GetProfilesHelper::InvokeDelegate, 381 &GetProfilesHelper::InvokeDelegate,
377 profiles.release())); 382 profiles.release()));
378 } 383 }
379 384
380 void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) { 385 void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) {
381 scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles); 386 scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles);
382 // If the delegate is gone by now, no need to do any work. 387 // If the delegate is gone by now, no need to do any work.
383 if (delegate_) 388 if (delegate_)
384 delegate_->OnGetProfilesDone(*udd_profiles.get()); 389 delegate_->OnGetProfilesDone(*udd_profiles.get());
385 } 390 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_plugin_host.cc ('k') | chrome/common/chrome_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698