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

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

Issue 15702004: Open Ash shell after creating Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback 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
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 // Assume "allowed" for tests; SetAllowGetDefaultProfile(false) should be called
Paweł Hajdan Jr. 2013/05/23 20:33:25 Let's make it stronger: false should be the defaul
236 // early to enable checking, e.g. from ChromeBrowserMainParts.
237 bool s_allow_get_default_profile = true;
238
239 } // namespace
240
241 // static
242 void ProfileManager::SetAllowGetDefaultProfile(bool allow) {
243 s_allow_get_default_profile = allow;
244 }
245
233 // static 246 // static
234 // TODO(nkostylev): Remove this method once all clients are migrated. 247 // TODO(nkostylev): Remove this method once all clients are migrated.
235 Profile* ProfileManager::GetDefaultProfile() { 248 Profile* ProfileManager::GetDefaultProfile() {
249 CHECK(s_allow_get_default_profile)
250 << "GetDefaultProfile() caled befofre allowed.";
236 ProfileManager* profile_manager = g_browser_process->profile_manager(); 251 ProfileManager* profile_manager = g_browser_process->profile_manager();
237 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); 252 return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_);
238 } 253 }
239 254
240 // static 255 // static
241 // TODO(nkostylev): Remove this method once all clients are migrated. 256 // TODO(nkostylev): Remove this method once all clients are migrated.
242 Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() { 257 Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() {
258 CHECK(s_allow_get_default_profile)
259 << "GetDefaultProfileOrOffTheRecord() caled befofre allowed.";
243 // TODO (mukai,nkostylev): In the long term we should fix those cases that 260 // TODO (mukai,nkostylev): In the long term we should fix those cases that
244 // crash on Guest mode and have only one GetDefaultProfile() method. 261 // crash on Guest mode and have only one GetDefaultProfile() method.
245 Profile* profile = GetDefaultProfile(); 262 Profile* profile = GetDefaultProfile();
246 #if defined(OS_CHROMEOS) 263 #if defined(OS_CHROMEOS)
247 if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) 264 if (chromeos::UserManager::Get()->IsLoggedInAsGuest())
248 profile = profile->GetOffTheRecordProfile(); 265 profile = profile->GetOffTheRecordProfile();
249 #endif 266 #endif
250 return profile; 267 return profile;
251 } 268 }
252 269
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 ProfileManager::ProfileInfo::ProfileInfo( 1181 ProfileManager::ProfileInfo::ProfileInfo(
1165 Profile* profile, 1182 Profile* profile,
1166 bool created) 1183 bool created)
1167 : profile(profile), 1184 : profile(profile),
1168 created(created) { 1185 created(created) {
1169 } 1186 }
1170 1187
1171 ProfileManager::ProfileInfo::~ProfileInfo() { 1188 ProfileManager::ProfileInfo::~ProfileInfo() {
1172 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1189 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1173 } 1190 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698