OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 7 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
8 <link rel="import" href="/tracing/ui/base/mouse_modes.html"> | 8 <link rel="import" href="/tracing/ui/base/mouse_modes.html"> |
9 | 9 |
10 <dom-module id='tr-ui-b-mouse-mode-icon'> | 10 <dom-module id='tr-ui-b-mouse-mode-icon'> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 ready() { | 44 ready() { |
45 this.updateContents_(); | 45 this.updateContents_(); |
46 }, | 46 }, |
47 | 47 |
48 get mode() { | 48 get mode() { |
49 return tr.ui.b.MOUSE_SELECTOR_MODE[this.modeName]; | 49 return tr.ui.b.MOUSE_SELECTOR_MODE[this.modeName]; |
50 }, | 50 }, |
51 | 51 |
52 set mode(mode) { | 52 set mode(mode) { |
53 const modeInfo = tr.ui.b.MOUSE_SELECTOR_MODE_INFOS[mode]; | 53 const modeInfo = tr.ui.b.MOUSE_SELECTOR_MODE_INFOS[mode]; |
54 const modeName = tr.b.findFirstKeyInDictMatching( | 54 if (modeInfo === undefined) { |
55 tr.ui.b.MOUSE_SELECTOR_MODE, | |
56 function(modeName, candidateMode) { | |
57 return candidateMode === mode; | |
58 }); | |
59 if (modeName === undefined) { | |
60 throw new Error('Unknown mode'); | 55 throw new Error('Unknown mode'); |
61 } | 56 } |
62 this.modeName = modeName; | 57 this.modeName = modeInfo.name; |
63 }, | 58 }, |
64 | 59 |
65 modeNameChanged() { | 60 modeNameChanged() { |
66 this.updateContents_(); | 61 this.updateContents_(); |
67 }, | 62 }, |
68 | 63 |
69 get active() { | 64 get active() { |
70 return this.active_; | 65 return this.active_; |
71 }, | 66 }, |
72 | 67 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 let bp; | 106 let bp; |
112 if (this.active_) { | 107 if (this.active_) { |
113 bp = modeInfo.activeBackgroundPosition; | 108 bp = modeInfo.activeBackgroundPosition; |
114 } else { | 109 } else { |
115 bp = modeInfo.defaultBackgroundPosition; | 110 bp = modeInfo.defaultBackgroundPosition; |
116 } | 111 } |
117 this.style.backgroundPosition = bp; | 112 this.style.backgroundPosition = bp; |
118 } | 113 } |
119 }); | 114 }); |
120 </script> | 115 </script> |
OLD | NEW |