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 14 matching lines...) Expand all Loading... |
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 defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
35 #include "chrome/browser/android/chrome_application.h" | 35 #include "chrome/browser/android/partner_browser_customizations.h" |
36 #endif // defined(OS_ANDROID) | 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 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 base::Bind( | 206 base::Bind( |
207 base::IgnoreResult(&PlatformParentalControlsValue::GetInstance))); | 207 base::IgnoreResult(&PlatformParentalControlsValue::GetInstance))); |
208 } | 208 } |
209 #endif | 209 #endif |
210 | 210 |
211 // static | 211 // static |
212 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { | 212 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { |
213 #if defined(OS_WIN) | 213 #if defined(OS_WIN) |
214 return PlatformParentalControlsValue::GetInstance()->is_enabled(); | 214 return PlatformParentalControlsValue::GetInstance()->is_enabled(); |
215 #elif defined(OS_ANDROID) | 215 #elif defined(OS_ANDROID) |
216 return chrome::android::ChromeApplication::AreParentalControlsEnabled(); | 216 return chrome::android::PartnerBrowserCustomizations::IsIncognitoDisabled(); |
217 #else | 217 #else |
218 return false; | 218 return false; |
219 #endif | 219 #endif |
220 } | 220 } |
221 | 221 |
222 // static | 222 // static |
223 IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailabilityInternal( | 223 IncognitoModePrefs::Availability IncognitoModePrefs::GetAvailabilityInternal( |
224 const PrefService* pref_service, | 224 const PrefService* pref_service, |
225 GetAvailabilityMode mode) { | 225 GetAvailabilityMode mode) { |
226 DCHECK(pref_service); | 226 DCHECK(pref_service); |
227 int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability); | 227 int pref_value = pref_service->GetInteger(prefs::kIncognitoModeAvailability); |
228 Availability result = IncognitoModePrefs::ENABLED; | 228 Availability result = IncognitoModePrefs::ENABLED; |
229 bool valid = IntToAvailability(pref_value, &result); | 229 bool valid = IntToAvailability(pref_value, &result); |
230 DCHECK(valid); | 230 DCHECK(valid); |
231 if (result != IncognitoModePrefs::DISABLED && | 231 if (result != IncognitoModePrefs::DISABLED && |
232 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { | 232 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { |
233 if (result == IncognitoModePrefs::FORCED) | 233 if (result == IncognitoModePrefs::FORCED) |
234 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; | 234 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; |
235 return IncognitoModePrefs::DISABLED; | 235 return IncognitoModePrefs::DISABLED; |
236 } | 236 } |
237 return result; | 237 return result; |
238 } | 238 } |
OLD | NEW |