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

Unified Diff: components/proximity_auth/permit_message.h

Issue 538843002: [EasyUnlock] Port Connection class to native code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: components/proximity_auth/permit_message.h
diff --git a/components/proximity_auth/permit_message.h b/components/proximity_auth/permit_message.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6057dfdb0f9df357d86fc6246696c667d0b3e1a
--- /dev/null
+++ b/components/proximity_auth/permit_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_PERMIT_MESSAGE_H
+#define COMPONENTS_PROXIMITY_AUTH_PERMIT_MESSAGE_H
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace proximity_auth {
+
+class PermitMessage {
Tim Song 2014/09/05 00:30:34 WireMessage would be a better name for this class.
Ilya Sherman 2014/09/05 01:02:12 Done.
+ public:
+ virtual ~PermitMessage();
+
+ // Returns |true| iff the |size| is at least equal to the message length
+ // encoded in the header of |bytes|.
+ static bool IsCompleteMessage(const char* bytes, int size);
Tim Song 2014/09/05 00:30:34 Let's use a vector<uint8_t> as the shared data typ
Ilya Sherman 2014/09/05 01:02:12 It looks like I was mistaken about how strings han
Tim Song 2014/09/05 03:10:33 Strings are good.
+
+ // Returns the deserialized message from the first |size| bytes of |bytes|, or
+ // NULL if the message is malformed.
+ static scoped_ptr<PermitMessage> FromBytes(const char* bytes, int size);
+
+ protected:
+ // Visible for tests.
+ PermitMessage();
+
+ private:
+ // Returns the deserialized message from the first |size| bytes of |bytes|, or
+ // NULL if the message is malformed.
+ static scoped_ptr<PermitMessage> FromBytesImpl(const char* bytes, int size);
+
+ DISALLOW_COPY_AND_ASSIGN(PermitMessage);
+};
+
+} // namespace proximity_auth
+
+#endif // COMPONENTS_PROXIMITY_AUTH_PERMIT_MESSAGE_H

Powered by Google App Engine
This is Rietveld 408576698