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

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

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/pairing_registry_delegate_win.h" 5 #include "remoting/host/pairing_registry_delegate_win.h"
6 6
7 #include <utility>
8
7 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "base/win/registry.h" 13 #include "base/win/registry.h"
12 14
13 namespace remoting { 15 namespace remoting {
14 16
15 namespace { 17 namespace {
16 18
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SetLastError(result); 134 SetLastError(result);
133 PLOG(ERROR) << "Cannot get the name of value " << index; 135 PLOG(ERROR) << "Cannot get the name of value " << index;
134 continue; 136 continue;
135 } 137 }
136 138
137 PairingRegistry::Pairing pairing = Load(base::WideToUTF8(value_name)); 139 PairingRegistry::Pairing pairing = Load(base::WideToUTF8(value_name));
138 if (pairing.is_valid()) 140 if (pairing.is_valid())
139 pairings->Append(pairing.ToValue().release()); 141 pairings->Append(pairing.ToValue().release());
140 } 142 }
141 143
142 return pairings.Pass(); 144 return pairings;
143 } 145 }
144 146
145 bool PairingRegistryDelegateWin::DeleteAll() { 147 bool PairingRegistryDelegateWin::DeleteAll() {
146 if (!privileged_.Valid()) { 148 if (!privileged_.Valid()) {
147 LOG(ERROR) << "Cannot delete pairings: the delegate is read-only."; 149 LOG(ERROR) << "Cannot delete pairings: the delegate is read-only.";
148 return false; 150 return false;
149 } 151 }
150 152
151 // Enumerate and delete the values in the privileged and unprivileged keys 153 // Enumerate and delete the values in the privileged and unprivileged keys
152 // separately in case they get out of sync. 154 // separately in case they get out of sync.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Extract the shared secret to a separate dictionary. 218 // Extract the shared secret to a separate dictionary.
217 scoped_ptr<base::Value> secret_key; 219 scoped_ptr<base::Value> secret_key;
218 CHECK(pairing_json->Remove(PairingRegistry::kSharedSecretKey, &secret_key)); 220 CHECK(pairing_json->Remove(PairingRegistry::kSharedSecretKey, &secret_key));
219 scoped_ptr<base::DictionaryValue> secret_json(new base::DictionaryValue()); 221 scoped_ptr<base::DictionaryValue> secret_json(new base::DictionaryValue());
220 secret_json->Set(PairingRegistry::kSharedSecretKey, secret_key.release()); 222 secret_json->Set(PairingRegistry::kSharedSecretKey, secret_key.release());
221 223
222 // presubmit: allow wstring 224 // presubmit: allow wstring
223 std::wstring value_name = base::UTF8ToWide(pairing.client_id()); 225 std::wstring value_name = base::UTF8ToWide(pairing.client_id());
224 226
225 // Write pairing to the registry. 227 // Write pairing to the registry.
226 if (!WriteValue(privileged_, value_name.c_str(), secret_json.Pass()) || 228 if (!WriteValue(privileged_, value_name.c_str(), std::move(secret_json)) ||
227 !WriteValue(unprivileged_, value_name.c_str(), pairing_json.Pass())) { 229 !WriteValue(unprivileged_, value_name.c_str(), std::move(pairing_json))) {
228 return false; 230 return false;
229 } 231 }
230 232
231 return true; 233 return true;
232 } 234 }
233 235
234 bool PairingRegistryDelegateWin::Delete(const std::string& client_id) { 236 bool PairingRegistryDelegateWin::Delete(const std::string& client_id) {
235 if (!privileged_.Valid()) { 237 if (!privileged_.Valid()) {
236 LOG(ERROR) << "Cannot delete pairing entry '" << client_id 238 LOG(ERROR) << "Cannot delete pairing entry '" << client_id
237 << "': the delegate is read-only."; 239 << "': the delegate is read-only.";
(...skipping 21 matching lines...) Expand all
259 } 261 }
260 262
261 return true; 263 return true;
262 } 264 }
263 265
264 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() { 266 scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
265 return make_scoped_ptr(new PairingRegistryDelegateWin()); 267 return make_scoped_ptr(new PairingRegistryDelegateWin());
266 } 268 }
267 269
268 } // namespace remoting 270 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/pairing_registry_delegate_linux.cc ('k') | remoting/host/pam_authorization_factory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698