| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @implements {Common.ContentProvider} | 5 * @implements {Common.ContentProvider} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 SDK.CSSStyleSheetHeader = class { | 8 SDK.CSSStyleSheetHeader = class { |
| 9 /** | 9 /** |
| 10 * @param {!SDK.CSSModel} cssModel | 10 * @param {!SDK.CSSModel} cssModel |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * @param {string=} sourceMapURL | 44 * @param {string=} sourceMapURL |
| 45 */ | 45 */ |
| 46 setSourceMapURL(sourceMapURL) { | 46 setSourceMapURL(sourceMapURL) { |
| 47 this.sourceMapURL = sourceMapURL; | 47 this.sourceMapURL = sourceMapURL; |
| 48 } | 48 } |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * @return {!SDK.Target} | |
| 52 */ | |
| 53 target() { | |
| 54 return this._cssModel.target(); | |
| 55 } | |
| 56 | |
| 57 /** | |
| 58 * @return {!SDK.CSSModel} | 51 * @return {!SDK.CSSModel} |
| 59 */ | 52 */ |
| 60 cssModel() { | 53 cssModel() { |
| 61 return this._cssModel; | 54 return this._cssModel; |
| 62 } | 55 } |
| 63 | 56 |
| 64 /** | 57 /** |
| 65 * @return {boolean} | 58 * @return {boolean} |
| 66 */ | 59 */ |
| 67 isAnonymousInlineStyleSheet() { | 60 isAnonymousInlineStyleSheet() { |
| 68 return !this.resourceURL() && !this._cssModel.sourceMapManager().sourceMapFo
rClient(this); | 61 return !this.resourceURL() && !this._cssModel.sourceMapManager().sourceMapFo
rClient(this); |
| 69 } | 62 } |
| 70 | 63 |
| 71 /** | 64 /** |
| 72 * @return {string} | 65 * @return {string} |
| 73 */ | 66 */ |
| 74 resourceURL() { | 67 resourceURL() { |
| 75 return this.isViaInspector() ? this._viaInspectorResourceURL() : this.source
URL; | 68 return this.isViaInspector() ? this._viaInspectorResourceURL() : this.source
URL; |
| 76 } | 69 } |
| 77 | 70 |
| 78 /** | 71 /** |
| 79 * @return {string} | 72 * @return {string} |
| 80 */ | 73 */ |
| 81 _viaInspectorResourceURL() { | 74 _viaInspectorResourceURL() { |
| 82 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this.target()); | 75 var frame = this._cssModel.target().model(SDK.ResourceTreeModel).frameForId(
this.frameId); |
| 83 var frame = resourceTreeModel.frameForId(this.frameId); | |
| 84 console.assert(frame); | 76 console.assert(frame); |
| 85 var parsedURL = new Common.ParsedURL(frame.url); | 77 var parsedURL = new Common.ParsedURL(frame.url); |
| 86 var fakeURL = 'inspector://' + parsedURL.host + parsedURL.folderPathComponen
ts; | 78 var fakeURL = 'inspector://' + parsedURL.host + parsedURL.folderPathComponen
ts; |
| 87 if (!fakeURL.endsWith('/')) | 79 if (!fakeURL.endsWith('/')) |
| 88 fakeURL += '/'; | 80 fakeURL += '/'; |
| 89 fakeURL += 'inspector-stylesheet'; | 81 fakeURL += 'inspector-stylesheet'; |
| 90 return fakeURL; | 82 return fakeURL; |
| 91 } | 83 } |
| 92 | 84 |
| 93 /** | 85 /** |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 this.requestContent().then(performSearch); | 139 this.requestContent().then(performSearch); |
| 148 } | 140 } |
| 149 | 141 |
| 150 /** | 142 /** |
| 151 * @return {boolean} | 143 * @return {boolean} |
| 152 */ | 144 */ |
| 153 isViaInspector() { | 145 isViaInspector() { |
| 154 return this.origin === 'inspector'; | 146 return this.origin === 'inspector'; |
| 155 } | 147 } |
| 156 }; | 148 }; |
| OLD | NEW |