| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.webcontents; | 5 package org.chromium.content.browser.webcontents; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| 11 import android.os.Parcel; | 11 import android.os.Parcel; |
| 12 import android.os.ParcelUuid; | 12 import android.os.ParcelUuid; |
| 13 import android.os.Parcelable; | 13 import android.os.Parcelable; |
| 14 | 14 |
| 15 import org.chromium.base.ObserverList; | 15 import org.chromium.base.ObserverList; |
| 16 import org.chromium.base.ThreadUtils; | 16 import org.chromium.base.ThreadUtils; |
| 17 import org.chromium.base.VisibleForTesting; | 17 import org.chromium.base.VisibleForTesting; |
| 18 import org.chromium.base.annotations.CalledByNative; | 18 import org.chromium.base.annotations.CalledByNative; |
| 19 import org.chromium.base.annotations.JNINamespace; | 19 import org.chromium.base.annotations.JNINamespace; |
| 20 import org.chromium.content.browser.AppWebMessagePort; | 20 import org.chromium.content.browser.AppWebMessagePort; |
| 21 import org.chromium.content.browser.AppWebMessagePortService; | 21 import org.chromium.content.browser.AppWebMessagePortService; |
| 22 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; | 22 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; |
| 23 import org.chromium.content_public.browser.AccessibilitySnapshotNode; | 23 import org.chromium.content_public.browser.AccessibilitySnapshotNode; |
| 24 import org.chromium.content_public.browser.ContentBitmapCallback; | 24 import org.chromium.content_public.browser.ContentBitmapCallback; |
| 25 import org.chromium.content_public.browser.ImageDownloadCallback; | 25 import org.chromium.content_public.browser.ImageDownloadCallback; |
| 26 import org.chromium.content_public.browser.JavaScriptCallback; | 26 import org.chromium.content_public.browser.JavaScriptCallback; |
| 27 import org.chromium.content_public.browser.MediaSessionDelegate; |
| 27 import org.chromium.content_public.browser.MessagePortService; | 28 import org.chromium.content_public.browser.MessagePortService; |
| 28 import org.chromium.content_public.browser.NavigationController; | 29 import org.chromium.content_public.browser.NavigationController; |
| 29 import org.chromium.content_public.browser.WebContents; | 30 import org.chromium.content_public.browser.WebContents; |
| 30 import org.chromium.content_public.browser.WebContentsObserver; | 31 import org.chromium.content_public.browser.WebContentsObserver; |
| 31 import org.chromium.ui.accessibility.AXTextStyle; | 32 import org.chromium.ui.accessibility.AXTextStyle; |
| 32 | 33 |
| 33 import java.util.ArrayList; | 34 import java.util.ArrayList; |
| 34 import java.util.List; | 35 import java.util.List; |
| 35 import java.util.UUID; | 36 import java.util.UUID; |
| 36 | 37 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 public int getThemeColor() { | 367 public int getThemeColor() { |
| 367 return nativeGetThemeColor(mNativeWebContentsAndroid); | 368 return nativeGetThemeColor(mNativeWebContentsAndroid); |
| 368 } | 369 } |
| 369 | 370 |
| 370 @Override | 371 @Override |
| 371 public void requestAccessibilitySnapshot(AccessibilitySnapshotCallback callb
ack) { | 372 public void requestAccessibilitySnapshot(AccessibilitySnapshotCallback callb
ack) { |
| 372 nativeRequestAccessibilitySnapshot(mNativeWebContentsAndroid, callback); | 373 nativeRequestAccessibilitySnapshot(mNativeWebContentsAndroid, callback); |
| 373 } | 374 } |
| 374 | 375 |
| 375 @Override | 376 @Override |
| 376 public void resumeMediaSession() { | 377 public void addMediaSessionDelegate(MediaSessionDelegate delegate) { |
| 377 nativeResumeMediaSession(mNativeWebContentsAndroid); | 378 nativeAddMediaSessionDelegate(mNativeWebContentsAndroid, delegate); |
| 378 } | |
| 379 | |
| 380 @Override | |
| 381 public void suspendMediaSession() { | |
| 382 nativeSuspendMediaSession(mNativeWebContentsAndroid); | |
| 383 } | |
| 384 | |
| 385 @Override | |
| 386 public void stopMediaSession() { | |
| 387 nativeStopMediaSession(mNativeWebContentsAndroid); | |
| 388 } | 379 } |
| 389 | 380 |
| 390 // root node can be null if parsing fails. | 381 // root node can be null if parsing fails. |
| 391 @CalledByNative | 382 @CalledByNative |
| 392 private static void onAccessibilitySnapshot(AccessibilitySnapshotNode root, | 383 private static void onAccessibilitySnapshot(AccessibilitySnapshotNode root, |
| 393 AccessibilitySnapshotCallback callback) { | 384 AccessibilitySnapshotCallback callback) { |
| 394 callback.onAccessibilitySnapshot(root); | 385 callback.onAccessibilitySnapshot(root); |
| 395 } | 386 } |
| 396 | 387 |
| 397 @CalledByNative | 388 @CalledByNative |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 long nativeWebContentsAndroid, int level, String message); | 531 long nativeWebContentsAndroid, int level, String message); |
| 541 private native void nativePostMessageToFrame(long nativeWebContentsAndroid,
String frameName, | 532 private native void nativePostMessageToFrame(long nativeWebContentsAndroid,
String frameName, |
| 542 String message, String targetOrigin, int[] sentPortIds); | 533 String message, String targetOrigin, int[] sentPortIds); |
| 543 private native void nativeCreateMessageChannel( | 534 private native void nativeCreateMessageChannel( |
| 544 long nativeWebContentsAndroid, AppWebMessagePort[] ports); | 535 long nativeWebContentsAndroid, AppWebMessagePort[] ports); |
| 545 private native boolean nativeHasAccessedInitialDocument( | 536 private native boolean nativeHasAccessedInitialDocument( |
| 546 long nativeWebContentsAndroid); | 537 long nativeWebContentsAndroid); |
| 547 private native int nativeGetThemeColor(long nativeWebContentsAndroid); | 538 private native int nativeGetThemeColor(long nativeWebContentsAndroid); |
| 548 private native void nativeRequestAccessibilitySnapshot( | 539 private native void nativeRequestAccessibilitySnapshot( |
| 549 long nativeWebContentsAndroid, AccessibilitySnapshotCallback callbac
k); | 540 long nativeWebContentsAndroid, AccessibilitySnapshotCallback callbac
k); |
| 550 private native void nativeResumeMediaSession(long nativeWebContentsAndroid); | 541 private native void nativeAddMediaSessionDelegate( |
| 551 private native void nativeSuspendMediaSession(long nativeWebContentsAndroid)
; | 542 long nativeWebContentsAndroid, MediaSessionDelegate delegate); |
| 552 private native void nativeStopMediaSession(long nativeWebContentsAndroid); | |
| 553 private native void nativeGetContentBitmap(long nativeWebContentsAndroid, | 543 private native void nativeGetContentBitmap(long nativeWebContentsAndroid, |
| 554 ContentBitmapCallback callback, Bitmap.Config config, float scale, | 544 ContentBitmapCallback callback, Bitmap.Config config, float scale, |
| 555 float x, float y, float width, float height); | 545 float x, float y, float width, float height); |
| 556 private native void nativeReloadLoFiImages(long nativeWebContentsAndroid); | 546 private native void nativeReloadLoFiImages(long nativeWebContentsAndroid); |
| 557 private native int nativeDownloadImage(long nativeWebContentsAndroid, | 547 private native int nativeDownloadImage(long nativeWebContentsAndroid, |
| 558 String url, boolean isFavicon, int maxBitmapSize, | 548 String url, boolean isFavicon, int maxBitmapSize, |
| 559 boolean bypassCache, ImageDownloadCallback callback); | 549 boolean bypassCache, ImageDownloadCallback callback); |
| 560 } | 550 } |
| OLD | NEW |