| 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..e6a0e50570c32472904eb4720d0e4fe0647e0f9a 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,19 @@ bool IncognitoModePrefs::ShouldLaunchIncognito(
|
| (command_line.HasSwitch(switches::kIncognito) ||
|
| incognito_avail == IncognitoModePrefs::FORCED);
|
| }
|
| +
|
| +// static
|
| +bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) {
|
| + 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;
|
| +}
|
|
|