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

Side by Side Diff: remoting/host/setup/daemon_controller_delegate_win.cc

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // The maximum duration of keeping a reference to an unprivileged instance of 51 // The maximum duration of keeping a reference to an unprivileged instance of
52 // the Daemon Controller. This interval should not be too long. If upgrade 52 // the Daemon Controller. This interval should not be too long. If upgrade
53 // happens while there is a live reference to a Daemon Controller instance 53 // happens while there is a live reference to a Daemon Controller instance
54 // the old binary still can be used. So dropping the references often makes sure 54 // the old binary still can be used. So dropping the references often makes sure
55 // that the old binary will go away sooner. 55 // that the old binary will go away sooner.
56 const int kUnprivilegedTimeoutSec = 60; 56 const int kUnprivilegedTimeoutSec = 60;
57 57
58 void ConfigToString(const base::DictionaryValue& config, ScopedBstr* out) { 58 void ConfigToString(const base::DictionaryValue& config, ScopedBstr* out) {
59 std::string config_str; 59 std::string config_str;
60 base::JSONWriter::Write(&config, &config_str); 60 base::JSONWriter::Write(&config, &config_str);
61 ScopedBstr config_scoped_bstr(UTF8ToUTF16(config_str).c_str()); 61 ScopedBstr config_scoped_bstr(base::UTF8ToUTF16(config_str).c_str());
62 out->Swap(config_scoped_bstr); 62 out->Swap(config_scoped_bstr);
63 } 63 }
64 64
65 DaemonController::State ConvertToDaemonState(DWORD service_state) { 65 DaemonController::State ConvertToDaemonState(DWORD service_state) {
66 switch (service_state) { 66 switch (service_state) {
67 case SERVICE_RUNNING: 67 case SERVICE_RUNNING:
68 return DaemonController::STATE_STARTED; 68 return DaemonController::STATE_STARTED;
69 69
70 case SERVICE_CONTINUE_PENDING: 70 case SERVICE_CONTINUE_PENDING:
71 case SERVICE_START_PENDING: 71 case SERVICE_START_PENDING:
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Get the host configuration. 176 // Get the host configuration.
177 ScopedBstr host_config; 177 ScopedBstr host_config;
178 hr = control_->GetConfig(host_config.Receive()); 178 hr = control_->GetConfig(host_config.Receive());
179 if (FAILED(hr)) 179 if (FAILED(hr))
180 return scoped_ptr<base::DictionaryValue>(); 180 return scoped_ptr<base::DictionaryValue>();
181 181
182 // Parse the string into a dictionary. 182 // Parse the string into a dictionary.
183 base::string16 file_content( 183 base::string16 file_content(
184 static_cast<BSTR>(host_config), host_config.Length()); 184 static_cast<BSTR>(host_config), host_config.Length());
185 scoped_ptr<base::Value> config( 185 scoped_ptr<base::Value> config(
186 base::JSONReader::Read(UTF16ToUTF8(file_content), 186 base::JSONReader::Read(base::UTF16ToUTF8(file_content),
187 base::JSON_ALLOW_TRAILING_COMMAS)); 187 base::JSON_ALLOW_TRAILING_COMMAS));
188 188
189 if (!config || config->GetType() != base::Value::TYPE_DICTIONARY) 189 if (!config || config->GetType() != base::Value::TYPE_DICTIONARY)
190 return scoped_ptr<base::DictionaryValue>(); 190 return scoped_ptr<base::DictionaryValue>();
191 191
192 return scoped_ptr<base::DictionaryValue>( 192 return scoped_ptr<base::DictionaryValue>(
193 static_cast<base::DictionaryValue*>(config.release())); 193 static_cast<base::DictionaryValue*>(config.release()));
194 } 194 }
195 195
196 void DaemonControllerDelegateWin::SetConfigAndStart( 196 void DaemonControllerDelegateWin::SetConfigAndStart(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 HRESULT hr = ActivateController(); 271 HRESULT hr = ActivateController();
272 if (FAILED(hr)) 272 if (FAILED(hr))
273 return std::string(); 273 return std::string();
274 274
275 // Get the version string. 275 // Get the version string.
276 ScopedBstr version; 276 ScopedBstr version;
277 hr = control_->GetVersion(version.Receive()); 277 hr = control_->GetVersion(version.Receive());
278 if (FAILED(hr)) 278 if (FAILED(hr))
279 return std::string(); 279 return std::string();
280 280
281 return UTF16ToUTF8( 281 return base::UTF16ToUTF8(
282 base::string16(static_cast<BSTR>(version), version.Length())); 282 base::string16(static_cast<BSTR>(version), version.Length()));
283 } 283 }
284 284
285 DaemonController::UsageStatsConsent 285 DaemonController::UsageStatsConsent
286 DaemonControllerDelegateWin::GetUsageStatsConsent() { 286 DaemonControllerDelegateWin::GetUsageStatsConsent() {
287 DaemonController::UsageStatsConsent consent; 287 DaemonController::UsageStatsConsent consent;
288 consent.supported = true; 288 consent.supported = true;
289 consent.allowed = false; 289 consent.allowed = false;
290 consent.set_by_policy = false; 290 consent.set_by_policy = false;
291 291
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 done.Run(HResultToAsyncResult(hr)); 449 done.Run(HResultToAsyncResult(hr));
450 } 450 }
451 451
452 scoped_refptr<DaemonController> DaemonController::Create() { 452 scoped_refptr<DaemonController> DaemonController::Create() {
453 scoped_ptr<DaemonController::Delegate> delegate( 453 scoped_ptr<DaemonController::Delegate> delegate(
454 new DaemonControllerDelegateWin()); 454 new DaemonControllerDelegateWin());
455 return new DaemonController(delegate.Pass()); 455 return new DaemonController(delegate.Pass());
456 } 456 }
457 457
458 } // namespace remoting 458 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/policy_hack/policy_watcher_win.cc ('k') | remoting/host/setup/daemon_installer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698