| 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 "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 void MashPackagedService::Create( | 38 void MashPackagedService::Create( |
| 39 const service_manager::Identity& remote_identity, | 39 const service_manager::Identity& remote_identity, |
| 40 mojo::InterfaceRequest<ServiceFactory> request) { | 40 mojo::InterfaceRequest<ServiceFactory> request) { |
| 41 service_factory_bindings_.AddBinding(this, std::move(request)); | 41 service_factory_bindings_.AddBinding(this, std::move(request)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void MashPackagedService::CreateService( | 44 void MashPackagedService::CreateService( |
| 45 service_manager::mojom::ServiceRequest request, | 45 service_manager::mojom::ServiceRequest request, |
| 46 const std::string& mojo_name) { | 46 const std::string& mojo_name) { |
| 47 if (service_) { | 47 if (context_) { |
| 48 LOG(ERROR) << "request to create additional service " << mojo_name; | 48 LOG(ERROR) << "request to create additional service " << mojo_name; |
| 49 return; | 49 return; |
| 50 } | 50 } |
| 51 service_ = CreateService(mojo_name); | 51 std::unique_ptr<service_manager::Service> service = CreateService(mojo_name); |
| 52 if (service_) { | 52 if (service) { |
| 53 service_->set_context(base::MakeUnique<service_manager::ServiceContext>( | 53 context_.reset(new service_manager::ServiceContext( |
| 54 service_.get(), std::move(request))); | 54 std::move(service), std::move(request))); |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 LOG(ERROR) << "unknown name " << mojo_name; | 57 LOG(ERROR) << "unknown name " << mojo_name; |
| 58 NOTREACHED(); | 58 NOTREACHED(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Please see header file for details on adding new services. | 61 // Please see header file for details on adding new services. |
| 62 std::unique_ptr<service_manager::Service> MashPackagedService::CreateService( | 62 std::unique_ptr<service_manager::Service> MashPackagedService::CreateService( |
| 63 const std::string& name) { | 63 const std::string& name) { |
| 64 const std::string debugger_target = | 64 const std::string debugger_target = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 if (name == "service:test_ime_driver") | 91 if (name == "service:test_ime_driver") |
| 92 return base::WrapUnique(new ui::test::TestIMEApplication); | 92 return base::WrapUnique(new ui::test::TestIMEApplication); |
| 93 #if defined(OS_LINUX) | 93 #if defined(OS_LINUX) |
| 94 if (name == "service:font_service") | 94 if (name == "service:font_service") |
| 95 return base::WrapUnique(new font_service::FontServiceApp); | 95 return base::WrapUnique(new font_service::FontServiceApp); |
| 96 #endif | 96 #endif |
| 97 return nullptr; | 97 return nullptr; |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace mash | 100 } // namespace mash |
| OLD | NEW |