hterm: Add scrollbar-visible preference.

This adds an 'scrollbar-visible' preference that makes it possible to
hide the vertical scrollbar. Default value is 'true'. Can be set
to 'false' to hide the scrollbar.

BUG=chromium-os:120666
TEST=manual

Change-Id: I5004ca14f2dc5f4dcf29654f17f22e80a24af529
Reviewed-on: https://gerrit.chromium.org/gerrit/19233
Reviewed-by: Robert Ginda <rginda@chromium.org>
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
diff --git a/hterm/js/terminal.js b/hterm/js/terminal.js
index 4b4b85a..bed8fb7 100644
--- a/hterm/js/terminal.js
+++ b/hterm/js/terminal.js
@@ -208,6 +208,14 @@
         self.bellAudio_.setAttribute('src', v);
       }
     ],
+
+    /**
+     * The vertical scrollbar mode.
+     */
+    ['scrollbar-visible', true, function(v) {
+        self.setScrollbarVisible(v);
+      }
+    ],
    ]);
 
   if (needSync)
@@ -705,6 +713,8 @@
   this.setFontSize(this.prefs_.get('font-size'));
   this.syncFontFamily();
 
+  this.setScrollbarVisible(this.prefs_.get('scrollbar-visible'));
+
   this.document_ = this.scrollPort_.getDocument();
 
   this.cursorNode_ = this.document_.createElement('div');
@@ -1876,3 +1886,17 @@
     this.cursorNode_.style.opacity = '0';
   }
 };
+
+/**
+ * Set the scrollbar-visible mode bit.
+ *
+ * If scrollbar-visible is on, the vertical scrollbar will be visible.
+ * Otherwise it will not.
+ *
+ * Defaults to on.
+ *
+ * @param {boolean} state True to set scrollbar-visible mode, false to unset.
+ */
+hterm.Terminal.prototype.setScrollbarVisible = function(state) {
+  this.scrollPort_.setScrollbarVisible(state);
+};