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

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

Issue 2023803003: arc: Send cryptohome ID on starting ARC instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: s/GetActiveUser/GetPrimaryUser/g Created 4 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 | « components/arc/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/task_runner_util.h" 19 #include "base/task_runner_util.h"
20 #include "base/threading/thread_checker.h" 20 #include "base/threading/thread_checker.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "base/threading/worker_pool.h" 22 #include "base/threading/worker_pool.h"
23 #include "chromeos/cryptohome/cryptohome_parameters.h"
23 #include "chromeos/dbus/dbus_method_call_status.h" 24 #include "chromeos/dbus/dbus_method_call_status.h"
24 #include "chromeos/dbus/dbus_thread_manager.h" 25 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "chromeos/dbus/session_manager_client.h" 26 #include "chromeos/dbus/session_manager_client.h"
27 #include "components/user_manager/user_manager.h"
26 #include "ipc/unix_domain_socket_util.h" 28 #include "ipc/unix_domain_socket_util.h"
27 #include "mojo/edk/embedder/embedder.h" 29 #include "mojo/edk/embedder/embedder.h"
28 #include "mojo/edk/embedder/platform_channel_pair.h" 30 #include "mojo/edk/embedder/platform_channel_pair.h"
29 #include "mojo/edk/embedder/platform_channel_utils_posix.h" 31 #include "mojo/edk/embedder/platform_channel_utils_posix.h"
30 #include "mojo/edk/embedder/platform_handle_vector.h" 32 #include "mojo/edk/embedder/platform_handle_vector.h"
31 #include "mojo/edk/embedder/scoped_platform_handle.h" 33 #include "mojo/edk/embedder/scoped_platform_handle.h"
32 #include "mojo/public/cpp/bindings/binding.h" 34 #include "mojo/public/cpp/bindings/binding.h"
33 35
34 namespace arc { 36 namespace arc {
35 37
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 VLOG(1) << "Stop() called while connecting"; 204 VLOG(1) << "Stop() called while connecting";
203 return; 205 return;
204 } 206 }
205 SetState(State::STARTING); 207 SetState(State::STARTING);
206 208
207 if (!socket_fd.is_valid()) { 209 if (!socket_fd.is_valid()) {
208 LOG(ERROR) << "ARC: Error creating socket"; 210 LOG(ERROR) << "ARC: Error creating socket";
209 Stop(); 211 Stop();
210 return; 212 return;
211 } 213 }
214
215 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
216 DCHECK(user_manager->GetPrimaryUser());
217 const cryptohome::Identification cryptohome_id(
218 user_manager->GetPrimaryUser()->GetAccountId());
219
212 chromeos::SessionManagerClient* session_manager_client = 220 chromeos::SessionManagerClient* session_manager_client =
213 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); 221 chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
214 session_manager_client->StartArcInstance( 222 session_manager_client->StartArcInstance(
215 kArcBridgeSocketPath, 223 cryptohome_id,
216 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted, 224 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceStarted,
217 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd))); 225 weak_factory_.GetWeakPtr(), base::Passed(&socket_fd)));
218 } 226 }
219 227
220 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd, 228 void ArcBridgeBootstrapImpl::OnInstanceStarted(base::ScopedFD socket_fd,
221 bool success) { 229 bool success) {
222 DCHECK(thread_checker_.CalledOnValidThread()); 230 DCHECK(thread_checker_.CalledOnValidThread());
223 if (state_ != State::STARTING) { 231 if (state_ != State::STARTING) {
224 VLOG(1) << "Stop() called when ARC is not running"; 232 VLOG(1) << "Stop() called when ARC is not running";
225 return; 233 return;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 343 }
336 344
337 } // namespace 345 } // namespace
338 346
339 // static 347 // static
340 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { 348 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() {
341 return base::WrapUnique(new ArcBridgeBootstrapImpl()); 349 return base::WrapUnique(new ArcBridgeBootstrapImpl());
342 } 350 }
343 351
344 } // namespace arc 352 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698