Index: chrome/browser/profiles/profile_manager.cc |
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
index ca55479b0a93cb25136fb86aa62cdcdbeb2011ad..e603d7e7bc45ed5cd35bf0129bcbad455dc25891 100644 |
--- a/chrome/browser/profiles/profile_manager.cc |
+++ b/chrome/browser/profiles/profile_manager.cc |
@@ -230,9 +230,22 @@ void ProfileManager::NukeDeletedProfilesFromDisk() { |
ProfilesToDelete().clear(); |
} |
+namespace { |
+// Assume "allowed" for tests; SetAllowGetDefaultProfile(false) should be called |
sail
2013/05/23 18:20:56
new line before
stevenjb
2013/05/23 18:28:15
Done.
|
+// early to enable checking, e.g. from ChromeBrowserMainParts. |
+bool s_allow_get_default_profile = true; |
+} |
sail
2013/05/23 18:20:56
new line before
stevenjb
2013/05/23 18:28:15
Done.
|
+ |
+// static |
+void ProfileManager::SetAllowGetDefaultProfile(bool allow) { |
+ s_allow_get_default_profile = allow; |
+} |
+ |
// static |
// TODO(nkostylev): Remove this method once all clients are migrated. |
Profile* ProfileManager::GetDefaultProfile() { |
+ LOG_IF(FATAL, !s_allow_get_default_profile) |
sail
2013/05/23 18:20:56
can we make this a CHECK() instead?
stevenjb
2013/05/23 18:28:15
Done.
|
+ << "GetDefaultProfile() caled befofre allowed."; |
ProfileManager* profile_manager = g_browser_process->profile_manager(); |
return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); |
} |
@@ -240,6 +253,8 @@ Profile* ProfileManager::GetDefaultProfile() { |
// static |
// TODO(nkostylev): Remove this method once all clients are migrated. |
Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() { |
+ LOG_IF(FATAL, !s_allow_get_default_profile) |
+ << "GetDefaultProfileOrOffTheRecord() caled befofre allowed."; |
// TODO (mukai,nkostylev): In the long term we should fix those cases that |
// crash on Guest mode and have only one GetDefaultProfile() method. |
Profile* profile = GetDefaultProfile(); |