Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: chrome/browser/prefs/incognito_mode_prefs.cc

Issue 950053002: Cache the Windows Parental Controls Platform Answer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/incognito_mode_prefs.h ('k') | chrome/browser/prefs/incognito_mode_prefs_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7fbe112d4fc953b0c9e3d0a2812b4bbedd3270a7 100644
--- a/chrome/browser/prefs/incognito_mode_prefs.cc
+++ b/chrome/browser/prefs/incognito_mode_prefs.cc
@@ -23,6 +23,7 @@
#if defined(OS_WIN)
namespace {
+bool g_parental_control_checked = false;
bool g_parental_control_on = false;
gab 2015/02/24 20:39:47 How about an enum class ParentalControlState { U
robliao 2015/02/24 23:43:01 sgtm. Done
} // empty namespace
@@ -47,7 +48,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,27 +102,16 @@ 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() {
gab 2015/02/24 20:39:47 Also, should we not instead lazily initialize this
robliao 2015/02/24 23:43:01 It's oddly enough the best place for it since we n
gab 2015/02/25 20:23:51 I see, since this state is const once initialized,
robliao 2015/02/26 21:03:51 I'm going to have to think about this some more to
g_parental_control_on = base::win::IsParentalControlActivityLoggingOn();
gab 2015/02/24 20:39:47 Any idea why this call is even in base::win:: (and
robliao 2015/02/24 23:43:01 In a change a long, long, time ago, this was going
+ g_parental_control_checked = true;
}
#endif // OS_WIN
bool IncognitoModePrefs::ArePlatformParentalControlsEnabledCached() {
#if defined(OS_WIN)
+ DCHECK(g_parental_control_checked);
return g_parental_control_on;
#elif defined(OS_ANDROID)
return chrome::android::ChromiumApplication::AreParentalControlsEnabled();
« no previous file with comments | « chrome/browser/prefs/incognito_mode_prefs.h ('k') | chrome/browser/prefs/incognito_mode_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698