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

Unified Diff: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc

Issue 2808093006: [Device Service] Move Gamepad Blink headers to be part of the Gamepad client library (Closed)
Patch Set: rebase and address comments Created 3 years, 8 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/vr/DEPS ('k') | ppapi/shared_impl/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
diff --git a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
index a18b6c6cae3382e2d50b27534d4a2b341470b765..8d0bb87788fab6b627f83f9bc717672999cc7fbc 100644
--- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
+++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
@@ -6,18 +6,16 @@
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "device/gamepad/public/cpp/gamepads.h"
#include "device/vr/android/gvr/gvr_gamepad_data_provider.h"
#include "device/vr/vr_types.h"
-#include "third_party/WebKit/public/platform/WebGamepads.h"
namespace device {
namespace {
-void CopyToWebUString(blink::WebUChar* dest,
- size_t dest_length,
- base::string16 src) {
- static_assert(sizeof(base::string16::value_type) == sizeof(blink::WebUChar),
+void CopyToUString(UChar* dest, size_t dest_length, base::string16 src) {
+ static_assert(sizeof(base::string16::value_type) == sizeof(UChar),
"Mismatched string16/WebUChar size.");
const size_t str_to_copy = std::min(src.size(), dest_length - 1);
@@ -27,8 +25,6 @@ void CopyToWebUString(blink::WebUChar* dest,
} // namespace
-using namespace blink;
-
GvrGamepadDataFetcher::Factory::Factory(GvrGamepadDataProvider* data_provider,
unsigned int display_id)
: data_provider_(data_provider), display_id_(display_id) {
@@ -85,22 +81,22 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
// TODO(bajones): ensure consistency?
GvrGamepadData provided_data = gamepad_data_;
- WebGamepad& pad = state->data;
+ Gamepad& pad = state->data;
if (state->active_state == GAMEPAD_NEWLY_ACTIVE) {
// This is the first time we've seen this device, so do some one-time
// initialization
pad.connected = true;
- CopyToWebUString(pad.id, WebGamepad::kIdLengthCap,
- base::UTF8ToUTF16("Daydream Controller"));
- CopyToWebUString(pad.mapping, WebGamepad::kMappingLengthCap,
- base::UTF8ToUTF16(""));
+ CopyToUString(pad.id, Gamepad::kIdLengthCap,
+ base::UTF8ToUTF16("Daydream Controller"));
+ CopyToUString(pad.mapping, Gamepad::kMappingLengthCap,
+ base::UTF8ToUTF16(""));
pad.buttons_length = 1;
pad.axes_length = 2;
pad.display_id = display_id_;
pad.hand =
- provided_data.right_handed ? kGamepadHandRight : kGamepadHandLeft;
+ provided_data.right_handed ? GamepadHand::kRight : GamepadHand::kLeft;
}
pad.timestamp = provided_data.timestamp;
« no previous file with comments | « device/vr/DEPS ('k') | ppapi/shared_impl/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698