OLD | NEW |
---|---|
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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 callback.Run(profile, Profile::CREATE_STATUS_INITIALIZED); | 452 callback.Run(profile, Profile::CREATE_STATUS_INITIALIZED); |
453 } else { | 453 } else { |
454 // Profile is either already in the process of being created, or new. | 454 // Profile is either already in the process of being created, or new. |
455 // Add callback to the list. | 455 // Add callback to the list. |
456 info->callbacks.push_back(callback); | 456 info->callbacks.push_back(callback); |
457 } | 457 } |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 bool ProfileManager::IsValidProfile(Profile* profile) { | 461 bool ProfileManager::IsValidProfile(Profile* profile) { |
462 // The profile_manager() returns NULL when running unit tests. | |
463 if (!(g_browser_process->profile_manager())) | |
Alexei Svitkine (slow)
2015/09/01 20:04:04
Nit: No need for extra ()'s
amohammadkhan
2015/09/01 23:02:43
Done.
| |
464 return false; | |
462 for (ProfilesInfoMap::iterator iter = profiles_info_.begin(); | 465 for (ProfilesInfoMap::iterator iter = profiles_info_.begin(); |
463 iter != profiles_info_.end(); ++iter) { | 466 iter != profiles_info_.end(); ++iter) { |
464 if (iter->second->created) { | 467 if (iter->second->created) { |
465 Profile* candidate = iter->second->profile.get(); | 468 Profile* candidate = iter->second->profile.get(); |
466 if (candidate == profile || | 469 if (candidate == profile || |
467 (candidate->HasOffTheRecordProfile() && | 470 (candidate->HasOffTheRecordProfile() && |
468 candidate->GetOffTheRecordProfile() == profile)) { | 471 candidate->GetOffTheRecordProfile() == profile)) { |
469 return true; | 472 return true; |
470 } | 473 } |
471 } | 474 } |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1476 } | 1479 } |
1477 | 1480 |
1478 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1481 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
1479 if (!original_callback.is_null()) | 1482 if (!original_callback.is_null()) |
1480 original_callback.Run(loaded_profile, status); | 1483 original_callback.Run(loaded_profile, status); |
1481 } | 1484 } |
1482 | 1485 |
1483 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1486 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1484 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1487 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1485 } | 1488 } |
OLD | NEW |