| 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 "chromeos/dbus/session_manager_client.h" | 5 #include "chromeos/dbus/session_manager_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/task_scheduler/post_task.h" | 22 #include "base/task_scheduler/post_task.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "chromeos/chromeos_paths.h" | 24 #include "chromeos/chromeos_paths.h" |
| 25 #include "chromeos/cryptohome/cryptohome_parameters.h" | 25 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 26 #include "chromeos/dbus/blocking_method_caller.h" | 26 #include "chromeos/dbus/blocking_method_caller.h" |
| 27 #include "chromeos/dbus/cryptohome_client.h" | 27 #include "chromeos/dbus/cryptohome_client.h" |
| 28 #include "chromeos/dbus/login_manager/arc.pb.h" |
| 28 #include "components/policy/proto/device_management_backend.pb.h" | 29 #include "components/policy/proto/device_management_backend.pb.h" |
| 29 #include "crypto/sha2.h" | 30 #include "crypto/sha2.h" |
| 30 #include "dbus/bus.h" | 31 #include "dbus/bus.h" |
| 31 #include "dbus/message.h" | 32 #include "dbus/message.h" |
| 32 #include "dbus/object_path.h" | 33 #include "dbus/object_path.h" |
| 33 #include "dbus/object_proxy.h" | 34 #include "dbus/object_proxy.h" |
| 34 #include "dbus/scoped_dbus_error.h" | 35 #include "dbus/scoped_dbus_error.h" |
| 35 #include "third_party/cros_system_api/dbus/service_constants.h" | 36 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 36 | 37 |
| 37 namespace chromeos { | 38 namespace chromeos { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 login_manager::kSessionManagerInterface, | 411 login_manager::kSessionManagerInterface, |
| 411 login_manager::kSessionManagerCheckArcAvailability); | 412 login_manager::kSessionManagerCheckArcAvailability); |
| 412 | 413 |
| 413 session_manager_proxy_->CallMethod( | 414 session_manager_proxy_->CallMethod( |
| 414 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 415 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 415 base::Bind(&SessionManagerClientImpl::OnCheckArcAvailability, | 416 base::Bind(&SessionManagerClientImpl::OnCheckArcAvailability, |
| 416 weak_ptr_factory_.GetWeakPtr(), callback)); | 417 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 417 } | 418 } |
| 418 | 419 |
| 419 void StartArcInstance(const cryptohome::Identification& cryptohome_id, | 420 void StartArcInstance(const cryptohome::Identification& cryptohome_id, |
| 420 bool disable_boot_completed_broadcast, | 421 bool skip_boot_completed_broadcast, |
| 421 bool enable_vendor_privileged, | 422 bool scan_vendor_priv_app, |
| 422 const StartArcInstanceCallback& callback) override { | 423 const StartArcInstanceCallback& callback) override { |
| 423 dbus::MethodCall method_call( | 424 dbus::MethodCall method_call( |
| 424 login_manager::kSessionManagerInterface, | 425 login_manager::kSessionManagerInterface, |
| 425 login_manager::kSessionManagerStartArcInstance); | 426 login_manager::kSessionManagerStartArcInstance); |
| 426 dbus::MessageWriter writer(&method_call); | 427 dbus::MessageWriter writer(&method_call); |
| 427 writer.AppendString(cryptohome_id.id()); | 428 |
| 428 writer.AppendBool(disable_boot_completed_broadcast); | 429 login_manager::StartArcInstanceRequest request; |
| 429 writer.AppendBool(enable_vendor_privileged); | 430 request.set_account_id(cryptohome_id.id()); |
| 431 request.set_skip_boot_completed_broadcast(skip_boot_completed_broadcast); |
| 432 request.set_scan_vendor_priv_app(scan_vendor_priv_app); |
| 433 writer.AppendProtoAsArrayOfBytes(request); |
| 434 |
| 430 session_manager_proxy_->CallMethodWithErrorCallback( | 435 session_manager_proxy_->CallMethodWithErrorCallback( |
| 431 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 436 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 432 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceSucceeded, | 437 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceSucceeded, |
| 433 weak_ptr_factory_.GetWeakPtr(), callback), | 438 weak_ptr_factory_.GetWeakPtr(), callback), |
| 434 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceFailed, | 439 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceFailed, |
| 435 weak_ptr_factory_.GetWeakPtr(), callback)); | 440 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 436 } | 441 } |
| 437 | 442 |
| 438 void StopArcInstance(const ArcCallback& callback) override { | 443 void StopArcInstance(const ArcCallback& callback) override { |
| 439 dbus::MethodCall method_call(login_manager::kSessionManagerInterface, | 444 dbus::MethodCall method_call(login_manager::kSessionManagerInterface, |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 | 1167 |
| 1163 SessionManagerClient* SessionManagerClient::Create( | 1168 SessionManagerClient* SessionManagerClient::Create( |
| 1164 DBusClientImplementationType type) { | 1169 DBusClientImplementationType type) { |
| 1165 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 1170 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 1166 return new SessionManagerClientImpl(); | 1171 return new SessionManagerClientImpl(); |
| 1167 DCHECK_EQ(FAKE_DBUS_CLIENT_IMPLEMENTATION, type); | 1172 DCHECK_EQ(FAKE_DBUS_CLIENT_IMPLEMENTATION, type); |
| 1168 return new SessionManagerClientStubImpl(); | 1173 return new SessionManagerClientStubImpl(); |
| 1169 } | 1174 } |
| 1170 | 1175 |
| 1171 } // namespace chromeos | 1176 } // namespace chromeos |
| OLD | NEW |