OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/user/user_shell_client.h" | 5 #include "services/user/user_shell_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/filesystem/lock_table.h" | 10 #include "components/filesystem/lock_table.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 leveldb_service_runner_->DeleteSoon(FROM_HERE, leveldb_objects_.release()); | 88 leveldb_service_runner_->DeleteSoon(FROM_HERE, leveldb_objects_.release()); |
89 } | 89 } |
90 | 90 |
91 void UserShellClient::OnStart(const shell::Identity& identity) { | 91 void UserShellClient::OnStart(const shell::Identity& identity) { |
92 user_objects_.reset(new UserShellClient::UserServiceObjects( | 92 user_objects_.reset(new UserShellClient::UserServiceObjects( |
93 GetUserDirForUserId(identity.user_id()))); | 93 GetUserDirForUserId(identity.user_id()))); |
94 leveldb_objects_.reset( | 94 leveldb_objects_.reset( |
95 new UserShellClient::LevelDBServiceObjects(leveldb_service_runner_)); | 95 new UserShellClient::LevelDBServiceObjects(leveldb_service_runner_)); |
96 } | 96 } |
97 | 97 |
98 bool UserShellClient::OnConnect(shell::Connection* connection) { | 98 bool UserShellClient::OnConnect(const shell::Identity& remote_identity, |
99 connection->AddInterface<leveldb::mojom::LevelDBService>(this); | 99 shell::InterfaceRegistry* registry) { |
100 connection->AddInterface<mojom::UserService>(this); | 100 registry->AddInterface<leveldb::mojom::LevelDBService>(this); |
| 101 registry->AddInterface<mojom::UserService>(this); |
101 return true; | 102 return true; |
102 } | 103 } |
103 | 104 |
104 void UserShellClient::Create(const shell::Identity& remote_identity, | 105 void UserShellClient::Create(const shell::Identity& remote_identity, |
105 mojom::UserServiceRequest request) { | 106 mojom::UserServiceRequest request) { |
106 user_service_runner_->PostTask( | 107 user_service_runner_->PostTask( |
107 FROM_HERE, | 108 FROM_HERE, |
108 base::Bind(&UserShellClient::UserServiceObjects::OnUserServiceRequest, | 109 base::Bind(&UserShellClient::UserServiceObjects::OnUserServiceRequest, |
109 user_objects_->AsWeakPtr(), remote_identity, | 110 user_objects_->AsWeakPtr(), remote_identity, |
110 base::Passed(&request))); | 111 base::Passed(&request))); |
111 } | 112 } |
112 | 113 |
113 void UserShellClient::Create(const shell::Identity& remote_identity, | 114 void UserShellClient::Create(const shell::Identity& remote_identity, |
114 leveldb::mojom::LevelDBServiceRequest request) { | 115 leveldb::mojom::LevelDBServiceRequest request) { |
115 leveldb_service_runner_->PostTask( | 116 leveldb_service_runner_->PostTask( |
116 FROM_HERE, | 117 FROM_HERE, |
117 base::Bind( | 118 base::Bind( |
118 &UserShellClient::LevelDBServiceObjects::OnLevelDBServiceRequest, | 119 &UserShellClient::LevelDBServiceObjects::OnLevelDBServiceRequest, |
119 leveldb_objects_->AsWeakPtr(), remote_identity, | 120 leveldb_objects_->AsWeakPtr(), remote_identity, |
120 base::Passed(&request))); | 121 base::Passed(&request))); |
121 } | 122 } |
122 | 123 |
123 } // namespace user_service | 124 } // namespace user_service |
OLD | NEW |