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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 std::wstring folder_path(user_data_root_); | 170 std::wstring folder_path(user_data_root_); |
171 file_util::AppendToPath(&folder_path, folder_name); | 171 file_util::AppendToPath(&folder_path, folder_name); |
172 return folder_path; | 172 return folder_path; |
173 } | 173 } |
174 | 174 |
175 std::wstring UserDataManager::GetCommandForProfile( | 175 std::wstring UserDataManager::GetCommandForProfile( |
176 const std::wstring& profile_name) const { | 176 const std::wstring& profile_name) const { |
177 std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); | 177 std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); |
178 std::wstring command; | 178 std::wstring command; |
179 PathService::Get(base::FILE_EXE, &command); | 179 PathService::Get(base::FILE_EXE, &command); |
180 CommandLine::AppendSwitchWithValue(&command, | 180 CommandLine command_line(command); |
181 switches::kUserDataDir, | 181 command_line.AppendSwitchWithValue(switches::kUserDataDir, |
182 user_data_dir); | 182 user_data_dir); |
183 std::wstring local_state_path; | 183 std::wstring local_state_path; |
184 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 184 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
185 CommandLine::AppendSwitchWithValue(&command, | 185 command_line.AppendSwitchWithValue(switches::kParentProfile, |
186 switches::kParentProfile, | |
187 local_state_path); | 186 local_state_path); |
188 return command; | 187 return command_line.command_line_string(); |
189 } | 188 } |
190 | 189 |
191 void UserDataManager::LaunchChromeForProfile( | 190 void UserDataManager::LaunchChromeForProfile( |
192 const std::wstring& profile_name) const { | 191 const std::wstring& profile_name) const { |
193 std::wstring command = GetCommandForProfile(profile_name); | 192 std::wstring command = GetCommandForProfile(profile_name); |
194 base::LaunchApp(command, false, false, NULL); | 193 base::LaunchApp(command, false, false, NULL); |
195 } | 194 } |
196 | 195 |
197 void UserDataManager::LaunchChromeForProfile(int index) const { | 196 void UserDataManager::LaunchChromeForProfile(int index) const { |
198 // Helper deletes itself when done. | 197 // Helper deletes itself when done. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 &GetProfilesHelper::InvokeDelegate, | 297 &GetProfilesHelper::InvokeDelegate, |
299 profiles.release())); | 298 profiles.release())); |
300 } | 299 } |
301 | 300 |
302 void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) { | 301 void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) { |
303 scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles); | 302 scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles); |
304 // If the delegate is gone by now, no need to do any work. | 303 // If the delegate is gone by now, no need to do any work. |
305 if (delegate_) | 304 if (delegate_) |
306 delegate_->OnGetProfilesDone(*udd_profiles.get()); | 305 delegate_->OnGetProfilesDone(*udd_profiles.get()); |
307 } | 306 } |
OLD | NEW |