| 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 e0255d4947d11a90c3d2e5fbbd56f707459c811b..bae288c839ab65351151b2c7c2b282ef9bee6f77 100644
|
| --- a/chrome/browser/prefs/incognito_mode_prefs.cc
|
| +++ b/chrome/browser/prefs/incognito_mode_prefs.cc
|
| @@ -23,7 +23,17 @@
|
| #if defined(OS_WIN)
|
| namespace {
|
|
|
| -bool g_parental_control_on = false;
|
| +// Possible values for the parental controls state.
|
| +enum ParentalControlsState {
|
| + // Parental controls state unknown. We have not queried for this value yet.
|
| + PARENTAL_CONTROLS_STATE_UNKNOWN = 0,
|
| + // Parental controls activity logging disabled.
|
| + ACTIVITY_LOGGING_DISABLED = 1,
|
| + // Parental controls activity logging enabled.
|
| + ACTIVITY_LOGGING_ENABLED = 2,
|
| +};
|
| +ParentalControlsState g_parental_controls_state =
|
| + PARENTAL_CONTROLS_STATE_UNKNOWN;
|
|
|
| } // empty namespace
|
| #endif // OS_WIN
|
| @@ -47,7 +57,7 @@ IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailability(
|
| Availability result = IncognitoModePrefs::ENABLED;
|
| bool valid = IntToAvailability(pref_value, &result);
|
| DCHECK(valid);
|
| - if (ArePlatformParentalControlsEnabled()) {
|
| + if (ArePlatformParentalControlsEnabledCached()) {
|
| if (result == IncognitoModePrefs::FORCED)
|
| LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on";
|
| return IncognitoModePrefs::DISABLED;
|
| @@ -101,28 +111,19 @@ bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) {
|
| }
|
| }
|
|
|
| -// static
|
| -bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() {
|
| -#if defined(OS_WIN)
|
| - // Disable incognito mode windows if parental controls are on. This is only
|
| - // for Windows Vista and above.
|
| - return base::win::IsParentalControlActivityLoggingOn();
|
| -#elif defined(OS_ANDROID)
|
| - return chrome::android::ChromiumApplication::AreParentalControlsEnabled();
|
| -#else
|
| - return false;
|
| -#endif
|
| -}
|
| -
|
| #if defined(OS_WIN)
|
| void IncognitoModePrefs::InitializePlatformParentalControls() {
|
| - g_parental_control_on = base::win::IsParentalControlActivityLoggingOn();
|
| + g_parental_controls_state =
|
| + base::win::IsParentalControlActivityLoggingOn() ?
|
| + ACTIVITY_LOGGING_ENABLED :
|
| + ACTIVITY_LOGGING_DISABLED;
|
| }
|
| #endif // OS_WIN
|
|
|
| bool IncognitoModePrefs::ArePlatformParentalControlsEnabledCached() {
|
| #if defined(OS_WIN)
|
| - return g_parental_control_on;
|
| + DCHECK(g_parental_controls_state != PARENTAL_CONTROLS_STATE_UNKNOWN);
|
| + return g_parental_controls_state == ACTIVITY_LOGGING_ENABLED;
|
| #elif defined(OS_ANDROID)
|
| return chrome::android::ChromiumApplication::AreParentalControlsEnabled();
|
| #else
|
|
|