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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java

Issue 1262863003: Revert "Revert of Add getThemeColor to Tab and add plumbing for ChromeActivites. (patchset #3 id:40… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
index 1ede45b25d91c86f03fb4ceb8fdd613deaf53d63..b22e66a8afb42569560719b9fe2332c1f37674e8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
@@ -58,7 +58,6 @@ import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.IntentUtils;
-import org.chromium.chrome.browser.widget.ControlContainer;
import org.chromium.chrome.browser.widget.RoundedIconGenerator;
import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager;
import org.chromium.components.service_tab_launcher.ServiceTabLauncher;
@@ -104,7 +103,6 @@ public class DocumentActivity extends ChromeActivity {
// Indicates whether mIcon was generated by RoundedIconGenerator.
private boolean mIsUsingGeneratedIcon;
- private Integer mThemeColor;
private int mDefaultThemeColor;
private DocumentTab mDocumentTab;
@@ -534,9 +532,7 @@ public class DocumentActivity extends ChromeActivity {
@Override
public void onWebContentsSwapped(Tab tab, boolean didStartLoad, boolean didFinishLoad) {
if (!didStartLoad) return;
- mThemeColor = tab.getWebContents().getThemeColor(mDefaultThemeColor);
- mIcon = null;
- updateTaskDescription();
+ onFaviconReceived(tab.getFavicon());
}
@Override
@@ -572,7 +568,7 @@ public class DocumentActivity extends ChromeActivity {
@Override
public void onSSLStateUpdated(Tab tab) {
- if (hasSecurityWarningOrError(tab)) resetThemeColorAndIcon();
+ if (hasSecurityWarningOrError(tab)) resetIcon();
}
@Override
@@ -592,30 +588,6 @@ public class DocumentActivity extends ChromeActivity {
}
@Override
- public void onDidChangeThemeColor(int color) {
- if (hasSecurityWarningOrError(mDocumentTab)) return;
- if (color == Color.TRANSPARENT) color = mDefaultThemeColor;
-
- // Ignore any transparency value.
- color |= 0xFF000000;
-
- mThemeColor = Integer.valueOf(color);
- updateTaskDescription();
- }
-
- @Override
- public void onDidAttachInterstitialPage(Tab tab) {
- resetThemeColorAndIcon();
- }
-
- @Override
- public void onDidDetachInterstitialPage(Tab tab) {
- mThemeColor = tab.getWebContents().getThemeColor(mDefaultThemeColor);
- mIcon = null;
- updateTaskDescription();
- }
-
- @Override
public void onCrash(Tab tab, boolean sadTabShown) {
int currentState = ApplicationStatus.getStateForActivity(DocumentActivity.this);
if (currentState != ActivityState.STOPPED) return;
@@ -655,8 +627,7 @@ public class DocumentActivity extends ChromeActivity {
}
}
- private void resetThemeColorAndIcon() {
- mThemeColor = null;
+ private void resetIcon() {
mIcon = null;
updateTaskDescription();
}
@@ -828,27 +799,19 @@ public class DocumentActivity extends ChromeActivity {
updateTaskDescription(label, mIcon);
}
- protected int getThemeColor() {
- if (isIncognito()) {
- return mDefaultThemeColor;
- } else {
- return mThemeColor != null ? mThemeColor.intValue() : mDefaultThemeColor;
- }
- }
-
private boolean shouldUseDefaultStatusBarColor() {
- return isIncognito() || mThemeColor == null || mThemeColor == mDefaultThemeColor;
+ return isIncognito() || mThemeColor == mDefaultThemeColor;
}
protected void updateTaskDescription(String label, Bitmap icon) {
- int color = getThemeColor();
- DocumentUtils.updateTaskDescription(this, label, icon, color,
+ DocumentUtils.updateTaskDescription(this, label, icon, mThemeColor,
shouldUseDefaultStatusBarColor());
- getToolbarManager().updatePrimaryColor(color);
+ }
- ControlContainer controlContainer =
- (ControlContainer) findViewById(R.id.control_container);
- controlContainer.getToolbarResourceAdapter().invalidate(null);
+ @Override
+ protected void onThemeColorUpdate() {
+ super.onThemeColorUpdate();
+ updateTaskDescription();
}
/**

Powered by Google App Engine
This is Rietveld 408576698