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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 2315953002: Add theme color for Blimp on Android. (Closed)
Patch Set: Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.chrome.browser.tab; 5 package org.chromium.chrome.browser.tab;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.Application; 8 import android.app.Application;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 // either be transparent, the last theme color, or the color restored fr om TabState. 1107 // either be transparent, the last theme color, or the color restored fr om TabState.
1108 int themeColor = mThemeColor; 1108 int themeColor = mThemeColor;
1109 1109
1110 // Only use the web contents for the theme color if it is known to have changed, This 1110 // Only use the web contents for the theme color if it is known to have changed, This
1111 // corresponds to the didChangeThemeColor in WebContentsObserver. 1111 // corresponds to the didChangeThemeColor in WebContentsObserver.
1112 if (getWebContents() != null && didWebContentsThemeColorChange) { 1112 if (getWebContents() != null && didWebContentsThemeColorChange) {
1113 themeColor = getWebContents().getThemeColor(); 1113 themeColor = getWebContents().getThemeColor();
1114 if (themeColor != 0 && !ColorUtils.isValidThemeColor(themeColor)) th emeColor = 0; 1114 if (themeColor != 0 && !ColorUtils.isValidThemeColor(themeColor)) th emeColor = 0;
1115 } 1115 }
1116 1116
1117 // Apply theme color for Blimp tab.
1118 if (isBlimpTab() && getBlimpContents() != null) {
1119 themeColor = getBlimpContents().getThemeColor();
David Trainor- moved to gerrit 2016/09/07 05:08:52 What does isValidThemeColor do? Do we need that?
nyquist 2016/09/07 15:11:04 Turns out it checks the HSL lightness value to be
xingliu 2016/09/07 17:23:36 Added isValidThemeColor check.
1120 }
1121
1117 // Do not apply the theme color if there are any security issues on the page. 1122 // Do not apply the theme color if there are any security issues on the page.
1118 int securityLevel = getSecurityLevel(); 1123 int securityLevel = getSecurityLevel();
1119 if (securityLevel == ConnectionSecurityLevel.SECURITY_ERROR 1124 if (securityLevel == ConnectionSecurityLevel.SECURITY_ERROR
1120 || securityLevel == ConnectionSecurityLevel.SECURITY_WARNING 1125 || securityLevel == ConnectionSecurityLevel.SECURITY_WARNING
1121 || securityLevel == ConnectionSecurityLevel.SECURITY_POLICY_WARN ING) { 1126 || securityLevel == ConnectionSecurityLevel.SECURITY_POLICY_WARN ING) {
1122 themeColor = getDefaultThemeColor(); 1127 themeColor = getDefaultThemeColor();
1123 } 1128 }
1124 1129
1125 if (isShowingInterstitialPage()) themeColor = getDefaultThemeColor(); 1130 if (isShowingInterstitialPage()) themeColor = getDefaultThemeColor();
1126 1131
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3316 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, 3321 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id,
3317 InterceptNavigationDelegate delegate); 3322 InterceptNavigationDelegate delegate);
3318 private native void nativeAttachToTabContentManager(long nativeTabAndroid, 3323 private native void nativeAttachToTabContentManager(long nativeTabAndroid,
3319 TabContentManager tabContentManager); 3324 TabContentManager tabContentManager);
3320 private native void nativeAttachOverlayWebContents( 3325 private native void nativeAttachOverlayWebContents(
3321 long nativeTabAndroid, WebContents webContents, boolean visible); 3326 long nativeTabAndroid, WebContents webContents, boolean visible);
3322 private native void nativeDetachOverlayWebContents( 3327 private native void nativeDetachOverlayWebContents(
3323 long nativeTabAndroid, WebContents webContents); 3328 long nativeTabAndroid, WebContents webContents);
3324 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); 3329 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url);
3325 } 3330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698