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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java

Issue 2735983004: Visually disable VR Shell back/forward buttons when no history is available (Closed)
Patch Set: Created 3 years, 9 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/vr_shell/VrShellImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
index 0a9b713d14b3e3fd4047691638b5360a4a1906d2..c74fa935163805dc8974247270e3ef2b7fc9a6a9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
@@ -204,6 +204,7 @@ public class VrShellImpl
} else {
nativeSwapContents(mNativeVrShell, null, mMotionEventSynthesizer);
}
+ updateHistoryButtonsVisibility();
}
@Override
@@ -558,11 +559,19 @@ public class VrShellImpl
@CalledByNative
public void navigateForward() {
mActivity.getToolbarManager().forward();
+ updateHistoryButtonsVisibility();
}
@CalledByNative
public void navigateBack() {
mActivity.getToolbarManager().back();
+ updateHistoryButtonsVisibility();
+ }
+
+ private void updateHistoryButtonsVisibility() {
+ boolean canGoBack = mTab != null && mTab.canGoBack(),
+ canGoForward = mTab != null && mTab.canGoForward();
mthiesse 2017/03/08 16:15:17 Chrome style prefers 'boolean canGoForward = mTab
acondor_ 2017/03/08 16:42:26 Done.
+ nativeSetHistoryButtonsEnabled(mNativeVrShell, canGoBack, canGoForward);
}
@CalledByNative
@@ -619,4 +628,6 @@ public class VrShellImpl
private native void nativeOnTabRemoved(long nativeVrShell, boolean incognito, int id);
private native Surface nativeTakeContentSurface(long nativeVrShell);
private native void nativeRestoreContentSurface(long nativeVrShell);
+ private native void nativeSetHistoryButtonsEnabled(
+ long nativeVrShell, boolean canGoBack, boolean canGoForward);
}
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/ui_interface.h » ('j') | chrome/browser/resources/vr_shell/vr_shell_ui.css » ('J')

Powered by Google App Engine
This is Rietveld 408576698