OLD | NEW |
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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 info->profile.get(), ProfileManagerObserver::STATUS_INITIALIZED); | 340 info->profile.get(), ProfileManagerObserver::STATUS_INITIALIZED); |
341 if (observer->DeleteAfter()) | 341 if (observer->DeleteAfter()) |
342 delete observer; | 342 delete observer; |
343 } else { | 343 } else { |
344 // Profile is being created. Add observer to list. | 344 // Profile is being created. Add observer to list. |
345 info->observers.push_back(observer); | 345 info->observers.push_back(observer); |
346 } | 346 } |
347 } else { | 347 } else { |
348 // Initiate asynchronous creation process. | 348 // Initiate asynchronous creation process. |
349 ProfileInfo* info = | 349 ProfileInfo* info = |
350 RegisterProfile(Profile::CreateProfileAsync(user_data_dir, this), | 350 RegisterProfile(CreateAsyncProfile(user_data_dir, this), |
351 false); | 351 false); |
352 info->observers.push_back(observer); | 352 info->observers.push_back(observer); |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 // static | 356 // static |
357 void ProfileManager::CreateDefaultProfileAsync( | 357 void ProfileManager::CreateDefaultProfileAsync( |
358 ProfileManagerObserver* observer) { | 358 ProfileManagerObserver* observer) { |
359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
360 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 360 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 void ProfileManager::DoFinalInitLogging(Profile* profile) { | 480 void ProfileManager::DoFinalInitLogging(Profile* profile) { |
481 // Log the profile size after a reasonable startup delay. | 481 // Log the profile size after a reasonable startup delay. |
482 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, | 482 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, |
483 new ProfileSizeTask(profile), 112000); | 483 new ProfileSizeTask(profile), 112000); |
484 } | 484 } |
485 | 485 |
486 Profile* ProfileManager::CreateProfile(const FilePath& path) { | 486 Profile* ProfileManager::CreateProfile(const FilePath& path) { |
487 return Profile::CreateProfile(path); | 487 return Profile::CreateProfile(path); |
488 } | 488 } |
489 | 489 |
| 490 Profile* ProfileManager::CreateAsyncProfile(const FilePath& path, |
| 491 Delegate* delegate) { |
| 492 return Profile::CreateProfileAsync(path, delegate); |
| 493 } |
| 494 |
490 void ProfileManager::OnProfileCreated(Profile* profile, bool success) { | 495 void ProfileManager::OnProfileCreated(Profile* profile, bool success) { |
491 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 496 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
492 | 497 |
493 ProfilesInfoMap::iterator iter = profiles_info_.find(profile->GetPath()); | 498 ProfilesInfoMap::iterator iter = profiles_info_.find(profile->GetPath()); |
494 DCHECK(iter != profiles_info_.end()); | 499 DCHECK(iter != profiles_info_.end()); |
495 ProfileInfo* info = iter->second.get(); | 500 ProfileInfo* info = iter->second.get(); |
496 | 501 |
497 std::vector<ProfileManagerObserver*> observers; | 502 std::vector<ProfileManagerObserver*> observers; |
498 info->observers.swap(observers); | 503 info->observers.swap(observers); |
499 | 504 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 681 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
677 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 682 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
678 } | 683 } |
679 | 684 |
680 void ProfileManager::RegisterTestingProfile(Profile* profile, | 685 void ProfileManager::RegisterTestingProfile(Profile* profile, |
681 bool add_to_cache) { | 686 bool add_to_cache) { |
682 RegisterProfile(profile, true); | 687 RegisterProfile(profile, true); |
683 if (add_to_cache) | 688 if (add_to_cache) |
684 AddProfileToCache(profile); | 689 AddProfileToCache(profile); |
685 } | 690 } |
OLD | NEW |