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..24084c6b59af73d79066483a2844504b740121cb 100644 |
--- a/chrome/browser/profiles/profile_manager.cc |
+++ b/chrome/browser/profiles/profile_manager.cc |
@@ -230,9 +230,24 @@ void ProfileManager::NukeDeletedProfilesFromDisk() { |
ProfilesToDelete().clear(); |
} |
+namespace { |
+ |
+// 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
|
+// early to enable checking, e.g. from ChromeBrowserMainParts. |
+bool s_allow_get_default_profile = true; |
+ |
+} // namespace |
+ |
+// 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() { |
+ CHECK(s_allow_get_default_profile) |
+ << "GetDefaultProfile() caled befofre allowed."; |
ProfileManager* profile_manager = g_browser_process->profile_manager(); |
return profile_manager->GetDefaultProfile(profile_manager->user_data_dir_); |
} |
@@ -240,6 +255,8 @@ Profile* ProfileManager::GetDefaultProfile() { |
// static |
// TODO(nkostylev): Remove this method once all clients are migrated. |
Profile* ProfileManager::GetDefaultProfileOrOffTheRecord() { |
+ CHECK(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(); |