OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Event management for WebViewInternal. | 5 // Event management for WebViewInternal. |
6 | 6 |
7 var DeclarativeWebRequestSchema = | 7 var DeclarativeWebRequestSchema = |
8 requireNative('schema_registry').GetSchema('declarativeWebRequest'); | 8 requireNative('schema_registry').GetSchema('declarativeWebRequest'); |
9 var EventBindings = require('event_bindings'); | 9 var EventBindings = require('event_bindings'); |
10 var IdGenerator = requireNative('id_generator'); | 10 var IdGenerator = requireNative('id_generator'); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 return; | 476 return; |
477 } | 477 } |
478 | 478 |
479 if (defaultPrevented) { | 479 if (defaultPrevented) { |
480 // Make browser plugin track lifetime of |windowObj|. | 480 // Make browser plugin track lifetime of |windowObj|. |
481 MessagingNatives.BindToGC(windowObj, function() { | 481 MessagingNatives.BindToGC(windowObj, function() { |
482 // Avoid showing a warning message if the decision has already been made. | 482 // Avoid showing a warning message if the decision has already been made. |
483 if (actionTaken) { | 483 if (actionTaken) { |
484 return; | 484 return; |
485 } | 485 } |
| 486 |
| 487 var guestInstanceId = getGuestInstanceId(); |
| 488 if (!guestInstanceId) { |
| 489 // If the opener is already gone, then we won't have its |
| 490 // guestInstanceId. |
| 491 return; |
| 492 } |
| 493 |
486 WebView.setPermission( | 494 WebView.setPermission( |
487 getGuestInstanceId(), requestId, 'default', '', function(allowed) { | 495 guestInstanceId, requestId, 'default', '', function(allowed) { |
488 if (allowed) { | 496 if (allowed) { |
489 return; | 497 return; |
490 } | 498 } |
491 showWarningMessage(); | 499 showWarningMessage(); |
492 }); | 500 }); |
493 }); | 501 }); |
494 } else { | 502 } else { |
495 actionTaken = true; | 503 actionTaken = true; |
496 // The default action is to discard the window. | 504 // The default action is to discard the window. |
497 WebView.setPermission( | 505 WebView.setPermission( |
498 getGuestInstanceId(), requestId, 'default', '', function(allowed) { | 506 getGuestInstanceId(), requestId, 'default', '', function(allowed) { |
499 if (allowed) { | 507 if (allowed) { |
500 return; | 508 return; |
501 } | 509 } |
502 showWarningMessage(); | 510 showWarningMessage(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 607 } |
600 }; | 608 }; |
601 | 609 |
602 WebViewEvents.prototype.handleSizeChangedEvent = function( | 610 WebViewEvents.prototype.handleSizeChangedEvent = function( |
603 event, webViewEvent) { | 611 event, webViewEvent) { |
604 this.webViewInternal.onSizeChanged(webViewEvent); | 612 this.webViewInternal.onSizeChanged(webViewEvent); |
605 }; | 613 }; |
606 | 614 |
607 exports.WebViewEvents = WebViewEvents; | 615 exports.WebViewEvents = WebViewEvents; |
608 exports.CreateEvent = CreateEvent; | 616 exports.CreateEvent = CreateEvent; |
OLD | NEW |