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

Side by Side Diff: ui/file_manager/file_manager/foreground/js/cws_container_client.js

Issue 1056433003: Add button to add new FSP services to Files app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests. Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 /** 5 /**
6 * @param {WebView} webView Web View tag. 6 * @param {WebView} webView Web View tag.
7 * @param {?string} ext File extension.
8 * @param {?string} mime File mime type.
9 * @param {?string} searchQuery Search query.
10 * @param {number} width Width of the CWS widget. 7 * @param {number} width Width of the CWS widget.
11 * @param {number} height Height of the CWS widget. 8 * @param {number} height Height of the CWS widget.
12 * @param {string} url Share Url for an entry. 9 * @param {string} url Share Url for an entry.
13 * @param {string} target Target (scheme + host + port) of the widget. 10 * @param {string} target Target (scheme + host + port) of the widget.
11 * @param {Object<string, *>} options Options to be sent to the dialog host.
14 * @constructor 12 * @constructor
15 * @extends {cr.EventTarget} 13 * @extends {cr.EventTarget}
16 */ 14 */
17 function CWSContainerClient( 15 function CWSContainerClient(webView, width, height, url, target, options) {
18 webView, ext, mime, searchQuery, width, height, url, target) {
19 this.webView_ = webView; 16 this.webView_ = webView;
20 this.ext_ = (ext && ext[0] == '.') ? ext.substr(1) : ext;
21 this.mime_ = mime;
22 this.searchQuery_ = searchQuery;
23 this.width_ = width; 17 this.width_ = width;
24 this.height_ = height; 18 this.height_ = height;
25 this.url_ = url; 19 this.url_ = url;
26 this.target_ = target; 20 this.target_ = target;
21 this.options_ = options;
27 22
28 this.loaded_ = false; 23 this.loaded_ = false;
29 this.loading_ = false; 24 this.loading_ = false;
30 25
31 this.onMessageBound_ = this.onMessage_.bind(this); 26 this.onMessageBound_ = this.onMessage_.bind(this);
32 this.onLoadStopBound_ = this.onLoadStop_.bind(this); 27 this.onLoadStopBound_ = this.onLoadStop_.bind(this);
33 this.onLoadAbortBound_ = this.onLoadAbort_.bind(this); 28 this.onLoadAbortBound_ = this.onLoadAbort_.bind(this);
34 } 29 }
35 30
36 CWSContainerClient.prototype = { 31 CWSContainerClient.prototype = {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 */ 178 */
184 CWSContainerClient.prototype.postInitializeMessage_ = function() { 179 CWSContainerClient.prototype.postInitializeMessage_ = function() {
185 var message = { 180 var message = {
186 message: 'initialize', 181 message: 'initialize',
187 hl: util.getCurrentLocaleOrDefault(), 182 hl: util.getCurrentLocaleOrDefault(),
188 width: this.width_, 183 width: this.width_,
189 height: this.height_, 184 height: this.height_,
190 v: 1 185 v: 1
191 }; 186 };
192 187
193 if (this.searchQuery_) { 188 if (this.options_) {
194 message['search_query'] = this.searchQuery_; 189 Object.keys(this.options_).forEach(function(key) {
195 } else { 190 message[key] = this.options_[key];
196 message['file_extension'] = this.ext_; 191 }.bind(this));
197 message['mime_type'] = this.mime_;
198 } 192 }
199 193
200 this.postMessage_(message); 194 this.postMessage_(message);
201 }; 195 };
202 196
203 /** 197 /**
204 * Send a message to the widget. This method shouldn't be called directly, 198 * Send a message to the widget. This method shouldn't be called directly,
205 * should from more specified posting function (eg. postXyzMessage_()). 199 * should from more specified posting function (eg. postXyzMessage_()).
206 * 200 *
207 * @param {Object} message Message object to be posted. 201 * @param {Object} message Message object to be posted.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 'loadabort', this.onLoadAbortBound_); 233 'loadabort', this.onLoadAbortBound_);
240 this.webView_.stop(); 234 this.webView_.stop();
241 }; 235 };
242 236
243 /** 237 /**
244 * Cleans the dialog by removing all handlers. 238 * Cleans the dialog by removing all handlers.
245 */ 239 */
246 CWSContainerClient.prototype.dispose = function() { 240 CWSContainerClient.prototype.dispose = function() {
247 this.abort(); 241 this.abort();
248 }; 242 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698