Chromium Code Reviews| Index: chrome/browser/resources/file_manager/js/cws_container_client.js |
| diff --git a/chrome/browser/resources/file_manager/js/cws_container_client.js b/chrome/browser/resources/file_manager/js/cws_container_client.js |
| index 9e7718f4d5a188c632f825a706f402b637ab9639..6172b7319eacd19820e731958d90af3320cc94c7 100644 |
| --- a/chrome/browser/resources/file_manager/js/cws_container_client.js |
| +++ b/chrome/browser/resources/file_manager/js/cws_container_client.js |
| @@ -47,7 +47,10 @@ CWSContainerClient.prototype.onMessage_ = function(event) { |
| var data = event.data; |
| switch (data['message']) { |
| case 'widget_loaded': |
| - // Do nothing. Waits for user action and next message. |
| + this.onWidgetLoaded_(); |
| + break; |
| + case 'widget_load_failed': |
| + this.onWidgetLoadFailed_(); |
| break; |
| case 'before_install': |
| this.sendInstallRequest_(data['item_id']); |
| @@ -70,12 +73,28 @@ CWSContainerClient.prototype.onLoadStop_ = function(event) { |
| }; |
| /** |
| + * Called when the widget is loaded successfully. |
| + * @private |
| + */ |
| +CWSContainerClient.prototype.onWidgetLoaded_ = function() { |
| + this.dispatchEvent(new cr.Event('loaded')); |
|
hirono
2013/08/30 09:06:19
Can we make the event names enum values?
To do thi
yoshiki
2013/08/30 09:16:03
Done.
|
| +}; |
| + |
| +/** |
| + * Called when the widget is failed to load. |
| + * @private |
| + */ |
| +CWSContainerClient.prototype.onWidgetLoadFailed_ = function() { |
| + this.sendWidgetLoadFailed_(); |
| +}; |
| + |
| +/** |
| * Called when receiving the 'loadabort' event from <webview>. |
| * @param {Event} event Message event. |
| * @private |
| */ |
| CWSContainerClient.prototype.onLoadAbort_ = function(event) { |
| - this.sendWebviewLoadAbort_(); |
| + this.sendWidgetLoadFailed_(); |
| }; |
| /** |
| @@ -92,11 +111,11 @@ CWSContainerClient.prototype.onInstallCompleted = function(result, itemId) { |
| }; |
| /** |
| - * Send the abort event to the suggest-app dialog. |
| + * Send the fail message to the suggest-app dialog. |
| * @private |
| */ |
| -CWSContainerClient.prototype.sendWebviewLoadAbort_ = function() { |
| - this.dispatchEvent(new cr.Event('webview-load-abort')); |
| +CWSContainerClient.prototype.sendWidgetLoadFailed_ = function() { |
| + this.dispatchEvent(new cr.Event('load-failed')); |
| }; |
| /** |