Chromium Code Reviews| 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..84f11131279db073b13816b9d3a335911c58cbb0 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; |
| @@ -368,11 +369,16 @@ public abstract class ChromeActivity extends AsyncInitializationActivity |
| getAppMenuLayoutId()); |
| mToolbarManager = new ToolbarManager(this, toolbarContainer, mAppMenuHandler, |
| mAppMenuPropertiesDelegate, getCompositorViewHolder().getInvalidator()); |
| + final ChromeActivity activity = this; |
| mAppMenuHandler.addObserver(new AppMenuObserver() { |
| @Override |
| public void onMenuVisibilityChanged(boolean isVisible) { |
| if (!isVisible) { |
| mAppMenuPropertiesDelegate.onMenuDismissed(); |
| + if (UpdateMenuItemHelper.getInstance().shouldShowMenuItem(activity) |
|
gone
2015/12/08 22:24:23
does it make more sense to record whether the Upda
Theresa
2015/12/10 03:53:17
AppMenuPropertiesDelegate is doing the checking fo
gone
2015/12/10 21:45:07
Yeah, this is actually what I was hoping you'd do.
|
| + && !isInOverviewMode()) { |
| + UpdateMenuItemHelper.getInstance().onAppMenuDismissed(); |
| + } |
| } |
| } |
| }); |
| @@ -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,16 @@ 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(); |
| + } |
| + } |
| + |
| + /** |
| * Handles menu item selection and keyboard shortcuts. |
| * |
| * @param id The ID of the selected menu item (defined in main_menu.xml) or |
| @@ -1379,6 +1397,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) { |