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

Unified Diff: chrome/browser/resources/file_manager/audio_player/elements/volume_controller.js

Issue 144883002: [Files.app] Initial implementation of new audio player (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the script/css files flattened. Created 6 years, 11 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/browser/resources/file_manager/audio_player/elements/volume_controller.js
diff --git a/chrome/browser/resources/file_manager/audio_player/elements/volume_controller.js b/chrome/browser/resources/file_manager/audio_player/elements/volume_controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..642f3d5638e23dceb1b503567d1587a3a756ac8c
--- /dev/null
+++ b/chrome/browser/resources/file_manager/audio_player/elements/volume_controller.js
@@ -0,0 +1,75 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+ 'use strict';
+
+ Polymer('volume-controller', {
+ /**
+ * Initializes an element. This method is called automatically when the
+ * element is ready.
+ */
+ ready: function() {
+ this.style.width = this.width + 'px';
+ this.style.height = this.height + 'px';
+
+ this.$.rawValueInput.style.width = this.height + 'px';
+ this.$.rawValueInput.style.height = this.width + 'px';
+ this.$.rawValueInput.style.webkitTransformOrigin =
+ (this.width / 2) + 'px ' +
+ (this.width / 2 - 2) + 'px';
+
+ var barLeft = (this.width / 2 - 1);
+ this.$.bar.style.left = barLeft + 'px';
+ this.$.bar.style.right = barLeft + 'px';
+ },
+
+ /**
+ * Volume. 0 is silent, and 100 is maximum.
+ * @type {number}
+ */
+ value: 50,
+
+ /**
+ * Volume. 1000 is silent, and 0 is maximum.
+ * @type {number}
+ */
+ rawValue: 0,
+
+ /**
+ * Height of the element in pixels. Must be specified before ready() is
+ * called. Dynamic change is not supprted.
+ * @type {number}
+ */
+ height: 100,
+
+ /**
+ * Width of the element in pixels. Must be specified before ready() is
+ * called. Dynamic change is not supported.
+ * @type {number}
+ */
+ width: 32,
+
+ /**
+ * Invoked the 'value' property is changed.
+ * @param {number} oldValue Old value.
+ * @param {number} newValue New value.
+ */
+ valueChanged: function(oldValue, newValue) {
+ if (oldValue != newValue)
+ this.rawValue = 100 - newValue;
+ this.fire('changed');
+ },
+
+ /**
+ * Invoked the 'rawValue' property is changed.
+ * @param {number} oldValue Old value.
+ * @param {number} newValue New value.
+ */
+ rawValueChanged: function(oldValue, newValue) {
+ if (oldValue != newValue)
+ this.value = 100 - newValue;
+ },
+ });
+})(); // Anonymous closure

Powered by Google App Engine
This is Rietveld 408576698