| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/example/wm/window_manager_impl.h" | 5 #include "components/mus/example/wm/window_manager_impl.h" |
| 6 | 6 |
| 7 #include "components/mus/example/wm/container.h" | 7 #include "components/mus/example/wm/container.h" |
| 8 #include "components/mus/example/wm/window_manager_application.h" | 8 #include "components/mus/example/wm/window_manager_application.h" |
| 9 #include "components/mus/public/cpp/types.h" | 9 #include "components/mus/public/cpp/types.h" |
| 10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 WindowManagerImpl::WindowManagerImpl( | 22 WindowManagerImpl::WindowManagerImpl( |
| 23 WindowManagerApplication* state, | 23 WindowManagerApplication* state, |
| 24 mojo::InterfaceRequest<mus::mojom::WindowManager> request) | 24 mojo::InterfaceRequest<mus::mojom::WindowManager> request) |
| 25 : state_(state), | 25 : state_(state), |
| 26 binding_(this, request.Pass()) { | 26 binding_(this, request.Pass()) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 WindowManagerImpl::~WindowManagerImpl() {} | 29 WindowManagerImpl::~WindowManagerImpl() {} |
| 30 | 30 |
| 31 void WindowManagerImpl::OpenWindow(mojo::ViewTreeClientPtr client) { | 31 void WindowManagerImpl::OpenWindow(mus::mojom::WindowTreeClientPtr client) { |
| 32 mus::Window* root = state_->root(); | 32 mus::Window* root = state_->root(); |
| 33 DCHECK(root); | 33 DCHECK(root); |
| 34 mus::Id container_window_id = | 34 mus::Id container_window_id = |
| 35 GetWindowIdForContainer(root->connection(), Container::USER_WINDOWS); | 35 GetWindowIdForContainer(root->connection(), Container::USER_WINDOWS); |
| 36 mus::Window* container_window = root->GetChildById(container_window_id); | 36 mus::Window* container_window = root->GetChildById(container_window_id); |
| 37 | 37 |
| 38 const int width = (root->bounds().width - 240); | 38 const int width = (root->bounds().width - 240); |
| 39 const int height = (root->bounds().height - 240); | 39 const int height = (root->bounds().height - 240); |
| 40 | 40 |
| 41 mus::Window* child_window = root->connection()->CreateWindow(); | 41 mus::Window* child_window = root->connection()->CreateWindow(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 displays[0]->device_pixel_ratio = | 104 displays[0]->device_pixel_ratio = |
| 105 state_->root()->viewport_metrics().device_pixel_ratio; | 105 state_->root()->viewport_metrics().device_pixel_ratio; |
| 106 callback.Run(displays.Pass()); | 106 callback.Run(displays.Pass()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void WindowManagerImpl::OnWindowDestroyed(mus::Window* window) { | 109 void WindowManagerImpl::OnWindowDestroyed(mus::Window* window) { |
| 110 auto it = std::find(windows_.begin(), windows_.end(), window->id()); | 110 auto it = std::find(windows_.begin(), windows_.end(), window->id()); |
| 111 DCHECK(it != windows_.end()); | 111 DCHECK(it != windows_.end()); |
| 112 windows_.erase(it); | 112 windows_.erase(it); |
| 113 } | 113 } |
| OLD | NEW |