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 org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
8 import org.chromium.base.JNINamespace; | 8 import org.chromium.base.JNINamespace; |
| 9 import org.chromium.content_public.browser.JavaScriptCallback; |
9 import org.chromium.content_public.browser.NavigationController; | 10 import org.chromium.content_public.browser.NavigationController; |
10 import org.chromium.content_public.browser.NavigationTransitionDelegate; | 11 import org.chromium.content_public.browser.NavigationTransitionDelegate; |
11 import org.chromium.content_public.browser.WebContents; | 12 import org.chromium.content_public.browser.WebContents; |
12 | 13 |
13 /** | 14 /** |
14 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo
ntentsImpl | 15 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo
ntentsImpl |
15 * object. | 16 * object. |
16 */ | 17 */ |
17 @JNINamespace("content") | 18 @JNINamespace("content") |
18 //TODO(tedchoc): Remove the package restriction once this class moves to a non-p
ublic content | 19 //TODO(tedchoc): Remove the package restriction once this class moves to a non-p
ublic content |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 161 } |
161 | 162 |
162 @Override | 163 @Override |
163 public void setNavigationTransitionDelegate(NavigationTransitionDelegate del
egate) { | 164 public void setNavigationTransitionDelegate(NavigationTransitionDelegate del
egate) { |
164 mNavigationTransitionDelegate = delegate; | 165 mNavigationTransitionDelegate = delegate; |
165 } | 166 } |
166 | 167 |
167 /** | 168 /** |
168 * Inserts the provided markup sandboxed into the frame. | 169 * Inserts the provided markup sandboxed into the frame. |
169 */ | 170 */ |
| 171 @Override |
170 public void setupTransitionView(String markup) { | 172 public void setupTransitionView(String markup) { |
171 nativeSetupTransitionView(mNativeWebContentsAndroid, markup); | 173 nativeSetupTransitionView(mNativeWebContentsAndroid, markup); |
172 } | 174 } |
173 | 175 |
174 /** | 176 /** |
175 * Hides transition elements specified by the selector, and activates any | 177 * Hides transition elements specified by the selector, and activates any |
176 * exiting-transition stylesheets. | 178 * exiting-transition stylesheets. |
177 */ | 179 */ |
| 180 @Override |
178 public void beginExitTransition(String cssSelector) { | 181 public void beginExitTransition(String cssSelector) { |
179 nativeBeginExitTransition(mNativeWebContentsAndroid, cssSelector); | 182 nativeBeginExitTransition(mNativeWebContentsAndroid, cssSelector); |
180 } | 183 } |
181 | 184 |
182 @CalledByNative | 185 @CalledByNative |
183 private void didDeferAfterResponseStarted(String markup, String cssSelector, | 186 private void didDeferAfterResponseStarted(String markup, String cssSelector, |
184 String enteringColor) { | 187 String enteringColor) { |
185 if (mNavigationTransitionDelegate != null ) { | 188 if (mNavigationTransitionDelegate != null ) { |
186 mNavigationTransitionDelegate.didDeferAfterResponseStarted(markup, | 189 mNavigationTransitionDelegate.didDeferAfterResponseStarted(markup, |
187 cssSelector, enteringColor); | 190 cssSelector, enteringColor); |
(...skipping 13 matching lines...) Expand all Loading... |
201 } | 204 } |
202 } | 205 } |
203 | 206 |
204 @CalledByNative | 207 @CalledByNative |
205 private void didStartNavigationTransitionForFrame(long frameId) { | 208 private void didStartNavigationTransitionForFrame(long frameId) { |
206 if (mNavigationTransitionDelegate != null ) { | 209 if (mNavigationTransitionDelegate != null ) { |
207 mNavigationTransitionDelegate.didStartNavigationTransitionForFrame(f
rameId); | 210 mNavigationTransitionDelegate.didStartNavigationTransitionForFrame(f
rameId); |
208 } | 211 } |
209 } | 212 } |
210 | 213 |
| 214 @Override |
| 215 public void evaluateJavaScript(String script, JavaScriptCallback callback, |
| 216 boolean startRenderer) { |
| 217 nativeEvaluateJavaScript(mNativeWebContentsAndroid, script, callback, t
rue); |
| 218 } |
| 219 |
| 220 @CalledByNative |
| 221 private static void onEvaluateJavaScriptResult( |
| 222 String jsonResult, JavaScriptCallback callback) { |
| 223 callback.handleJavaScriptResult(jsonResult); |
| 224 } |
| 225 |
211 private native String nativeGetTitle(long nativeWebContentsAndroid); | 226 private native String nativeGetTitle(long nativeWebContentsAndroid); |
212 private native String nativeGetVisibleURL(long nativeWebContentsAndroid); | 227 private native String nativeGetVisibleURL(long nativeWebContentsAndroid); |
213 private native void nativeStop(long nativeWebContentsAndroid); | 228 private native void nativeStop(long nativeWebContentsAndroid); |
214 private native void nativeInsertCSS(long nativeWebContentsAndroid, String cs
s); | 229 private native void nativeInsertCSS(long nativeWebContentsAndroid, String cs
s); |
215 private native void nativeOnHide(long nativeWebContentsAndroid); | 230 private native void nativeOnHide(long nativeWebContentsAndroid); |
216 private native void nativeOnShow(long nativeWebContentsAndroid); | 231 private native void nativeOnShow(long nativeWebContentsAndroid); |
217 private native int nativeGetBackgroundColor(long nativeWebContentsAndroid); | 232 private native int nativeGetBackgroundColor(long nativeWebContentsAndroid); |
218 private native void nativeAddStyleSheetByURL(long nativeWebContentsAndroid, | 233 private native void nativeAddStyleSheetByURL(long nativeWebContentsAndroid, |
219 String url); | 234 String url); |
220 private native void nativeShowInterstitialPage(long nativeWebContentsAndroid
, | 235 private native void nativeShowInterstitialPage(long nativeWebContentsAndroid
, |
221 String url, long nativeInterstitialPageDelegateAndroid); | 236 String url, long nativeInterstitialPageDelegateAndroid); |
222 private native boolean nativeIsShowingInterstitialPage(long nativeWebContent
sAndroid); | 237 private native boolean nativeIsShowingInterstitialPage(long nativeWebContent
sAndroid); |
223 private native boolean nativeIsRenderWidgetHostViewReady(long nativeWebConte
ntsAndroid); | 238 private native boolean nativeIsRenderWidgetHostViewReady(long nativeWebConte
ntsAndroid); |
224 private native void nativeExitFullscreen(long nativeWebContentsAndroid); | 239 private native void nativeExitFullscreen(long nativeWebContentsAndroid); |
225 private native void nativeUpdateTopControlsState(long nativeWebContentsAndro
id, | 240 private native void nativeUpdateTopControlsState(long nativeWebContentsAndro
id, |
226 boolean enableHiding, boolean enableShowing, boolean animate); | 241 boolean enableHiding, boolean enableShowing, boolean animate); |
227 private native void nativeShowImeIfNeeded(long nativeWebContentsAndroid); | 242 private native void nativeShowImeIfNeeded(long nativeWebContentsAndroid); |
228 private native void nativeScrollFocusedEditableNodeIntoView(long nativeWebCo
ntentsAndroid); | 243 private native void nativeScrollFocusedEditableNodeIntoView(long nativeWebCo
ntentsAndroid); |
229 private native void nativeSelectWordAroundCaret(long nativeWebContentsAndroi
d); | 244 private native void nativeSelectWordAroundCaret(long nativeWebContentsAndroi
d); |
230 private native String nativeGetURL(long nativeWebContentsAndroid); | 245 private native String nativeGetURL(long nativeWebContentsAndroid); |
231 private native boolean nativeIsIncognito(long nativeWebContentsAndroid); | 246 private native boolean nativeIsIncognito(long nativeWebContentsAndroid); |
232 private native void nativeResumeResponseDeferredAtStart(long nativeWebConten
tsAndroid); | 247 private native void nativeResumeResponseDeferredAtStart(long nativeWebConten
tsAndroid); |
233 private native void nativeSetHasPendingNavigationTransitionForTesting( | 248 private native void nativeSetHasPendingNavigationTransitionForTesting( |
234 long nativeWebContentsAndroid); | 249 long nativeWebContentsAndroid); |
235 private native void nativeSetupTransitionView(long nativeWebContentsAndroid, | 250 private native void nativeSetupTransitionView(long nativeWebContentsAndroid, |
236 String markup); | 251 String markup); |
237 private native void nativeBeginExitTransition(long nativeWebContentsAndroid, | 252 private native void nativeBeginExitTransition(long nativeWebContentsAndroid, |
238 String cssSelector); | 253 String cssSelector); |
| 254 private native void nativeEvaluateJavaScript(long nativeWebContentsAndroid, |
| 255 String script, JavaScriptCallback callback, boolean startRenderer); |
239 } | 256 } |
OLD | NEW |