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 "base/win/metro.h" | 5 #include "base/win/metro.h" |
6 | 6 |
| 7 #include "base/message_loop.h" |
7 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/win/scoped_comptr.h" |
| 10 #include "base/win/windows_version.h" |
8 | 11 |
9 namespace base { | 12 namespace base { |
10 namespace win { | 13 namespace win { |
11 | 14 |
12 const char kActivateApplication[] = "ActivateApplication"; | 15 const char kActivateApplication[] = "ActivateApplication"; |
13 | 16 |
14 HMODULE GetMetroModule() { | 17 HMODULE GetMetroModule() { |
15 const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1); | 18 const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1); |
16 static HMODULE metro_module = kUninitialized; | 19 static HMODULE metro_module = kUninitialized; |
17 | 20 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 base::wcslcpy(dest, src.c_str(), dest_size); | 79 base::wcslcpy(dest, src.c_str(), dest_size); |
77 return dest; | 80 return dest; |
78 } | 81 } |
79 | 82 |
80 bool IsTouchEnabled() { | 83 bool IsTouchEnabled() { |
81 int value = GetSystemMetrics(SM_DIGITIZER); | 84 int value = GetSystemMetrics(SM_DIGITIZER); |
82 return value & (NID_READY | NID_INTEGRATED_TOUCH) == | 85 return value & (NID_READY | NID_INTEGRATED_TOUCH) == |
83 (NID_READY | NID_INTEGRATED_TOUCH); | 86 (NID_READY | NID_INTEGRATED_TOUCH); |
84 } | 87 } |
85 | 88 |
| 89 bool IsParentalControlActivityLoggingOn() { |
| 90 DCHECK(MessageLoop::current() && |
| 91 (MessageLoop::current()->type() == MessageLoop::TYPE_UI)); |
| 92 |
| 93 // Query this info on Windows 8 and above. |
| 94 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
| 95 return false; |
| 96 |
| 97 static bool parental_control_logging_required = false; |
| 98 static bool parental_control_status_determined = false; |
| 99 |
| 100 if (parental_control_status_determined) |
| 101 return parental_control_logging_required; |
| 102 |
| 103 parental_control_status_determined = true; |
| 104 |
| 105 ScopedComPtr<IWindowsParentalControlsCore> parent_controls; |
| 106 HRESULT hr = parent_controls.CreateInstance( |
| 107 __uuidof(WindowsParentalControls)); |
| 108 if (FAILED(hr)) |
| 109 return false; |
| 110 |
| 111 ScopedComPtr<IWPCSettings> settings; |
| 112 hr = parent_controls->GetUserSettings(NULL, settings.Receive()); |
| 113 if (FAILED(hr)) |
| 114 return false; |
| 115 |
| 116 unsigned long restrictions = 0; |
| 117 settings->GetRestrictions(&restrictions); |
| 118 |
| 119 parental_control_logging_required = |
| 120 (restrictions & WPCFLAG_LOGGING_REQUIRED) == WPCFLAG_LOGGING_REQUIRED; |
| 121 return parental_control_logging_required; |
| 122 } |
| 123 |
86 } // namespace win | 124 } // namespace win |
87 } // namespace base | 125 } // namespace base |
OLD | NEW |