| 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 "components/mus/ws/window_manager_state.h" | 5 #include "components/mus/ws/window_manager_state.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/mus/common/event_matcher_util.h" | 10 #include "components/mus/common/event_matcher_util.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 void WindowManagerState::AddSystemModalWindow(ServerWindow* window) { | 140 void WindowManagerState::AddSystemModalWindow(ServerWindow* window) { |
| 141 DCHECK(!window->transient_parent()); | 141 DCHECK(!window->transient_parent()); |
| 142 event_dispatcher_.AddSystemModalWindow(window); | 142 event_dispatcher_.AddSystemModalWindow(window); |
| 143 } | 143 } |
| 144 | 144 |
| 145 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { | 145 mojom::DisplayPtr WindowManagerState::ToMojomDisplay() const { |
| 146 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); | 146 mojom::DisplayPtr display_ptr = display_->ToMojomDisplay(); |
| 147 // TODO(sky): set work area. | 147 // TODO(sky): set work area. |
| 148 display_ptr->work_area = display_ptr->bounds.Clone(); | 148 display_ptr->work_area = display_ptr->bounds; |
| 149 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); | 149 display_ptr->frame_decoration_values = frame_decoration_values_.Clone(); |
| 150 return display_ptr; | 150 return display_ptr; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void WindowManagerState::OnWillDestroyTree(WindowTree* tree) { | 153 void WindowManagerState::OnWillDestroyTree(WindowTree* tree) { |
| 154 if (tree_awaiting_input_ack_ != tree) | 154 if (tree_awaiting_input_ack_ != tree) |
| 155 return; | 155 return; |
| 156 // The WindowTree is dying. So it's not going to ack the event. | 156 // The WindowTree is dying. So it's not going to ack the event. |
| 157 // If the dying tree matches the root |tree_| marked as handled so we don't | 157 // If the dying tree matches the root |tree_| marked as handled so we don't |
| 158 // notify it of accelerators. | 158 // notify it of accelerators. |
| 159 OnEventAck(tree_awaiting_input_ack_, tree == tree_ | 159 OnEventAck(tree_awaiting_input_ack_, tree == tree_ |
| 160 ? mojom::EventResult::HANDLED | 160 ? mojom::EventResult::HANDLED |
| 161 : mojom::EventResult::UNHANDLED); | 161 : mojom::EventResult::UNHANDLED); |
| 162 } | 162 } |
| 163 | 163 |
| 164 WindowManagerState::WindowManagerState(Display* display, | 164 WindowManagerState::WindowManagerState(Display* display, |
| 165 PlatformDisplay* platform_display, | 165 PlatformDisplay* platform_display, |
| 166 bool is_user_id_valid, | 166 bool is_user_id_valid, |
| 167 const UserId& user_id) | 167 const UserId& user_id) |
| 168 : display_(display), | 168 : display_(display), |
| 169 platform_display_(platform_display), | 169 platform_display_(platform_display), |
| 170 is_user_id_valid_(is_user_id_valid), | 170 is_user_id_valid_(is_user_id_valid), |
| 171 user_id_(user_id), | 171 user_id_(user_id), |
| 172 event_dispatcher_(this), | 172 event_dispatcher_(this), |
| 173 weak_factory_(this) { | 173 weak_factory_(this) { |
| 174 frame_decoration_values_ = mojom::FrameDecorationValues::New(); | 174 frame_decoration_values_ = mojom::FrameDecorationValues::New(); |
| 175 frame_decoration_values_->normal_client_area_insets = mojo::Insets::New(); | |
| 176 frame_decoration_values_->maximized_client_area_insets = mojo::Insets::New(); | |
| 177 frame_decoration_values_->max_title_bar_button_width = 0u; | 175 frame_decoration_values_->max_title_bar_button_width = 0u; |
| 178 | 176 |
| 179 root_.reset(window_server()->CreateServerWindow( | 177 root_.reset(window_server()->CreateServerWindow( |
| 180 window_server()->display_manager()->GetAndAdvanceNextRootId(), | 178 window_server()->display_manager()->GetAndAdvanceNextRootId(), |
| 181 ServerWindow::Properties())); | 179 ServerWindow::Properties())); |
| 182 // Our root is always a child of the Display's root. Do this | 180 // Our root is always a child of the Display's root. Do this |
| 183 // before the WindowTree has been created so that the client doesn't get | 181 // before the WindowTree has been created so that the client doesn't get |
| 184 // notified of the add, bounds change and visibility change. | 182 // notified of the add, bounds change and visibility change. |
| 185 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size())); | 183 root_->SetBounds(gfx::Rect(display->root_window()->bounds().size())); |
| 186 root_->SetVisible(true); | 184 root_->SetVisible(true); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 weak_accelerator); | 420 weak_accelerator); |
| 423 } | 421 } |
| 424 | 422 |
| 425 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { | 423 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) { |
| 426 window_server()->SendToEventObservers(event, user_id_, | 424 window_server()->SendToEventObservers(event, user_id_, |
| 427 nullptr /* ignore_tree */); | 425 nullptr /* ignore_tree */); |
| 428 } | 426 } |
| 429 | 427 |
| 430 } // namespace ws | 428 } // namespace ws |
| 431 } // namespace mus | 429 } // namespace mus |
| OLD | NEW |