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 */ |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 | 215 |
216 this.webviewContainer_.innerHTML = | 216 this.webviewContainer_.innerHTML = |
217 '<webview id="cws-widget" partition="persist:cwswidgets"></webview>'; | 217 '<webview id="cws-widget" partition="persist:cwswidgets"></webview>'; |
218 var webView = this.container_.querySelector('#cws-widget'); | 218 var webView = this.container_.querySelector('#cws-widget'); |
219 webView.style.width = WEBVIEW_WIDTH + 'px'; | 219 webView.style.width = WEBVIEW_WIDTH + 'px'; |
220 webView.style.height = WEBVIEW_HEIGHT + 'px'; | 220 webView.style.height = WEBVIEW_HEIGHT + 'px'; |
221 webView.request.onBeforeSendHeaders.addListener( | 221 webView.request.onBeforeSendHeaders.addListener( |
222 this.authorizeRequest_.bind(this), | 222 this.authorizeRequest_.bind(this), |
223 {urls: [this.widgetOrigin_ + '/*']}, | 223 {urls: [this.widgetOrigin_ + '/*']}, |
224 ['blocking', 'requestHeaders']); | 224 ['blocking', 'requestHeaders']); |
225 webView.addEventListener('newwindow', function(e) { | |
hirono
2013/08/30 02:02:36
e -> event ?
| |
226 // Discard the window object and reopen in an external window. | |
227 e.window.discard(); | |
228 util.visitURL(e.targetUrl); | |
229 e.preventDefault(); | |
230 }); | |
225 webView.focus(); | 231 webView.focus(); |
226 | 232 |
227 this.webviewClient_ = new CWSContainerClient( | 233 this.webviewClient_ = new CWSContainerClient( |
228 webView, | 234 webView, |
229 extension, mime, | 235 extension, mime, |
230 WEBVIEW_WIDTH, WEBVIEW_HEIGHT, | 236 WEBVIEW_WIDTH, WEBVIEW_HEIGHT, |
231 this.widgetUrl_, this.widgetOrigin_); | 237 this.widgetUrl_, this.widgetOrigin_); |
232 this.webviewClient_.addEventListener('install-request', | 238 this.webviewClient_.addEventListener('install-request', |
233 this.onInstallRequest_.bind(this)); | 239 this.onInstallRequest_.bind(this)); |
234 this.webviewClient_.load(); | 240 this.webviewClient_.load(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 this.mime_ = null; | 319 this.mime_ = null; |
314 | 320 |
315 cr.ui.dialogs.BaseDialog.prototype.hide.call(this); | 321 cr.ui.dialogs.BaseDialog.prototype.hide.call(this); |
316 | 322 |
317 // Calls the callback after the dialog hides. | 323 // Calls the callback after the dialog hides. |
318 setTimeout(function() { | 324 setTimeout(function() { |
319 var installed = this.state_ == SuggestAppsDialog.State.INSTALLED; | 325 var installed = this.state_ == SuggestAppsDialog.State.INSTALLED; |
320 this.onDialogClosed_(installed); | 326 this.onDialogClosed_(installed); |
321 }.bind(this), 0); | 327 }.bind(this), 0); |
322 }; | 328 }; |
OLD | NEW |