| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * SuggestAppsDialog contains a list box to select an app to be opened the file | 8 * SuggestAppsDialog contains a list box to select an app to be opened the file |
| 9 * with. This dialog should be used as action picker for file operations. | 9 * with. This dialog should be used as action picker for file operations. |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * The width of the widget (in pixel). | 13 * The width of the widget (in pixel). |
| 14 * @type {number} | 14 * @type {number} |
| 15 * @const | 15 * @const |
| 16 */ | 16 */ |
| 17 var WEBVIEW_WIDTH = 735; | 17 var WEBVIEW_WIDTH = 735; |
| 18 /** | 18 /** |
| 19 * The height of the widget (in pixel). | 19 * The height of the widget (in pixel). |
| 20 * @type {number} | 20 * @type {number} |
| 21 * @const | 21 * @const |
| 22 */ | 22 */ |
| 23 var WEBVIEW_HEIGHT = 480; | 23 var WEBVIEW_HEIGHT = 480; |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * The mergin inside the widget (in pixel). | |
| 27 * @type {number} | |
| 28 * @const | |
| 29 */ | |
| 30 var WIDGET_MARGIN = 8; | |
| 31 | |
| 32 /** | |
| 33 * The widget of the spinner box (in pixel). | 26 * The widget of the spinner box (in pixel). |
| 34 * @type {number} | 27 * @type {number} |
| 35 * @const | 28 * @const |
| 36 */ | 29 */ |
| 37 var SPINNER_WIDTH = 300; | 30 var SPINNER_WIDTH = 300; |
| 38 /** | 31 /** |
| 39 * The height of the spinner box (in pixel). | 32 * The height of the spinner box (in pixel). |
| 40 * @type {number} | 33 * @type {number} |
| 41 * @const | 34 * @const |
| 42 */ | 35 */ |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 /** | 314 /** |
| 322 * Called when the widget is loaded successfuly. | 315 * Called when the widget is loaded successfuly. |
| 323 * @param {Event} event Evnet. | 316 * @param {Event} event Evnet. |
| 324 * @private | 317 * @private |
| 325 */ | 318 */ |
| 326 SuggestAppsDialog.prototype.onWidgetLoaded_ = function(event) { | 319 SuggestAppsDialog.prototype.onWidgetLoaded_ = function(event) { |
| 327 this.spinnerWrapper_.hidden = true; | 320 this.spinnerWrapper_.hidden = true; |
| 328 this.webviewContainer_.classList.add('loaded'); | 321 this.webviewContainer_.classList.add('loaded'); |
| 329 this.state_ = SuggestAppsDialog.State.INITIALIZED; | 322 this.state_ = SuggestAppsDialog.State.INITIALIZED; |
| 330 | 323 |
| 331 this.webviewContainer_.style.width = | 324 this.webviewContainer_.style.width = WEBVIEW_WIDTH + 'px'; |
| 332 (WEBVIEW_WIDTH + WIDGET_MARGIN * 2) + 'px'; | 325 this.webviewContainer_.style.height = WEBVIEW_HEIGHT + 'px'; |
| 333 this.webviewContainer_.style.height = | |
| 334 (WEBVIEW_HEIGHT + WIDGET_MARGIN * 2) + 'px'; | |
| 335 | 326 |
| 336 this.webview_.style.width = | 327 this.webview_.style.width = WEBVIEW_WIDTH + 'px'; |
| 337 (WEBVIEW_WIDTH + WIDGET_MARGIN * 2) + 'px'; | 328 this.webview_.style.height = WEBVIEW_HEIGHT + 'px'; |
| 338 this.webview_.style.height = | |
| 339 (WEBVIEW_HEIGHT + WIDGET_MARGIN * 2) + 'px'; | |
| 340 this.webview_.focus(); | 329 this.webview_.focus(); |
| 341 }; | 330 }; |
| 342 | 331 |
| 343 /** | 332 /** |
| 344 * Called when the widget is failed to load. | 333 * Called when the widget is failed to load. |
| 345 * @param {Event} event Evnet. | 334 * @param {Event} event Evnet. |
| 346 * @private | 335 * @private |
| 347 */ | 336 */ |
| 348 SuggestAppsDialog.prototype.onWidgetLoadFailed_ = function(event) { | 337 SuggestAppsDialog.prototype.onWidgetLoadFailed_ = function(event) { |
| 349 this.spinnerWrapper_.hidden = true; | 338 this.spinnerWrapper_.hidden = true; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 result = SuggestAppsDialog.Result.USER_CANCELL; | 449 result = SuggestAppsDialog.Result.USER_CANCELL; |
| 461 break; | 450 break; |
| 462 default: | 451 default: |
| 463 result = SuggestAppsDialog.Result.USER_CANCELL; | 452 result = SuggestAppsDialog.Result.USER_CANCELL; |
| 464 console.error('Invalid state.'); | 453 console.error('Invalid state.'); |
| 465 } | 454 } |
| 466 this.state_ = SuggestAppsDialog.State.UNINITIALIZED; | 455 this.state_ = SuggestAppsDialog.State.UNINITIALIZED; |
| 467 | 456 |
| 468 this.onDialogClosed_(result); | 457 this.onDialogClosed_(result); |
| 469 }; | 458 }; |
| OLD | NEW |