Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PROXIMITY_AUTH_PERMIT_MESSAGE_H | |
| 6 #define COMPONENTS_PROXIMITY_AUTH_PERMIT_MESSAGE_H | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | |
| 11 namespace proximity_auth { | |
| 12 | |
| 13 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.
| |
| 14 public: | |
| 15 virtual ~PermitMessage(); | |
| 16 | |
| 17 // Returns |true| iff the |size| is at least equal to the message length | |
| 18 // encoded in the header of |bytes|. | |
| 19 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.
| |
| 20 | |
| 21 // Returns the deserialized message from the first |size| bytes of |bytes|, or | |
| 22 // NULL if the message is malformed. | |
| 23 static scoped_ptr<PermitMessage> FromBytes(const char* bytes, int size); | |
| 24 | |
| 25 protected: | |
| 26 // Visible for tests. | |
| 27 PermitMessage(); | |
| 28 | |
| 29 private: | |
| 30 // Returns the deserialized message from the first |size| bytes of |bytes|, or | |
| 31 // NULL if the message is malformed. | |
| 32 static scoped_ptr<PermitMessage> FromBytesImpl(const char* bytes, int size); | |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(PermitMessage); | |
| 35 }; | |
| 36 | |
| 37 } // namespace proximity_auth | |
| 38 | |
| 39 #endif // COMPONENTS_PROXIMITY_AUTH_PERMIT_MESSAGE_H | |
| OLD | NEW |