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

Side by Side Diff: remoting/test/host_list_fetcher.cc

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
« no previous file with comments | « remoting/test/host_list_fetcher.h ('k') | remoting/test/host_list_fetcher_unittest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/test/host_list_fetcher.h" 5 #include "remoting/test/host_list_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 LOG(ERROR) << "Hostlist request failed with error code: " << response_code; 53 LOG(ERROR) << "Hostlist request failed with error code: " << response_code;
54 return false; 54 return false;
55 } 55 }
56 56
57 std::string response_string; 57 std::string response_string;
58 if (!request_->GetResponseAsString(&response_string)) { 58 if (!request_->GetResponseAsString(&response_string)) {
59 LOG(ERROR) << "Failed to retrieve Hostlist response data"; 59 LOG(ERROR) << "Failed to retrieve Hostlist response data";
60 return false; 60 return false;
61 } 61 }
62 62
63 scoped_ptr<base::Value> response_value( 63 std::unique_ptr<base::Value> response_value(
64 base::JSONReader::Read(response_string)); 64 base::JSONReader::Read(response_string));
65 if (!response_value || 65 if (!response_value ||
66 !response_value->IsType(base::Value::TYPE_DICTIONARY)) { 66 !response_value->IsType(base::Value::TYPE_DICTIONARY)) {
67 LOG(ERROR) << "Failed to parse response string to JSON"; 67 LOG(ERROR) << "Failed to parse response string to JSON";
68 return false; 68 return false;
69 } 69 }
70 70
71 const base::DictionaryValue* response; 71 const base::DictionaryValue* response;
72 if (!response_value->GetAsDictionary(&response)) { 72 if (!response_value->GetAsDictionary(&response)) {
73 LOG(ERROR) << "Failed to convert parsed JSON to a dictionary object"; 73 LOG(ERROR) << "Failed to convert parsed JSON to a dictionary object";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::vector<HostInfo> hostlist; 106 std::vector<HostInfo> hostlist;
107 107
108 if (!ProcessResponse(&hostlist)) { 108 if (!ProcessResponse(&hostlist)) {
109 hostlist.clear(); 109 hostlist.clear();
110 } 110 }
111 base::ResetAndReturn(&hostlist_callback_).Run(hostlist); 111 base::ResetAndReturn(&hostlist_callback_).Run(hostlist);
112 } 112 }
113 113
114 } // namespace test 114 } // namespace test
115 } // namespace remoting 115 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/host_list_fetcher.h ('k') | remoting/test/host_list_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698