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

Unified Diff: components/proximity_auth/wire_message.h

Issue 538843002: [EasyUnlock] Port Connection class to native code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android test compile failures Created 6 years, 3 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 | « components/proximity_auth/connection_unittest.cc ('k') | components/proximity_auth/wire_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/wire_message.h
diff --git a/components/proximity_auth/wire_message.h b/components/proximity_auth/wire_message.h
new file mode 100644
index 0000000000000000000000000000000000000000..db5af37ec2b6261f86cd54fc05d3d620a0d94589
--- /dev/null
+++ b/components/proximity_auth/wire_message.h
@@ -0,0 +1,39 @@
+// 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.
+
+#ifndef COMPONENTS_PROXIMITY_AUTH_WIRE_MESSAGE_H
+#define COMPONENTS_PROXIMITY_AUTH_WIRE_MESSAGE_H
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace proximity_auth {
+
+class WireMessage {
+ public:
+ virtual ~WireMessage();
+
+ // Returns |true| iff the size of |message_bytes| is at least equal to the
+ // message length encoded in the message header. Returns false if the message
+ // header is not available.
+ static bool IsCompleteMessage(const std::string& message_bytes);
+
+ // Returns the deserialized message from |serialized_message|, or NULL if the
+ // message is malformed.
+ static scoped_ptr<WireMessage> Deserialize(
+ const std::string& serialized_message);
+
+ protected:
+ // Visible for tests.
+ WireMessage();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WireMessage);
+};
+
+} // namespace proximity_auth
+
+#endif // COMPONENTS_PROXIMITY_AUTH_WIRE_MESSAGE_H
« no previous file with comments | « components/proximity_auth/connection_unittest.cc ('k') | components/proximity_auth/wire_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698