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 CHROME_BROWSER_CHROMEOS_CHROME_INTERFACE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CHROME_INTERFACE_FACTORY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CHROME_INTERFACE_FACTORY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CHROME_INTERFACE_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "ash/sysui/public/interfaces/wallpaper.mojom.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "content/public/common/mojo_shell_connection.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "mash/public/interfaces/launchable.mojom.h" |
11 #include "content/public/common/connection_filter.h" | 11 #include "mojo/public/cpp/bindings/binding_set.h" |
| 12 #include "services/shell/public/cpp/interface_factory.h" |
| 13 #include "services/shell/public/cpp/service.h" |
| 14 #include "ui/app_list/presenter/app_list_presenter.mojom.h" |
| 15 #include "ui/keyboard/keyboard.mojom.h" |
| 16 |
| 17 class AppListPresenterService; |
| 18 class ChromeLaunchable; |
| 19 class ChromeWallpaperManager; |
| 20 class KeyboardUIService; |
12 | 21 |
13 namespace chromeos { | 22 namespace chromeos { |
14 | 23 |
15 // InterfaceFactory for creating all services provided by chrome. | 24 // InterfaceFactory for creating all services provided by chrome. |
16 class ChromeInterfaceFactory : public content::ConnectionFilter { | 25 class ChromeInterfaceFactory |
| 26 : public shell::Service, |
| 27 public shell::InterfaceFactory<keyboard::mojom::Keyboard>, |
| 28 public shell::InterfaceFactory<mash::mojom::Launchable>, |
| 29 public shell::InterfaceFactory<ash::sysui::mojom::WallpaperManager>, |
| 30 public shell::InterfaceFactory<app_list::mojom::AppListPresenter> { |
17 public: | 31 public: |
18 ChromeInterfaceFactory(); | 32 ChromeInterfaceFactory(); |
19 ~ChromeInterfaceFactory() override; | 33 ~ChromeInterfaceFactory() override; |
20 | 34 |
21 private: | 35 private: |
22 // content::ConnectionFilter: | 36 // shell::Service: |
23 bool OnConnect(shell::Connection* connection, | 37 bool OnConnect(shell::Connection* connection) override; |
24 shell::Connector* connector) override; | |
25 | 38 |
26 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 39 // shell::InterfaceFactory<keyboard::Keyboard>: |
| 40 void Create( |
| 41 shell::Connection* connection, |
| 42 mojo::InterfaceRequest<keyboard::mojom::Keyboard> request) override; |
| 43 |
| 44 // mojo::InterfaceFactory<mash::mojom::Launchable> |
| 45 void Create(shell::Connection* connection, |
| 46 mash::mojom::LaunchableRequest request) override; |
| 47 |
| 48 // mojo::InterfaceFactory<ash::sysui::mojom::WallpaperManager> |
| 49 void Create(shell::Connection* connection, |
| 50 ash::sysui::mojom::WallpaperManagerRequest request) override; |
| 51 |
| 52 // mojo::InterfaceFactory<app_list::AppListPresenter>: |
| 53 void Create(shell::Connection* connection, |
| 54 mojo::InterfaceRequest<app_list::mojom::AppListPresenter> request) |
| 55 override; |
| 56 |
| 57 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; |
| 58 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_; |
| 59 std::unique_ptr<ChromeLaunchable> launchable_; |
| 60 std::unique_ptr<ChromeWallpaperManager> wallpaper_manager_; |
| 61 std::unique_ptr<AppListPresenterService> app_list_presenter_service_; |
| 62 mojo::BindingSet<app_list::mojom::AppListPresenter> |
| 63 app_list_presenter_bindings_; |
27 | 64 |
28 DISALLOW_COPY_AND_ASSIGN(ChromeInterfaceFactory); | 65 DISALLOW_COPY_AND_ASSIGN(ChromeInterfaceFactory); |
29 }; | 66 }; |
30 | 67 |
31 } // namespace chromeos | 68 } // namespace chromeos |
32 | 69 |
33 #endif // CHROME_BROWSER_CHROMEOS_CHROME_INTERFACE_FACTORY_H_ | 70 #endif // CHROME_BROWSER_CHROMEOS_CHROME_INTERFACE_FACTORY_H_ |
OLD | NEW |