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

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

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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/unload_uitest.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('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 "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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/unload_uitest.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698