OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.h" | 10 #include "base/file_util.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 return profile; | 132 return profile; |
133 } | 133 } |
134 #endif | 134 #endif |
135 return GetProfile(default_profile_dir); | 135 return GetProfile(default_profile_dir); |
136 } | 136 } |
137 | 137 |
138 Profile* ProfileManager::GetProfile(const FilePath& profile_dir) { | 138 Profile* ProfileManager::GetProfile(const FilePath& profile_dir) { |
139 return GetProfile(profile_dir, true); | 139 return GetProfile(profile_dir, true); |
140 } | 140 } |
141 | 141 |
142 Profile* ProfileManager::GetProfileWithId(ProfileId profile_id) { | |
willchan no longer on Chromium
2011/02/28 21:48:41
I think it should be a bug for profile_id == kInva
| |
143 for (iterator i = begin(); i != end(); ++i) { | |
144 if ((*i)->GetRuntimeId() == profile_id) | |
145 return *i; | |
146 if ((*i)->HasOffTheRecordProfile() && | |
147 (*i)->GetOffTheRecordProfile()->GetRuntimeId() == profile_id) { | |
148 return (*i)->GetOffTheRecordProfile(); | |
149 } | |
150 } | |
151 return NULL; | |
152 } | |
153 | |
142 bool ProfileManager::IsValidProfile(Profile* profile) { | 154 bool ProfileManager::IsValidProfile(Profile* profile) { |
143 for (iterator i = begin(); i != end(); ++i) { | 155 for (iterator i = begin(); i != end(); ++i) { |
144 if (*i == profile) | 156 if (*i == profile) |
145 return true; | 157 return true; |
146 if ((*i)->HasOffTheRecordProfile() && | 158 if ((*i)->HasOffTheRecordProfile() && |
147 (*i)->GetOffTheRecordProfile() == profile) { | 159 (*i)->GetOffTheRecordProfile() == profile) { |
148 return true; | 160 return true; |
149 } | 161 } |
150 } | 162 } |
151 return false; | 163 return false; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 if (!file_util::PathExists(path)) { | 301 if (!file_util::PathExists(path)) { |
290 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the | 302 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the |
291 // profile directory. We should eventually be able to run in this | 303 // profile directory. We should eventually be able to run in this |
292 // situation. | 304 // situation. |
293 if (!file_util::CreateDirectory(path)) | 305 if (!file_util::CreateDirectory(path)) |
294 return NULL; | 306 return NULL; |
295 } | 307 } |
296 | 308 |
297 return Profile::CreateProfile(path); | 309 return Profile::CreateProfile(path); |
298 } | 310 } |
OLD | NEW |