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

Side by Side Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 2708613002: Add EventForwarder for routing touch events (Closed)
Patch Set: EventForwarder... Created 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_view_android.h" 5 #include "content/browser/web_contents/web_contents_view_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
11 #include "content/browser/android/content_view_core_impl.h" 11 #include "content/browser/android/content_view_core_impl.h"
12 #include "content/browser/frame_host/interstitial_page_impl.h" 12 #include "content/browser/frame_host/interstitial_page_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_view_android.h"
14 #include "content/browser/renderer_host/render_view_host_factory.h" 13 #include "content/browser/renderer_host/render_view_host_factory.h"
15 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
15 #include "content/browser/renderer_host/render_widget_host_view_android.h"
16 #include "content/browser/web_contents/web_contents_impl.h" 16 #include "content/browser/web_contents/web_contents_impl.h"
17 #include "content/public/browser/render_widget_host.h" 17 #include "content/public/browser/render_widget_host.h"
18 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
19 #include "content/public/common/drop_data.h" 19 #include "content/public/common/drop_data.h"
20 #include "ui/android/overscroll_refresh_handler.h" 20 #include "ui/android/overscroll_refresh_handler.h"
21 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
22 #include "ui/events/android/motion_event_android.h"
22 #include "ui/gfx/android/java_bitmap.h" 23 #include "ui/gfx/android/java_bitmap.h"
23 #include "ui/gfx/image/image_skia.h" 24 #include "ui/gfx/image/image_skia.h"
24 25
25 using base::android::AttachCurrentThread; 26 using base::android::AttachCurrentThread;
26 using base::android::ConvertUTF16ToJavaString; 27 using base::android::ConvertUTF16ToJavaString;
27 using base::android::JavaRef; 28 using base::android::JavaRef;
28 using base::android::ScopedJavaLocalRef; 29 using base::android::ScopedJavaLocalRef;
29 30
30 namespace content { 31 namespace content {
31 32
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 *render_view_host_delegate_view = rv; 76 *render_view_host_delegate_view = rv;
76 return rv; 77 return rv;
77 } 78 }
78 79
79 WebContentsViewAndroid::WebContentsViewAndroid( 80 WebContentsViewAndroid::WebContentsViewAndroid(
80 WebContentsImpl* web_contents, 81 WebContentsImpl* web_contents,
81 WebContentsViewDelegate* delegate) 82 WebContentsViewDelegate* delegate)
82 : web_contents_(web_contents), 83 : web_contents_(web_contents),
83 content_view_core_(NULL), 84 content_view_core_(NULL),
84 delegate_(delegate), 85 delegate_(delegate),
85 synchronous_compositor_client_(nullptr) { 86 view_(this),
86 } 87 synchronous_compositor_client_(nullptr) {}
87 88
88 WebContentsViewAndroid::~WebContentsViewAndroid() { 89 WebContentsViewAndroid::~WebContentsViewAndroid() {
89 if (view_.GetLayer()) 90 if (view_.GetLayer())
90 view_.GetLayer()->RemoveFromParent(); 91 view_.GetLayer()->RemoveFromParent();
91 } 92 }
92 93
93 void WebContentsViewAndroid::SetContentViewCore( 94 void WebContentsViewAndroid::SetContentViewCore(
94 ContentViewCoreImpl* content_view_core) { 95 ContentViewCoreImpl* content_view_core) {
95 content_view_core_ = content_view_core; 96 content_view_core_ = content_view_core;
96 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( 97 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>(
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 389
389 // This is called when we the renderer asks us to take focus back (i.e., it has 390 // This is called when we the renderer asks us to take focus back (i.e., it has
390 // iterated past the last focusable element on the page). 391 // iterated past the last focusable element on the page).
391 void WebContentsViewAndroid::TakeFocus(bool reverse) { 392 void WebContentsViewAndroid::TakeFocus(bool reverse) {
392 if (web_contents_->GetDelegate() && 393 if (web_contents_->GetDelegate() &&
393 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 394 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
394 return; 395 return;
395 web_contents_->GetRenderWidgetHostView()->Focus(); 396 web_contents_->GetRenderWidgetHostView()->Focus();
396 } 397 }
397 398
399 bool WebContentsViewAndroid::OnTouchEvent(const ui::MotionEventAndroid& event,
400 bool for_touch_handle) {
401 if (event.GetAction() == ui::MotionEventAndroid::ACTION_DOWN)
402 content_view_core_->OnTouchDown(event.GetJavaObject());
403 return false; // let the children handle the actual event.
404 }
405
398 } // namespace content 406 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_android.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698