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