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.graphics.Color; |
| 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 import org.chromium.content_public.browser.WebContentsObserver; | 15 import org.chromium.content_public.browser.WebContentsObserver; |
14 | 16 |
15 /** | 17 /** |
16 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo
ntentsImpl | 18 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo
ntentsImpl |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return nativeHasAccessedInitialDocument(mNativeWebContentsAndroid); | 316 return nativeHasAccessedInitialDocument(mNativeWebContentsAndroid); |
315 } | 317 } |
316 | 318 |
317 @CalledByNative | 319 @CalledByNative |
318 private static void onEvaluateJavaScriptResult( | 320 private static void onEvaluateJavaScriptResult( |
319 String jsonResult, JavaScriptCallback callback) { | 321 String jsonResult, JavaScriptCallback callback) { |
320 callback.handleJavaScriptResult(jsonResult); | 322 callback.handleJavaScriptResult(jsonResult); |
321 } | 323 } |
322 | 324 |
323 @Override | 325 @Override |
| 326 public int getThemeColor(int defaultColor) { |
| 327 int color = nativeGetThemeColor(mNativeWebContentsAndroid); |
| 328 if (color == Color.TRANSPARENT) return defaultColor; |
| 329 |
| 330 return (color | 0xFF000000); |
| 331 } |
| 332 |
| 333 @Override |
324 public void addObserver(WebContentsObserver observer) { | 334 public void addObserver(WebContentsObserver observer) { |
325 assert mNativeWebContentsAndroid != 0; | 335 assert mNativeWebContentsAndroid != 0; |
326 if (mObserverProxy == null) mObserverProxy = new WebContentsObserverProx
y(this); | 336 if (mObserverProxy == null) mObserverProxy = new WebContentsObserverProx
y(this); |
327 mObserverProxy.addObserver(observer); | 337 mObserverProxy.addObserver(observer); |
328 } | 338 } |
329 | 339 |
330 @Override | 340 @Override |
331 public void removeObserver(WebContentsObserver observer) { | 341 public void removeObserver(WebContentsObserver observer) { |
332 if (mObserverProxy == null) return; | 342 if (mObserverProxy == null) return; |
333 mObserverProxy.removeObserver(observer); | 343 mObserverProxy.removeObserver(observer); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 private native void nativeShowTransitionElements(long nativeWebContentsAndro
id, | 384 private native void nativeShowTransitionElements(long nativeWebContentsAndro
id, |
375 String cssSelector); | 385 String cssSelector); |
376 private native void nativeClearNavigationTransitionData(long nativeWebConten
tsAndroid); | 386 private native void nativeClearNavigationTransitionData(long nativeWebConten
tsAndroid); |
377 private native void nativeFetchTransitionElements(long nativeWebContentsAndr
oid, String url); | 387 private native void nativeFetchTransitionElements(long nativeWebContentsAndr
oid, String url); |
378 private native void nativeEvaluateJavaScript(long nativeWebContentsAndroid, | 388 private native void nativeEvaluateJavaScript(long nativeWebContentsAndroid, |
379 String script, JavaScriptCallback callback); | 389 String script, JavaScriptCallback callback); |
380 private native void nativeAddMessageToDevToolsConsole( | 390 private native void nativeAddMessageToDevToolsConsole( |
381 long nativeWebContentsAndroid, int level, String message); | 391 long nativeWebContentsAndroid, int level, String message); |
382 private native boolean nativeHasAccessedInitialDocument( | 392 private native boolean nativeHasAccessedInitialDocument( |
383 long nativeWebContentsAndroid); | 393 long nativeWebContentsAndroid); |
| 394 private native int nativeGetThemeColor(long nativeWebContentsAndroid); |
384 } | 395 } |
OLD | NEW |