| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2015 The Chromium Authors. All rights reserved. | 3 Copyright 2015 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 | 7 |
| 8 <link rel="import" href="/tracing/ui/brushing_state_controller.html"> | 8 <link rel="import" href="/tracing/ui/brushing_state_controller.html"> |
| 9 | 9 |
| 10 <!-- | 10 <!-- |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 /** | 50 /** |
| 51 * Retrieve the persisted state of the associated view. The returned object | 51 * Retrieve the persisted state of the associated view. The returned object |
| 52 * (or any of its fields) must not be modified by the caller (unless the | 52 * (or any of its fields) must not be modified by the caller (unless the |
| 53 * object/field is treated as a reference). | 53 * object/field is treated as a reference). |
| 54 * | 54 * |
| 55 * If no state has been persisted yet or there is no ancestor element with | 55 * If no state has been persisted yet or there is no ancestor element with |
| 56 * a brushingStateController field, this method returns undefined. | 56 * a brushingStateController field, this method returns undefined. |
| 57 */ | 57 */ |
| 58 get: function() { | 58 get: function() { |
| 59 var viewId = this.viewId; | 59 var viewId = this.viewId; |
| 60 if (!viewId) | 60 if (!viewId) { |
| 61 throw new Error('Element must have a view-id attribute!'); | 61 throw new Error('Element must have a view-id attribute!'); |
| 62 } |
| 62 | 63 |
| 63 var brushingStateController = | 64 var brushingStateController = |
| 64 tr.c.BrushingStateController.getControllerForElement(this); | 65 tr.c.BrushingStateController.getControllerForElement(this); |
| 65 if (!brushingStateController) | 66 if (!brushingStateController) return undefined; |
| 66 return undefined; | |
| 67 | 67 |
| 68 return brushingStateController.getViewSpecificBrushingState(viewId); | 68 return brushingStateController.getViewSpecificBrushingState(viewId); |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Persist the provided state of the associated view. The provided object | 72 * Persist the provided state of the associated view. The provided object |
| 73 * (or any of its fields) must not be modified afterwards (unless the | 73 * (or any of its fields) must not be modified afterwards (unless the |
| 74 * object/field is treated as a reference). | 74 * object/field is treated as a reference). |
| 75 * | 75 * |
| 76 * If there is no ancestor element with a brushingStateController field, | 76 * If there is no ancestor element with a brushingStateController field, |
| 77 * this method does nothing. | 77 * this method does nothing. |
| 78 */ | 78 */ |
| 79 set: function(state) { | 79 set: function(state) { |
| 80 var viewId = this.viewId; | 80 var viewId = this.viewId; |
| 81 if (!viewId) | 81 if (!viewId) { |
| 82 throw new Error('Element must have a view-id attribute!'); | 82 throw new Error('Element must have a view-id attribute!'); |
| 83 } |
| 83 | 84 |
| 84 var brushingStateController = | 85 var brushingStateController = |
| 85 tr.c.BrushingStateController.getControllerForElement(this); | 86 tr.c.BrushingStateController.getControllerForElement(this); |
| 86 if (!brushingStateController) | 87 if (!brushingStateController) return; |
| 87 return; | |
| 88 | 88 |
| 89 brushingStateController.changeViewSpecificBrushingState(viewId, state); | 89 brushingStateController.changeViewSpecificBrushingState(viewId, state); |
| 90 } | 90 } |
| 91 }); | 91 }); |
| 92 </script> | 92 </script> |
| OLD | NEW |