Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / android / java / src / org / chromium / chrome / browser / ChromeWebContentsDelegateAndroid.java
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser;
6
7 import android.graphics.Rect;
8 import android.graphics.RectF;
9
10 import org.chromium.base.CalledByNative;
11 import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid;
12
13 /**
14  * Chromium Android specific WebContentsDelegate.
15  * This file is the Java version of the native class of the same name.
16  * It should contain empty WebContentsDelegate methods to be implemented by the embedder.
17  * These methods belong to the Chromium Android port but not to WebView.
18  */
19 public class ChromeWebContentsDelegateAndroid extends WebContentsDelegateAndroid {
20
21     @CalledByNative
22     public void onFindResultAvailable(FindNotificationDetails result) {
23     }
24
25     @CalledByNative
26     public void onFindMatchRectsAvailable(FindMatchRectsDetails result) {
27     }
28
29     @CalledByNative
30     public boolean addNewContents(long nativeSourceWebContents, long nativeWebContents,
31             int disposition, Rect initialPosition, boolean userGesture) {
32         return false;
33     }
34
35     @CalledByNative
36     public void webContentsCreated(long sourceWebContents, long opener_render_frame_id,
37             String frameName, String targetUrl, long newWebContents) {
38     }
39
40     // Helper functions used to create types that are part of the public interface
41     @CalledByNative
42     private static Rect createRect(int x, int y, int right, int bottom) {
43         return new Rect(x, y, right, bottom);
44     }
45
46     @CalledByNative
47     private static RectF createRectF(float x, float y, float right, float bottom) {
48         return new RectF(x, y, right, bottom);
49     }
50
51     @CalledByNative
52     private static FindNotificationDetails createFindNotificationDetails(
53             int numberOfMatches, Rect rendererSelectionRect,
54             int activeMatchOrdinal, boolean finalUpdate) {
55         return new FindNotificationDetails(numberOfMatches, rendererSelectionRect,
56                 activeMatchOrdinal, finalUpdate);
57     }
58
59     @CalledByNative
60     private static FindMatchRectsDetails createFindMatchRectsDetails(
61             int version, int numRects, RectF activeRect) {
62         return new FindMatchRectsDetails(version, numRects, activeRect);
63     }
64
65     @CalledByNative
66     private static void setMatchRectByIndex(
67             FindMatchRectsDetails findMatchRectsDetails, int index, RectF rect) {
68         findMatchRectsDetails.rects[index] = rect;
69     }
70 }