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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 1729373003: Implement touch events for site-isolation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add non-NaN force to touch event. Created 4 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/frame_host/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 : host_(RenderWidgetHostImpl::From(widget_host)), 38 : host_(RenderWidgetHostImpl::From(widget_host)),
39 next_surface_sequence_(1u), 39 next_surface_sequence_(1u),
40 last_output_surface_id_(0), 40 last_output_surface_id_(0),
41 current_surface_scale_factor_(1.f), 41 current_surface_scale_factor_(1.f),
42 ack_pending_count_(0), 42 ack_pending_count_(0),
43 frame_connector_(nullptr), 43 frame_connector_(nullptr),
44 weak_factory_(this) { 44 weak_factory_(this) {
45 id_allocator_ = CreateSurfaceIdAllocator(); 45 id_allocator_ = CreateSurfaceIdAllocator();
46 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 46 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
47 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner( 47 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner(
48 GetSurfaceIdNamespace(), this); 48 GetSurfaceIdNamespace(), this);
kenrb 2016/02/25 00:58:04 Should this be replaced by a call to RegisterSurfa
wjmaclean 2016/02/25 12:23:02 That's reasonable, done.
49 } 49 }
50 50
51 host_->SetView(this); 51 host_->SetView(this);
52 } 52 }
53 53
54 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { 54 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
55 if (!surface_id_.is_null()) 55 if (!surface_id_.is_null())
56 surface_factory_->Destroy(surface_id_); 56 surface_factory_->Destroy(surface_id_);
57 } 57 }
58 58
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 void RenderWidgetHostViewChildFrame::Destroy() { 205 void RenderWidgetHostViewChildFrame::Destroy() {
206 if (frame_connector_) { 206 if (frame_connector_) {
207 frame_connector_->set_view(NULL); 207 frame_connector_->set_view(NULL);
208 frame_connector_ = NULL; 208 frame_connector_ = NULL;
209 } 209 }
210 210
211 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 211 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
212 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner( 212 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner(
213 GetSurfaceIdNamespace()); 213 GetSurfaceIdNamespace());
kenrb 2016/02/25 00:58:04 Replace with a call to UnregisterSurfaceIdNamespac
wjmaclean 2016/02/25 12:23:02 This is going away in https://codereview.chromium.
214 } 214 }
215 215
216 host_->SetView(NULL); 216 host_->SetView(NULL);
217 host_ = NULL; 217 host_ = NULL;
218 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 218 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
219 } 219 }
220 220
221 void RenderWidgetHostViewChildFrame::SetTooltipText( 221 void RenderWidgetHostViewChildFrame::SetTooltipText(
222 const base::string16& tooltip_text) { 222 const base::string16& tooltip_text) {
223 } 223 }
224 224
225 void RenderWidgetHostViewChildFrame::SelectionChanged( 225 void RenderWidgetHostViewChildFrame::SelectionChanged(
226 const base::string16& text, 226 const base::string16& text,
227 size_t offset, 227 size_t offset,
228 const gfx::Range& range) { 228 const gfx::Range& range) {
229 } 229 }
230 230
231 void RenderWidgetHostViewChildFrame::SelectionBoundsChanged( 231 void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
232 const ViewHostMsg_SelectionBounds_Params& params) { 232 const ViewHostMsg_SelectionBounds_Params& params) {
233 } 233 }
234 234
235 void RenderWidgetHostViewChildFrame::LockCompositingSurface() { 235 void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
236 NOTIMPLEMENTED(); 236 NOTIMPLEMENTED();
237 } 237 }
238 238
239 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() { 239 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
240 NOTIMPLEMENTED(); 240 NOTIMPLEMENTED();
241 } 241 }
242 242
243 void RenderWidgetHostViewChildFrame::RegisterSurfaceNamespaceId() {
244 DCHECK(host_);
245 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
246 RenderWidgetHostInputEventRouter* router =
247 host_->delegate()->GetInputEventRouter();
248 if (!router->is_registered(GetSurfaceIdNamespace()))
249 router->AddSurfaceIdNamespaceOwner(GetSurfaceIdNamespace(), this);
250 }
251 }
252
253 void RenderWidgetHostViewChildFrame::UnregisterSurfaceNamespaceId() {
254 DCHECK(host_);
255 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
256 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner(
257 GetSurfaceIdNamespace());
258 }
259 }
260
243 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, 261 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id,
244 cc::SurfaceDrawStatus drawn) { 262 cc::SurfaceDrawStatus drawn) {
245 cc::CompositorFrameAck ack; 263 cc::CompositorFrameAck ack;
246 DCHECK_GT(ack_pending_count_, 0U); 264 DCHECK_GT(ack_pending_count_, 0U);
247 if (!surface_returned_resources_.empty()) 265 if (!surface_returned_resources_.empty())
248 ack.resources.swap(surface_returned_resources_); 266 ack.resources.swap(surface_returned_resources_);
249 if (host_) { 267 if (host_) {
250 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), 268 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(),
251 output_surface_id, ack)); 269 output_surface_id, ack));
252 } 270 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 DCHECK(color_profile->empty()); 354 DCHECK(color_profile->empty());
337 NOTIMPLEMENTED(); 355 NOTIMPLEMENTED();
338 return false; 356 return false;
339 } 357 }
340 358
341 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() { 359 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
342 // We do not have any root window specific parts in this view. 360 // We do not have any root window specific parts in this view.
343 return GetViewBounds(); 361 return GetViewBounds();
344 } 362 }
345 363
346 #if defined(USE_AURA)
347 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent( 364 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
348 const TouchEventWithLatencyInfo& touch, 365 const TouchEventWithLatencyInfo& touch,
349 InputEventAckState ack_result) { 366 InputEventAckState ack_result) {
367 if (!frame_connector_)
368 return;
369
370 frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result);
350 } 371 }
351 #endif // defined(USE_AURA)
352 372
353 bool RenderWidgetHostViewChildFrame::LockMouse() { 373 bool RenderWidgetHostViewChildFrame::LockMouse() {
354 return false; 374 return false;
355 } 375 }
356 376
357 void RenderWidgetHostViewChildFrame::UnlockMouse() { 377 void RenderWidgetHostViewChildFrame::UnlockMouse() {
358 } 378 }
359 379
360 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { 380 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() {
361 return id_allocator_->id_namespace(); 381 return id_allocator_->id_namespace();
362 } 382 }
363 383
364 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( 384 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent(
365 const NativeWebKeyboardEvent& event) { 385 const NativeWebKeyboardEvent& event) {
366 if (!host_)
367 return;
368
369 host_->ForwardKeyboardEvent(event); 386 host_->ForwardKeyboardEvent(event);
370 } 387 }
371 388
372 void RenderWidgetHostViewChildFrame::ProcessMouseEvent( 389 void RenderWidgetHostViewChildFrame::ProcessMouseEvent(
373 const blink::WebMouseEvent& event) { 390 const blink::WebMouseEvent& event) {
374 if (!host_)
375 return;
376
377 host_->ForwardMouseEvent(event); 391 host_->ForwardMouseEvent(event);
378 } 392 }
379 393
380 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent( 394 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent(
381 const blink::WebMouseWheelEvent& event) { 395 const blink::WebMouseWheelEvent& event) {
382 if (!host_) 396 if (!host_)
383 return; 397 return;
384 398
385 if (event.deltaX != 0 || event.deltaY != 0) 399 if (event.deltaX != 0 || event.deltaY != 0)
386 host_->ForwardWheelEvent(event); 400 host_->ForwardWheelEvent(event);
387 } 401 }
388 402
403 void RenderWidgetHostViewChildFrame::ProcessTouchEvent(
404 const blink::WebTouchEvent& event,
405 const ui::LatencyInfo& latency) {
406 if (event.type == blink::WebInputEvent::TouchStart &&
407 frame_connector_ && !frame_connector_->HasFocus()) {
408 frame_connector_->Focus();
409 }
410
411 host_->ForwardTouchEventWithLatencyInfo(event, latency);
412 }
413
389 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace( 414 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace(
390 const gfx::Point& point) { 415 const gfx::Point& point) {
391 if (!frame_connector_) 416 if (!frame_connector_)
392 return point; 417 return point;
393 418
394 return frame_connector_->TransformPointToRootCoordSpace(point, surface_id_); 419 return frame_connector_->TransformPointToRootCoordSpace(point, surface_id_);
395 } 420 }
396 421
397 #if defined(OS_MACOSX) 422 #if defined(OS_MACOSX)
398 void RenderWidgetHostViewChildFrame::SetActive(bool active) { 423 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 552 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
528 } 553 }
529 554
530 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 555 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
531 if (surface_factory_ && !surface_id_.is_null()) 556 if (surface_factory_ && !surface_id_.is_null())
532 surface_factory_->Destroy(surface_id_); 557 surface_factory_->Destroy(surface_id_);
533 surface_id_ = cc::SurfaceId(); 558 surface_id_ = cc::SurfaceId();
534 } 559 }
535 560
536 } // namespace content 561 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698