Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Widget} | 7 * @extends {WebInspector.Widget} |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.MediaQueryInspector = function() | 10 WebInspector.MediaQueryInspector = function() |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 /** | 178 /** |
| 179 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 179 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
| 180 */ | 180 */ |
| 181 _refetchMediaQueries: function(finishCallback) | 181 _refetchMediaQueries: function(finishCallback) |
| 182 { | 182 { |
| 183 if (!this._enabled || !this._cssModel) { | 183 if (!this._enabled || !this._cssModel) { |
| 184 finishCallback(); | 184 finishCallback(); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| 188 /** | 188 this._cssModel.mediaQueriesPromise() |
| 189 * @param {!Array.<!WebInspector.CSSMedia>} cssMedias | 189 .then(this._rebuildMediaQueries.bind(this)) |
| 190 * @this {!WebInspector.MediaQueryInspector} | 190 .then(finishCallback) |
|
pfeldman
2015/06/26 09:59:17
then(finishCallback, finishCallback);
lushnikov
2015/06/26 10:16:26
The .catch is way more easy to read and find visua
| |
| 191 */ | 191 .catch(finishCallback); |
| 192 function callback(cssMedias) | |
| 193 { | |
| 194 this._rebuildMediaQueries(cssMedias); | |
| 195 finishCallback(); | |
| 196 } | |
| 197 this._cssModel.getMediaQueries(callback.bind(this)); | |
| 198 }, | 192 }, |
| 199 | 193 |
| 200 /** | 194 /** |
| 201 * @param {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} mod els | 195 * @param {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} mod els |
| 202 * @return {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} | 196 * @return {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} |
| 203 */ | 197 */ |
| 204 _squashAdjacentEqual: function(models) | 198 _squashAdjacentEqual: function(models) |
| 205 { | 199 { |
| 206 var filtered = []; | 200 var filtered = []; |
| 207 for (var i = 0; i < models.length; ++i) { | 201 for (var i = 0; i < models.length; ++i) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 }, | 501 }, |
| 508 | 502 |
| 509 /** | 503 /** |
| 510 * @return {boolean} | 504 * @return {boolean} |
| 511 */ | 505 */ |
| 512 active: function() | 506 active: function() |
| 513 { | 507 { |
| 514 return this._active; | 508 return this._active; |
| 515 } | 509 } |
| 516 } | 510 } |
| OLD | NEW |