Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 WebInspector.InspectElementModeController.prototype = { | 49 WebInspector.InspectElementModeController.prototype = { |
| 50 /** | 50 /** |
| 51 * @override | 51 * @override |
| 52 * @param {!WebInspector.Target} target | 52 * @param {!WebInspector.Target} target |
| 53 */ | 53 */ |
| 54 targetAdded: function(target) | 54 targetAdded: function(target) |
| 55 { | 55 { |
| 56 // When DevTools are opening in the inspect element mode, the first targ et comes in | 56 // When DevTools are opening in the inspect element mode, the first targ et comes in |
| 57 // much later than the InspectorFrontendAPI.enterInspectElementMode even t. | 57 // much later than the InspectorFrontendAPI.enterInspectElementMode even t. |
| 58 if (!this.enabled()) | 58 if (!this.started()) |
| 59 return; | 59 return; |
| 60 var domModel = WebInspector.DOMModel.fromTarget(target); | 60 var domModel = WebInspector.DOMModel.fromTarget(target); |
| 61 domModel.setInspectModeEnabled(true, WebInspector.moduleSetting("showUAS hadowDOM").get()); | 61 domModel.setInspectModeEnabled(true, WebInspector.moduleSetting("showUAS hadowDOM").get() ? "showUAShadowDOM" : null); |
| 62 }, | 62 }, |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * @override | 65 * @override |
| 66 * @param {!WebInspector.Target} target | 66 * @param {!WebInspector.Target} target |
| 67 */ | 67 */ |
| 68 targetRemoved: function(target) | 68 targetRemoved: function(target) |
| 69 { | 69 { |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * @return {boolean} | 73 * @return {boolean} |
| 74 */ | 74 */ |
| 75 enabled: function() | 75 started: function() |
|
pfeldman
2015/08/24 23:18:13
Why is this public?
sergeyv
2015/08/25 17:58:02
We call it from ElementsPanel
| |
| 76 { | 76 { |
| 77 return this._toggleSearchButton.toggled(); | 77 return this._toggleSearchButton.toggled(); |
| 78 }, | 78 }, |
| 79 | 79 |
| 80 stop: function() | |
| 81 { | |
| 82 if (this.started()) | |
| 83 this._toggleSearch(); | |
| 84 }, | |
| 85 | |
| 80 disable: function() | 86 disable: function() |
| 81 { | 87 { |
| 82 if (this.enabled()) | 88 this.stop(); |
| 83 this._toggleSearch(); | 89 this._toggleSearchButton.setEnabled(false); |
| 90 }, | |
| 91 | |
| 92 enable: function() | |
| 93 { | |
| 94 this._toggleSearchButton.setEnabled(true); | |
| 84 }, | 95 }, |
| 85 | 96 |
| 86 _toggleSearch: function() | 97 _toggleSearch: function() |
| 87 { | 98 { |
| 88 var enabled = !this.enabled(); | 99 var enabled = !this.started(); |
| 89 this._toggleSearchButton.setToggled(enabled); | 100 this._toggleSearchButton.setToggled(enabled); |
| 90 | 101 |
| 91 for (var domModel of WebInspector.DOMModel.instances()) | 102 for (var domModel of WebInspector.DOMModel.instances()) |
| 92 domModel.setInspectModeEnabled(enabled, WebInspector.moduleSetting(" showUAShadowDOM").get()); | 103 domModel.setInspectModeEnabled(enabled, WebInspector.moduleSetting(" showUAShadowDOM").get() ? "showUAShadowDOM" : null); |
| 93 }, | 104 }, |
| 94 | 105 |
| 95 _suspendStateChanged: function() | 106 _suspendStateChanged: function() |
| 96 { | 107 { |
| 97 if (WebInspector.targetManager.allTargetsSuspended()) | 108 if (WebInspector.targetManager.allTargetsSuspended()) |
| 98 this._toggleSearchButton.setToggled(false); | 109 this._toggleSearchButton.setToggled(false); |
| 99 } | 110 } |
| 100 } | 111 } |
| 101 | 112 |
| 102 /** | 113 /** |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 { | 149 { |
| 139 if (!WebInspector.inspectElementModeController) | 150 if (!WebInspector.inspectElementModeController) |
| 140 return null; | 151 return null; |
| 141 | 152 |
| 142 return WebInspector.inspectElementModeController._toggleSearchButton; | 153 return WebInspector.inspectElementModeController._toggleSearchButton; |
| 143 } | 154 } |
| 144 } | 155 } |
| 145 | 156 |
| 146 /** @type {?WebInspector.InspectElementModeController} */ | 157 /** @type {?WebInspector.InspectElementModeController} */ |
| 147 WebInspector.inspectElementModeController = null; | 158 WebInspector.inspectElementModeController = null; |
| OLD | NEW |