| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 Resources.ResourcesPanel = class extends UI.PanelWithSidebar { | 5 Resources.ResourcesPanel = class extends UI.PanelWithSidebar { |
| 6 constructor() { | 6 constructor() { |
| 7 super('resources'); | 7 super('resources'); |
| 8 this.registerRequiredCSS('resources/resourcesPanel.css'); | 8 this.registerRequiredCSS('resources/resourcesPanel.css'); |
| 9 | 9 |
| 10 this._resourcesLastSelectedItemSetting = Common.settings.createSetting('reso
urcesLastSelectedItem', ''); | 10 this._resourcesLastSelectedItemSetting = Common.settings.createSetting('reso
urcesLastSelectedItem', ''); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 else | 118 else |
| 119 this._domStorageView.setStorage(domStorage); | 119 this._domStorageView.setStorage(domStorage); |
| 120 this.showView(this._domStorageView); | 120 this.showView(this._domStorageView); |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {!SDK.Target} cookieFrameTarget | 124 * @param {!SDK.Target} cookieFrameTarget |
| 125 * @param {string} cookieDomain | 125 * @param {string} cookieDomain |
| 126 */ | 126 */ |
| 127 showCookies(cookieFrameTarget, cookieDomain) { | 127 showCookies(cookieFrameTarget, cookieDomain) { |
| 128 var model = SDK.CookieModel.fromTarget(cookieFrameTarget); | 128 var model = cookieFrameTarget.model(SDK.CookieModel); |
| 129 if (!model) |
| 130 return; |
| 129 if (!this._cookieView) | 131 if (!this._cookieView) |
| 130 this._cookieView = new Resources.CookieItemsView(model, cookieDomain); | 132 this._cookieView = new Resources.CookieItemsView(model, cookieDomain); |
| 131 else | 133 else |
| 132 this._cookieView.setCookiesDomain(model, cookieDomain); | 134 this._cookieView.setCookiesDomain(model, cookieDomain); |
| 133 this.showView(this._cookieView); | 135 this.showView(this._cookieView); |
| 134 } | 136 } |
| 135 | 137 |
| 136 /** | 138 /** |
| 137 * @param {string} text | 139 * @param {string} text |
| 138 */ | 140 */ |
| 139 showEmptyWidget(text) { | 141 showEmptyWidget(text) { |
| 140 if (!this._emptyWidget) | 142 if (!this._emptyWidget) |
| 141 this._emptyWidget = new UI.EmptyWidget(text); | 143 this._emptyWidget = new UI.EmptyWidget(text); |
| 142 else | 144 else |
| 143 this._emptyWidget.text = text; | 145 this._emptyWidget.text = text; |
| 144 this.showView(this._emptyWidget); | 146 this.showView(this._emptyWidget); |
| 145 } | 147 } |
| 146 | 148 |
| 147 /** | 149 /** |
| 148 * @param {!SDK.Target} target | 150 * @param {!SDK.Target} target |
| 149 * @param {string} cookieDomain | 151 * @param {string} cookieDomain |
| 150 */ | 152 */ |
| 151 clearCookies(target, cookieDomain) { | 153 clearCookies(target, cookieDomain) { |
| 152 SDK.CookieModel.fromTarget(target).clear(cookieDomain, () => { | 154 var model = target.model(SDK.CookieModel); |
| 155 if (!model) |
| 156 return; |
| 157 model.clear(cookieDomain, () => { |
| 153 if (this._cookieView) | 158 if (this._cookieView) |
| 154 this._cookieView.refreshItems(); | 159 this._cookieView.refreshItems(); |
| 155 }); | 160 }); |
| 156 } | 161 } |
| 157 }; | 162 }; |
| 158 | 163 |
| 159 /** | 164 /** |
| 160 * @implements {Common.Revealer} | 165 * @implements {Common.Revealer} |
| 161 */ | 166 */ |
| 162 Resources.ResourcesPanel.ResourceRevealer = class { | 167 Resources.ResourcesPanel.ResourceRevealer = class { |
| 163 /** | 168 /** |
| 164 * @override | 169 * @override |
| 165 * @param {!Object} resource | 170 * @param {!Object} resource |
| 166 * @return {!Promise} | 171 * @return {!Promise} |
| 167 */ | 172 */ |
| 168 reveal(resource) { | 173 reveal(resource) { |
| 169 if (!(resource instanceof SDK.Resource)) | 174 if (!(resource instanceof SDK.Resource)) |
| 170 return Promise.reject(new Error('Internal error: not a resource')); | 175 return Promise.reject(new Error('Internal error: not a resource')); |
| 171 var panel = Resources.ResourcesPanel._instance()._sidebar; | 176 var panel = Resources.ResourcesPanel._instance()._sidebar; |
| 172 return UI.viewManager.showView('resources').then(panel.showResource.bind(pan
el, resource)); | 177 return UI.viewManager.showView('resources').then(panel.showResource.bind(pan
el, resource)); |
| 173 } | 178 } |
| 174 }; | 179 }; |
| OLD | NEW |