| 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 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 #include <windows.h> | 25 #include <windows.h> |
| 26 #include <objbase.h> | 26 #include <objbase.h> |
| 27 #include <wpcapi.h> | 27 #include <wpcapi.h> |
| 28 #include "base/bind.h" | 28 #include "base/bind.h" |
| 29 #include "base/bind_helpers.h" | 29 #include "base/bind_helpers.h" |
| 30 #include "base/memory/singleton.h" | 30 #include "base/memory/singleton.h" |
| 31 #include "base/win/scoped_comptr.h" | 31 #include "base/win/scoped_comptr.h" |
| 32 #include "base/win/windows_version.h" | |
| 33 #endif // OS_WIN | 32 #endif // OS_WIN |
| 34 | 33 |
| 35 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 36 #include "chrome/browser/android/partner_browser_customizations.h" | 35 #include "chrome/browser/android/partner_browser_customizations.h" |
| 37 #endif // defined(OS_ANDROID) | 36 #endif // defined(OS_ANDROID) |
| 38 | 37 |
| 39 using content::BrowserThread; | 38 using content::BrowserThread; |
| 40 | 39 |
| 41 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 42 namespace { | 41 namespace { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 70 | 69 |
| 71 ~PlatformParentalControlsValue() = default; | 70 ~PlatformParentalControlsValue() = default; |
| 72 | 71 |
| 73 // Returns true if Windows Parental control activity logging is enabled. This | 72 // Returns true if Windows Parental control activity logging is enabled. This |
| 74 // 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 |
| 75 // called on a COM Initialized thread and is potentially blocking. | 74 // called on a COM Initialized thread and is potentially blocking. |
| 76 static bool IsParentalControlActivityLoggingOn() { | 75 static bool IsParentalControlActivityLoggingOn() { |
| 77 // 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. |
| 78 base::ThreadRestrictions::AssertIOAllowed(); | 77 base::ThreadRestrictions::AssertIOAllowed(); |
| 79 | 78 |
| 80 // Query this info on Windows 7 and above. | |
| 81 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
| 82 return false; | |
| 83 | |
| 84 ThreadType thread_type = ThreadType::BLOCKING; | 79 ThreadType thread_type = ThreadType::BLOCKING; |
| 85 if (BrowserThread::IsThreadInitialized(BrowserThread::UI) && | 80 if (BrowserThread::IsThreadInitialized(BrowserThread::UI) && |
| 86 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { | 81 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
| 87 thread_type = ThreadType::UI; | 82 thread_type = ThreadType::UI; |
| 88 } | 83 } |
| 89 | 84 |
| 90 UMA_HISTOGRAM_ENUMERATION( | 85 UMA_HISTOGRAM_ENUMERATION( |
| 91 "IncognitoModePrefs.WindowsParentalControlsInitThread", | 86 "IncognitoModePrefs.WindowsParentalControlsInitThread", |
| 92 static_cast<int32_t>(thread_type), | 87 static_cast<int32_t>(thread_type), |
| 93 static_cast<int32_t>(ThreadType::COUNT)); | 88 static_cast<int32_t>(ThreadType::COUNT)); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 bool valid = IntToAvailability(pref_value, &result); | 224 bool valid = IntToAvailability(pref_value, &result); |
| 230 DCHECK(valid); | 225 DCHECK(valid); |
| 231 if (result != IncognitoModePrefs::DISABLED && | 226 if (result != IncognitoModePrefs::DISABLED && |
| 232 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { | 227 mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) { |
| 233 if (result == IncognitoModePrefs::FORCED) | 228 if (result == IncognitoModePrefs::FORCED) |
| 234 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; | 229 LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on"; |
| 235 return IncognitoModePrefs::DISABLED; | 230 return IncognitoModePrefs::DISABLED; |
| 236 } | 231 } |
| 237 return result; | 232 return result; |
| 238 } | 233 } |
| OLD | NEW |