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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_api.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
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 "extensions/browser/api/cast_channel/cast_channel_api.h" 5 #include "extensions/browser/api/cast_channel/cast_channel_api.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 using cast_channel::ReadyState; 52 using cast_channel::ReadyState;
53 using content::BrowserThread; 53 using content::BrowserThread;
54 54
55 namespace { 55 namespace {
56 56
57 // T is an extension dictionary (MessageInfo or ChannelInfo) 57 // T is an extension dictionary (MessageInfo or ChannelInfo)
58 template <class T> 58 template <class T>
59 std::string ParamToString(const T& info) { 59 std::string ParamToString(const T& info) {
60 scoped_ptr<base::DictionaryValue> dict = info.ToValue(); 60 scoped_ptr<base::DictionaryValue> dict = info.ToValue();
61 std::string out; 61 std::string out;
62 base::JSONWriter::Write(dict.get(), &out); 62 base::JSONWriter::Write(*dict, &out);
63 return out; 63 return out;
64 } 64 }
65 65
66 // Fills |channel_info| from the destination and state of |socket|. 66 // Fills |channel_info| from the destination and state of |socket|.
67 void FillChannelInfo(const CastSocket& socket, ChannelInfo* channel_info) { 67 void FillChannelInfo(const CastSocket& socket, ChannelInfo* channel_info) {
68 DCHECK(channel_info); 68 DCHECK(channel_info);
69 channel_info->channel_id = socket.id(); 69 channel_info->channel_id = socket.id();
70 channel_info->url = socket.cast_url(); 70 channel_info->url = socket.cast_url();
71 const net::IPEndPoint& ip_endpoint = socket.ip_endpoint(); 71 const net::IPEndPoint& ip_endpoint = socket.ip_endpoint();
72 channel_info->connect_info.ip_address = ip_endpoint.ToStringWithoutPort(); 72 channel_info->connect_info.ip_address = ip_endpoint.ToStringWithoutPort();
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 std::string& signature = params_->signature; 637 std::string& signature = params_->signature;
638 if (signature.empty() || keys.empty() || 638 if (signature.empty() || keys.empty() ||
639 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { 639 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) {
640 SetError("Unable to set authority keys."); 640 SetError("Unable to set authority keys.");
641 } 641 }
642 642
643 AsyncWorkCompleted(); 643 AsyncWorkCompleted();
644 } 644 }
645 645
646 } // namespace extensions 646 } // namespace extensions
OLDNEW
« no previous file with comments | « dbus/values_util_unittest.cc ('k') | extensions/browser/api/cast_channel/keep_alive_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698