Chromium Code Reviews| 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 ProfileManager* pm = g_browser_process->profile_manager(); | |
|
Alexei Svitkine (slow)
2015/08/31 17:26:31
Nit: Just inline this into the if, if you're only
amohammadkhan
2015/09/01 04:52:48
Done.
| |
| 463 if (!pm) // Is NULL when running unit tests. | |
| 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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1477 } | 1480 } |
| 1478 | 1481 |
| 1479 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); | 1482 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); |
| 1480 if (!original_callback.is_null()) | 1483 if (!original_callback.is_null()) |
| 1481 original_callback.Run(loaded_profile, status); | 1484 original_callback.Run(loaded_profile, status); |
| 1482 } | 1485 } |
| 1483 | 1486 |
| 1484 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1487 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
| 1485 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1488 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
| 1486 } | 1489 } |
| OLD | NEW |