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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 7346024: Get rid of the ProfileId. It was added for ceee. I reverted the original change, since it led to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 profile = profile->GetOffTheRecordProfile(); 206 profile = profile->GetOffTheRecordProfile();
207 } else { 207 } else {
208 profile = GetProfile(default_profile_dir); 208 profile = GetProfile(default_profile_dir);
209 } 209 }
210 return profile; 210 return profile;
211 } 211 }
212 #endif 212 #endif
213 return GetProfile(default_profile_dir); 213 return GetProfile(default_profile_dir);
214 } 214 }
215 215
216 Profile* ProfileManager::GetProfileWithId(ProfileId profile_id) {
217 DCHECK_NE(Profile::kInvalidProfileId, profile_id);
218 for (ProfilesInfoMap::iterator iter = profiles_info_.begin();
219 iter != profiles_info_.end(); ++iter) {
220 if (iter->second->created) {
221 Profile* candidate = iter->second->profile.get();
222 if (candidate->GetRuntimeId() == profile_id)
223 return candidate;
224 if (candidate->HasOffTheRecordProfile()) {
225 candidate = candidate->GetOffTheRecordProfile();
226 if (candidate->GetRuntimeId() == profile_id)
227 return candidate;
228 }
229 }
230 }
231 return NULL;
232 }
233
234 bool ProfileManager::IsValidProfile(Profile* profile) { 216 bool ProfileManager::IsValidProfile(Profile* profile) {
235 for (ProfilesInfoMap::iterator iter = profiles_info_.begin(); 217 for (ProfilesInfoMap::iterator iter = profiles_info_.begin();
236 iter != profiles_info_.end(); ++iter) { 218 iter != profiles_info_.end(); ++iter) {
237 if (iter->second->created) { 219 if (iter->second->created) {
238 Profile* candidate = iter->second->profile.get(); 220 Profile* candidate = iter->second->profile.get();
239 if (candidate == profile || 221 if (candidate == profile ||
240 (candidate->HasOffTheRecordProfile() && 222 (candidate->HasOffTheRecordProfile() &&
241 candidate->GetOffTheRecordProfile() == profile)) { 223 candidate->GetOffTheRecordProfile() == profile)) {
242 return true; 224 return true;
243 } 225 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 550 }
569 551
570 // static 552 // static
571 bool ProfileManager::IsMultipleProfilesEnabled() { 553 bool ProfileManager::IsMultipleProfilesEnabled() {
572 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) 554 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)
573 return true; 555 return true;
574 #else 556 #else
575 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); 557 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles);
576 #endif 558 #endif
577 } 559 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/renderer_host/chrome_render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698