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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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 <memory>
9 #include <string> 10 #include <string>
10 11
11 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 // ----------------------------------------------------------------------------- 17 // -----------------------------------------------------------------------------
18 // Introduction 18 // Introduction
19 // ----------------------------------------------------------------------------- 19 // -----------------------------------------------------------------------------
20 // 20 //
21 // This file defines the message format and messages used to interact with the 21 // This file defines the message format and messages used to interact with the
22 // remote_security_key process which is used to forward security key requests 22 // remote_security_key process which is used to forward security key requests
23 // to a remote client and return security key responses from the remote client. 23 // to a remote client and return security key responses from the remote client.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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. 120 // method is only expected to be called from test code.
121 static scoped_ptr<SecurityKeyMessage> CreateMessageForTest( 121 static std::unique_ptr<SecurityKeyMessage> CreateMessageForTest(
122 RemoteSecurityKeyMessageType type, 122 RemoteSecurityKeyMessageType type,
123 const std::string& payload); 123 const std::string& payload);
124 124
125 // Parses |message_data| and initializes the internal members. Returns true 125 // Parses |message_data| and initializes the internal members. Returns true
126 // if |message_data| was parsed and the instance was initialized successfully. 126 // if |message_data| was parsed and the instance was initialized successfully.
127 bool ParseMessage(const std::string& message_data); 127 bool ParseMessage(const std::string& message_data);
128 128
129 RemoteSecurityKeyMessageType type() { return type_; } 129 RemoteSecurityKeyMessageType type() { return type_; }
130 130
131 const std::string& payload() { return payload_; } 131 const std::string& payload() { return payload_; }
132 132
133 private: 133 private:
134 RemoteSecurityKeyMessageType type_ = RemoteSecurityKeyMessageType::INVALID; 134 RemoteSecurityKeyMessageType type_ = RemoteSecurityKeyMessageType::INVALID;
135 std::string payload_; 135 std::string payload_;
136 136
137 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessage); 137 DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessage);
138 }; 138 };
139 139
140 // Used to pass remote security key message data between classes. 140 // Used to pass remote security key message data between classes.
141 typedef base::Callback<void(scoped_ptr<SecurityKeyMessage> message)> 141 typedef base::Callback<void(std::unique_ptr<SecurityKeyMessage> message)>
142 SecurityKeyMessageCallback; 142 SecurityKeyMessageCallback;
143 143
144 } // namespace remoting 144 } // namespace remoting
145 145
146 #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