| Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| index ebeaa204310acaa03315acf923299d2d42d859a5..b29f2dc4611996a8a4defa1a088f566ccc53fa3c 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
| @@ -94,6 +94,7 @@ import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
|
| import org.chromium.chrome.browser.nfc.BeamController;
|
| import org.chromium.chrome.browser.nfc.BeamProvider;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
|
| +import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
|
| import org.chromium.chrome.browser.pageinfo.WebsiteSettingsPopup;
|
| import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations;
|
| import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
|
| @@ -373,6 +374,11 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
| public void onMenuVisibilityChanged(boolean isVisible) {
|
| if (!isVisible) {
|
| mAppMenuPropertiesDelegate.onMenuDismissed();
|
| + MenuItem updateMenuItem = mAppMenuHandler.getAppMenu().getMenu().findItem(
|
| + R.id.update_menu_id);
|
| + if (updateMenuItem != null && updateMenuItem.isVisible()) {
|
| + UpdateMenuItemHelper.getInstance().onMenuDismissed();
|
| + }
|
| }
|
| }
|
| });
|
| @@ -554,6 +560,7 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
| @Override
|
| public void onStartWithNative() {
|
| super.onStartWithNative();
|
| + UpdateMenuItemHelper.getInstance().onStart();
|
| getChromeApplication().onStartWithNative();
|
| FeatureUtilities.setDocumentModeEnabled(FeatureUtilities.isDocumentMode(this));
|
| WarmupManager.getInstance().clearWebContentsIfNecessary();
|
| @@ -693,6 +700,7 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
| });
|
|
|
| getChromeApplication().getUpdateInfoBarHelper().checkForUpdateOnBackgroundThread(this);
|
| + UpdateMenuItemHelper.getInstance().checkForUpdateOnBackgroundThread(this);
|
|
|
| removeSnapshotDatabase();
|
| if (mToolbarManager != null) {
|
| @@ -1364,6 +1372,19 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
| }
|
|
|
| /**
|
| + * Callback after UpdateMenuItemHelper#checkForUpdateOnBackgroundThread is complete.
|
| + * @param updateAvailable Whether an update is available.
|
| + */
|
| + public void onCheckForUpdate(boolean updateAvailable) {
|
| + if (UpdateMenuItemHelper.getInstance().shouldShowToolbarBadge(this)) {
|
| + mToolbarManager.getToolbar().showAppMenuUpdateBadge();
|
| + mCompositorViewHolder.requestRender();
|
| + } else {
|
| + mToolbarManager.getToolbar().removeAppMenuUpdateBadge();
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Handles menu item selection and keyboard shortcuts.
|
| *
|
| * @param id The ID of the selected menu item (defined in main_menu.xml) or
|
| @@ -1379,6 +1400,11 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
|
| showAppMenuForKeyboardEvent();
|
| }
|
|
|
| + if (id == R.id.update_menu_id) {
|
| + UpdateMenuItemHelper.getInstance().onMenuItemClicked(this);
|
| + return true;
|
| + }
|
| +
|
| // All the code below assumes currentTab is not null, so return early if it is null.
|
| final Tab currentTab = getActivityTab();
|
| if (currentTab == null) {
|
|
|