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

Side by Side Diff: components/mus/view_tree_host_impl.cc

Issue 1328953003: Mandoline: Support transforms and clipping of OOPIFs and events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaked comments Created 5 years, 3 months 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
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/view_tree_host_impl.h" 5 #include "components/mus/view_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/connection_manager.h" 8 #include "components/mus/connection_manager.h"
9 #include "components/mus/display_manager.h" 9 #include "components/mus/display_manager.h"
10 #include "components/mus/focus_controller.h" 10 #include "components/mus/focus_controller.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 client()->OnAccelerator(accelerator_id, event.Pass()); 106 client()->OnAccelerator(accelerator_id, event.Pass());
107 } 107 }
108 108
109 void ViewTreeHostImpl::DispatchInputEventToView(const ServerView* target, 109 void ViewTreeHostImpl::DispatchInputEventToView(const ServerView* target,
110 mojo::EventPtr event) { 110 mojo::EventPtr event) {
111 // If the view is an embed root, forward to the embedded view, not the owner. 111 // If the view is an embed root, forward to the embedded view, not the owner.
112 ViewTreeImpl* connection = 112 ViewTreeImpl* connection =
113 connection_manager_->GetConnectionWithRoot(target->id()); 113 connection_manager_->GetConnectionWithRoot(target->id());
114 if (!connection) 114 if (!connection)
115 connection = connection_manager_->GetConnection(target->id().connection_id); 115 connection = connection_manager_->GetConnection(target->id().connection_id);
116 DCHECK_EQ(this, connection->GetHost());
117 connection->client()->OnViewInputEvent(ViewIdToTransportId(target->id()), 116 connection->client()->OnViewInputEvent(ViewIdToTransportId(target->id()),
118 event.Pass(), 117 event.Pass(),
119 base::Bind(&base::DoNothing)); 118 base::Bind(&base::DoNothing));
120 } 119 }
121 120
122 void ViewTreeHostImpl::SetSize(mojo::SizePtr size) { 121 void ViewTreeHostImpl::SetSize(mojo::SizePtr size) {
123 display_manager_->SetViewportSize(size.To<gfx::Size>()); 122 display_manager_->SetViewportSize(size.To<gfx::Size>());
124 } 123 }
125 124
126 void ViewTreeHostImpl::SetTitle(const mojo::String& title) { 125 void ViewTreeHostImpl::SetTitle(const mojo::String& title) {
(...skipping 16 matching lines...) Expand all
143 // can destroy the corresponding ViewTreeHostConnection, and |this|. So 142 // can destroy the corresponding ViewTreeHostConnection, and |this|. So
144 // setting it to nullptr afterwards in reset() ends up writing on free'd 143 // setting it to nullptr afterwards in reset() ends up writing on free'd
145 // memory. So transfer over to a local scoped_ptr<> before destroying it. 144 // memory. So transfer over to a local scoped_ptr<> before destroying it.
146 scoped_ptr<DisplayManager> temp = display_manager_.Pass(); 145 scoped_ptr<DisplayManager> temp = display_manager_.Pass();
147 } 146 }
148 147
149 ServerView* ViewTreeHostImpl::GetRootView() { 148 ServerView* ViewTreeHostImpl::GetRootView() {
150 return root_.get(); 149 return root_.get();
151 } 150 }
152 151
153 void ViewTreeHostImpl::OnEvent(mojo::EventPtr event) { 152 void ViewTreeHostImpl::OnEvent(ViewId id, mojo::EventPtr event) {
153 ServerView* view = connection_manager_->GetView(id);
154 if (view) {
sky 2015/09/17 22:36:05 How about a TODO here, as this should really be a
Fady Samuel 2015/09/17 23:58:01 Done.
155 DispatchInputEventToView(view, event.Pass());
156 return;
157 }
154 event_dispatcher_.OnEvent(event.Pass()); 158 event_dispatcher_.OnEvent(event.Pass());
155 } 159 }
156 160
157 void ViewTreeHostImpl::OnDisplayClosed() { 161 void ViewTreeHostImpl::OnDisplayClosed() {
158 if (delegate_) 162 if (delegate_)
159 delegate_->OnDisplayClosed(); 163 delegate_->OnDisplayClosed();
160 } 164 }
161 165
162 void ViewTreeHostImpl::OnViewportMetricsChanged( 166 void ViewTreeHostImpl::OnViewportMetricsChanged(
163 const mojo::ViewportMetrics& old_metrics, 167 const mojo::ViewportMetrics& old_metrics,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 root_tree != embedded_connection_old && 236 root_tree != embedded_connection_old &&
233 root_tree != owning_connection_new && 237 root_tree != owning_connection_new &&
234 root_tree != embedded_connection_new) { 238 root_tree != embedded_connection_new) {
235 root_tree->ProcessFocusChanged(old_focused_view, new_focused_view); 239 root_tree->ProcessFocusChanged(old_focused_view, new_focused_view);
236 } 240 }
237 241
238 UpdateTextInputState(new_focused_view, new_focused_view->text_input_state()); 242 UpdateTextInputState(new_focused_view, new_focused_view->text_input_state());
239 } 243 }
240 244
241 } // namespace mus 245 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698