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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js

Issue 2487293002: DevTools: introduce sync checkmarks icons in StylesSidebarPane. (Closed)
Patch Set: Created 4 years, 1 month 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 // 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 WebInspector.Persistence = class extends WebInspector.Object { 7 WebInspector.Persistence = class extends WebInspector.Object {
8 /** 8 /**
9 * @param {!WebInspector.Workspace} workspace 9 * @param {!WebInspector.Workspace} workspace
10 * @param {!WebInspector.BreakpointManager} breakpointManager 10 * @param {!WebInspector.BreakpointManager} breakpointManager
11 * @param {!WebInspector.FileSystemMapping} fileSystemMapping 11 * @param {!WebInspector.FileSystemMapping} fileSystemMapping
12 */ 12 */
13 constructor(workspace, breakpointManager, fileSystemMapping) { 13 constructor(workspace, breakpointManager, fileSystemMapping) {
14 super(); 14 super();
15 this._workspace = workspace; 15 this._workspace = workspace;
16 this._breakpointManager = breakpointManager; 16 this._breakpointManager = breakpointManager;
17 /** @type {!Map<string, number>} */ 17 /** @type {!Map<string, number>} */
18 this._filePathPrefixesToBindingCount = new Map(); 18 this._filePathPrefixesToBindingCount = new Map();
19 19
20 if (Runtime.experiments.isEnabled('persistence2')) 20 if (Runtime.experiments.isEnabled('persistence2')) {
21 var iconProvider = new WebInspector.Persistence.LinkifierIconProvider(this );
22 WebInspector.Linkifier.registerIconProvider(iconProvider);
21 this._mapping = 23 this._mapping =
22 new WebInspector.Automapping(workspace, this._onBindingCreated.bind(th is), this._onBindingRemoved.bind(this)); 24 new WebInspector.Automapping(workspace, this._onBindingCreated.bind(th is), this._onBindingRemoved.bind(this));
23 else 25 } else {
24 this._mapping = new WebInspector.DefaultMapping( 26 this._mapping = new WebInspector.DefaultMapping(
25 workspace, fileSystemMapping, this._onBindingCreated.bind(this), this. _onBindingRemoved.bind(this)); 27 workspace, fileSystemMapping, this._onBindingCreated.bind(this), this. _onBindingRemoved.bind(this));
28 }
26 } 29 }
27 30
28 /** 31 /**
29 * @param {!WebInspector.PersistenceBinding} binding 32 * @param {!WebInspector.PersistenceBinding} binding
30 */ 33 */
31 _onBindingCreated(binding) { 34 _onBindingCreated(binding) {
32 if (binding.network.isDirty()) { 35 if (binding.network.isDirty()) {
33 WebInspector.console.log(WebInspector.UIString( 36 WebInspector.console.log(WebInspector.UIString(
34 '%s can not be persisted to file system due to unsaved changes.', bind ing.network.name())); 37 '%s can not be persisted to file system due to unsaved changes.', bind ing.network.name()));
35 return; 38 return;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 * @param {!WebInspector.UISourceCode} fileSystem 250 * @param {!WebInspector.UISourceCode} fileSystem
248 * @param {boolean} exactMatch 251 * @param {boolean} exactMatch
249 */ 252 */
250 constructor(network, fileSystem, exactMatch) { 253 constructor(network, fileSystem, exactMatch) {
251 this.network = network; 254 this.network = network;
252 this.fileSystem = fileSystem; 255 this.fileSystem = fileSystem;
253 this.exactMatch = exactMatch; 256 this.exactMatch = exactMatch;
254 } 257 }
255 }; 258 };
256 259
260 /**
261 * @extends {WebInspector.Object}
262 * @implements {WebInspector.LinkifierIconProvider}
263 */
264 WebInspector.Persistence.LinkifierIconProvider = class extends WebInspector.Obje ct {
265 constructor(persistence) {
266 super();
267 persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._bindingChanged, this);
268 persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._bindingChanged, this);
269 }
270
271 /**
272 * @param {!WebInspector.Event} event
273 */
274 _bindingChanged(event) {
275 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data);
276 this.dispatchEventToListeners(WebInspector.LinkifierIconProvider.Events.Icon Changed, binding.network);
277 }
278
279 /**
280 * @override
281 * @param {!WebInspector.UISourceCode} uiSourceCode
282 */
283 iconType(uiSourceCode) {
284 var binding = WebInspector.persistence.binding(uiSourceCode);
285 return binding ? 'smallicon-checkmark' : '';
286 }
287 };
288
257 /** @type {!WebInspector.Persistence} */ 289 /** @type {!WebInspector.Persistence} */
258 WebInspector.persistence; 290 WebInspector.persistence;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698