| 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 } |
| 21 void OnStart(const shell::Identity& identity) override { | 25 void OnStart(const shell::Identity& identity) override { |
| 22 mojom::IMEDriverPtr ime_driver_ptr; | 26 mojom::IMEDriverPtr ime_driver_ptr; |
| 23 new TestIMEDriver(GetProxy(&ime_driver_ptr)); | 27 new TestIMEDriver(GetProxy(&ime_driver_ptr)); |
| 24 | 28 |
| 25 ui::mojom::IMERegistrarPtr ime_registrar; | 29 ui::mojom::IMERegistrarPtr ime_registrar; |
| 26 connector()->ConnectToInterface("mojo:ui", &ime_registrar); | 30 connector()->ConnectToInterface("mojo:ui", &ime_registrar); |
| 27 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); | 31 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); |
| 28 } | 32 } |
| 29 | 33 |
| 30 DISALLOW_COPY_AND_ASSIGN(TestIME); | 34 DISALLOW_COPY_AND_ASSIGN(TestIME); |
| 31 }; | 35 }; |
| 32 | 36 |
| 33 } // namespace test | 37 } // namespace test |
| 34 } // namespace ui | 38 } // namespace ui |
| 35 | 39 |
| 36 MojoResult ServiceMain(MojoHandle service_request_handle) { | 40 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 37 shell::ServiceRunner runner(new ui::test::TestIME); | 41 shell::ServiceRunner runner(new ui::test::TestIME); |
| 38 return runner.Run(service_request_handle); | 42 return runner.Run(service_request_handle); |
| 39 } | 43 } |
| OLD | NEW |