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

Side by Side Diff: Source/devtools/front_end/sdk/StylesSourceMapping.js

Issue 313603003: Devtools: get rid of ProjectWillReset event, introduce ProjectRemoved instead of it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.SourceMapping} 33 * @implements {WebInspector.SourceMapping}
34 * @param {!WebInspector.CSSStyleModel} cssModel 34 * @param {!WebInspector.CSSStyleModel} cssModel
35 * @param {!WebInspector.Workspace} workspace 35 * @param {!WebInspector.Workspace} workspace
36 */ 36 */
37 WebInspector.StylesSourceMapping = function(cssModel, workspace) 37 WebInspector.StylesSourceMapping = function(cssModel, workspace)
38 { 38 {
39 this._cssModel = cssModel; 39 this._cssModel = cssModel;
40 this._workspace = workspace; 40 this._workspace = workspace;
41 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillRe set, this._projectWillReset, this); 41 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove d, this._projectRemoved, this);
42 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAddedToWorkspace, this); 42 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAddedToWorkspace, this);
43 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR emoved, this._uiSourceCodeRemoved, this); 43 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR emoved, this._uiSourceCodeRemoved, this);
44 44
45 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, th is); 45 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameCreatedOrNavigated, this._mainFrameCreatedOrNavigated, th is);
46 46
47 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheet Changed, this._styleSheetChanged, this); 47 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheet Changed, this._styleSheetChanged, this);
48 this._initialize(); 48 this._initialize();
49 } 49 }
50 50
51 WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs = 1000; 51 WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs = 1000;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (this._styleFiles.get(uiSourceCode) || header.isInline) 176 if (this._styleFiles.get(uiSourceCode) || header.isInline)
177 return; 177 return;
178 var url = uiSourceCode.url; 178 var url = uiSourceCode.url;
179 this._styleFiles.put(uiSourceCode, new WebInspector.StyleFile(uiSourceCo de, this)); 179 this._styleFiles.put(uiSourceCode, new WebInspector.StyleFile(uiSourceCo de, this));
180 header.updateLocations(); 180 header.updateLocations();
181 }, 181 },
182 182
183 /** 183 /**
184 * @param {!WebInspector.Event} event 184 * @param {!WebInspector.Event} event
185 */ 185 */
186 _projectWillReset: function(event) 186 _projectRemoved: function(event)
187 { 187 {
188 var project = /** @type {!WebInspector.Project} */ (event.data); 188 var project = /** @type {!WebInspector.Project} */ (event.data);
189 var uiSourceCodes = project.uiSourceCodes(); 189 var uiSourceCodes = project.uiSourceCodes();
190 for (var i = 0; i < uiSourceCodes.length; ++i) 190 for (var i = 0; i < uiSourceCodes.length; ++i)
191 this._unbindUISourceCode(uiSourceCodes[i]); 191 this._unbindUISourceCode(uiSourceCodes[i]);
192 }, 192 },
193 193
194 /** 194 /**
195 * @param {!WebInspector.Event} event 195 * @param {!WebInspector.Event} event
196 */ 196 */
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 this._uiSourceCode.addRevision(content); 420 this._uiSourceCode.addRevision(content);
421 delete this._isAddingRevision; 421 delete this._isAddingRevision;
422 }, 422 },
423 423
424 dispose: function() 424 dispose: function()
425 { 425 {
426 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); 426 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this);
427 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 427 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
428 } 428 }
429 } 429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698