| 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/shell/public/c/main.h" | 5 #include "services/shell/public/c/main.h" |
| 6 #include "services/shell/public/cpp/connector.h" | 6 #include "services/shell/public/cpp/connector.h" |
| 7 #include "services/shell/public/cpp/service.h" | 7 #include "services/shell/public/cpp/service.h" |
| 8 #include "services/shell/public/cpp/service_runner.h" | 8 #include "services/shell/public/cpp/service_runner.h" |
| 9 #include "services/ui/ime/test_ime_driver/test_ime_driver.h" | 9 #include "services/ui/ime/test_ime_driver/test_ime_driver.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 namespace test { | 12 namespace test { |
| 13 | 13 |
| 14 class TestIME : public shell::Service { | 14 class TestIME : public shell::Service { |
| 15 public: | 15 public: |
| 16 TestIME() {} | 16 TestIME() {} |
| 17 ~TestIME() override {} | 17 ~TestIME() override {} |
| 18 | 18 |
| 19 private: | 19 private: |
| 20 // shell::Service: | 20 // shell::Service: |
| 21 bool OnConnect(const shell::Identity& remote_identity, | |
| 22 shell::InterfaceRegistry* registry) override { | |
| 23 return true; | |
| 24 } | |
| 25 void OnStart(const shell::Identity& identity) override { | 21 void OnStart(const shell::Identity& identity) override { |
| 26 mojom::IMEDriverPtr ime_driver_ptr; | 22 mojom::IMEDriverPtr ime_driver_ptr; |
| 27 new TestIMEDriver(GetProxy(&ime_driver_ptr)); | 23 new TestIMEDriver(GetProxy(&ime_driver_ptr)); |
| 28 | 24 |
| 29 ui::mojom::IMERegistrarPtr ime_registrar; | 25 ui::mojom::IMERegistrarPtr ime_registrar; |
| 30 connector()->ConnectToInterface("mojo:ui", &ime_registrar); | 26 connector()->ConnectToInterface("mojo:ui", &ime_registrar); |
| 31 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); | 27 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); |
| 32 } | 28 } |
| 33 | 29 |
| 34 DISALLOW_COPY_AND_ASSIGN(TestIME); | 30 DISALLOW_COPY_AND_ASSIGN(TestIME); |
| 35 }; | 31 }; |
| 36 | 32 |
| 37 } // namespace test | 33 } // namespace test |
| 38 } // namespace ui | 34 } // namespace ui |
| 39 | 35 |
| 40 MojoResult ServiceMain(MojoHandle service_request_handle) { | 36 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 41 shell::ServiceRunner runner(new ui::test::TestIME); | 37 shell::ServiceRunner runner(new ui::test::TestIME); |
| 42 return runner.Run(service_request_handle); | 38 return runner.Run(service_request_handle); |
| 43 } | 39 } |
| OLD | NEW |