| 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 "mojo/public/c/system/main.h" | 5 #include "mojo/public/c/system/main.h" |
| 6 #include "mojo/public/cpp/bindings/binding.h" | 6 #include "mojo/public/cpp/bindings/binding.h" |
| 7 #include "services/shell/public/cpp/application_runner.h" | 7 #include "services/shell/public/cpp/application_runner.h" |
| 8 #include "services/shell/public/cpp/connector.h" | 8 #include "services/shell/public/cpp/connector.h" |
| 9 #include "services/shell/public/cpp/shell_client.h" | 9 #include "services/shell/public/cpp/service.h" |
| 10 #include "services/ui/public/cpp/window.h" | 10 #include "services/ui/public/cpp/window.h" |
| 11 #include "services/ui/public/cpp/window_manager_delegate.h" | 11 #include "services/ui/public/cpp/window_manager_delegate.h" |
| 12 #include "services/ui/public/cpp/window_tree_client.h" | 12 #include "services/ui/public/cpp/window_tree_client.h" |
| 13 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 13 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
| 14 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 15 #include "ui/display/mojo/display_type_converters.h" | 15 #include "ui/display/mojo/display_type_converters.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 namespace test { | 18 namespace test { |
| 19 | 19 |
| 20 class TestWM : public shell::ShellClient, | 20 class TestWM : public shell::Service, |
| 21 public ui::WindowTreeClientDelegate, | 21 public ui::WindowTreeClientDelegate, |
| 22 public ui::WindowManagerDelegate { | 22 public ui::WindowManagerDelegate { |
| 23 public: | 23 public: |
| 24 TestWM() {} | 24 TestWM() {} |
| 25 ~TestWM() override { delete window_tree_client_; } | 25 ~TestWM() override { delete window_tree_client_; } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 // shell::ShellClient: | 28 // shell::Service: |
| 29 void Initialize(shell::Connector* connector, | 29 void OnStart(shell::Connector* connector, |
| 30 const shell::Identity& identity, | 30 const shell::Identity& identity, |
| 31 uint32_t id) override { | 31 uint32_t id) override { |
| 32 window_tree_client_ = new ui::WindowTreeClient(this, this, nullptr); | 32 window_tree_client_ = new ui::WindowTreeClient(this, this, nullptr); |
| 33 window_tree_client_->ConnectAsWindowManager(connector); | 33 window_tree_client_->ConnectAsWindowManager(connector); |
| 34 } | 34 } |
| 35 bool AcceptConnection(shell::Connection* connection) override { | 35 bool OnConnect(shell::Connection* connection) override { |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // ui::WindowTreeClientDelegate: | 39 // ui::WindowTreeClientDelegate: |
| 40 void OnEmbed(ui::Window* root) override { | 40 void OnEmbed(ui::Window* root) override { |
| 41 // WindowTreeClients configured as the window manager should never get | 41 // WindowTreeClients configured as the window manager should never get |
| 42 // OnEmbed(). | 42 // OnEmbed(). |
| 43 NOTREACHED(); | 43 NOTREACHED(); |
| 44 } | 44 } |
| 45 void OnDidDestroyClient(ui::WindowTreeClient* client) override { | 45 void OnDidDestroyClient(ui::WindowTreeClient* client) override { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 DISALLOW_COPY_AND_ASSIGN(TestWM); | 98 DISALLOW_COPY_AND_ASSIGN(TestWM); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace test | 101 } // namespace test |
| 102 } // namespace ui | 102 } // namespace ui |
| 103 | 103 |
| 104 MojoResult MojoMain(MojoHandle shell_handle) { | 104 MojoResult MojoMain(MojoHandle shell_handle) { |
| 105 shell::ApplicationRunner runner(new ui::test::TestWM); | 105 shell::ApplicationRunner runner(new ui::test::TestWM); |
| 106 return runner.Run(shell_handle); | 106 return runner.Run(shell_handle); |
| 107 } | 107 } |
| OLD | NEW |