OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sandbox/win/src/broker_services.h" | 5 #include "sandbox/win/src/broker_services.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "base/win/scoped_handle.h" | 10 #include "base/win/scoped_handle.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 HANDLE job_temp; | 310 HANDLE job_temp; |
311 result = policy_base->MakeJobObject(&job_temp); | 311 result = policy_base->MakeJobObject(&job_temp); |
312 if (SBOX_ALL_OK != result) | 312 if (SBOX_ALL_OK != result) |
313 return result; | 313 return result; |
314 | 314 |
315 base::win::ScopedHandle job(job_temp); | 315 base::win::ScopedHandle job(job_temp); |
316 | 316 |
317 // Initialize the startup information from the policy. | 317 // Initialize the startup information from the policy. |
318 base::win::StartupInformation startup_info; | 318 base::win::StartupInformation startup_info; |
319 string16 desktop = policy_base->GetAlternateDesktop(); | 319 base::string16 desktop = policy_base->GetAlternateDesktop(); |
320 if (!desktop.empty()) { | 320 if (!desktop.empty()) { |
321 startup_info.startup_info()->lpDesktop = | 321 startup_info.startup_info()->lpDesktop = |
322 const_cast<wchar_t*>(desktop.c_str()); | 322 const_cast<wchar_t*>(desktop.c_str()); |
323 } | 323 } |
324 | 324 |
325 bool inherit_handles = false; | 325 bool inherit_handles = false; |
326 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 326 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
327 int attribute_count = 0; | 327 int attribute_count = 0; |
328 const AppContainerAttributes* app_container = | 328 const AppContainerAttributes* app_container = |
329 policy_base->GetAppContainer(); | 329 policy_base->GetAppContainer(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // Release the pointer since it will be cleaned up by the callback. | 479 // Release the pointer since it will be cleaned up by the callback. |
480 peer.release(); | 480 peer.release(); |
481 return SBOX_ALL_OK; | 481 return SBOX_ALL_OK; |
482 } | 482 } |
483 | 483 |
484 ResultCode BrokerServicesBase::InstallAppContainer(const wchar_t* sid, | 484 ResultCode BrokerServicesBase::InstallAppContainer(const wchar_t* sid, |
485 const wchar_t* name) { | 485 const wchar_t* name) { |
486 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) | 486 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) |
487 return SBOX_ERROR_UNSUPPORTED; | 487 return SBOX_ERROR_UNSUPPORTED; |
488 | 488 |
489 string16 old_name = LookupAppContainer(sid); | 489 base::string16 old_name = LookupAppContainer(sid); |
490 if (old_name.empty()) | 490 if (old_name.empty()) |
491 return CreateAppContainer(sid, name); | 491 return CreateAppContainer(sid, name); |
492 | 492 |
493 if (old_name != name) | 493 if (old_name != name) |
494 return SBOX_ERROR_INVALID_APP_CONTAINER; | 494 return SBOX_ERROR_INVALID_APP_CONTAINER; |
495 | 495 |
496 return SBOX_ALL_OK; | 496 return SBOX_ALL_OK; |
497 } | 497 } |
498 | 498 |
499 ResultCode BrokerServicesBase::UninstallAppContainer(const wchar_t* sid) { | 499 ResultCode BrokerServicesBase::UninstallAppContainer(const wchar_t* sid) { |
500 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) | 500 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) |
501 return SBOX_ERROR_UNSUPPORTED; | 501 return SBOX_ERROR_UNSUPPORTED; |
502 | 502 |
503 string16 name = LookupAppContainer(sid); | 503 base::string16 name = LookupAppContainer(sid); |
504 if (name.empty()) | 504 if (name.empty()) |
505 return SBOX_ERROR_INVALID_APP_CONTAINER; | 505 return SBOX_ERROR_INVALID_APP_CONTAINER; |
506 | 506 |
507 return DeleteAppContainer(sid); | 507 return DeleteAppContainer(sid); |
508 } | 508 } |
509 | 509 |
510 } // namespace sandbox | 510 } // namespace sandbox |
OLD | NEW |