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

Unified Diff: content/common/gamepad_param_traits.cc

Issue 2522843002: Convert Gamepad IPC messages into mojo interface. (Closed)
Patch Set: code rebase Created 4 years 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/common/gamepad_param_traits.h ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gamepad_param_traits.cc
diff --git a/content/common/gamepad_param_traits.cc b/content/common/gamepad_param_traits.cc
deleted file mode 100644
index 5a343fa1e0654164de9d7da46c071440e491c3b8..0000000000000000000000000000000000000000
--- a/content/common/gamepad_param_traits.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2014 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/common/gamepad_param_traits.h"
-
-#include <stddef.h>
-
-#include "base/macros.h"
-#include "base/pickle.h"
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
-#include "ipc/ipc_message_utils.h"
-#include "third_party/WebKit/public/platform/WebGamepad.h"
-
-using blink::WebGamepad;
-
-namespace {
-
-void LogWebUCharString(
- const blink::WebUChar web_string[],
- const size_t array_size,
- std::string* log) {
- base::string16 utf16;
- utf16.reserve(array_size);
- for (size_t i = 0; i < array_size && web_string[i]; ++i) {
- utf16[i] = web_string[i];
- }
- log->append(base::UTF16ToUTF8(utf16));
-}
-
-}
-
-namespace IPC {
-
-void ParamTraits<WebGamepad>::Write(base::Pickle* m, const WebGamepad& p) {
- m->WriteData(reinterpret_cast<const char*>(&p), sizeof(WebGamepad));
-}
-
-bool ParamTraits<WebGamepad>::Read(const base::Pickle* m,
- base::PickleIterator* iter,
- WebGamepad* p) {
- int length;
- const char* data;
- if (!iter->ReadData(&data, &length) || length != sizeof(WebGamepad))
- return false;
- memcpy(p, data, sizeof(WebGamepad));
-
- return true;
-}
-
-void ParamTraits<WebGamepad>::Log(
- const WebGamepad& p,
- std::string* l) {
- l->append("WebGamepad(");
- LogParam(p.connected, l);
- LogWebUCharString(p.id, WebGamepad::idLengthCap, l);
- l->append(",");
- LogWebUCharString(p.mapping, WebGamepad::mappingLengthCap, l);
- l->append(",");
- LogParam(p.timestamp, l);
- l->append(",");
- LogParam(p.axesLength, l);
- l->append(", [");
- for (size_t i = 0; i < arraysize(p.axes); ++i) {
- l->append(base::StringPrintf("%f%s", p.axes[i],
- i < (arraysize(p.axes) - 1) ? ", " : "], "));
- }
- LogParam(p.buttonsLength, l);
- l->append(", [");
- for (size_t i = 0; i < arraysize(p.buttons); ++i) {
- l->append(base::StringPrintf("(%u, %f)%s",
- p.buttons[i].pressed, p.buttons[i].value,
- i < (arraysize(p.buttons) - 1) ? ", " : "], "));
- }
- l->append(")");
-}
-
-} // namespace IPC
« no previous file with comments | « content/common/gamepad_param_traits.h ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698