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

Side by Side Diff: chrome/browser/resources/settings/device_page/pointers.js

Issue 2753353002: MD Settings: Pointers: Avoid setting mouse swap pref while mouse pressed (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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/device_page/pointers.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-pointers' is the settings subpage with mouse and touchpad settings. 7 * 'settings-pointers' is the settings subpage with mouse and touchpad settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-pointers', 10 is: 'settings-pointers',
(...skipping 14 matching lines...) Expand all
25 * @const {!Array<number>} 25 * @const {!Array<number>}
26 * @private 26 * @private
27 */ 27 */
28 sensitivityValues_: { 28 sensitivityValues_: {
29 type: Array, 29 type: Array,
30 value: [1, 2, 3, 4, 5], 30 value: [1, 2, 3, 4, 5],
31 readOnly: true, 31 readOnly: true,
32 }, 32 },
33 }, 33 },
34 34
35 // Used to correctly identify when the mouse swap toggle has changed and
36 // the mouse button has been released. crbug.com/686949.
37 receivedMouseSwapButtonsUp_: false,
38 receivedMouseSwapButtonsChange_: false,
39
35 /** 40 /**
36 * Prevents the link from activating its parent paper-radio-button. 41 * Prevents the link from activating its parent paper-radio-button.
37 * @param {!Event} e 42 * @param {!Event} e
38 * @private 43 * @private
39 */ 44 */
40 onLearnMoreLinkActivated_: function(e) { 45 onLearnMoreLinkActivated_: function(e) {
41 settings.DevicePageBrowserProxyImpl.getInstance().handleLinkEvent(e); 46 settings.DevicePageBrowserProxyImpl.getInstance().handleLinkEvent(e);
42 }, 47 },
43 48
44 /** 49 /**
45 * Mouse and touchpad sections are only subsections if they are both present. 50 * Mouse and touchpad sections are only subsections if they are both present.
46 * @param {boolean} hasMouse 51 * @param {boolean} hasMouse
47 * @param {boolean} hasTouchpad 52 * @param {boolean} hasTouchpad
48 * @return {string} 53 * @return {string}
54 * @private
49 */ 55 */
50 getSubsectionClass_: function(hasMouse, hasTouchpad) { 56 getSubsectionClass_: function(hasMouse, hasTouchpad) {
51 return hasMouse && hasTouchpad ? 'subsection' : ''; 57 return hasMouse && hasTouchpad ? 'subsection' : '';
52 }, 58 },
59
60 /** @private */
61 onMouseSwapButtonsDown_: function() {
62 this.receivedMouseSwapButtonsUp_ = false;
michaelpg 2017/03/17 22:53:26 Tracking two booleans is confusing, and the "why"
michaelpg 2017/03/17 23:09:14 So as you said offline, keeping both booleans avoi
63 this.receivedMouseSwapButtonsChange_ = false;
64 },
65
66 /** @private */
67 onMouseSwapButtonsUp_: function() {
68 this.receivedMouseSwapButtonsUp_ = true;
69 this.maybeSendMouseSwapButtonsPrefChange_();
70 },
71
72 /** @private */
73 onMouseSwapButtonsChange_: function(event) {
74 this.receivedMouseSwapButtonsChange_ = true;
75 this.maybeSendMouseSwapButtonsPrefChange_();
76 },
77
78 /** @private */
79 maybeSendMouseSwapButtonsPrefChange_: function() {
80 if (this.receivedMouseSwapButtonsUp_ &&
81 this.receivedMouseSwapButtonsChange_) {
82 /** @type {!SettingsToggleButtonElement} */ (this.$.mouseSwapButton)
83 .sendPrefChange();
84 }
85 },
53 }); 86 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/device_page/pointers.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698