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 Persistence.PersistenceUtils = class { | 5 Persistence.PersistenceUtils = class { |
6 /** | 6 /** |
7 * @param {!Workspace.UISourceCode} uiSourceCode | 7 * @param {!Workspace.UISourceCode} uiSourceCode |
8 * @return {string} | 8 * @return {string} |
9 */ | 9 */ |
10 static tooltipForUISourceCode(uiSourceCode) { | 10 static tooltipForUISourceCode(uiSourceCode) { |
11 var binding = Persistence.persistence.binding(uiSourceCode); | 11 var binding = Persistence.persistence.binding(uiSourceCode); |
12 if (!binding) | 12 if (!binding) |
13 return ''; | 13 return ''; |
14 if (uiSourceCode === binding.network) | 14 if (uiSourceCode === binding.network) |
15 return Common.UIString('Persisted to file system: %s', binding.fileSystem.
url().trimMiddle(150)); | 15 return Common.UIString('Persisted to file system: %s', binding.fileSystem.
url().trimMiddle(150)); |
16 if (binding.network.contentType().isFromSourceMap()) | 16 if (binding.network.contentType().isFromSourceMap()) |
17 return Common.UIString('Linked to source map: %s', binding.network.url().t
rimMiddle(150)); | 17 return Common.UIString('Linked to source map: %s', binding.network.url().t
rimMiddle(150)); |
18 return Common.UIString('Linked to %s', binding.network.url().trimMiddle(150)
); | 18 return Common.UIString('Linked to %s', binding.network.url().trimMiddle(150)
); |
19 } | 19 } |
20 | 20 |
21 /** | 21 /** |
22 * @param {!Workspace.UISourceCode} uiSourceCode | 22 * @param {!Workspace.UISourceCode} uiSourceCode |
23 * @return {?UI.Icon} | 23 * @return {?UI.Icon} |
24 */ | 24 */ |
25 static iconForUISourceCode(uiSourceCode) { | 25 static iconForUISourceCode(uiSourceCode) { |
26 if (!Runtime.experiments.isEnabled('persistence2')) | 26 if (!Runtime.experiments.isEnabled('persistence2')) |
27 return null; | 27 return null; |
28 var binding = Persistence.persistence.binding(uiSourceCode); | 28 var binding = Persistence.persistence.binding(uiSourceCode); |
29 if (binding) { | 29 if (binding) { |
30 var icon = UI.Icon.create('smallicon-file-sync'); | 30 var icon = UI.Icon.create('mediumicon-file-sync'); |
31 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(binding.f
ileSystem); | 31 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(binding.f
ileSystem); |
32 return icon; | 32 return icon; |
33 } | 33 } |
34 if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem) | 34 if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem) |
35 return null; | 35 return null; |
36 var icon = UI.Icon.create('smallicon-file'); | 36 var icon = UI.Icon.create('mediumicon-file'); |
37 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod
e); | 37 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod
e); |
38 return icon; | 38 return icon; |
39 } | 39 } |
40 }; | 40 }; |
41 | 41 |
42 /** | 42 /** |
43 * @extends {Common.Object} | 43 * @extends {Common.Object} |
44 * @implements {Components.LinkDecorator} | 44 * @implements {Components.LinkDecorator} |
45 */ | 45 */ |
46 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object { | 46 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object { |
(...skipping 16 matching lines...) Expand all Loading... |
63 | 63 |
64 /** | 64 /** |
65 * @override | 65 * @override |
66 * @param {!Workspace.UISourceCode} uiSourceCode | 66 * @param {!Workspace.UISourceCode} uiSourceCode |
67 * @return {?UI.Icon} | 67 * @return {?UI.Icon} |
68 */ | 68 */ |
69 linkIcon(uiSourceCode) { | 69 linkIcon(uiSourceCode) { |
70 return Persistence.PersistenceUtils.iconForUISourceCode(uiSourceCode); | 70 return Persistence.PersistenceUtils.iconForUISourceCode(uiSourceCode); |
71 } | 71 } |
72 }; | 72 }; |
OLD | NEW |