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

Side by Side Diff: remoting/host/video_frame_recorder_host_extension.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
« no previous file with comments | « remoting/host/token_validator_factory_impl_unittest.cc ('k') | sync/api/sync_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « remoting/host/token_validator_factory_impl_unittest.cc ('k') | sync/api/sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698