Save diff mode preference when toggled

Introduce the gr-diff-mode-selector which componentizes the diff mode
buttons already used in the file list and adds them to the diff view.
With this new component, when authenticated users change their diff
preference using the new selector (or by the 'm' keyboard shortcut), the
new mode is saved to their preferences. Unauthenticated users see no
change in diff mode preference persistence.

The diff selector is now consistently labeled as "Diff view" rather than
as "Diff views".

Bug: Issue 8144
Change-Id: I4b30714deb9a466e707b3d4ae90c1d4c60222c64
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
index f1cc83e..90a3913 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
@@ -437,9 +437,9 @@
 
       e.preventDefault();
       if (this._getDiffViewMode() === DiffViewMode.SIDE_BY_SIDE) {
-        this.set('changeViewState.diffMode', DiffViewMode.UNIFIED);
+        this.$.modeSelect.setMode(DiffViewMode.UNIFIED);
       } else {
-        this.set('changeViewState.diffMode', DiffViewMode.SIDE_BY_SIDE);
+        this.$.modeSelect.setMode(DiffViewMode.SIDE_BY_SIDE);
       }
     },
 
@@ -814,15 +814,15 @@
       if (this.changeViewState.diffMode) {
         return this.changeViewState.diffMode;
       } else if (this._userPrefs) {
-        return this.changeViewState.diffMode =
-            this._userPrefs.default_diff_view;
+        this.set('changeViewState.diffMode', this._userPrefs.default_diff_view);
+        return this._userPrefs.default_diff_view;
       } else {
         return 'SIDE_BY_SIDE';
       }
     },
 
-    _computeModeSelectHidden() {
-      return this._isImageDiff;
+    _computeModeSelectHideClass(isImageDiff) {
+      return isImageDiff ? 'hide' : '';
     },
 
     _onLineSelected(e, detail) {