OLD | NEW |
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 "chrome/browser/user_data_manager.h" | 5 #include "chrome/browser/user_data_manager.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Helper deletes itself when done. | 198 // Helper deletes itself when done. |
199 LaunchChromeForProfileIndexHelper* helper = | 199 LaunchChromeForProfileIndexHelper* helper = |
200 new LaunchChromeForProfileIndexHelper(this, index); | 200 new LaunchChromeForProfileIndexHelper(this, index); |
201 helper->StartLaunch(); | 201 helper->StartLaunch(); |
202 } | 202 } |
203 | 203 |
204 void UserDataManager::GetProfiles(std::vector<std::wstring>* profiles) const { | 204 void UserDataManager::GetProfiles(std::vector<std::wstring>* profiles) const { |
205 // This function should be called on the file thread. | 205 // This function should be called on the file thread. |
206 DCHECK(MessageLoop::current() == | 206 DCHECK(MessageLoop::current() == |
207 ChromeThread::GetMessageLoop(ChromeThread::FILE)); | 207 ChromeThread::GetMessageLoop(ChromeThread::FILE)); |
208 file_util::FileEnumerator file_enum(user_data_root_, | 208 file_util::FileEnumerator file_enum( |
209 false, | 209 FilePath::FromWStringHack(user_data_root_), |
210 file_util::FileEnumerator::DIRECTORIES); | 210 false, file_util::FileEnumerator::DIRECTORIES); |
211 std::wstring folder_name; | 211 std::wstring folder_name; |
212 while (!(folder_name = file_enum.Next()).empty()) { | 212 while (!(folder_name = file_enum.Next().ToWStringHack()).empty()) { |
213 folder_name = file_util::GetFilenameFromPath(folder_name); | 213 folder_name = file_util::GetFilenameFromPath(folder_name); |
214 std::wstring profile_name; | 214 std::wstring profile_name; |
215 if (GetProfileNameFromFolderName(folder_name, &profile_name)) | 215 if (GetProfileNameFromFolderName(folder_name, &profile_name)) |
216 profiles->push_back(profile_name); | 216 profiles->push_back(profile_name); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 bool UserDataManager::CreateDesktopShortcutForProfile( | 220 bool UserDataManager::CreateDesktopShortcutForProfile( |
221 const std::wstring& profile_name) const { | 221 const std::wstring& profile_name) const { |
222 std::wstring exe_path; | 222 std::wstring exe_path; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 &GetProfilesHelper::InvokeDelegate, | 298 &GetProfilesHelper::InvokeDelegate, |
299 profiles.release())); | 299 profiles.release())); |
300 } | 300 } |
301 | 301 |
302 void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) { | 302 void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) { |
303 scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles); | 303 scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles); |
304 // If the delegate is gone by now, no need to do any work. | 304 // If the delegate is gone by now, no need to do any work. |
305 if (delegate_) | 305 if (delegate_) |
306 delegate_->OnGetProfilesDone(*udd_profiles.get()); | 306 delegate_->OnGetProfilesDone(*udd_profiles.get()); |
307 } | 307 } |
OLD | NEW |