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

Side by Side Diff: components/arc/arc_bridge_bootstrap.cc

Issue 2359003004: Disable ACTION_BOOT_COMPLETED event for 3rd party apps. (Closed)
Patch Set: Revise user facing strings in chrome://flags Created 4 years, 2 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
OLDNEW
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/command_line.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
15 #include "base/location.h" 16 #include "base/location.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
18 #include "base/posix/eintr_wrapper.h" 19 #include "base/posix/eintr_wrapper.h"
19 #include "base/sys_info.h" 20 #include "base/sys_info.h"
20 #include "base/task_runner_util.h" 21 #include "base/task_runner_util.h"
21 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
22 #include "base/threading/thread_task_runner_handle.h" 23 #include "base/threading/thread_task_runner_handle.h"
23 #include "base/threading/worker_pool.h" 24 #include "base/threading/worker_pool.h"
25 #include "chromeos/chromeos_switches.h"
24 #include "chromeos/cryptohome/cryptohome_parameters.h" 26 #include "chromeos/cryptohome/cryptohome_parameters.h"
25 #include "chromeos/dbus/dbus_method_call_status.h" 27 #include "chromeos/dbus/dbus_method_call_status.h"
26 #include "chromeos/dbus/dbus_thread_manager.h" 28 #include "chromeos/dbus/dbus_thread_manager.h"
27 #include "chromeos/dbus/session_manager_client.h" 29 #include "chromeos/dbus/session_manager_client.h"
28 #include "components/user_manager/user_manager.h" 30 #include "components/user_manager/user_manager.h"
29 #include "ipc/unix_domain_socket_util.h" 31 #include "ipc/unix_domain_socket_util.h"
30 #include "mojo/edk/embedder/embedder.h" 32 #include "mojo/edk/embedder/embedder.h"
31 #include "mojo/edk/embedder/platform_channel_pair.h" 33 #include "mojo/edk/embedder/platform_channel_pair.h"
32 #include "mojo/edk/embedder/platform_channel_utils_posix.h" 34 #include "mojo/edk/embedder/platform_channel_utils_posix.h"
33 #include "mojo/edk/embedder/platform_handle_vector.h" 35 #include "mojo/edk/embedder/platform_handle_vector.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 LOG(ERROR) << "ARC: Error creating socket"; 291 LOG(ERROR) << "ARC: Error creating socket";
290 AbortBoot(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE); 292 AbortBoot(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE);
291 return; 293 return;
292 } 294 }
293 295
294 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 296 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
295 DCHECK(user_manager->GetPrimaryUser()); 297 DCHECK(user_manager->GetPrimaryUser());
296 const cryptohome::Identification cryptohome_id( 298 const cryptohome::Identification cryptohome_id(
297 user_manager->GetPrimaryUser()->GetAccountId()); 299 user_manager->GetPrimaryUser()->GetAccountId());
298 300
301 // Read the disable-arc-boot-completed-broadcast flag
302 base::CommandLine *command_line = base::CommandLine::ForCurrentProcess();
303 bool disable_arc_boot_completed_broadcast =
304 command_line->HasSwitch(
305 chromeos::switches::kDisableArcBootCompletedBroadcast);
306
299 chromeos::SessionManagerClient* session_manager_client = 307 chromeos::SessionManagerClient* session_manager_client =
300 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); 308 chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
301 session_manager_client->StartArcInstance( 309 session_manager_client->StartArcInstance(
302 cryptohome_id, 310 cryptohome_id,
311 disable_arc_boot_completed_broadcast,
303 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted, 312 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted,
304 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd))); 313 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd)));
305 } 314 }
306 315
307 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd, 316 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd,
308 bool success) { 317 bool success) {
309 DCHECK(thread_checker_.CalledOnValidThread()); 318 DCHECK(thread_checker_.CalledOnValidThread());
310 if (!success) { 319 if (!success) {
311 LOG(ERROR) << "Failed to start ARC instance"; 320 LOG(ERROR) << "Failed to start ARC instance";
312 // Roll back the state to SOCKET_CREATING to avoid sending the D-Bus signal 321 // 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
441 } 450 }
442 451
443 } // namespace 452 } // namespace
444 453
445 // static 454 // static
446 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { 455 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() {
447 return base::WrapUnique(new ArcBridgeBootstrapImpl()); 456 return base::WrapUnique(new ArcBridgeBootstrapImpl());
448 } 457 }
449 458
450 } // namespace arc 459 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698