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

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: Address comments. Created 4 years, 10 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 25 matching lines...) Expand all
36 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( 36 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
37 RenderWidgetHost* widget_host) 37 RenderWidgetHost* widget_host)
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 RegisterSurfaceNamespaceId();
piman 2016/02/25 21:27:21 Where is the corresponding UnregisteSurfaceNamespa
wjmaclean 2016/02/28 19:45:03 It is called in BrowserPluginGuest. However, it s
47 host_->delegate()->GetInputEventRouter()->AddSurfaceIdNamespaceOwner(
48 GetSurfaceIdNamespace(), this);
49 }
50 47
51 host_->SetView(this); 48 host_->SetView(this);
52 } 49 }
53 50
54 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { 51 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
55 if (!surface_id_.is_null()) 52 if (!surface_id_.is_null())
56 surface_factory_->Destroy(surface_id_); 53 surface_factory_->Destroy(surface_id_);
57 } 54 }
58 55
59 void RenderWidgetHostViewChildFrame::InitAsChild( 56 void RenderWidgetHostViewChildFrame::InitAsChild(
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 230 }
234 231
235 void RenderWidgetHostViewChildFrame::LockCompositingSurface() { 232 void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
236 NOTIMPLEMENTED(); 233 NOTIMPLEMENTED();
237 } 234 }
238 235
239 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() { 236 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
240 NOTIMPLEMENTED(); 237 NOTIMPLEMENTED();
241 } 238 }
242 239
240 void RenderWidgetHostViewChildFrame::RegisterSurfaceNamespaceId() {
241 DCHECK(host_);
242 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
243 RenderWidgetHostInputEventRouter* router =
244 host_->delegate()->GetInputEventRouter();
245 if (!router->is_registered(GetSurfaceIdNamespace()))
246 router->AddSurfaceIdNamespaceOwner(GetSurfaceIdNamespace(), this);
247 }
248 }
249
250 void RenderWidgetHostViewChildFrame::UnregisterSurfaceNamespaceId() {
251 DCHECK(host_);
252 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
253 host_->delegate()->GetInputEventRouter()->RemoveSurfaceIdNamespaceOwner(
254 GetSurfaceIdNamespace());
255 }
256 }
257
243 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, 258 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id,
244 cc::SurfaceDrawStatus drawn) { 259 cc::SurfaceDrawStatus drawn) {
245 cc::CompositorFrameAck ack; 260 cc::CompositorFrameAck ack;
246 DCHECK_GT(ack_pending_count_, 0U); 261 DCHECK_GT(ack_pending_count_, 0U);
247 if (!surface_returned_resources_.empty()) 262 if (!surface_returned_resources_.empty())
248 ack.resources.swap(surface_returned_resources_); 263 ack.resources.swap(surface_returned_resources_);
249 if (host_) { 264 if (host_) {
250 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), 265 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(),
251 output_surface_id, ack)); 266 output_surface_id, ack));
252 } 267 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 DCHECK(color_profile->empty()); 351 DCHECK(color_profile->empty());
337 NOTIMPLEMENTED(); 352 NOTIMPLEMENTED();
338 return false; 353 return false;
339 } 354 }
340 355
341 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() { 356 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
342 // We do not have any root window specific parts in this view. 357 // We do not have any root window specific parts in this view.
343 return GetViewBounds(); 358 return GetViewBounds();
344 } 359 }
345 360
346 #if defined(USE_AURA)
347 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent( 361 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
348 const TouchEventWithLatencyInfo& touch, 362 const TouchEventWithLatencyInfo& touch,
349 InputEventAckState ack_result) { 363 InputEventAckState ack_result) {
364 if (!frame_connector_)
365 return;
366
367 frame_connector_->ForwardProcessAckedTouchEvent(touch, ack_result);
350 } 368 }
351 #endif // defined(USE_AURA)
352 369
353 bool RenderWidgetHostViewChildFrame::LockMouse() { 370 bool RenderWidgetHostViewChildFrame::LockMouse() {
354 return false; 371 return false;
355 } 372 }
356 373
357 void RenderWidgetHostViewChildFrame::UnlockMouse() { 374 void RenderWidgetHostViewChildFrame::UnlockMouse() {
358 } 375 }
359 376
360 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() { 377 uint32_t RenderWidgetHostViewChildFrame::GetSurfaceIdNamespace() {
361 return id_allocator_->id_namespace(); 378 return id_allocator_->id_namespace();
362 } 379 }
363 380
364 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent( 381 void RenderWidgetHostViewChildFrame::ProcessKeyboardEvent(
365 const NativeWebKeyboardEvent& event) { 382 const NativeWebKeyboardEvent& event) {
366 if (!host_)
367 return;
368
369 host_->ForwardKeyboardEvent(event); 383 host_->ForwardKeyboardEvent(event);
370 } 384 }
371 385
372 void RenderWidgetHostViewChildFrame::ProcessMouseEvent( 386 void RenderWidgetHostViewChildFrame::ProcessMouseEvent(
373 const blink::WebMouseEvent& event) { 387 const blink::WebMouseEvent& event) {
374 if (!host_)
375 return;
376
377 host_->ForwardMouseEvent(event); 388 host_->ForwardMouseEvent(event);
378 } 389 }
379 390
380 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent( 391 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent(
381 const blink::WebMouseWheelEvent& event) { 392 const blink::WebMouseWheelEvent& event) {
382 if (!host_) 393 if (!host_)
383 return; 394 return;
384 395
385 if (event.deltaX != 0 || event.deltaY != 0) 396 if (event.deltaX != 0 || event.deltaY != 0)
386 host_->ForwardWheelEvent(event); 397 host_->ForwardWheelEvent(event);
387 } 398 }
388 399
400 void RenderWidgetHostViewChildFrame::ProcessTouchEvent(
401 const blink::WebTouchEvent& event,
402 const ui::LatencyInfo& latency) {
403 if (event.type == blink::WebInputEvent::TouchStart &&
404 frame_connector_ && !frame_connector_->HasFocus()) {
405 frame_connector_->Focus();
406 }
407
408 host_->ForwardTouchEventWithLatencyInfo(event, latency);
409 }
410
389 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace( 411 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace(
390 const gfx::Point& point) { 412 const gfx::Point& point) {
391 if (!frame_connector_) 413 if (!frame_connector_)
392 return point; 414 return point;
393 415
394 return frame_connector_->TransformPointToRootCoordSpace(point, surface_id_); 416 return frame_connector_->TransformPointToRootCoordSpace(point, surface_id_);
395 } 417 }
396 418
397 #if defined(OS_MACOSX) 419 #if defined(OS_MACOSX)
398 void RenderWidgetHostViewChildFrame::SetActive(bool active) { 420 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 549 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
528 } 550 }
529 551
530 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 552 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
531 if (surface_factory_ && !surface_id_.is_null()) 553 if (surface_factory_ && !surface_id_.is_null())
532 surface_factory_->Destroy(surface_id_); 554 surface_factory_->Destroy(surface_id_);
533 surface_id_ = cc::SurfaceId(); 555 surface_id_ = cc::SurfaceId();
534 } 556 }
535 557
536 } // namespace content 558 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698