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

Side by Side Diff: remoting/host/security_key/security_key_message.h

Issue 1855613002: Adding the RemoteSecurityKeyMessageHandler class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_
6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <string> 9 #include <string>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 ~SecurityKeyMessage(); 109 ~SecurityKeyMessage();
110 110
111 // When given a header value (uint32_t), this method will return whether the 111 // When given a header value (uint32_t), this method will return whether the
112 // length is within the allowable size range. 112 // length is within the allowable size range.
113 static bool IsValidMessageSize(uint32_t message_size); 113 static bool IsValidMessageSize(uint32_t message_size);
114 114
115 // Returns a RemoteSecurityKeyMessageType enum value corresponding to the 115 // Returns a RemoteSecurityKeyMessageType enum value corresponding to the
116 // value passed in if it is valid, otherwise INVALID is returned. 116 // value passed in if it is valid, otherwise INVALID is returned.
117 static RemoteSecurityKeyMessageType MessageTypeFromValue(int value); 117 static RemoteSecurityKeyMessageType MessageTypeFromValue(int value);
118 118
119 // Creates a message from the passed in values, no validation is done as this
120 // method is only expected to be called from test code.
121 static scoped_ptr<SecurityKeyMessage> CreateMessageForTest(
122 RemoteSecurityKeyMessageType type,
123 const std::string& payload);
124
119 // Parses |message_data| and initializes the internal members. Returns true 125 // Parses |message_data| and initializes the internal members. Returns true
120 // if |message_data| was parsed and the instance was initialized successfully. 126 // if |message_data| was parsed and the instance was initialized successfully.
121 bool ParseMessage(const std::string& message_data); 127 bool ParseMessage(const std::string& message_data);
122 128
123 RemoteSecurityKeyMessageType type() { return type_; } 129 RemoteSecurityKeyMessageType type() { return type_; }
124 130
125 const std::string& payload() { return payload_; } 131 const std::string& payload() { return payload_; }
126 132
127 private: 133 private:
128 RemoteSecurityKeyMessageType type_ = RemoteSecurityKeyMessageType::INVALID; 134 RemoteSecurityKeyMessageType type_ = RemoteSecurityKeyMessageType::INVALID;
129 std::string payload_; 135 std::string payload_;
130 136
131 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessage); 137 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessage);
132 }; 138 };
133 139
134 // Used to pass remote security key message data between classes. 140 // Used to pass remote security key message data between classes.
135 typedef base::Callback<void(scoped_ptr<SecurityKeyMessage> message)> 141 typedef base::Callback<void(scoped_ptr<SecurityKeyMessage> message)>
136 SecurityKeyMessageCallback; 142 SecurityKeyMessageCallback;
137 143
138 } // namespace remoting 144 } // namespace remoting
139 145
140 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_ 146 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698