| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "services/service_manager/public/c/main.h" | 11 #include "services/service_manager/public/c/main.h" |
| 12 #include "services/service_manager/public/cpp/connector.h" | 12 #include "services/service_manager/public/cpp/connector.h" |
| 13 #include "services/service_manager/public/cpp/service.h" | 13 #include "services/service_manager/public/cpp/service.h" |
| 14 #include "services/service_manager/public/cpp/service_context.h" | 14 #include "services/service_manager/public/cpp/service_context.h" |
| 15 #include "services/service_manager/public/cpp/service_runner.h" | 15 #include "services/service_manager/public/cpp/service_runner.h" |
| 16 #include "ui/aura/client/default_capture_client.h" |
| 16 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
| 17 #include "ui/aura/mus/property_converter.h" | 18 #include "ui/aura/mus/property_converter.h" |
| 18 #include "ui/aura/mus/property_utils.h" | 19 #include "ui/aura/mus/property_utils.h" |
| 19 #include "ui/aura/mus/window_manager_delegate.h" | 20 #include "ui/aura/mus/window_manager_delegate.h" |
| 20 #include "ui/aura/mus/window_tree_client.h" | 21 #include "ui/aura/mus/window_tree_client.h" |
| 21 #include "ui/aura/mus/window_tree_client_delegate.h" | 22 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 22 #include "ui/aura/mus/window_tree_host_mus.h" | 23 #include "ui/aura/mus/window_tree_host_mus.h" |
| 23 #include "ui/aura/test/test_focus_client.h" | 24 #include "ui/aura/test/test_focus_client.h" |
| 24 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 25 #include "ui/display/display.h" | 26 #include "ui/display/display.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 DCHECK_EQ(0u, screen_->display_list().displays().size()); | 125 DCHECK_EQ(0u, screen_->display_list().displays().size()); |
| 125 screen_->display_list().AddDisplay(display, | 126 screen_->display_list().AddDisplay(display, |
| 126 display::DisplayList::Type::PRIMARY); | 127 display::DisplayList::Type::PRIMARY); |
| 127 } | 128 } |
| 128 void OnWmNewDisplay(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 129 void OnWmNewDisplay(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 129 const display::Display& display) override { | 130 const display::Display& display) override { |
| 130 // Only handles a single root. | 131 // Only handles a single root. |
| 131 DCHECK(!root_); | 132 DCHECK(!root_); |
| 132 window_tree_host_ = std::move(window_tree_host); | 133 window_tree_host_ = std::move(window_tree_host); |
| 133 root_ = window_tree_host_->window(); | 134 root_ = window_tree_host_->window(); |
| 135 default_capture_client_ = |
| 136 base::MakeUnique<aura::client::DefaultCaptureClient>( |
| 137 root_->GetRootWindow()); |
| 134 DCHECK(window_manager_client_); | 138 DCHECK(window_manager_client_); |
| 135 window_manager_client_->AddActivationParent(root_); | 139 window_manager_client_->AddActivationParent(root_); |
| 136 ui::mojom::FrameDecorationValuesPtr frame_decoration_values = | 140 ui::mojom::FrameDecorationValuesPtr frame_decoration_values = |
| 137 ui::mojom::FrameDecorationValues::New(); | 141 ui::mojom::FrameDecorationValues::New(); |
| 138 frame_decoration_values->max_title_bar_button_width = 0; | 142 frame_decoration_values->max_title_bar_button_width = 0; |
| 139 window_manager_client_->SetFrameDecorationValues( | 143 window_manager_client_->SetFrameDecorationValues( |
| 140 std::move(frame_decoration_values)); | 144 std::move(frame_decoration_values)); |
| 141 aura::client::SetFocusClient(root_, &focus_client_); | 145 aura::client::SetFocusClient(root_, &focus_client_); |
| 142 } | 146 } |
| 143 void OnWmDisplayRemoved(aura::WindowTreeHostMus* window_tree_host) override { | 147 void OnWmDisplayRemoved(aura::WindowTreeHostMus* window_tree_host) override { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 168 std::unique_ptr<display::ScreenBase> screen_; | 172 std::unique_ptr<display::ScreenBase> screen_; |
| 169 | 173 |
| 170 std::unique_ptr<aura::Env> aura_env_; | 174 std::unique_ptr<aura::Env> aura_env_; |
| 171 ::wm::WMState wm_state_; | 175 ::wm::WMState wm_state_; |
| 172 aura::PropertyConverter property_converter_; | 176 aura::PropertyConverter property_converter_; |
| 173 aura::test::TestFocusClient focus_client_; | 177 aura::test::TestFocusClient focus_client_; |
| 174 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | 178 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; |
| 175 aura::Window* root_ = nullptr; | 179 aura::Window* root_ = nullptr; |
| 176 aura::WindowManagerClient* window_manager_client_ = nullptr; | 180 aura::WindowManagerClient* window_manager_client_ = nullptr; |
| 177 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; | 181 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; |
| 182 std::unique_ptr<aura::client::DefaultCaptureClient> default_capture_client_; |
| 178 | 183 |
| 179 bool started_ = false; | 184 bool started_ = false; |
| 180 | 185 |
| 181 DISALLOW_COPY_AND_ASSIGN(TestWM); | 186 DISALLOW_COPY_AND_ASSIGN(TestWM); |
| 182 }; | 187 }; |
| 183 | 188 |
| 184 } // namespace test | 189 } // namespace test |
| 185 } // namespace ui | 190 } // namespace ui |
| 186 | 191 |
| 187 MojoResult ServiceMain(MojoHandle service_request_handle) { | 192 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 188 service_manager::ServiceRunner runner(new ui::test::TestWM); | 193 service_manager::ServiceRunner runner(new ui::test::TestWM); |
| 189 return runner.Run(service_request_handle); | 194 return runner.Run(service_request_handle); |
| 190 } | 195 } |
| OLD | NEW |