1a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)package org.chromium.android_webview; 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 7ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochimport com.google.common.annotations.VisibleForTesting; 8ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)import org.chromium.base.CalledByNative; 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)import org.chromium.base.JNINamespace; 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid; 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * WebView-specific WebContentsDelegate. 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This file is the Java version of the native class of the same name. 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * It should contain abstract WebContentsDelegate methods to be implemented by the embedder. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * These methods belong to WebView but are not shared with the Chromium Android port. 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 19ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch@VisibleForTesting 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@JNINamespace("android_webview") 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)public abstract class AwWebContentsDelegate extends WebContentsDelegateAndroid { 22ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch // Callback filesSelectedInChooser() when done. 23ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch @CalledByNative 24ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch public abstract void runFileChooser(int processId, int renderId, int mode_flags, 25ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch String acceptTypes, String title, String defaultFilename, boolean capture); 26ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) @CalledByNative 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public abstract boolean addNewContents(boolean isDialog, boolean isUserGesture); 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 30a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) @Override 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) @CalledByNative 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public abstract void closeContents(); 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 34a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) @Override 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) @CalledByNative 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public abstract void activateContents(); 37c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 38ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch // Call in response to a prior runFileChooser call. 39ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch protected static native void nativeFilesSelectedInChooser(int processId, int renderId, 40ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch int mode_flags, String[] filePath); 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 42