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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 #include <windows.h> | 25 #include <windows.h> |
26 #include <wpcapi.h> | 26 #include <wpcapi.h> |
27 #include "base/bind.h" | 27 #include "base/bind.h" |
28 #include "base/bind_helpers.h" | 28 #include "base/bind_helpers.h" |
29 #include "base/memory/singleton.h" | 29 #include "base/memory/singleton.h" |
30 #include "base/win/scoped_comptr.h" | 30 #include "base/win/scoped_comptr.h" |
31 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
32 #endif // OS_WIN | 32 #endif // OS_WIN |
33 | 33 |
34 #if BUILDFLAG(ANDROID_JAVA_UI) | 34 #if defined(OS_ANDROID) |
35 #include "chrome/browser/android/chrome_application.h" | 35 #include "chrome/browser/android/chrome_application.h" |
36 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 36 #endif // defined(OS_ANDROID) |
37 | 37 |
38 using content::BrowserThread; | 38 using content::BrowserThread; |
39 | 39 |
40 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
41 namespace { | 41 namespace { |
42 | 42 |
43 // This singleton allows us to attempt to calculate the Platform Parental | 43 // This singleton allows us to attempt to calculate the Platform Parental |
44 // Controls enabled value on a worker thread before the UI thread needs the | 44 // Controls enabled value on a worker thread before the UI thread needs the |
45 // value. If the UI thread finishes sooner than we expect, that's no worse than | 45 // value. If the UI thread finishes sooner than we expect, that's no worse than |
46 // today where we block. | 46 // today where we block. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 FROM_HERE, | 203 FROM_HERE, |
204 base::Bind( | 204 base::Bind( |
205 base::IgnoreResult(&PlatformParentalControlsValue::GetInstance))); | 205 base::IgnoreResult(&PlatformParentalControlsValue::GetInstance))); |
206 } | 206 } |
207 #endif | 207 #endif |
208 | 208 |
209 // static | 209 // static |
210 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { | 210 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { |
211 #if defined(OS_WIN) | 211 #if defined(OS_WIN) |
212 return PlatformParentalControlsValue::GetInstance()->is_enabled(); | 212 return PlatformParentalControlsValue::GetInstance()->is_enabled(); |
213 #elif BUILDFLAG(ANDROID_JAVA_UI) | 213 #elif defined(OS_ANDROID) |
214 return chrome::android::ChromeApplication::AreParentalControlsEnabled(); | 214 return chrome::android::ChromeApplication::AreParentalControlsEnabled(); |
215 #else | 215 #else |
216 return false; | 216 return false; |
217 #endif | 217 #endif |
218 } | 218 } |
219 | 219 |
220 // static | 220 // static |
221 IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailabilityInternal( | 221 IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailabilityInternal( |
222 const PrefService* pref_service, | 222 const PrefService* pref_service, |
223 GetAvailabilityMode mode) { | 223 GetAvailabilityMode mode) { |
224 DCHECK(pref_service); | 224 DCHECK(pref_service); |
225 int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability); | 225 int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability); |
226 Availability result = IncognitoModePrefs::ENABLED; | 226 Availability result = IncognitoModePrefs::ENABLED; |
227 bool valid = IntToAvailability(pref_value, &result); | 227 bool valid = IntToAvailability(pref_value, &result); |
228 DCHECK(valid); | 228 DCHECK(valid); |
229 if (result != IncognitoModePrefs::DISABLED && | 229 if (result != IncognitoModePrefs::DISABLED && |
230 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { | 230 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { |
231 if (result == IncognitoModePrefs::FORCED) | 231 if (result == IncognitoModePrefs::FORCED) |
232 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; | 232 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; |
233 return IncognitoModePrefs::DISABLED; | 233 return IncognitoModePrefs::DISABLED; |
234 } | 234 } |
235 return result; | 235 return result; |
236 } | 236 } |
OLD | NEW |