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

Side by Side Diff: chrome/browser/resources/file_manager/js/suggest_apps_dialog.js

Issue 23483029: [Files.app] Not to capture mouse events when the suggest app dialog is visible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename enableDragOnTitleArea -> onDialogShownOrHidden Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 * @type {RegExp} 82 * @type {RegExp}
83 * @const 83 * @const
84 */ 84 */
85 var REGEXP_LOCALHOST_MATCH = /^https?:\/\/localhost(?:\:\d{1,5})?$/; 85 var REGEXP_LOCALHOST_MATCH = /^https?:\/\/localhost(?:\:\d{1,5})?$/;
86 86
87 /** 87 /**
88 * Creates dialog in DOM tree. 88 * Creates dialog in DOM tree.
89 * 89 *
90 * @param {HTMLElement} parentNode Node to be parent for this dialog. 90 * @param {HTMLElement} parentNode Node to be parent for this dialog.
91 * @constructor 91 * @constructor
92 * @extends {cr.ui.dialogs.BaseDialog} 92 * @extends {FileManagerDialogBase}
93 */ 93 */
94 function SuggestAppsDialog(parentNode) { 94 function SuggestAppsDialog(parentNode) {
95 cr.ui.dialogs.BaseDialog.call(this, parentNode); 95 FileManagerDialogBase.call(this, parentNode);
96 96
97 this.frame_.id = 'suggest-app-dialog'; 97 this.frame_.id = 'suggest-app-dialog';
98 98
99 this.spinnerWrapper_ = this.document_.createElement('div'); 99 this.spinnerWrapper_ = this.document_.createElement('div');
100 this.spinnerWrapper_.className = 'spinner-container'; 100 this.spinnerWrapper_.className = 'spinner-container';
101 this.spinnerWrapper_.style.width = SPINNER_WIDTH + 'px'; 101 this.spinnerWrapper_.style.width = SPINNER_WIDTH + 'px';
102 this.spinnerWrapper_.style.height = SPINNER_HEIGHT + 'px'; 102 this.spinnerWrapper_.style.height = SPINNER_HEIGHT + 'px';
103 this.spinnerWrapper_.hidden = true; 103 this.spinnerWrapper_.hidden = true;
104 this.frame_.appendChild(this.spinnerWrapper_); 104 this.frame_.appendChild(this.spinnerWrapper_);
105 105
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 this.mime_ = null; 154 this.mime_ = null;
155 this.installingItemId_ = null; 155 this.installingItemId_ = null;
156 this.state_ = SuggestAppsDialog.State.UNINITIALIZED; 156 this.state_ = SuggestAppsDialog.State.UNINITIALIZED;
157 157
158 this.initializationTask_ = new AsyncUtil.Group(); 158 this.initializationTask_ = new AsyncUtil.Group();
159 this.initializationTask_.add(this.retrieveAuthorizeToken_.bind(this)); 159 this.initializationTask_.add(this.retrieveAuthorizeToken_.bind(this));
160 this.initializationTask_.run(); 160 this.initializationTask_.run();
161 } 161 }
162 162
163 SuggestAppsDialog.prototype = { 163 SuggestAppsDialog.prototype = {
164 __proto__: cr.ui.dialogs.BaseDialog.prototype 164 __proto__: FileManagerDialogBase.prototype
165 }; 165 };
166 166
167 /** 167 /**
168 * @enum {string} 168 * @enum {string}
169 * @const 169 * @const
170 */ 170 */
171 SuggestAppsDialog.State = { 171 SuggestAppsDialog.State = {
172 UNINITIALIZED: 'SuggestAppsDialog.State.UNINITIALIZED', 172 UNINITIALIZED: 'SuggestAppsDialog.State.UNINITIALIZED',
173 INITIALIZING: 'SuggestAppsDialog.State.INITIALIZING', 173 INITIALIZING: 'SuggestAppsDialog.State.INITIALIZING',
174 INITIALIZE_FAILED_CLOSING: 174 INITIALIZE_FAILED_CLOSING:
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 this.state_ = SuggestAppsDialog.State.INITIALIZING; 260 this.state_ = SuggestAppsDialog.State.INITIALIZING;
261 261
262 // Makes it sure that the initialization is completed. 262 // Makes it sure that the initialization is completed.
263 this.initializationTask_.run(function() { 263 this.initializationTask_.run(function() {
264 var title = str('SUGGEST_DIALOG_TITLE'); 264 var title = str('SUGGEST_DIALOG_TITLE');
265 265
266 // TODO(yoshiki): Remove this before ShareDialog launches. 266 // TODO(yoshiki): Remove this before ShareDialog launches.
267 if (this.urlOverrided_) 267 if (this.urlOverrided_)
268 title += ' [OVERRIDED]'; 268 title += ' [OVERRIDED]';
269 269
270 cr.ui.dialogs.BaseDialog.prototype.showWithTitle.apply( 270 var show =
271 this, [title, '', function() {}, null, null]); 271 FileManagerDialogBase.prototype.showTitleOnlyDialog.call(this, title);
272 if (!show) {
273 console.error('SuggestAppsDialog can\'t be shown');
274 this.state_ = SuggestAppsDialog.State.UNINITIALIZED;
275 this.onHide();
276 return;
277 }
272 278
273 this.webviewContainer_.innerHTML = 279 this.webviewContainer_.innerHTML =
274 '<webview id="cws-widget" partition="persist:cwswidgets"></webview>'; 280 '<webview id="cws-widget" partition="persist:cwswidgets"></webview>';
275 this.webviewContainer_.classList.remove('loaded'); 281 this.webviewContainer_.classList.remove('loaded');
276 this.webviewContainer_.style.width = SPINNER_WIDTH + 'px'; 282 this.webviewContainer_.style.width = SPINNER_WIDTH + 'px';
277 this.webviewContainer_.style.height = SPINNER_HEIGHT + 'px'; 283 this.webviewContainer_.style.height = SPINNER_HEIGHT + 'px';
278 284
279 this.webview_ = this.container_.querySelector('#cws-widget'); 285 this.webview_ = this.container_.querySelector('#cws-widget');
280 this.webview_.request.onBeforeSendHeaders.addListener( 286 this.webview_.request.onBeforeSendHeaders.addListener(
281 this.authorizeRequest_.bind(this), 287 this.authorizeRequest_.bind(this),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 423
418 if (this.webviewClient_) { 424 if (this.webviewClient_) {
419 this.webviewClient_.dispose(); 425 this.webviewClient_.dispose();
420 this.webviewClient_ = null; 426 this.webviewClient_ = null;
421 } 427 }
422 428
423 this.webviewContainer_.innerHTML = ''; 429 this.webviewContainer_.innerHTML = '';
424 this.extension_ = null; 430 this.extension_ = null;
425 this.mime_ = null; 431 this.mime_ = null;
426 432
427 cr.ui.dialogs.BaseDialog.prototype.hide.call( 433 FileManagerDialogBase.prototype.hide.call(
428 this, 434 this,
429 this.onHide_.bind(this, opt_originalOnHide)); 435 this.onHide_.bind(this, opt_originalOnHide));
430 }; 436 };
431 437
432 /** 438 /**
433 * @param {function()=} opt_originalOnHide Original onHide function passed to 439 * @param {function()=} opt_originalOnHide Original onHide function passed to
434 * SuggestAppsDialog.hide(). 440 * SuggestAppsDialog.hide().
435 * @private 441 * @private
436 */ 442 */
437 SuggestAppsDialog.prototype.onHide_ = function(opt_originalOnHide) { 443 SuggestAppsDialog.prototype.onHide_ = function(opt_originalOnHide) {
(...skipping 16 matching lines...) Expand all
454 result = SuggestAppsDialog.Result.USER_CANCELL; 460 result = SuggestAppsDialog.Result.USER_CANCELL;
455 break; 461 break;
456 default: 462 default:
457 result = SuggestAppsDialog.Result.USER_CANCELL; 463 result = SuggestAppsDialog.Result.USER_CANCELL;
458 console.error('Invalid state.'); 464 console.error('Invalid state.');
459 } 465 }
460 this.state_ = SuggestAppsDialog.State.UNINITIALIZED; 466 this.state_ = SuggestAppsDialog.State.UNINITIALIZED;
461 467
462 this.onDialogClosed_(result); 468 this.onDialogClosed_(result);
463 }; 469 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698