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

Side by Side Diff: chromeos/dbus/session_manager_client.cc

Issue 2869163002: Refactor dbus SessionManagerInterface.StartArcInterface (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « chromeos/dbus/session_manager_client.h ('k') | components/arc/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 login_manager::kSessionManagerInterface, 396 login_manager::kSessionManagerInterface,
396 login_manager::kSessionManagerCheckArcAvailability); 397 login_manager::kSessionManagerCheckArcAvailability);
397 398
398 session_manager_proxy_->CallMethod( 399 session_manager_proxy_->CallMethod(
399 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 400 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
400 base::Bind(&SessionManagerClientImpl::OnCheckArcAvailability, 401 base::Bind(&SessionManagerClientImpl::OnCheckArcAvailability,
401 weak_ptr_factory_.GetWeakPtr(), callback)); 402 weak_ptr_factory_.GetWeakPtr(), callback));
402 } 403 }
403 404
404 void StartArcInstance(const cryptohome::Identification& cryptohome_id, 405 void StartArcInstance(const cryptohome::Identification& cryptohome_id,
405 bool disable_boot_completed_broadcast, 406 bool skip_boot_completed_broadcast,
406 bool enable_vendor_privileged, 407 bool scan_vendor_priv_app,
407 const StartArcInstanceCallback& callback) override { 408 const StartArcInstanceCallback& callback) override {
408 dbus::MethodCall method_call( 409 dbus::MethodCall method_call(
409 login_manager::kSessionManagerInterface, 410 login_manager::kSessionManagerInterface,
410 login_manager::kSessionManagerStartArcInstance); 411 login_manager::kSessionManagerStartArcInstance);
411 dbus::MessageWriter writer(&method_call); 412 dbus::MessageWriter writer(&method_call);
412 writer.AppendString(cryptohome_id.id()); 413
413 writer.AppendBool(disable_boot_completed_broadcast); 414 login_manager::StartArcInstanceRequest request;
414 writer.AppendBool(enable_vendor_privileged); 415 request.set_account_id(cryptohome_id.id());
416 request.set_skip_boot_completed_broadcast(skip_boot_completed_broadcast);
417 request.set_scan_vendor_priv_app(scan_vendor_priv_app);
418 writer.AppendProtoAsArrayOfBytes(request);
419
415 session_manager_proxy_->CallMethodWithErrorCallback( 420 session_manager_proxy_->CallMethodWithErrorCallback(
416 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 421 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
417 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceSucceeded, 422 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceSucceeded,
418 weak_ptr_factory_.GetWeakPtr(), callback), 423 weak_ptr_factory_.GetWeakPtr(), callback),
419 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceFailed, 424 base::Bind(&SessionManagerClientImpl::OnStartArcInstanceFailed,
420 weak_ptr_factory_.GetWeakPtr(), callback)); 425 weak_ptr_factory_.GetWeakPtr(), callback));
421 } 426 }
422 427
423 void StopArcInstance(const ArcCallback& callback) override { 428 void StopArcInstance(const ArcCallback& callback) override {
424 dbus::MethodCall method_call(login_manager::kSessionManagerInterface, 429 dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1100
1096 SessionManagerClient* SessionManagerClient::Create( 1101 SessionManagerClient* SessionManagerClient::Create(
1097 DBusClientImplementationType type) { 1102 DBusClientImplementationType type) {
1098 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 1103 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
1099 return new SessionManagerClientImpl(); 1104 return new SessionManagerClientImpl();
1100 DCHECK_EQ(FAKE_DBUS_CLIENT_IMPLEMENTATION, type); 1105 DCHECK_EQ(FAKE_DBUS_CLIENT_IMPLEMENTATION, type);
1101 return new SessionManagerClientStubImpl(); 1106 return new SessionManagerClientStubImpl();
1102 } 1107 }
1103 1108
1104 } // namespace chromeos 1109 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/session_manager_client.h ('k') | components/arc/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698