Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointsModel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointsModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointsModel.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..49a8b645356280cb797bffce270b919443ba8635 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointsModel.js |
| @@ -0,0 +1,75 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @constructor |
| + * @extends {WebInspector.SDKModel} |
| + * @param {!WebInspector.Target} target |
| + */ |
| +WebInspector.DOMBreakpointsModel = function(target) |
| +{ |
| + WebInspector.SDKModel.call(this, WebInspector.DOMBreakpointsModel, target); |
| + this._agent = target.domdebuggerAgent(); |
| +}; |
| + |
| +WebInspector.DOMBreakpointsModel.Marker = "breakpoint-marker"; |
| + |
| +WebInspector.DOMBreakpointsModel.prototype = { |
| + /** |
|
lushnikov
2016/07/30 01:24:42
you might also want to add domBreakpoints() getter
chenwilliam
2016/08/06 00:28:21
Done.
|
| + * @param {number} nodeId |
| + * @param {!DOMDebuggerAgent.DOMBreakpointType} type |
| + */ |
| + setDOMBreakpoint: function(nodeId, type) |
| + { |
| + this._agent.setDOMBreakpoint(nodeId, type); |
| + }, |
| + |
| + /** |
| + * @param {number} nodeId |
| + * @param {!DOMDebuggerAgent.DOMBreakpointType} type |
| + */ |
| + removeDOMBreakpoint: function(nodeId, type) |
| + { |
| + this._agent.removeDOMBreakpoint(nodeId, type); |
| + }, |
| + |
| + /** |
| + * @param {!WebInspector.DOMNode} node |
| + * @param {?boolean} value |
| + */ |
| + setMarker: function(node, value) |
| + { |
| + node.setMarker(WebInspector.DOMBreakpointsModel.Marker, value); |
|
lushnikov
2016/07/30 01:24:42
We shouldn't expose this method. We should call no
chenwilliam
2016/08/06 00:28:21
Done.
|
| + }, |
| + |
| + __proto__: WebInspector.SDKModel.prototype |
| +}; |
| + |
| +/** |
| + * @param {number} nodeId |
| + * @param {!DOMDebuggerAgent.DOMBreakpointType} type |
| + * @return {string} |
| + */ |
| +WebInspector.DOMBreakpointsModel.createBreakpointId = function(nodeId, type) |
|
lushnikov
2016/07/30 01:24:42
this should be a part of DOMBreakpointsSidebarPane
chenwilliam
2016/08/06 00:28:21
I've changed it so the use of createBreakpointId i
|
| +{ |
| + return `${nodeId}:${type}`; |
| +}; |
| + |
| +/** |
| + * @param {!WebInspector.Target} target |
| + * @return {?WebInspector.DOMBreakpointsModel} |
| + */ |
| +WebInspector.DOMBreakpointsModel.fromTarget = function(target) |
|
lushnikov
2016/07/30 01:24:42
let's inline this unless it is needed
chenwilliam
2016/08/06 00:28:21
Done.
|
| +{ |
| + return /** @type {?WebInspector.DOMBreakpointsModel} */ (target.model(WebInspector.DOMBreakpointsModel)); |
| +}; |
| + |
| +/** |
| + * @param {!WebInspector.DOMNode} node |
| + * @return {!WebInspector.DOMBreakpointsModel} |
| + */ |
| +WebInspector.DOMBreakpointsModel.fromNode = function(node) |
| +{ |
| + return /** @type {!WebInspector.DOMBreakpointsModel} */ (WebInspector.DOMBreakpointsModel.fromTarget(node.target())); |
| +}; |