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

Side by Side Diff: net/base/address_list.cc

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/base/address_list.h" 5 #include "net/base/address_list.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
11 #include "net/base/sys_addrinfo.h" 11 #include "net/base/sys_addrinfo.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 base::Value* NetLogAddressListCallback(const AddressList* address_list, 17 scoped_ptr<base::Value> NetLogAddressListCallback(
18 NetLogCaptureMode capture_mode) { 18 const AddressList* address_list,
19 NetLogCaptureMode capture_mode) {
19 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 20 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
20 scoped_ptr<base::ListValue> list(new base::ListValue()); 21 scoped_ptr<base::ListValue> list(new base::ListValue());
21 22
22 for (AddressList::const_iterator it = address_list->begin(); 23 for (AddressList::const_iterator it = address_list->begin();
23 it != address_list->end(); ++it) { 24 it != address_list->end(); ++it) {
24 list->Append(new base::StringValue(it->ToString())); 25 list->Append(new base::StringValue(it->ToString()));
25 } 26 }
26 27
27 dict->Set("address_list", list.Pass()); 28 dict->Set("address_list", list.Pass());
28 return dict.release(); 29 return dict.Pass();
29 } 30 }
30 31
31 } // namespace 32 } // namespace
32 33
33 AddressList::AddressList() {} 34 AddressList::AddressList() {}
34 35
35 AddressList::~AddressList() {} 36 AddressList::~AddressList() {}
36 37
37 AddressList::AddressList(const IPEndPoint& endpoint) { 38 AddressList::AddressList(const IPEndPoint& endpoint) {
38 push_back(endpoint); 39 push_back(endpoint);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 out.push_back(IPEndPoint(list[i].address(), port)); 83 out.push_back(IPEndPoint(list[i].address(), port));
83 return out; 84 return out;
84 } 85 }
85 86
86 void AddressList::SetDefaultCanonicalName() { 87 void AddressList::SetDefaultCanonicalName() {
87 DCHECK(!empty()); 88 DCHECK(!empty());
88 set_canonical_name(front().ToStringWithoutPort()); 89 set_canonical_name(front().ToStringWithoutPort());
89 } 90 }
90 91
91 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { 92 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const {
92 return base::Bind(&NetLogAddressListCallback, this); 93 return base::Bind(NetLogAddressListCallback, this);
93 } 94 }
94 95
95 } // namespace net 96 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698