Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1363)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java

Issue 975293004: Start caching the theme color in web_contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made the default transparent and started caching last sent Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698