Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1101)

Unified Diff: base/win/metro.cc

Issue 10693133: Add a helper function to query whether parental control logging is on for the current chrome user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/metro.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/metro.cc
===================================================================
--- base/win/metro.cc (revision 146138)
+++ base/win/metro.cc (working copy)
@@ -4,7 +4,10 @@
#include "base/win/metro.h"
+#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/win/scoped_comptr.h"
+#include "base/win/windows_version.h"
namespace base {
namespace win {
@@ -83,5 +86,40 @@
(NID_READY | NID_INTEGRATED_TOUCH);
}
+bool IsParentalControlActivityLoggingOn() {
+ DCHECK(MessageLoop::current() &&
+ (MessageLoop::current()->type() == MessageLoop::TYPE_UI));
+
+ // 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;
+ 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;
+ return parental_control_logging_required;
+}
+
} // namespace win
} // namespace base
« no previous file with comments | « base/win/metro.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698