OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 5 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "components/pref_registry/pref_registry_syncable.h" | 13 #include "components/pref_registry/pref_registry_syncable.h" |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 #include "base/win/metro.h" | 16 #include "base/win/metro.h" |
17 #endif // OS_WIN | 17 #endif // OS_WIN |
18 | 18 |
19 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
20 #include "chrome/browser/android/chromium_application.h" | 20 #include "chrome/browser/android/chromium_application.h" |
21 #endif // OS_ANDROID | 21 #endif // OS_ANDROID |
22 | 22 |
| 23 #if defined(OS_WIN) |
| 24 namespace { |
| 25 |
| 26 bool g_parental_control_on = false; |
| 27 |
| 28 } // empty namespace |
| 29 #endif // OS_WIN |
| 30 |
23 // static | 31 // static |
24 bool IncognitoModePrefs::IntToAvailability(int in_value, | 32 bool IncognitoModePrefs::IntToAvailability(int in_value, |
25 Availability* out_value) { | 33 Availability* out_value) { |
26 if (in_value < 0 || in_value >= AVAILABILITY_NUM_TYPES) { | 34 if (in_value < 0 || in_value >= AVAILABILITY_NUM_TYPES) { |
27 *out_value = ENABLED; | 35 *out_value = ENABLED; |
28 return false; | 36 return false; |
29 } | 37 } |
30 *out_value = static_cast<Availability>(in_value); | 38 *out_value = static_cast<Availability>(in_value); |
31 return true; | 39 return true; |
32 } | 40 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
96 // Disable incognito mode windows if parental controls are on. This is only | 104 // Disable incognito mode windows if parental controls are on. This is only |
97 // for Windows Vista and above. | 105 // for Windows Vista and above. |
98 return base::win::IsParentalControlActivityLoggingOn(); | 106 return base::win::IsParentalControlActivityLoggingOn(); |
99 #elif defined(OS_ANDROID) | 107 #elif defined(OS_ANDROID) |
100 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); | 108 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); |
101 #else | 109 #else |
102 return false; | 110 return false; |
103 #endif | 111 #endif |
104 } | 112 } |
| 113 |
| 114 #if defined(OS_WIN) |
| 115 void IncognitoModePrefs::InitializePlatformParentalControls() { |
| 116 g_parental_control_on = base::win::IsParentalControlActivityLoggingOn(); |
| 117 } |
| 118 #endif // OS_WIN |
| 119 |
| 120 bool IncognitoModePrefs::ArePlatformParentalControlsEnabledCached() { |
| 121 #if defined(OS_WIN) |
| 122 return g_parental_control_on; |
| 123 #elif defined(OS_ANDROID) |
| 124 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); |
| 125 #else |
| 126 return false; |
| 127 #endif |
| 128 } |
| 129 |
OLD | NEW |