| 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/host/setup/daemon_controller_delegate_win.h" | 5 #include "remoting/host/setup/daemon_controller_delegate_win.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return DaemonController::STATE_NOT_INSTALLED; | 166 return DaemonController::STATE_NOT_INSTALLED; |
| 167 default: | 167 default: |
| 168 return DaemonController::STATE_UNKNOWN; | 168 return DaemonController::STATE_UNKNOWN; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 scoped_ptr<base::DictionaryValue> DaemonControllerDelegateWin::GetConfig() { | 172 scoped_ptr<base::DictionaryValue> DaemonControllerDelegateWin::GetConfig() { |
| 173 // Configure and start the Daemon Controller if it is installed already. | 173 // Configure and start the Daemon Controller if it is installed already. |
| 174 HRESULT hr = ActivateController(); | 174 HRESULT hr = ActivateController(); |
| 175 if (FAILED(hr)) | 175 if (FAILED(hr)) |
| 176 return scoped_ptr<base::DictionaryValue>(); | 176 return nullptr; |
| 177 | 177 |
| 178 // Get the host configuration. | 178 // Get the host configuration. |
| 179 ScopedBstr host_config; | 179 ScopedBstr host_config; |
| 180 hr = control_->GetConfig(host_config.Receive()); | 180 hr = control_->GetConfig(host_config.Receive()); |
| 181 if (FAILED(hr)) | 181 if (FAILED(hr)) |
| 182 return scoped_ptr<base::DictionaryValue>(); | 182 return nullptr; |
| 183 | 183 |
| 184 // Parse the string into a dictionary. | 184 // Parse the string into a dictionary. |
| 185 base::string16 file_content( | 185 base::string16 file_content( |
| 186 static_cast<BSTR>(host_config), host_config.Length()); | 186 static_cast<BSTR>(host_config), host_config.Length()); |
| 187 scoped_ptr<base::Value> config( | 187 scoped_ptr<base::Value> config( |
| 188 base::JSONReader::Read(base::UTF16ToUTF8(file_content), | 188 base::JSONReader::Read(base::UTF16ToUTF8(file_content), |
| 189 base::JSON_ALLOW_TRAILING_COMMAS)); | 189 base::JSON_ALLOW_TRAILING_COMMAS)); |
| 190 | 190 |
| 191 if (!config || config->GetType() != base::Value::TYPE_DICTIONARY) | 191 if (!config || config->GetType() != base::Value::TYPE_DICTIONARY) |
| 192 return scoped_ptr<base::DictionaryValue>(); | 192 return nullptr; |
| 193 | 193 |
| 194 return scoped_ptr<base::DictionaryValue>( | 194 return scoped_ptr<base::DictionaryValue>( |
| 195 static_cast<base::DictionaryValue*>(config.release())); | 195 static_cast<base::DictionaryValue*>(config.release())); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void DaemonControllerDelegateWin::InstallHost( | 198 void DaemonControllerDelegateWin::InstallHost( |
| 199 const DaemonController::CompletionCallback& done) { | 199 const DaemonController::CompletionCallback& done) { |
| 200 DoInstallHost(base::Bind(&InvokeCompletionCallback, done)); | 200 DoInstallHost(base::Bind(&InvokeCompletionCallback, done)); |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 InvokeCompletionCallback(done, hr); | 458 InvokeCompletionCallback(done, hr); |
| 459 } | 459 } |
| 460 | 460 |
| 461 scoped_refptr<DaemonController> DaemonController::Create() { | 461 scoped_refptr<DaemonController> DaemonController::Create() { |
| 462 scoped_ptr<DaemonController::Delegate> delegate( | 462 scoped_ptr<DaemonController::Delegate> delegate( |
| 463 new DaemonControllerDelegateWin()); | 463 new DaemonControllerDelegateWin()); |
| 464 return new DaemonController(delegate.Pass()); | 464 return new DaemonController(delegate.Pass()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace remoting | 467 } // namespace remoting |
| OLD | NEW |