| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 : is_enabled_(IsParentalControlActivityLoggingOn()) {} | 68 : is_enabled_(IsParentalControlActivityLoggingOn()) {} |
| 69 | 69 |
| 70 ~PlatformParentalControlsValue() = default; | 70 ~PlatformParentalControlsValue() = default; |
| 71 | 71 |
| 72 // Returns true if Windows Parental control activity logging is enabled. This | 72 // Returns true if Windows Parental control activity logging is enabled. This |
| 73 // feature is available on Windows 7 and beyond. This function should be | 73 // feature is available on Windows 7 and beyond. This function should be |
| 74 // called on a COM Initialized thread and is potentially blocking. | 74 // called on a COM Initialized thread and is potentially blocking. |
| 75 static bool IsParentalControlActivityLoggingOn() { | 75 static bool IsParentalControlActivityLoggingOn() { |
| 76 // Since we can potentially block, make sure the thread is okay with this. | 76 // Since we can potentially block, make sure the thread is okay with this. |
| 77 base::ThreadRestrictions::AssertIOAllowed(); | 77 base::ThreadRestrictions::AssertIOAllowed(); |
| 78 base::ThreadRestrictions::AssertWaitAllowed(); | |
| 79 | 78 |
| 80 // Query this info on Windows 7 and above. | 79 // Query this info on Windows 7 and above. |
| 81 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 80 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 82 return false; | 81 return false; |
| 83 | 82 |
| 84 ThreadType thread_type = ThreadType::BLOCKING; | 83 ThreadType thread_type = ThreadType::BLOCKING; |
| 85 if (BrowserThread::IsThreadInitialized(BrowserThread::UI) && | 84 if (BrowserThread::IsThreadInitialized(BrowserThread::UI) && |
| 86 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { | 85 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
| 87 thread_type = ThreadType::UI; | 86 thread_type = ThreadType::UI; |
| 88 } | 87 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 bool valid = IntToAvailability(pref_value, &result); | 226 bool valid = IntToAvailability(pref_value, &result); |
| 228 DCHECK(valid); | 227 DCHECK(valid); |
| 229 if (result != IncognitoModePrefs::DISABLED && | 228 if (result != IncognitoModePrefs::DISABLED && |
| 230 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { | 229 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { |
| 231 if (result == IncognitoModePrefs::FORCED) | 230 if (result == IncognitoModePrefs::FORCED) |
| 232 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; | 231 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; |
| 233 return IncognitoModePrefs::DISABLED; | 232 return IncognitoModePrefs::DISABLED; |
| 234 } | 233 } |
| 235 return result; | 234 return result; |
| 236 } | 235 } |
| OLD | NEW |