Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/protocol/pairing_registry.h" | 5 #include "remoting/protocol/pairing_registry.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool PairingRegistry::Pairing::operator==(const Pairing& other) const { | 85 bool PairingRegistry::Pairing::operator==(const Pairing& other) const { |
| 86 return created_time_ == other.created_time_ && | 86 return created_time_ == other.created_time_ && |
| 87 client_id_ == other.client_id_ && | 87 client_id_ == other.client_id_ && |
| 88 client_name_ == other.client_name_ && | 88 client_name_ == other.client_name_ && |
| 89 shared_secret_ == other.shared_secret_; | 89 shared_secret_ == other.shared_secret_; |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool PairingRegistry::Pairing::is_valid() const { | 92 bool PairingRegistry::Pairing::is_valid() const { |
| 93 return !client_id_.empty() && !shared_secret_.empty(); | 93 // |shared_secret_| is optional. It will be empty on Windows because the |
| 94 // privileged registry key can only be read in the elevated host process. | |
|
Jamie
2014/02/22 00:28:39
Could we fix this by setting a dummy value for the
| |
| 95 return !client_id_.empty(); | |
| 94 } | 96 } |
| 95 | 97 |
| 96 PairingRegistry::PairingRegistry( | 98 PairingRegistry::PairingRegistry( |
| 97 scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner, | 99 scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner, |
| 98 scoped_ptr<Delegate> delegate) | 100 scoped_ptr<Delegate> delegate) |
| 99 : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 101 : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 100 delegate_task_runner_(delegate_task_runner), | 102 delegate_task_runner_(delegate_task_runner), |
| 101 delegate_(delegate.Pass()) { | 103 delegate_(delegate.Pass()) { |
| 102 DCHECK(delegate_); | 104 DCHECK(delegate_); |
| 103 } | 105 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 | 293 |
| 292 void PairingRegistry::ServiceNextRequest() { | 294 void PairingRegistry::ServiceNextRequest() { |
| 293 if (pending_requests_.empty()) | 295 if (pending_requests_.empty()) |
| 294 return; | 296 return; |
| 295 | 297 |
| 296 PostTask(delegate_task_runner_, FROM_HERE, pending_requests_.front()); | 298 PostTask(delegate_task_runner_, FROM_HERE, pending_requests_.front()); |
| 297 } | 299 } |
| 298 | 300 |
| 299 } // namespace protocol | 301 } // namespace protocol |
| 300 } // namespace remoting | 302 } // namespace remoting |
| OLD | NEW |