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

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

Issue 1728193002: Support dragging texts into Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: generate DragEvent JNI bindings and use the enums from JNI Created 4 years, 5 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/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/android/content_view_core_impl.h" 8 #include "content/browser/android/content_view_core_impl.h"
9 #include "content/browser/frame_host/interstitial_page_impl.h" 9 #include "content/browser/frame_host/interstitial_page_impl.h"
10 #include "content/browser/renderer_host/render_widget_host_view_android.h" 10 #include "content/browser/renderer_host/render_widget_host_view_android.h"
11 #include "content/browser/renderer_host/render_view_host_factory.h" 11 #include "content/browser/renderer_host/render_view_host_factory.h"
12 #include "content/browser/renderer_host/render_view_host_impl.h" 12 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/browser/web_contents/web_contents_impl.h" 13 #include "content/browser/web_contents/web_contents_impl.h"
14 #include "content/public/browser/render_widget_host.h" 14 #include "content/public/browser/render_widget_host.h"
15 #include "content/public/browser/web_contents_delegate.h" 15 #include "content/public/browser/web_contents_delegate.h"
16 #include "content/public/common/drop_data.h"
16 17
17 namespace content { 18 namespace content {
19
18 WebContentsView* CreateWebContentsView( 20 WebContentsView* CreateWebContentsView(
19 WebContentsImpl* web_contents, 21 WebContentsImpl* web_contents,
20 WebContentsViewDelegate* delegate, 22 WebContentsViewDelegate* delegate,
21 RenderViewHostDelegateView** render_view_host_delegate_view) { 23 RenderViewHostDelegateView** render_view_host_delegate_view) {
22 WebContentsViewAndroid* rv = new WebContentsViewAndroid( 24 WebContentsViewAndroid* rv = new WebContentsViewAndroid(
23 web_contents, delegate); 25 web_contents, delegate);
24 *render_view_host_delegate_view = rv; 26 *render_view_host_delegate_view = rv;
25 return rv; 27 return rv;
26 } 28 }
27 29
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 const gfx::ImageSkia& image, 194 const gfx::ImageSkia& image,
193 const gfx::Vector2d& image_offset, 195 const gfx::Vector2d& image_offset,
194 const DragEventSourceInfo& event_info) { 196 const DragEventSourceInfo& event_info) {
195 NOTIMPLEMENTED(); 197 NOTIMPLEMENTED();
196 } 198 }
197 199
198 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) { 200 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) {
199 NOTIMPLEMENTED(); 201 NOTIMPLEMENTED();
200 } 202 }
201 203
204 void WebContentsViewAndroid::OnDragEntered(
205 const std::vector<DropData::Metadata>& metadata,
206 const gfx::Point& location,
207 const gfx::Point& screen_location) {
208 web_contents_->GetRenderViewHost()->DragTargetDragEnterWithMetaData(
209 metadata, location, screen_location, blink::WebDragOperationCopy, 0);
210 }
211
212 void WebContentsViewAndroid::OnDragUpdated(const gfx::Point& location,
213 const gfx::Point& screen_location) {
214 web_contents_->GetRenderViewHost()->DragTargetDragOver(
215 location, screen_location, blink::WebDragOperationCopy, 0);
216 }
217
218 void WebContentsViewAndroid::OnDragExited() {
219 web_contents_->GetRenderViewHost()->DragTargetDragLeave();
220 }
221
222 void WebContentsViewAndroid::OnPerformDrop(DropData* drop_data,
223 const gfx::Point& location,
224 const gfx::Point& screen_location) {
225 web_contents_->GetRenderViewHost()->FilterDropData(drop_data);
226 web_contents_->GetRenderViewHost()->DragTargetDrop(*drop_data, location,
227 screen_location, 0);
228 }
229
202 void WebContentsViewAndroid::GotFocus() { 230 void WebContentsViewAndroid::GotFocus() {
203 // This is only used in the views FocusManager stuff but it bleeds through 231 // This is only used in the views FocusManager stuff but it bleeds through
204 // all subclasses. http://crbug.com/21875 232 // all subclasses. http://crbug.com/21875
205 } 233 }
206 234
207 // This is called when we the renderer asks us to take focus back (i.e., it has 235 // This is called when we the renderer asks us to take focus back (i.e., it has
208 // iterated past the last focusable element on the page). 236 // iterated past the last focusable element on the page).
209 void WebContentsViewAndroid::TakeFocus(bool reverse) { 237 void WebContentsViewAndroid::TakeFocus(bool reverse) {
210 if (web_contents_->GetDelegate() && 238 if (web_contents_->GetDelegate() &&
211 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 239 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
212 return; 240 return;
213 web_contents_->GetRenderWidgetHostView()->Focus(); 241 web_contents_->GetRenderWidgetHostView()->Focus();
214 } 242 }
215 243
216 } // namespace content 244 } // 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