Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: components/mus/ws/window_tree_host_impl.cc

Issue 1414943003: Moves move logic into WM instead of WS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/window_tree_host_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ws/window_tree_host_impl.h" 5 #include "components/mus/ws/window_tree_host_impl.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/mus/public/cpp/types.h" 8 #include "components/mus/public/cpp/types.h"
9 #include "components/mus/ws/connection_manager.h" 9 #include "components/mus/ws/connection_manager.h"
10 #include "components/mus/ws/display_manager.h" 10 #include "components/mus/ws/display_manager.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 void WindowTreeHostImpl::AddAccelerator(uint32_t id, 113 void WindowTreeHostImpl::AddAccelerator(uint32_t id,
114 mojo::EventMatcherPtr event_matcher) { 114 mojo::EventMatcherPtr event_matcher) {
115 event_dispatcher_.AddAccelerator(id, event_matcher.Pass()); 115 event_dispatcher_.AddAccelerator(id, event_matcher.Pass());
116 } 116 }
117 117
118 void WindowTreeHostImpl::RemoveAccelerator(uint32_t id) { 118 void WindowTreeHostImpl::RemoveAccelerator(uint32_t id) {
119 event_dispatcher_.RemoveAccelerator(id); 119 event_dispatcher_.RemoveAccelerator(id);
120 } 120 }
121 121
122 void WindowTreeHostImpl::EnableWindowDraggingForChildren(
123 Id transport_window_id) {
124 ServerWindow* window =
125 root_->GetChildWindow(WindowIdFromTransportId(transport_window_id));
126 if (window)
127 window->set_is_draggable_window_container(true);
128 }
129
130 void WindowTreeHostImpl::OnClientClosed() { 122 void WindowTreeHostImpl::OnClientClosed() {
131 // |display_manager_.reset()| destroys the display-manager first, and then 123 // |display_manager_.reset()| destroys the display-manager first, and then
132 // sets |display_manager_| to nullptr. However, destroying |display_manager_| 124 // sets |display_manager_| to nullptr. However, destroying |display_manager_|
133 // can destroy the corresponding WindowTreeHostConnection, and |this|. So 125 // can destroy the corresponding WindowTreeHostConnection, and |this|. So
134 // setting it to nullptr afterwards in reset() ends up writing on free'd 126 // setting it to nullptr afterwards in reset() ends up writing on free'd
135 // memory. So transfer over to a local scoped_ptr<> before destroying it. 127 // memory. So transfer over to a local scoped_ptr<> before destroying it.
136 scoped_ptr<DisplayManager> temp = display_manager_.Pass(); 128 scoped_ptr<DisplayManager> temp = display_manager_.Pass();
137 } 129 }
138 130
139 ServerWindow* WindowTreeHostImpl::GetRootWindow() { 131 ServerWindow* WindowTreeHostImpl::GetRootWindow() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( 232 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher(
241 ServerWindow* new_focused_window) { 233 ServerWindow* new_focused_window) {
242 SetFocusedWindow(new_focused_window); 234 SetFocusedWindow(new_focused_window);
243 } 235 }
244 236
245 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { 237 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() {
246 return GetFocusedWindow(); 238 return GetFocusedWindow();
247 } 239 }
248 240
249 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, 241 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target,
242 bool in_nonclient_area,
250 mojo::EventPtr event) { 243 mojo::EventPtr event) {
251 // If the window is an embed root, forward to the embedded window, not the 244 // If the event is in the non-client area the event goes to the owner of
252 // owner. 245 // the window. Otherwise if the window is an embed root, forward to the
246 // embedded window.
253 WindowTreeImpl* connection = 247 WindowTreeImpl* connection =
254 connection_manager_->GetConnectionWithRoot(target->id()); 248 in_nonclient_area
255 if (!connection) 249 ? connection_manager_->GetConnection(target->id().connection_id)
250 : connection_manager_->GetConnectionWithRoot(target->id());
251 if (!connection) {
252 DCHECK(!in_nonclient_area);
256 connection = connection_manager_->GetConnection(target->id().connection_id); 253 connection = connection_manager_->GetConnection(target->id().connection_id);
254 }
257 connection->client()->OnWindowInputEvent(WindowIdToTransportId(target->id()), 255 connection->client()->OnWindowInputEvent(WindowIdToTransportId(target->id()),
258 event.Pass(), 256 event.Pass(),
259 base::Bind(&base::DoNothing)); 257 base::Bind(&base::DoNothing));
260 } 258 }
261 259
262 } // namespace ws 260 } // namespace ws
263 } // namespace mus 261 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698