OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/arc_bridge_bootstrap.h" | 5 #include "components/arc/arc_bridge_bootstrap.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <grp.h> | 8 #include <grp.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/posix/eintr_wrapper.h" | 18 #include "base/posix/eintr_wrapper.h" |
19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
20 #include "base/task_runner_util.h" | 20 #include "base/task_runner_util.h" |
21 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" |
22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
23 #include "base/threading/worker_pool.h" | 23 #include "base/threading/worker_pool.h" |
24 #include "chromeos/cryptohome/cryptohome_parameters.h" | 24 #include "chromeos/cryptohome/cryptohome_parameters.h" |
25 #include "chromeos/dbus/dbus_method_call_status.h" | 25 #include "chromeos/dbus/dbus_method_call_status.h" |
26 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
27 #include "chromeos/dbus/session_manager_client.h" | 27 #include "chromeos/dbus/session_manager_client.h" |
| 28 #include "components/arc/arc_features.h" |
28 #include "components/user_manager/user_manager.h" | 29 #include "components/user_manager/user_manager.h" |
29 #include "ipc/unix_domain_socket_util.h" | 30 #include "ipc/unix_domain_socket_util.h" |
30 #include "mojo/edk/embedder/embedder.h" | 31 #include "mojo/edk/embedder/embedder.h" |
31 #include "mojo/edk/embedder/platform_channel_pair.h" | 32 #include "mojo/edk/embedder/platform_channel_pair.h" |
32 #include "mojo/edk/embedder/platform_channel_utils_posix.h" | 33 #include "mojo/edk/embedder/platform_channel_utils_posix.h" |
33 #include "mojo/edk/embedder/platform_handle_vector.h" | 34 #include "mojo/edk/embedder/platform_handle_vector.h" |
34 #include "mojo/edk/embedder/scoped_platform_handle.h" | 35 #include "mojo/edk/embedder/scoped_platform_handle.h" |
35 #include "mojo/public/cpp/bindings/binding.h" | 36 #include "mojo/public/cpp/bindings/binding.h" |
36 | 37 |
37 namespace arc { | 38 namespace arc { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 LOG(ERROR) << "ARC: Error creating socket"; | 290 LOG(ERROR) << "ARC: Error creating socket"; |
290 AbortBoot(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE); | 291 AbortBoot(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE); |
291 return; | 292 return; |
292 } | 293 } |
293 | 294 |
294 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 295 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
295 DCHECK(user_manager->GetPrimaryUser()); | 296 DCHECK(user_manager->GetPrimaryUser()); |
296 const cryptohome::Identification cryptohome_id( | 297 const cryptohome::Identification cryptohome_id( |
297 user_manager->GetPrimaryUser()->GetAccountId()); | 298 user_manager->GetPrimaryUser()->GetAccountId()); |
298 | 299 |
| 300 bool disable_boot_completed_broadcast = |
| 301 !base::FeatureList::IsEnabled(arc::kBootCompletedBroadcastFeature); |
| 302 |
299 chromeos::SessionManagerClient* session_manager_client = | 303 chromeos::SessionManagerClient* session_manager_client = |
300 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | 304 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
301 session_manager_client->StartArcInstance( | 305 session_manager_client->StartArcInstance( |
302 cryptohome_id, | 306 cryptohome_id, |
| 307 disable_boot_completed_broadcast, |
303 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted, | 308 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted, |
304 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd))); | 309 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd))); |
305 } | 310 } |
306 | 311 |
307 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd, | 312 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd, |
308 bool success) { | 313 bool success) { |
309 DCHECK(thread_checker_.CalledOnValidThread()); | 314 DCHECK(thread_checker_.CalledOnValidThread()); |
310 if (!success) { | 315 if (!success) { |
311 LOG(ERROR) << "Failed to start ARC instance"; | 316 LOG(ERROR) << "Failed to start ARC instance"; |
312 // Roll back the state to SOCKET_CREATING to avoid sending the D-Bus signal | 317 // Roll back the state to SOCKET_CREATING to avoid sending the D-Bus signal |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 446 } |
442 | 447 |
443 } // namespace | 448 } // namespace |
444 | 449 |
445 // static | 450 // static |
446 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 451 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
447 return base::WrapUnique(new ArcBridgeBootstrapImpl()); | 452 return base::WrapUnique(new ArcBridgeBootstrapImpl()); |
448 } | 453 } |
449 | 454 |
450 } // namespace arc | 455 } // namespace arc |
OLD | NEW |