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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 2738663003: Fix TODOs related to SDK 24 (Closed)
Patch Set: Re-revert fix TODOs related to SDK 24 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.assist.AssistStructure.ViewNode; 9 import android.app.assist.AssistStructure.ViewNode;
10 import android.content.ClipData; 10 import android.content.ClipData;
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2409 2409
2410 public void setBackgroundOpaque(boolean opaque) { 2410 public void setBackgroundOpaque(boolean opaque) {
2411 if (mNativeContentViewCore != 0) { 2411 if (mNativeContentViewCore != 0) {
2412 nativeSetBackgroundOpaque(mNativeContentViewCore, opaque); 2412 nativeSetBackgroundOpaque(mNativeContentViewCore, opaque);
2413 } 2413 }
2414 } 2414 }
2415 2415
2416 /** 2416 /**
2417 * @see View#onDragEvent(DragEvent) 2417 * @see View#onDragEvent(DragEvent)
2418 */ 2418 */
2419 // TODO(hush): uncomment below when we build with API 24. 2419 @TargetApi(Build.VERSION_CODES.N)
2420 // @TargetApi(Build.VERSION_CODES.N)
2421 public boolean onDragEvent(DragEvent event) { 2420 public boolean onDragEvent(DragEvent event) {
2422 if (mNativeContentViewCore == 0 || Build.VERSION.SDK_INT <= Build.VERSIO N_CODES.M) { 2421 if (mNativeContentViewCore == 0 || Build.VERSION.SDK_INT <= Build.VERSIO N_CODES.M) {
2423 return false; 2422 return false;
2424 } 2423 }
2425 2424
2426 ClipDescription clipDescription = event.getClipDescription(); 2425 ClipDescription clipDescription = event.getClipDescription();
2427 2426
2428 // text/* will match text/uri-list, text/html, text/plain. 2427 // text/* will match text/uri-list, text/html, text/plain.
2429 String[] mimeTypes = 2428 String[] mimeTypes =
2430 clipDescription == null ? new String[0] : clipDescription.filter MimeTypes("text/*"); 2429 clipDescription == null ? new String[0] : clipDescription.filter MimeTypes("text/*");
2431 2430
2432 if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) { 2431 if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) {
2433 // TODO(hush): support dragging more than just text. 2432 // TODO(hush): support dragging more than just text.
2434 return mimeTypes != null && mimeTypes.length > 0 2433 return mimeTypes != null && mimeTypes.length > 0
2435 && nativeIsTouchDragDropEnabled(mNativeContentViewCore); 2434 && nativeIsTouchDragDropEnabled(mNativeContentViewCore);
2436 } 2435 }
2437 2436
2438 StringBuilder content = new StringBuilder(""); 2437 StringBuilder content = new StringBuilder("");
2439 if (event.getAction() == DragEvent.ACTION_DROP) { 2438 if (event.getAction() == DragEvent.ACTION_DROP) {
2440 // TODO(hush): obtain dragdrop permissions (via reflection?), when d ragging files into 2439 // TODO(hush): obtain dragdrop permissions, when dragging files into Chrome/WebView is
2441 // Chrome/WebView is supported. Not necessary to do so for now, beca use only text 2440 // supported. Not necessary to do so for now, because only text drag ging is supported.
2442 // dragging is supported.
2443 ClipData clipData = event.getClipData(); 2441 ClipData clipData = event.getClipData();
2444 final int itemCount = clipData.getItemCount(); 2442 final int itemCount = clipData.getItemCount();
2445 for (int i = 0; i < itemCount; i++) { 2443 for (int i = 0; i < itemCount; i++) {
2446 ClipData.Item item = clipData.getItemAt(i); 2444 ClipData.Item item = clipData.getItemAt(i);
2447 content.append(item.coerceToStyledText(mContainerView.getContext ())); 2445 content.append(item.coerceToStyledText(mContainerView.getContext ()));
2448 } 2446 }
2449 } 2447 }
2450 2448
2451 int[] locationOnScreen = new int[2]; 2449 int[] locationOnScreen = new int[2];
2452 mContainerView.getLocationOnScreen(locationOnScreen); 2450 mContainerView.getLocationOnScreen(locationOnScreen);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l, 2679 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l,
2682 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily, 2680 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily,
2683 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor, 2681 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor,
2684 String textTrackTextShadow, String textTrackTextSize); 2682 String textTrackTextShadow, String textTrackTextSize);
2685 2683
2686 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 2684 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
2687 private native boolean nativeIsTouchDragDropEnabled(long nativeContentViewCo reImpl); 2685 private native boolean nativeIsTouchDragDropEnabled(long nativeContentViewCo reImpl);
2688 private native void nativeOnDragEvent(long nativeContentViewCoreImpl, int ac tion, int x, int y, 2686 private native void nativeOnDragEvent(long nativeContentViewCoreImpl, int ac tion, int x, int y,
2689 int screenX, int screenY, String[] mimeTypes, String content); 2687 int screenX, int screenY, String[] mimeTypes, String content);
2690 } 2688 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698