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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/FileManager.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots 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 /* 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.FileManager = class extends WebInspector.Object { 34 Workspace.FileManager = class extends Common.Object {
35 constructor() { 35 constructor() {
36 super(); 36 super();
37 this._savedURLsSetting = WebInspector.settings.createLocalSetting('savedURLs ', {}); 37 this._savedURLsSetting = Common.settings.createLocalSetting('savedURLs', {}) ;
38 38
39 /** @type {!Object.<string, ?function(boolean)>} */ 39 /** @type {!Object.<string, ?function(boolean)>} */
40 this._saveCallbacks = {}; 40 this._saveCallbacks = {};
41 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.SavedURL, this._savedURL, this); 41 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.SavedURL, this._savedURL, this);
42 InspectorFrontendHost.events.addEventListener( 42 InspectorFrontendHost.events.addEventListener(
43 InspectorFrontendHostAPI.Events.CanceledSaveURL, this._canceledSaveURL, this); 43 InspectorFrontendHostAPI.Events.CanceledSaveURL, this._canceledSaveURL, this);
44 InspectorFrontendHost.events.addEventListener( 44 InspectorFrontendHost.events.addEventListener(
45 InspectorFrontendHostAPI.Events.AppendedToURL, this._appendedToURL, this ); 45 InspectorFrontendHostAPI.Events.AppendedToURL, this._appendedToURL, this );
46 } 46 }
47 47
48 /** 48 /**
49 * @param {string} url 49 * @param {string} url
50 * @param {string} content 50 * @param {string} content
51 * @param {boolean} forceSaveAs 51 * @param {boolean} forceSaveAs
52 * @param {function(boolean)=} callback 52 * @param {function(boolean)=} callback
53 */ 53 */
54 save(url, content, forceSaveAs, callback) { 54 save(url, content, forceSaveAs, callback) {
55 // Remove this url from the saved URLs while it is being saved. 55 // Remove this url from the saved URLs while it is being saved.
56 var savedURLs = this._savedURLsSetting.get(); 56 var savedURLs = this._savedURLsSetting.get();
57 delete savedURLs[url]; 57 delete savedURLs[url];
58 this._savedURLsSetting.set(savedURLs); 58 this._savedURLsSetting.set(savedURLs);
59 this._saveCallbacks[url] = callback || null; 59 this._saveCallbacks[url] = callback || null;
60 InspectorFrontendHost.save(url, content, forceSaveAs); 60 InspectorFrontendHost.save(url, content, forceSaveAs);
61 } 61 }
62 62
63 /** 63 /**
64 * @param {!WebInspector.Event} event 64 * @param {!Common.Event} event
65 */ 65 */
66 _savedURL(event) { 66 _savedURL(event) {
67 var url = /** @type {string} */ (event.data); 67 var url = /** @type {string} */ (event.data);
68 var savedURLs = this._savedURLsSetting.get(); 68 var savedURLs = this._savedURLsSetting.get();
69 savedURLs[url] = true; 69 savedURLs[url] = true;
70 this._savedURLsSetting.set(savedURLs); 70 this._savedURLsSetting.set(savedURLs);
71 this.dispatchEventToListeners(WebInspector.FileManager.Events.SavedURL, url) ; 71 this.dispatchEventToListeners(Workspace.FileManager.Events.SavedURL, url);
72 this._invokeSaveCallback(url, true); 72 this._invokeSaveCallback(url, true);
73 } 73 }
74 74
75 /** 75 /**
76 * @param {string} url 76 * @param {string} url
77 * @param {boolean} accepted 77 * @param {boolean} accepted
78 */ 78 */
79 _invokeSaveCallback(url, accepted) { 79 _invokeSaveCallback(url, accepted) {
80 var callback = this._saveCallbacks[url]; 80 var callback = this._saveCallbacks[url];
81 delete this._saveCallbacks[url]; 81 delete this._saveCallbacks[url];
82 if (callback) 82 if (callback)
83 callback(accepted); 83 callback(accepted);
84 } 84 }
85 85
86 /** 86 /**
87 * @param {!WebInspector.Event} event 87 * @param {!Common.Event} event
88 */ 88 */
89 _canceledSaveURL(event) { 89 _canceledSaveURL(event) {
90 var url = /** @type {string} */ (event.data); 90 var url = /** @type {string} */ (event.data);
91 this._invokeSaveCallback(url, false); 91 this._invokeSaveCallback(url, false);
92 } 92 }
93 93
94 /** 94 /**
95 * @param {string} url 95 * @param {string} url
96 * @return {boolean} 96 * @return {boolean}
97 */ 97 */
(...skipping 11 matching lines...) Expand all
109 } 109 }
110 110
111 /** 111 /**
112 * @param {string} url 112 * @param {string} url
113 */ 113 */
114 close(url) { 114 close(url) {
115 // Currently a no-op. 115 // Currently a no-op.
116 } 116 }
117 117
118 /** 118 /**
119 * @param {!WebInspector.Event} event 119 * @param {!Common.Event} event
120 */ 120 */
121 _appendedToURL(event) { 121 _appendedToURL(event) {
122 var url = /** @type {string} */ (event.data); 122 var url = /** @type {string} */ (event.data);
123 this.dispatchEventToListeners(WebInspector.FileManager.Events.AppendedToURL, url); 123 this.dispatchEventToListeners(Workspace.FileManager.Events.AppendedToURL, ur l);
124 } 124 }
125 }; 125 };
126 126
127 /** @enum {symbol} */ 127 /** @enum {symbol} */
128 WebInspector.FileManager.Events = { 128 Workspace.FileManager.Events = {
129 SavedURL: Symbol('SavedURL'), 129 SavedURL: Symbol('SavedURL'),
130 AppendedToURL: Symbol('AppendedToURL') 130 AppendedToURL: Symbol('AppendedToURL')
131 }; 131 };
132 132
133 /** 133 /**
134 * @type {?WebInspector.FileManager} 134 * @type {?Workspace.FileManager}
135 */ 135 */
136 WebInspector.fileManager = null; 136 Workspace.fileManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698