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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win/metro.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/win/metro.h" 5 #include "base/win/metro.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/win/scoped_comptr.h"
9 #include "base/win/windows_version.h"
8 10
9 namespace base { 11 namespace base {
10 namespace win { 12 namespace win {
11 13
12 const char kActivateApplication[] = "ActivateApplication"; 14 const char kActivateApplication[] = "ActivateApplication";
13 15
14 HMODULE GetMetroModule() { 16 HMODULE GetMetroModule() {
15 const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1); 17 const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1);
16 static HMODULE metro_module = kUninitialized; 18 static HMODULE metro_module = kUninitialized;
17 19
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 base::wcslcpy(dest, src.c_str(), dest_size); 78 base::wcslcpy(dest, src.c_str(), dest_size);
77 return dest; 79 return dest;
78 } 80 }
79 81
80 bool IsTouchEnabled() { 82 bool IsTouchEnabled() {
81 int value = GetSystemMetrics(SM_DIGITIZER); 83 int value = GetSystemMetrics(SM_DIGITIZER);
82 return value & (NID_READY | NID_INTEGRATED_TOUCH) == 84 return value & (NID_READY | NID_INTEGRATED_TOUCH) ==
83 (NID_READY | NID_INTEGRATED_TOUCH); 85 (NID_READY | NID_INTEGRATED_TOUCH);
84 } 86 }
85 87
88 bool IsParentalControlActivityLoggingOn() {
89 // Query this info on Windows 8 and above.
90 if (base::win::GetVersion() < base::win::VERSION_WIN8)
91 return false;
92
93 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.
94 static bool parental_control_status_determined = false;
95
96 if (parental_control_status_determined)
97 return parental_control_logging_required;
98
99 parental_control_status_determined = true;
100
101 ScopedComPtr<IWindowsParentalControlsCore> parent_controls;
102 HRESULT hr = parent_controls.CreateInstance(
103 __uuidof(WindowsParentalControls));
104 if (FAILED(hr))
105 return false;
106
107 ScopedComPtr<IWPCSettings> settings;
108 hr = parent_controls->GetUserSettings(NULL, settings.Receive());
109 if (FAILED(hr))
110 return false;
111
112 unsigned long restrictions = 0;
113 settings->GetRestrictions(&restrictions);
114
115 parental_control_logging_required =
116 (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.
117 return parental_control_logging_required;
118 }
119
86 } // namespace win 120 } // namespace win
87 } // namespace base 121 } // namespace base
OLDNEW
« 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