Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
  2. index e068604..933b6ce 100644
  3. --- a/ui/base/BUILD.gn
  4. +++ b/ui/base/BUILD.gn
  5. @@ -251,6 +251,7 @@ component("base") {
  6. "theme_provider.cc",
  7. "theme_provider.h",
  8. "touch/touch_device.h",
  9. + "touch/touch_device_util.cc",
  10. "touch/touch_editing_controller.cc",
  11. "touch/touch_editing_controller.h",
  12. "ui_base_export.h",
  13. @@ -357,6 +358,7 @@ component("base") {
  14. sources += [ "touch/touch_device_win.cc" ]
  15. } else if (is_android) {
  16. sources += [ "touch/touch_device_android.cc" ]
  17. + sources -= [ "touch/touch_device_util.cc" ]
  18. } else if (is_ios) {
  19. sources += [ "touch/touch_device_ios.cc" ]
  20. } else if (is_linux) {
  21. diff --git a/ui/base/touch/touch_device.h b/ui/base/touch/touch_device.h
  22. index 7b1b65f..18daecb 100644
  23. --- a/ui/base/touch/touch_device.h
  24. +++ b/ui/base/touch/touch_device.h
  25. @@ -61,6 +61,8 @@ enum HoverType {
  26. HOVER_TYPE_LAST = HOVER_TYPE_HOVER
  27. };
  28.  
  29. +int GetAvailablePointerTypes();
  30. +int GetAvailableHoverTypes();
  31. UI_BASE_EXPORT std::pair<int, int> GetAvailablePointerAndHoverTypes();
  32. UI_BASE_EXPORT void SetAvailablePointerAndHoverTypesForTesting(
  33. int available_pointer_types,
  34. diff --git a/ui/base/touch/touch_device_linux.cc b/ui/base/touch/touch_device_linux.cc
  35. index b555a3c..3452aa3 100644
  36. --- a/ui/base/touch/touch_device_linux.cc
  37. +++ b/ui/base/touch/touch_device_linux.cc
  38. @@ -29,6 +29,8 @@ bool isMouseOrTouchpadPresent() {
  39. return false;
  40. }
  41.  
  42. +} // namespace
  43. +
  44. int GetAvailablePointerTypes() {
  45. int available_pointer_types = 0;
  46. if (isMouseOrTouchpadPresent())
  47. @@ -45,11 +47,12 @@ int GetAvailablePointerTypes() {
  48. }
  49.  
  50. int GetAvailableHoverTypes() {
  51. - return isMouseOrTouchpadPresent() ? HOVER_TYPE_HOVER : HOVER_TYPE_NONE;
  52. + int available_hover_types = HOVER_TYPE_HOVER;
  53. + if (isMouseOrTouchpadPresent())
  54. + available_hover_types |= HOVER_TYPE_HOVER;
  55. + return available_hover_types;
  56. }
  57.  
  58. -} // namespace
  59. -
  60. TouchScreensAvailability GetTouchScreensAvailability() {
  61. if (!IsTouchDevicePresent())
  62. return TouchScreensAvailability::NONE;
  63. @@ -70,24 +73,6 @@ int MaxTouchPoints() {
  64. return max_touch;
  65. }
  66.  
  67. -bool return_available_pointer_and_hover_types_for_testing = false;
  68. -int available_pointer_types_for_testing = POINTER_TYPE_NONE;
  69. -int available_hover_types_for_testing = HOVER_TYPE_NONE;
  70. -
  71. -void SetAvailablePointerAndHoverTypesForTesting(int available_pointer_types,
  72. - int available_hover_types) {
  73. - return_available_pointer_and_hover_types_for_testing = true;
  74. - available_pointer_types_for_testing = available_pointer_types;
  75. - available_hover_types_for_testing = available_hover_types;
  76. -}
  77. -
  78. -std::pair<int, int> GetAvailablePointerAndHoverTypes() {
  79. - if (return_available_pointer_and_hover_types_for_testing)
  80. - return std::make_pair(available_pointer_types_for_testing,
  81. - available_hover_types_for_testing);
  82. - return std::make_pair(GetAvailablePointerTypes(), GetAvailableHoverTypes());
  83. -}
  84. -
  85. PointerType GetPrimaryPointerType(int available_pointer_types) {
  86. if (available_pointer_types & POINTER_TYPE_FINE)
  87. return POINTER_TYPE_FINE;
  88. diff --git a/ui/base/touch/touch_device_win.cc b/ui/base/touch/touch_device_win.cc
  89. index 3ccbb1b..3ff8b53 100644
  90. --- a/ui/base/touch/touch_device_win.cc
  91. +++ b/ui/base/touch/touch_device_win.cc
  92. @@ -17,6 +17,8 @@ bool IsTouchDevicePresent() {
  93. ((value & NID_INTEGRATED_TOUCH) || (value & NID_EXTERNAL_TOUCH));
  94. }
  95.  
  96. +} // namespace
  97. +
  98. // The following method logic is as follow :
  99. // - On versions prior to Windows 8 it will always return POINTER_TYPE_FINE
  100. // and/or POINTER_TYPE_COARSE (if the device has a touch screen).
  101. @@ -65,8 +67,6 @@ int GetAvailableHoverTypes() {
  102. return available_hover_types;
  103. }
  104.  
  105. -} // namespace
  106. -
  107. TouchScreensAvailability GetTouchScreensAvailability() {
  108. if (!IsTouchDevicePresent())
  109. return TouchScreensAvailability::NONE;
  110. @@ -97,22 +97,4 @@ HoverType GetPrimaryHoverType(int available_hover_types) {
  111. return HOVER_TYPE_NONE;
  112. }
  113.  
  114. -bool return_available_pointer_and_hover_types_for_testing = false;
  115. -int available_pointer_types_for_testing = POINTER_TYPE_NONE;
  116. -int available_hover_types_for_testing = HOVER_TYPE_NONE;
  117. -
  118. -void SetAvailablePointerAndHoverTypesForTesting(int available_pointer_types,
  119. - int available_hover_types) {
  120. - return_available_pointer_and_hover_types_for_testing = true;
  121. - available_pointer_types_for_testing = available_pointer_types;
  122. - available_hover_types_for_testing = available_hover_types;
  123. -}
  124. -
  125. -std::pair<int, int> GetAvailablePointerAndHoverTypes() {
  126. - if (return_available_pointer_and_hover_types_for_testing)
  127. - return std::make_pair(available_pointer_types_for_testing,
  128. - available_hover_types_for_testing);
  129. - return std::make_pair(GetAvailablePointerTypes(), GetAvailableHoverTypes());
  130. -}
  131. -
  132. } // namespace ui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement