| Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
|
| index 72b3b4e2320ebdc8540550ca395f17b624625d58..068a12358558918afe48e3c586ccf722bed34af6 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
|
| @@ -9,6 +9,7 @@ import android.app.Activity;
|
| import android.content.Context;
|
| import android.content.res.Configuration;
|
| import android.content.res.Resources;
|
| +import android.graphics.PorterDuff;
|
| import android.graphics.drawable.ColorDrawable;
|
| import android.graphics.drawable.Drawable;
|
| import android.text.TextUtils;
|
| @@ -62,6 +63,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| private UrlBar mUrlBar;
|
| private TextView mTitleBar;
|
| private ImageView mSecurityButton;
|
| + private ImageView mOfflineButton;
|
| private ImageButton mCustomActionButton;
|
| private int mSecurityIconType;
|
| private ImageButton mCloseButton;
|
| @@ -104,11 +106,13 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| mTitleUrlContainer = findViewById(R.id.title_url_container);
|
| mSecurityButton = (ImageButton) findViewById(R.id.security_button);
|
| mSecurityIconType = ConnectionSecurityLevel.NONE;
|
| + mOfflineButton = (ImageButton) findViewById(R.id.offline_button);
|
| mCustomActionButton = (ImageButton) findViewById(R.id.action_button);
|
| mCustomActionButton.setOnLongClickListener(this);
|
| mCloseButton = (ImageButton) findViewById(R.id.close_button);
|
| mCloseButton.setOnLongClickListener(this);
|
| - mAnimDelegate = new CustomTabToolbarAnimationDelegate(mSecurityButton, mTitleUrlContainer);
|
| + mAnimDelegate = new CustomTabToolbarAnimationDelegate(
|
| + mSecurityButton, mOfflineButton, mTitleUrlContainer);
|
| }
|
|
|
| @Override
|
| @@ -127,7 +131,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| @Override
|
| public void onNativeLibraryReady() {
|
| super.onNativeLibraryReady();
|
| - mSecurityButton.setOnClickListener(new OnClickListener() {
|
| +
|
| + OnClickListener onClickListener = new OnClickListener() {
|
| @Override
|
| public void onClick(View v) {
|
| Tab currentTab = getToolbarDataProvider().getTab();
|
| @@ -136,7 +141,10 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| if (activity == null) return;
|
| WebsiteSettingsPopup.show(activity, currentTab);
|
| }
|
| - });
|
| + };
|
| +
|
| + mSecurityButton.setOnClickListener(onClickListener);
|
| + mOfflineButton.setOnClickListener(onClickListener);
|
| }
|
|
|
| @Override
|
| @@ -432,7 +440,19 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
|
| mSecurityIconType = securityLevel;
|
|
|
| if (securityLevel == ConnectionSecurityLevel.NONE) {
|
| - mAnimDelegate.hideSecurityButton();
|
| + Tab currentTab = getCurrentTab();
|
| + if (currentTab != null && currentTab.isOfflinePage()) {
|
| + Drawable bolt =
|
| + ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.offline_bolt);
|
| + bolt.setColorFilter(ApiCompatibilityUtils.getColor(getResources(), mUseDarkColors
|
| + ? R.color.locationbar_status_color
|
| + : R.color.locationbar_status_color_light),
|
| + PorterDuff.Mode.SRC_IN);
|
| + mOfflineButton.setImageDrawable(bolt);
|
| + mAnimDelegate.showOfflineButton();
|
| + } else {
|
| + mAnimDelegate.hideButtons();
|
| + }
|
| } else {
|
| int id = LocationBarLayout.getSecurityIconResource(
|
| securityLevel, !shouldEmphasizeHttpsScheme());
|
|
|