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 #ifndef SERVICES_USER_USER_SHELL_CLIENT_H_ | 5 #ifndef SERVICES_USER_USER_SHELL_CLIENT_H_ |
6 #define SERVICES_USER_USER_SHELL_CLIENT_H_ | 6 #define SERVICES_USER_USER_SHELL_CLIENT_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "components/filesystem/lock_table.h" | 10 #include "components/filesystem/lock_table.h" |
11 #include "components/leveldb/public/interfaces/leveldb.mojom.h" | 11 #include "components/leveldb/public/interfaces/leveldb.mojom.h" |
12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
13 #include "services/shell/public/cpp/interface_factory.h" | 13 #include "services/shell/public/cpp/interface_factory.h" |
14 #include "services/shell/public/cpp/shell_client.h" | 14 #include "services/shell/public/cpp/service.h" |
15 #include "services/user/public/interfaces/user_service.mojom.h" | 15 #include "services/user/public/interfaces/user_service.mojom.h" |
16 | 16 |
17 namespace user_service { | 17 namespace user_service { |
18 | 18 |
19 std::unique_ptr<shell::ShellClient> CreateUserShellClient( | 19 std::unique_ptr<shell::Service> CreateUserService( |
20 scoped_refptr<base::SingleThreadTaskRunner> user_service_runner, | 20 scoped_refptr<base::SingleThreadTaskRunner> user_service_runner, |
21 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner, | 21 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner, |
22 const base::Closure& quit_closure); | 22 const base::Closure& quit_closure); |
23 | 23 |
24 class UserShellClient | 24 class UserShellClient |
25 : public shell::ShellClient, | 25 : public shell::Service, |
26 public shell::InterfaceFactory<mojom::UserService>, | 26 public shell::InterfaceFactory<mojom::UserService>, |
27 public shell::InterfaceFactory<leveldb::mojom::LevelDBService> { | 27 public shell::InterfaceFactory<leveldb::mojom::LevelDBService> { |
28 public: | 28 public: |
29 UserShellClient( | 29 UserShellClient( |
30 scoped_refptr<base::SingleThreadTaskRunner> user_service_runner, | 30 scoped_refptr<base::SingleThreadTaskRunner> user_service_runner, |
31 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner); | 31 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner); |
32 ~UserShellClient() override; | 32 ~UserShellClient() override; |
33 | 33 |
34 private: | 34 private: |
35 // |ShellClient| override: | 35 // |Service| override: |
36 void Initialize(shell::Connector* connector, | 36 void OnStart(shell::Connector* connector, |
37 const shell::Identity& identity, | 37 const shell::Identity& identity, |
38 uint32_t id) override; | 38 uint32_t id) override; |
39 bool AcceptConnection(shell::Connection* connection) override; | 39 bool OnConnect(shell::Connection* connection) override; |
40 | 40 |
41 // |InterfaceFactory<mojom::UserService>| implementation: | 41 // |InterfaceFactory<mojom::UserService>| implementation: |
42 void Create(shell::Connection* connection, | 42 void Create(shell::Connection* connection, |
43 mojom::UserServiceRequest request) override; | 43 mojom::UserServiceRequest request) override; |
44 | 44 |
45 // |InterfaceFactory<LevelDBService>| implementation: | 45 // |InterfaceFactory<LevelDBService>| implementation: |
46 void Create(shell::Connection* connection, | 46 void Create(shell::Connection* connection, |
47 leveldb::mojom::LevelDBServiceRequest request) override; | 47 leveldb::mojom::LevelDBServiceRequest request) override; |
48 | 48 |
49 void OnLevelDBServiceRequest(shell::Connection* connection, | 49 void OnLevelDBServiceRequest(shell::Connection* connection, |
(...skipping 10 matching lines...) Expand all Loading... |
60 | 60 |
61 class LevelDBServiceObjects; | 61 class LevelDBServiceObjects; |
62 std::unique_ptr<LevelDBServiceObjects> leveldb_objects_; | 62 std::unique_ptr<LevelDBServiceObjects> leveldb_objects_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(UserShellClient); | 64 DISALLOW_COPY_AND_ASSIGN(UserShellClient); |
65 }; | 65 }; |
66 | 66 |
67 } // namespace user_service | 67 } // namespace user_service |
68 | 68 |
69 #endif // SERVICES_USER_USER_SHELL_CLIENT_H_ | 69 #endif // SERVICES_USER_USER_SHELL_CLIENT_H_ |
OLD | NEW |