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