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

Unified Diff: content/renderer/vr/vr_type_converters.cc

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT! Created 4 years, 7 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 | « content/renderer/vr/vr_type_converters.h ('k') | third_party/WebKit/Source/modules/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/vr/vr_type_converters.cc
diff --git a/content/renderer/vr/vr_type_converters.cc b/content/renderer/vr/vr_type_converters.cc
deleted file mode 100644
index 61b14d1e9fa0bab3bd5d4b7f43d4884394d325d4..0000000000000000000000000000000000000000
--- a/content/renderer/vr/vr_type_converters.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/vr/vr_type_converters.h"
-
-#include <string.h>
-
-#include <algorithm>
-
-using content::mojom::VRVector3Ptr;
-using content::mojom::VRVector4Ptr;
-using content::mojom::VRRectPtr;
-using content::mojom::VRFieldOfViewPtr;
-using content::mojom::VREyeParametersPtr;
-using content::mojom::VRHMDInfoPtr;
-using content::mojom::VRDeviceInfoPtr;
-using content::mojom::VRSensorStatePtr;
-
-namespace mojo {
-
-// static
-blink::WebVRVector3 TypeConverter<blink::WebVRVector3, VRVector3Ptr>::Convert(
- const VRVector3Ptr& input) {
- blink::WebVRVector3 output;
- output.x = input->x;
- output.y = input->y;
- output.z = input->z;
- return output;
-}
-
-// static
-blink::WebVRVector4 TypeConverter<blink::WebVRVector4, VRVector4Ptr>::Convert(
- const VRVector4Ptr& input) {
- blink::WebVRVector4 output;
- output.x = input->x;
- output.y = input->y;
- output.z = input->z;
- output.w = input->w;
- return output;
-}
-
-// static
-blink::WebVRRect TypeConverter<blink::WebVRRect, VRRectPtr>::Convert(
- const VRRectPtr& input) {
- blink::WebVRRect output;
- output.x = input->x;
- output.y = input->y;
- output.width = input->width;
- output.height = input->height;
- return output;
-}
-
-// static
-blink::WebVRFieldOfView
-TypeConverter<blink::WebVRFieldOfView, VRFieldOfViewPtr>::Convert(
- const VRFieldOfViewPtr& input) {
- blink::WebVRFieldOfView output;
- output.upDegrees = input->upDegrees;
- output.downDegrees = input->downDegrees;
- output.leftDegrees = input->leftDegrees;
- output.rightDegrees = input->rightDegrees;
- return output;
-}
-
-// static
-blink::WebVREyeParameters
-TypeConverter<blink::WebVREyeParameters, VREyeParametersPtr>::Convert(
- const VREyeParametersPtr& input) {
- blink::WebVREyeParameters output;
- output.minimumFieldOfView =
- input->minimumFieldOfView.To<blink::WebVRFieldOfView>();
- output.maximumFieldOfView =
- input->maximumFieldOfView.To<blink::WebVRFieldOfView>();
- output.recommendedFieldOfView =
- input->recommendedFieldOfView.To<blink::WebVRFieldOfView>();
- output.eyeTranslation = input->eyeTranslation.To<blink::WebVRVector3>();
- output.renderRect = input->renderRect.To<blink::WebVRRect>();
- return output;
-}
-
-// static
-blink::WebVRHMDInfo TypeConverter<blink::WebVRHMDInfo, VRHMDInfoPtr>::Convert(
- const VRHMDInfoPtr& input) {
- blink::WebVRHMDInfo output;
- output.leftEye = input->leftEye.To<blink::WebVREyeParameters>();
- output.rightEye = input->rightEye.To<blink::WebVREyeParameters>();
- return output;
-}
-
-// static
-blink::WebVRDevice TypeConverter<blink::WebVRDevice, VRDeviceInfoPtr>::Convert(
- const VRDeviceInfoPtr& input) {
- blink::WebVRDevice output;
- memset(&output, 0, sizeof(blink::WebVRDevice));
-
- output.index = input->index;
- output.flags = blink::WebVRDeviceTypePosition;
- output.deviceName = blink::WebString::fromUTF8(input->deviceName.data(),
- input->deviceName.size());
-
- if (!input->hmdInfo.is_null()) {
- output.flags |= blink::WebVRDeviceTypeHMD;
- output.hmdInfo = input->hmdInfo.To<blink::WebVRHMDInfo>();
- }
-
- return output;
-}
-
-// static
-blink::WebHMDSensorState
-TypeConverter<blink::WebHMDSensorState, VRSensorStatePtr>::Convert(
- const VRSensorStatePtr& input) {
- blink::WebHMDSensorState output;
- output.timestamp = input->timestamp;
- output.frameIndex = input->frameIndex;
- output.flags = 0;
-
- if (!input->orientation.is_null()) {
- output.flags |= blink::WebVRSensorStateOrientation;
- output.orientation = input->orientation.To<blink::WebVRVector4>();
- }
- if (!input->position.is_null()) {
- output.flags |= blink::WebVRSensorStatePosition;
- output.position = input->position.To<blink::WebVRVector3>();
- }
- if (!input->angularVelocity.is_null()) {
- output.flags |= blink::WebVRSensorStateAngularVelocity;
- output.angularVelocity = input->angularVelocity.To<blink::WebVRVector3>();
- }
- if (!input->linearVelocity.is_null()) {
- output.flags |= blink::WebVRSensorStateLinearVelocity;
- output.linearVelocity = input->linearVelocity.To<blink::WebVRVector3>();
- }
- if (!input->angularAcceleration.is_null()) {
- output.flags |= blink::WebVRSensorStateAngularAcceleration;
- output.angularAcceleration =
- input->angularAcceleration.To<blink::WebVRVector3>();
- }
- if (!input->linearAcceleration.is_null()) {
- output.flags |= blink::WebVRSensorStateLinearAcceleration;
- output.linearAcceleration =
- input->linearAcceleration.To<blink::WebVRVector3>();
- }
-
- return output;
-}
-
-} // namespace mojo
« no previous file with comments | « content/renderer/vr/vr_type_converters.h ('k') | third_party/WebKit/Source/modules/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698