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

Side by Side Diff: remoting/test/remote_host_info_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
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/remote_host_info_fetcher.h" 5 #include "remoting/test/remote_host_info_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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return; 80 return;
81 } 81 }
82 82
83 std::string response_string; 83 std::string response_string;
84 if (!request_->GetResponseAsString(&response_string)) { 84 if (!request_->GetResponseAsString(&response_string)) {
85 LOG(ERROR) << "Failed to retrieve RemoteHostInfo response data"; 85 LOG(ERROR) << "Failed to retrieve RemoteHostInfo response data";
86 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); 86 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
87 return; 87 return;
88 } 88 }
89 89
90 scoped_ptr<base::Value> response_value( 90 std::unique_ptr<base::Value> response_value(
91 base::JSONReader::Read(response_string)); 91 base::JSONReader::Read(response_string));
92 if (!response_value || 92 if (!response_value ||
93 !response_value->IsType(base::Value::TYPE_DICTIONARY)) { 93 !response_value->IsType(base::Value::TYPE_DICTIONARY)) {
94 LOG(ERROR) << "Failed to parse response string to JSON"; 94 LOG(ERROR) << "Failed to parse response string to JSON";
95 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); 95 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
96 return; 96 return;
97 } 97 }
98 98
99 std::string remote_host_status; 99 std::string remote_host_status;
100 const base::DictionaryValue* response; 100 const base::DictionaryValue* response;
(...skipping 14 matching lines...) Expand all
115 response->GetString("authorizationCode", 115 response->GetString("authorizationCode",
116 &remote_host_info.authorization_code); 116 &remote_host_info.authorization_code);
117 response->GetString("sharedSecret", &remote_host_info.shared_secret); 117 response->GetString("sharedSecret", &remote_host_info.shared_secret);
118 } 118 }
119 119
120 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); 120 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
121 } 121 }
122 122
123 } // namespace test 123 } // namespace test
124 } // namespace remoting 124 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/remote_host_info_fetcher.h ('k') | remoting/test/remote_host_info_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698