| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Persistence.DefaultMapping = class { | 7 Persistence.DefaultMapping = class { |
| 8 /** | 8 /** |
| 9 * @param {!Workspace.Workspace} workspace | 9 * @param {!Workspace.Workspace} workspace |
| 10 * @param {!Workspace.FileSystemMapping} fileSystemMapping | 10 * @param {!Workspace.FileSystemMapping} fileSystemMapping |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 for (var uiSourceCode of project.uiSourceCodes()) | 63 for (var uiSourceCode of project.uiSourceCodes()) |
| 64 this._unbind(uiSourceCode); | 64 this._unbind(uiSourceCode); |
| 65 } | 65 } |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @param {!Workspace.UISourceCode} uiSourceCode | 68 * @param {!Workspace.UISourceCode} uiSourceCode |
| 69 * @return {?Persistence.PersistenceBinding} | 69 * @return {?Persistence.PersistenceBinding} |
| 70 */ | 70 */ |
| 71 _createBinding(uiSourceCode) { | 71 _createBinding(uiSourceCode) { |
| 72 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) { | 72 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) { |
| 73 var fileSystemPath = Bindings.FileSystemWorkspaceBinding.fileSystemPath(ui
SourceCode.project().id()); | 73 var fileSystemPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath
(uiSourceCode.project().id()); |
| 74 var networkURL = this._fileSystemMapping.networkURLForFileSystemURL(fileSy
stemPath, uiSourceCode.url()); | 74 var networkURL = this._fileSystemMapping.networkURLForFileSystemURL(fileSy
stemPath, uiSourceCode.url()); |
| 75 var networkSourceCode = networkURL ? this._workspace.uiSourceCodeForURL(ne
tworkURL) : null; | 75 var networkSourceCode = networkURL ? this._workspace.uiSourceCodeForURL(ne
tworkURL) : null; |
| 76 return networkSourceCode ? new Persistence.PersistenceBinding(networkSourc
eCode, uiSourceCode, false) : null; | 76 return networkSourceCode ? new Persistence.PersistenceBinding(networkSourc
eCode, uiSourceCode, false) : null; |
| 77 } | 77 } |
| 78 if (uiSourceCode.project().type() === Workspace.projectTypes.Network) { | 78 if (uiSourceCode.project().type() === Workspace.projectTypes.Network) { |
| 79 var file = this._fileSystemMapping.fileForURL(uiSourceCode.url()); | 79 var file = this._fileSystemMapping.fileForURL(uiSourceCode.url()); |
| 80 var projectId = file ? Bindings.FileSystemWorkspaceBinding.projectId(file.
fileSystemPath) : null; | 80 var projectId = file ? Persistence.FileSystemWorkspaceBinding.projectId(fi
le.fileSystemPath) : null; |
| 81 var fileSourceCode = file && projectId ? this._workspace.uiSourceCode(proj
ectId, file.fileURL) : null; | 81 var fileSourceCode = file && projectId ? this._workspace.uiSourceCode(proj
ectId, file.fileURL) : null; |
| 82 return fileSourceCode ? new Persistence.PersistenceBinding(uiSourceCode, f
ileSourceCode, false) : null; | 82 return fileSourceCode ? new Persistence.PersistenceBinding(uiSourceCode, f
ileSourceCode, false) : null; |
| 83 } | 83 } |
| 84 return null; | 84 return null; |
| 85 } | 85 } |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * @param {!Workspace.UISourceCode} uiSourceCode | 88 * @param {!Workspace.UISourceCode} uiSourceCode |
| 89 */ | 89 */ |
| 90 _bind(uiSourceCode) { | 90 _bind(uiSourceCode) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 this._unbind(binding.network); | 128 this._unbind(binding.network); |
| 129 this._bind(binding.network); | 129 this._bind(binding.network); |
| 130 } | 130 } |
| 131 | 131 |
| 132 dispose() { | 132 dispose() { |
| 133 Common.EventTarget.removeEventListeners(this._eventListeners); | 133 Common.EventTarget.removeEventListeners(this._eventListeners); |
| 134 } | 134 } |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 Persistence.DefaultMapping._binding = Symbol('DefaultMapping.Binding'); | 137 Persistence.DefaultMapping._binding = Symbol('DefaultMapping.Binding'); |
| OLD | NEW |