| 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/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // This singleton allows us to attempt to calculate the Platform Parental | 38 // This singleton allows us to attempt to calculate the Platform Parental |
| 39 // Controls enabled value on a worker thread before the UI thread needs the | 39 // Controls enabled value on a worker thread before the UI thread needs the |
| 40 // value. If the UI thread finishes sooner than we expect, that's no worse than | 40 // value. If the UI thread finishes sooner than we expect, that's no worse than |
| 41 // today where we block. | 41 // today where we block. |
| 42 class PlatformParentalControlsValue { | 42 class PlatformParentalControlsValue { |
| 43 public: | 43 public: |
| 44 static PlatformParentalControlsValue* GetInstance() { | 44 static PlatformParentalControlsValue* GetInstance() { |
| 45 return Singleton<PlatformParentalControlsValue>::get(); | 45 return base::Singleton<PlatformParentalControlsValue>::get(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool is_enabled() const { | 48 bool is_enabled() const { |
| 49 return is_enabled_; | 49 return is_enabled_; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 friend struct DefaultSingletonTraits<PlatformParentalControlsValue>; | 53 friend struct base::DefaultSingletonTraits<PlatformParentalControlsValue>; |
| 54 | 54 |
| 55 // Histogram enum for tracking the thread that checked parental controls. | 55 // Histogram enum for tracking the thread that checked parental controls. |
| 56 enum class ThreadType { | 56 enum class ThreadType { |
| 57 UI = 0, | 57 UI = 0, |
| 58 BLOCKING, | 58 BLOCKING, |
| 59 COUNT, | 59 COUNT, |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 PlatformParentalControlsValue() | 62 PlatformParentalControlsValue() |
| 63 : is_enabled_(IsParentalControlActivityLoggingOn()) {} | 63 : is_enabled_(IsParentalControlActivityLoggingOn()) {} |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { | 208 bool IncognitoModePrefs::ArePlatformParentalControlsEnabled() { |
| 209 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
| 210 return PlatformParentalControlsValue::GetInstance()->is_enabled(); | 210 return PlatformParentalControlsValue::GetInstance()->is_enabled(); |
| 211 #elif defined(OS_ANDROID) | 211 #elif defined(OS_ANDROID) |
| 212 return chrome::android::ChromeApplication::AreParentalControlsEnabled(); | 212 return chrome::android::ChromeApplication::AreParentalControlsEnabled(); |
| 213 #else | 213 #else |
| 214 return false; | 214 return false; |
| 215 #endif | 215 #endif |
| 216 } | 216 } |
| 217 | 217 |
| OLD | NEW |