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

Unified Diff: device/hid/hid_usage_and_page.cc

Issue 317783010: chrome.hid: enrich model with report IDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix hid.idl comment Created 6 years, 6 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 | « device/hid/hid_usage_and_page.h ('k') | device/hid/hid_utils_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_usage_and_page.cc
diff --git a/device/hid/hid_usage_and_page.cc b/device/hid/hid_usage_and_page.cc
index 773346b7a5b75eac628fb64fed9405c0b176fef3..079ec6623d6f8fc21a2d963cc4602011a8be977d 100644
--- a/device/hid/hid_usage_and_page.cc
+++ b/device/hid/hid_usage_and_page.cc
@@ -6,8 +6,31 @@
namespace device {
-bool HidUsageAndPage::operator==(const HidUsageAndPage& other) const {
- return usage == other.usage && usage_page == other.usage_page;
+bool HidUsageAndPage::IsProtected() const {
+ if (usage_page == HidUsageAndPage::kPageKeyboard)
+ return true;
+
+ if (usage_page != HidUsageAndPage::kPageGenericDesktop)
+ return false;
+
+ if (usage == HidUsageAndPage::kGenericDesktopPointer ||
+ usage == HidUsageAndPage::kGenericDesktopMouse ||
+ usage == HidUsageAndPage::kGenericDesktopKeyboard ||
+ usage == HidUsageAndPage::kGenericDesktopKeypad) {
+ return true;
+ }
+
+ if (usage >= HidUsageAndPage::kGenericDesktopSystemControl &&
+ usage <= HidUsageAndPage::kGenericDesktopSystemWarmRestart) {
+ return true;
+ }
+
+ if (usage >= HidUsageAndPage::kGenericDesktopSystemDock &&
+ usage <= HidUsageAndPage::kGenericDesktopSystemDisplaySwap) {
+ return true;
+ }
+
+ return false;
}
} // namespace device
« no previous file with comments | « device/hid/hid_usage_and_page.h ('k') | device/hid/hid_utils_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698