Index: base/win/metro.cc |
=================================================================== |
--- base/win/metro.cc (revision 145702) |
+++ base/win/metro.cc (working copy) |
@@ -5,6 +5,8 @@ |
#include "base/win/metro.h" |
#include "base/string_util.h" |
+#include "base/win/scoped_comptr.h" |
+#include "base/win/windows_version.h" |
namespace base { |
namespace win { |
@@ -83,5 +85,37 @@ |
(NID_READY | NID_INTEGRATED_TOUCH); |
} |
+bool IsParentalControlActivityLoggingOn() { |
+ // Query this info on Windows 8 and above. |
+ if (base::win::GetVersion() < base::win::VERSION_WIN8) |
+ return false; |
+ |
+ static bool parental_control_logging_required = false; |
jar (doing other things)
2012/07/11 21:07:06
Is this only called on the UI thread, so that you
ananta
2012/07/11 21:13:02
Added a comment in the header.
|
+ static bool parental_control_status_determined = false; |
+ |
+ if (parental_control_status_determined) |
+ return parental_control_logging_required; |
+ |
+ parental_control_status_determined = true; |
+ |
+ ScopedComPtr<IWindowsParentalControlsCore> parent_controls; |
+ HRESULT hr = parent_controls.CreateInstance( |
+ __uuidof(WindowsParentalControls)); |
+ if (FAILED(hr)) |
+ return false; |
+ |
+ ScopedComPtr<IWPCSettings> settings; |
+ hr = parent_controls->GetUserSettings(NULL, settings.Receive()); |
+ if (FAILED(hr)) |
+ return false; |
+ |
+ unsigned long restrictions = 0; |
+ settings->GetRestrictions(&restrictions); |
+ |
+ parental_control_logging_required = |
+ (restrictions & WPCFLAG_LOGGING_REQUIRED == WPCFLAG_LOGGING_REQUIRED); |
jar (doing other things)
2012/07/11 21:07:06
I think you need to move the trailing paren, or th
ananta
2012/07/11 21:13:02
Done.
|
+ return parental_control_logging_required; |
+} |
+ |
} // namespace win |
} // namespace base |