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

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

Issue 15695010: Add ProfileManager::AllowGetDefaultProfile() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browsertest Created 7 years, 7 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
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ++it) { 223 ++it) {
224 // Delete both the profile directory and its corresponding cache. 224 // Delete both the profile directory and its corresponding cache.
225 base::FilePath cache_path; 225 base::FilePath cache_path;
226 chrome::GetUserCacheDirectory(*it, &cache_path); 226 chrome::GetUserCacheDirectory(*it, &cache_path);
227 file_util::Delete(*it, true); 227 file_util::Delete(*it, true);
228 file_util::Delete(cache_path, true); 228 file_util::Delete(cache_path, true);
229 } 229 }
230 ProfilesToDelete().clear(); 230 ProfilesToDelete().clear();
231 } 231 }
232 232
233 namespace {
234
235 bool s_allow_get_default_profile = false;
236
237 } // namespace
238
239 // static
240 void ProfileManager::AllowGetDefaultProfile() {
241 s_allow_get_default_profile = true;
242 }
243
233 // static 244 // static
234 // TODO(nkostylev): Remove this method once all clients are migrated. 245 // TODO(nkostylev): Remove this method once all clients are migrated.
235 Profile* ProfileManager::GetDefaultProfile() { 246 Profile* ProfileManager::GetDefaultProfile() {
247 CHECK(s_allow_get_default_profile)
248 << "GetDefaultProfile() caled befofre allowed.";
236 ProfileManager* profile_manager = g_browser_process->profile_manager(); 249 ProfileManager* profile_manager = g_browser_process->profile_manager();
237 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); 250 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_);
238 } 251 }
239 252
240 // static 253 // static
241 // TODO(nkostylev): Remove this method once all clients are migrated. 254 // TODO(nkostylev): Remove this method once all clients are migrated.
242 Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() { 255 Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() {
256 CHECK(s_allow_get_default_profile)
257 << "GetDefaultProfileOrOffTheRecord() caled befofre allowed.";
243 // TODO (mukai,nkostylev): In the long term we should fix those cases that 258 // TODO (mukai,nkostylev): In the long term we should fix those cases that
244 // crash on Guest mode and have only one GetDefaultProfile() method. 259 // crash on Guest mode and have only one GetDefaultProfile() method.
245 Profile* profile = GetDefaultProfile(); 260 Profile* profile = GetDefaultProfile();
246 #if defined(OS_CHROMEOS) 261 #if defined(OS_CHROMEOS)
247 if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) 262 if (chromeos::UserManager::Get()->IsLoggedInAsGuest())
248 profile = profile->GetOffTheRecordProfile(); 263 profile = profile->GetOffTheRecordProfile();
249 #endif 264 #endif
250 return profile; 265 return profile;
251 } 266 }
252 267
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 ProfileManager::ProfileInfo::ProfileInfo( 1170 ProfileManager::ProfileInfo::ProfileInfo(
1156 Profile* profile, 1171 Profile* profile,
1157 bool created) 1172 bool created)
1158 : profile(profile), 1173 : profile(profile),
1159 created(created) { 1174 created(created) {
1160 } 1175 }
1161 1176
1162 ProfileManager::ProfileInfo::~ProfileInfo() { 1177 ProfileManager::ProfileInfo::~ProfileInfo() {
1163 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1178 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1164 } 1179 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698