| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "remoting/host/video_frame_recorder_host_extension.h" | 5 #include "remoting/host/video_frame_recorder_host_extension.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Copy the Base64 data into the message. | 153 // Copy the Base64 data into the message. |
| 154 const char kData[] = "data"; | 154 const char kData[] = "data"; |
| 155 reply_message.SetString(kData, base64_data); | 155 reply_message.SetString(kData, base64_data); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // JSON-encode the reply into a string. | 158 // JSON-encode the reply into a string. |
| 159 // Note that JSONWriter::Write() can only fail due to invalid inputs, and will | 159 // Note that JSONWriter::Write() can only fail due to invalid inputs, and will |
| 160 // DCHECK in Debug builds in that case. | 160 // DCHECK in Debug builds in that case. |
| 161 std::string reply_json; | 161 std::string reply_json; |
| 162 if (!base::JSONWriter::Write(&reply_message, &reply_json)) { | 162 if (!base::JSONWriter::Write(reply_message, &reply_json)) { |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Return the frame (or a 'data'-less reply) to the client. | 166 // Return the frame (or a 'data'-less reply) to the client. |
| 167 protocol::ExtensionMessage message; | 167 protocol::ExtensionMessage message; |
| 168 message.set_type(kVideoRecorderType); | 168 message.set_type(kVideoRecorderType); |
| 169 message.set_data(reply_json); | 169 message.set_data(reply_json); |
| 170 client_stub->DeliverHostMessage(message); | 170 client_stub->DeliverHostMessage(message); |
| 171 } | 171 } |
| 172 | 172 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 188 | 188 |
| 189 scoped_ptr<HostExtensionSession> | 189 scoped_ptr<HostExtensionSession> |
| 190 VideoFrameRecorderHostExtension::CreateExtensionSession( | 190 VideoFrameRecorderHostExtension::CreateExtensionSession( |
| 191 ClientSessionControl* client_session_control, | 191 ClientSessionControl* client_session_control, |
| 192 protocol::ClientStub* client_stub) { | 192 protocol::ClientStub* client_stub) { |
| 193 return make_scoped_ptr( | 193 return make_scoped_ptr( |
| 194 new VideoFrameRecorderHostExtensionSession(max_content_bytes_)); | 194 new VideoFrameRecorderHostExtensionSession(max_content_bytes_)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace remoting | 197 } // namespace remoting |
| OLD | NEW |