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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java

Issue 2779543005: Add support for highlighting menu items (Closed)
Patch Set: Moved PulseDrawable Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.toolbar; 5 package org.chromium.chrome.browser.toolbar;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.res.Configuration; 8 import android.content.res.Configuration;
9 import android.graphics.drawable.Drawable; 9 import android.graphics.drawable.Drawable;
10 import android.os.Handler; 10 import android.os.Handler;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 private final SceneChangeObserver mSceneChangeObserver; 137 private final SceneChangeObserver mSceneChangeObserver;
138 private final ActionBarDelegate mActionBarDelegate; 138 private final ActionBarDelegate mActionBarDelegate;
139 private final ActionModeController mActionModeController; 139 private final ActionModeController mActionModeController;
140 private final LoadProgressSimulator mLoadProgressSimulator; 140 private final LoadProgressSimulator mLoadProgressSimulator;
141 private final Callback<Boolean> mUrlFocusChangedCallback; 141 private final Callback<Boolean> mUrlFocusChangedCallback;
142 142
143 private BrowserStateBrowserControlsVisibilityDelegate mControlsVisibilityDel egate; 143 private BrowserStateBrowserControlsVisibilityDelegate mControlsVisibilityDel egate;
144 private int mFullscreenFocusToken = FullscreenManager.INVALID_TOKEN; 144 private int mFullscreenFocusToken = FullscreenManager.INVALID_TOKEN;
145 private int mFullscreenFindInPageToken = FullscreenManager.INVALID_TOKEN; 145 private int mFullscreenFindInPageToken = FullscreenManager.INVALID_TOKEN;
146 private int mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN; 146 private int mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN;
147 private int mFullscreenHighlightToken = FullscreenManager.INVALID_TOKEN;
147 148
148 private int mPreselectedTabId = Tab.INVALID_TAB_ID; 149 private int mPreselectedTabId = Tab.INVALID_TAB_ID;
149 150
150 private boolean mNativeLibraryReady; 151 private boolean mNativeLibraryReady;
151 private boolean mTabRestoreCompleted; 152 private boolean mTabRestoreCompleted;
152 153
153 private AppMenuButtonHelper mAppMenuButtonHelper; 154 private AppMenuButtonHelper mAppMenuButtonHelper;
154 155
155 private HomepageStateListener mHomepageStateListener; 156 private HomepageStateListener mHomepageStateListener;
156 157
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 if (mControlsVisibilityDelegate == null) return; 823 if (mControlsVisibilityDelegate == null) return;
823 if (isVisible) { 824 if (isVisible) {
824 mFullscreenMenuToken = 825 mFullscreenMenuToken =
825 mControlsVisibilityDelegate.showControlsPersistentAn dClearOldToken( 826 mControlsVisibilityDelegate.showControlsPersistentAn dClearOldToken(
826 mFullscreenMenuToken); 827 mFullscreenMenuToken);
827 } else { 828 } else {
828 mControlsVisibilityDelegate.hideControlsPersistent(mFullscre enMenuToken); 829 mControlsVisibilityDelegate.hideControlsPersistent(mFullscre enMenuToken);
829 mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN; 830 mFullscreenMenuToken = FullscreenManager.INVALID_TOKEN;
830 } 831 }
831 } 832 }
833
834 @Override
835 public void onMenuHighlightChanged(boolean highlighting) {
836 mToolbar.setMenuButtonHighlight(highlighting);
837
838 if (mControlsVisibilityDelegate == null) return;
839 if (highlighting) {
840 mFullscreenHighlightToken =
841 mControlsVisibilityDelegate.showControlsPersistentAn dClearOldToken(
842 mFullscreenHighlightToken);
843 } else {
844 mControlsVisibilityDelegate.hideControlsPersistent(mFullscre enHighlightToken);
845 mFullscreenHighlightToken = FullscreenManager.INVALID_TOKEN;
846 }
847 }
832 }); 848 });
833 mAppMenuButtonHelper = new AppMenuButtonHelper(menuHandler); 849 mAppMenuButtonHelper = new AppMenuButtonHelper(menuHandler);
834 mAppMenuButtonHelper.setOnAppMenuShownListener(new Runnable() { 850 mAppMenuButtonHelper.setOnAppMenuShownListener(new Runnable() {
835 @Override 851 @Override
836 public void run() { 852 public void run() {
837 RecordUserAction.record("MobileToolbarShowMenu"); 853 RecordUserAction.record("MobileToolbarShowMenu");
838 mToolbar.onMenuShown(); 854 mToolbar.onMenuShown();
839 } 855 }
840 }); 856 });
841 } 857 }
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 } 1284 }
1269 1285
1270 /** 1286 /**
1271 * Cancels simulating load progress. 1287 * Cancels simulating load progress.
1272 */ 1288 */
1273 public void cancel() { 1289 public void cancel() {
1274 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS); 1290 mHandler.removeMessages(MSG_ID_UPDATE_PROGRESS);
1275 } 1291 }
1276 } 1292 }
1277 } 1293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698