Index: chrome/browser/prefs/incognito_mode_prefs.cc |
diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc |
index 4f5f7cf9b03eb8cc1a0e372acdb40e7748d10cb6..e899015397e8db7ebf6b9b83b71f3449afb68c15 100644 |
--- a/chrome/browser/prefs/incognito_mode_prefs.cc |
+++ b/chrome/browser/prefs/incognito_mode_prefs.cc |
@@ -7,6 +7,7 @@ |
#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/prefs/pref_service.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
#include "components/user_prefs/pref_registry_syncable.h" |
@@ -70,3 +71,23 @@ bool IncognitoModePrefs::ShouldLaunchIncognito( |
(command_line.HasSwitch(switches::kIncognito) || |
incognito_avail == IncognitoModePrefs::FORCED); |
} |
+ |
+// static |
+bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) { |
+ // If this causes a crash in Browser then a window is being opened using a |
+ // profile type that is disallowed by policy. The crash prevents the |
+ // "forbidden" window type from opening at all, but the path that triggered |
+ // it should be fixed. |
Mattias Nissler (ping if slow)
2013/05/29 11:33:08
Shouldn't this comment go with the CHECK()?
Joao da Silva
2013/05/29 11:40:40
Done.
|
+ switch (GetAvailability(profile->GetPrefs())) { |
+ case IncognitoModePrefs::ENABLED: |
+ return true; |
+ case IncognitoModePrefs::DISABLED: |
+ return !profile->IsOffTheRecord(); |
+ case IncognitoModePrefs::FORCED: |
+ return profile->IsOffTheRecord(); |
+ case IncognitoModePrefs::AVAILABILITY_NUM_TYPES: |
+ NOTREACHED(); |
+ } |
+ NOTREACHED(); |
+ return false; |
+} |