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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 462 }
463 }, 463 },
464 464
465 /** 465 /**
466 * @param {?WebInspector.CSSStyleSheetHeader} styleSheetHeader 466 * @param {?WebInspector.CSSStyleSheetHeader} styleSheetHeader
467 */ 467 */
468 _createNewRuleInStyleSheet: function(styleSheetHeader) 468 _createNewRuleInStyleSheet: function(styleSheetHeader)
469 { 469 {
470 if (!styleSheetHeader) 470 if (!styleSheetHeader)
471 return; 471 return;
472 styleSheetHeader.requestContent(onStyleSheetContent.bind(this, styleShee tHeader.id)); 472 styleSheetHeader.requestContent().then(onStyleSheetContent.bind(this, st yleSheetHeader.id));
473 473
474 /** 474 /**
475 * @param {string} styleSheetId 475 * @param {string} styleSheetId
476 * @param {string} text 476 * @param {?string} text
477 * @this {WebInspector.StylesSidebarPane} 477 * @this {WebInspector.StylesSidebarPane}
478 */ 478 */
479 function onStyleSheetContent(styleSheetId, text) 479 function onStyleSheetContent(styleSheetId, text)
480 { 480 {
481 text = text || "";
481 var lines = text.split("\n"); 482 var lines = text.split("\n");
482 var range = WebInspector.TextRange.createFromLocation(lines.length - 1, lines[lines.length - 1].length); 483 var range = WebInspector.TextRange.createFromLocation(lines.length - 1, lines[lines.length - 1].length);
483 this._addBlankSection(this._sectionBlocks[0].sections[0], styleSheet Id, range); 484 this._addBlankSection(this._sectionBlocks[0].sections[0], styleSheet Id, range);
484 } 485 }
485 }, 486 },
486 487
487 /** 488 /**
488 * @param {!WebInspector.StylePropertiesSection} insertAfterSection 489 * @param {!WebInspector.StylePropertiesSection} insertAfterSection
489 * @param {string} styleSheetId 490 * @param {string} styleSheetId
490 * @param {!WebInspector.TextRange} ruleLocation 491 * @param {!WebInspector.TextRange} ruleLocation
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2965 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged); 2966 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged);
2966 onNodeChanged(); 2967 onNodeChanged();
2967 return button; 2968 return button;
2968 2969
2969 function onNodeChanged() 2970 function onNodeChanged()
2970 { 2971 {
2971 var node = WebInspector.context.flavor(WebInspector.DOMNode); 2972 var node = WebInspector.context.flavor(WebInspector.DOMNode);
2972 button.setEnabled(!!node); 2973 button.setEnabled(!!node);
2973 } 2974 }
2974 } 2975 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698