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 "mash/package/mash_packaged_service.h" | 5 #include "mash/package/mash_packaged_service.h" |
6 | 6 |
7 #include "ash/autoclick/mus/autoclick_application.h" | 7 #include "ash/autoclick/mus/autoclick_application.h" |
8 #include "ash/mus/window_manager_application.h" | 8 #include "ash/mus/window_manager_application.h" |
9 #include "ash/touch_hud/mus/touch_hud_application.h" | 9 #include "ash/touch_hud/mus/touch_hud_application.h" |
10 #include "mash/app_driver/app_driver.h" | 10 #include "mash/app_driver/app_driver.h" |
11 #include "mash/quick_launch/quick_launch.h" | 11 #include "mash/quick_launch/quick_launch.h" |
12 #include "mash/session/session.h" | 12 #include "mash/session/session.h" |
13 #include "mash/task_viewer/task_viewer.h" | 13 #include "mash/task_viewer/task_viewer.h" |
14 #include "services/service_manager/public/cpp/service_context.h" | 14 #include "services/service_manager/public/cpp/service_context.h" |
15 #include "services/ui/ime/test_ime_driver/test_ime_application.h" | 15 #include "services/ui/ime/test_ime_driver/test_ime_application.h" |
16 #include "services/ui/service.h" | 16 #include "services/ui/service.h" |
17 | 17 |
18 #if defined(OS_LINUX) | 18 #if defined(OS_LINUX) |
19 #include "components/font_service/font_service_app.h" | 19 #include "components/font_service/font_service_app.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace mash { | 22 namespace mash { |
23 | 23 |
24 MashPackagedService::MashPackagedService() {} | 24 MashPackagedService::MashPackagedService() {} |
25 | 25 |
26 MashPackagedService::~MashPackagedService() {} | 26 MashPackagedService::~MashPackagedService() {} |
27 | 27 |
28 bool MashPackagedService::OnConnect(const shell::Identity& remote_identity, | 28 bool MashPackagedService::OnConnect( |
29 shell::InterfaceRegistry* registry) { | 29 const service_manager::Identity& remote_identity, |
| 30 service_manager::InterfaceRegistry* registry) { |
30 registry->AddInterface<ServiceFactory>(this); | 31 registry->AddInterface<ServiceFactory>(this); |
31 return true; | 32 return true; |
32 } | 33 } |
33 | 34 |
34 void MashPackagedService::Create( | 35 void MashPackagedService::Create( |
35 const shell::Identity& remote_identity, | 36 const service_manager::Identity& remote_identity, |
36 mojo::InterfaceRequest<ServiceFactory> request) { | 37 mojo::InterfaceRequest<ServiceFactory> request) { |
37 service_factory_bindings_.AddBinding(this, std::move(request)); | 38 service_factory_bindings_.AddBinding(this, std::move(request)); |
38 } | 39 } |
39 | 40 |
40 void MashPackagedService::CreateService(shell::mojom::ServiceRequest request, | 41 void MashPackagedService::CreateService( |
41 const std::string& mojo_name) { | 42 service_manager::mojom::ServiceRequest request, |
| 43 const std::string& mojo_name) { |
42 if (service_) { | 44 if (service_) { |
43 LOG(ERROR) << "request to create additional service " << mojo_name; | 45 LOG(ERROR) << "request to create additional service " << mojo_name; |
44 return; | 46 return; |
45 } | 47 } |
46 service_ = CreateService(mojo_name); | 48 service_ = CreateService(mojo_name); |
47 if (service_) { | 49 if (service_) { |
48 service_->set_context(base::MakeUnique<shell::ServiceContext>( | 50 service_->set_context(base::MakeUnique<service_manager::ServiceContext>( |
49 service_.get(), std::move(request))); | 51 service_.get(), std::move(request))); |
50 return; | 52 return; |
51 } | 53 } |
52 LOG(ERROR) << "unknown name " << mojo_name; | 54 LOG(ERROR) << "unknown name " << mojo_name; |
53 NOTREACHED(); | 55 NOTREACHED(); |
54 } | 56 } |
55 | 57 |
56 // Please see header file for details on adding new services. | 58 // Please see header file for details on adding new services. |
57 std::unique_ptr<shell::Service> MashPackagedService::CreateService( | 59 std::unique_ptr<service_manager::Service> MashPackagedService::CreateService( |
58 const std::string& name) { | 60 const std::string& name) { |
59 if (name == "service:ash") | 61 if (name == "service:ash") |
60 return base::WrapUnique(new ash::mus::WindowManagerApplication); | 62 return base::WrapUnique(new ash::mus::WindowManagerApplication); |
61 if (name == "service:accessibility_autoclick") | 63 if (name == "service:accessibility_autoclick") |
62 return base::WrapUnique(new ash::autoclick::AutoclickApplication); | 64 return base::WrapUnique(new ash::autoclick::AutoclickApplication); |
63 if (name == "service:touch_hud") | 65 if (name == "service:touch_hud") |
64 return base::WrapUnique(new ash::touch_hud::TouchHudApplication); | 66 return base::WrapUnique(new ash::touch_hud::TouchHudApplication); |
65 if (name == "service:mash_session") | 67 if (name == "service:mash_session") |
66 return base::WrapUnique(new mash::session::Session); | 68 return base::WrapUnique(new mash::session::Session); |
67 if (name == "service:ui") | 69 if (name == "service:ui") |
68 return base::WrapUnique(new ui::Service); | 70 return base::WrapUnique(new ui::Service); |
69 if (name == "service:quick_launch") | 71 if (name == "service:quick_launch") |
70 return base::WrapUnique(new mash::quick_launch::QuickLaunch); | 72 return base::WrapUnique(new mash::quick_launch::QuickLaunch); |
71 if (name == "service:task_viewer") | 73 if (name == "service:task_viewer") |
72 return base::WrapUnique(new mash::task_viewer::TaskViewer); | 74 return base::WrapUnique(new mash::task_viewer::TaskViewer); |
73 if (name == "service:test_ime_driver") | 75 if (name == "service:test_ime_driver") |
74 return base::WrapUnique(new ui::test::TestIMEApplication); | 76 return base::WrapUnique(new ui::test::TestIMEApplication); |
75 #if defined(OS_LINUX) | 77 #if defined(OS_LINUX) |
76 if (name == "service:font_service") | 78 if (name == "service:font_service") |
77 return base::WrapUnique(new font_service::FontServiceApp); | 79 return base::WrapUnique(new font_service::FontServiceApp); |
78 #endif | 80 #endif |
79 if (name == "service:app_driver") | 81 if (name == "service:app_driver") |
80 return base::WrapUnique(new mash::app_driver::AppDriver); | 82 return base::WrapUnique(new mash::app_driver::AppDriver); |
81 return nullptr; | 83 return nullptr; |
82 } | 84 } |
83 | 85 |
84 } // namespace mash | 86 } // namespace mash |
OLD | NEW |