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.content.Context; |
| 8 |
7 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
8 import org.chromium.base.JNINamespace; | 10 import org.chromium.base.JNINamespace; |
9 import org.chromium.content_public.browser.JavaScriptCallback; | 11 import org.chromium.content_public.browser.JavaScriptCallback; |
10 import org.chromium.content_public.browser.NavigationController; | 12 import org.chromium.content_public.browser.NavigationController; |
11 import org.chromium.content_public.browser.NavigationTransitionDelegate; | 13 import org.chromium.content_public.browser.NavigationTransitionDelegate; |
12 import org.chromium.content_public.browser.WebContents; | 14 import org.chromium.content_public.browser.WebContents; |
13 | 15 |
14 /** | 16 /** |
15 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo
ntentsImpl | 17 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo
ntentsImpl |
16 * object. | 18 * object. |
17 */ | 19 */ |
18 @JNINamespace("content") | 20 @JNINamespace("content") |
19 //TODO(tedchoc): Remove the package restriction once this class moves to a non-p
ublic content | 21 //TODO(tedchoc): Remove the package restriction once this class moves to a non-p
ublic content |
20 // package whose visibility will be enforced via DEPS. | 22 // package whose visibility will be enforced via DEPS. |
21 /* package */ class WebContentsImpl implements WebContents { | 23 /* package */ class WebContentsImpl implements WebContents { |
22 | 24 |
23 private long mNativeWebContentsAndroid; | 25 private long mNativeWebContentsAndroid; |
24 private NavigationController mNavigationController; | 26 private NavigationController mNavigationController; |
| 27 private Context mContext; |
25 | 28 |
26 private NavigationTransitionDelegate mNavigationTransitionDelegate = null; | 29 private NavigationTransitionDelegate mNavigationTransitionDelegate = null; |
27 | 30 |
28 private WebContentsImpl( | 31 private WebContentsImpl( |
29 long nativeWebContentsAndroid, NavigationController navigationContro
ller) { | 32 long nativeWebContentsAndroid, NavigationController navigationContro
ller) { |
30 mNativeWebContentsAndroid = nativeWebContentsAndroid; | 33 mNativeWebContentsAndroid = nativeWebContentsAndroid; |
31 mNavigationController = navigationController; | 34 mNavigationController = navigationController; |
32 } | 35 } |
33 | 36 |
34 @CalledByNative | 37 @CalledByNative |
35 private static WebContentsImpl create( | 38 private static WebContentsImpl create( |
36 long nativeWebContentsAndroid, NavigationController navigationContro
ller) { | 39 long nativeWebContentsAndroid, NavigationController navigationContro
ller) { |
37 return new WebContentsImpl(nativeWebContentsAndroid, navigationControlle
r); | 40 return new WebContentsImpl(nativeWebContentsAndroid, navigationControlle
r); |
38 } | 41 } |
39 | 42 |
40 @CalledByNative | 43 @CalledByNative |
41 private void destroy() { | 44 private void destroy() { |
42 mNativeWebContentsAndroid = 0; | 45 mNativeWebContentsAndroid = 0; |
43 mNavigationController = null; | 46 mNavigationController = null; |
44 } | 47 } |
45 | 48 |
46 @CalledByNative | 49 @CalledByNative |
47 private long getNativePointer() { | 50 private long getNativePointer() { |
48 return mNativeWebContentsAndroid; | 51 return mNativeWebContentsAndroid; |
49 } | 52 } |
50 | 53 |
51 @Override | 54 @Override |
| 55 public void setContext(Context context) { |
| 56 mContext = context; |
| 57 } |
| 58 |
| 59 @Override |
| 60 public Context getContext() { |
| 61 return mContext; |
| 62 } |
| 63 |
| 64 @Override |
52 public NavigationController getNavigationController() { | 65 public NavigationController getNavigationController() { |
53 return mNavigationController; | 66 return mNavigationController; |
54 } | 67 } |
55 | 68 |
56 @Override | 69 @Override |
57 public String getTitle() { | 70 public String getTitle() { |
58 return nativeGetTitle(mNativeWebContentsAndroid); | 71 return nativeGetTitle(mNativeWebContentsAndroid); |
59 } | 72 } |
60 | 73 |
61 @Override | 74 @Override |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 private native void nativeResumeResponseDeferredAtStart(long nativeWebConten
tsAndroid); | 265 private native void nativeResumeResponseDeferredAtStart(long nativeWebConten
tsAndroid); |
253 private native void nativeSetHasPendingNavigationTransitionForTesting( | 266 private native void nativeSetHasPendingNavigationTransitionForTesting( |
254 long nativeWebContentsAndroid); | 267 long nativeWebContentsAndroid); |
255 private native void nativeSetupTransitionView(long nativeWebContentsAndroid, | 268 private native void nativeSetupTransitionView(long nativeWebContentsAndroid, |
256 String markup); | 269 String markup); |
257 private native void nativeBeginExitTransition(long nativeWebContentsAndroid, | 270 private native void nativeBeginExitTransition(long nativeWebContentsAndroid, |
258 String cssSelector); | 271 String cssSelector); |
259 private native void nativeEvaluateJavaScript(long nativeWebContentsAndroid, | 272 private native void nativeEvaluateJavaScript(long nativeWebContentsAndroid, |
260 String script, JavaScriptCallback callback); | 273 String script, JavaScriptCallback callback); |
261 } | 274 } |
OLD | NEW |