OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // --site-per-process overrides for guest_view.js. | 5 // --site-per-process overrides for guest_view.js. |
6 | 6 |
7 var GuestView = require('guestView').GuestView; | 7 var GuestView = require('guestView').GuestView; |
8 var GuestViewImpl = require('guestView').GuestViewImpl; | 8 var GuestViewImpl = require('guestView').GuestViewImpl; |
9 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 9 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
10 var ResizeEvent = require('guestView').ResizeEvent; | 10 var ResizeEvent = require('guestView').ResizeEvent; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } else { | 42 } else { |
43 // Only update the contentWindow if attaching is successful. | 43 // Only update the contentWindow if attaching is successful. |
44 this.contentWindow = contentWindow; | 44 this.contentWindow = contentWindow; |
45 } | 45 } |
46 | 46 |
47 this.handleCallback(callback); | 47 this.handleCallback(callback); |
48 }; | 48 }; |
49 | 49 |
50 attachParams['instanceId'] = viewInstanceId; | 50 attachParams['instanceId'] = viewInstanceId; |
51 var contentWindow = getIframeContentWindow(viewInstanceId); | 51 var contentWindow = getIframeContentWindow(viewInstanceId); |
52 // TODO(lazyboy): Call binding function to attach this guest. | 52 // |contentWindow| is used to retrieve the RenderFrame in cpp. |
53 // |contentWindow| should be used to retrieve the RenderFrame in cpp. | 53 GuestViewInternalNatives.AttachIframeGuest( |
| 54 internalInstanceId, this.id, attachParams, contentWindow, |
| 55 callbackWrapper.bind(this, callback)); |
54 | 56 |
55 this.internalInstanceId = internalInstanceId; | 57 this.internalInstanceId = internalInstanceId; |
56 this.state = GuestViewImpl.GuestState.GUEST_STATE_ATTACHED; | 58 this.state = GuestViewImpl.GuestState.GUEST_STATE_ATTACHED; |
57 | 59 |
58 // Detach automatically when the container is destroyed. | 60 // Detach automatically when the container is destroyed. |
59 GuestViewInternalNatives.RegisterDestructionCallback( | 61 GuestViewInternalNatives.RegisterDestructionCallback( |
60 internalInstanceId, this.weakWrapper(function() { | 62 internalInstanceId, this.weakWrapper(function() { |
61 if (this.state != GuestViewImpl.GuestState.GUEST_STATE_ATTACHED || | 63 if (this.state != GuestViewImpl.GuestState.GUEST_STATE_ATTACHED || |
62 this.internalInstanceId != internalInstanceId) { | 64 this.internalInstanceId != internalInstanceId) { |
63 return; | 65 return; |
(...skipping 25 matching lines...) Expand all Loading... |
89 } | 91 } |
90 | 92 |
91 ResizeEvent.addListener(this.callOnResize, {instanceId: this.id}); | 93 ResizeEvent.addListener(this.callOnResize, {instanceId: this.id}); |
92 this.handleCallback(callback); | 94 this.handleCallback(callback); |
93 }; | 95 }; |
94 | 96 |
95 this.sendCreateRequest(createParams, callbackWrapper.bind(this, callback)); | 97 this.sendCreateRequest(createParams, callbackWrapper.bind(this, callback)); |
96 | 98 |
97 this.state = GuestViewImpl.GuestState.GUEST_STATE_CREATED; | 99 this.state = GuestViewImpl.GuestState.GUEST_STATE_CREATED; |
98 }; | 100 }; |
OLD | NEW |