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 window.console.log('contentWindow stuff **** WHEEE'); |
| 54 window.console.log(contentWindow); |
| 55 GuestViewInternalNatives.AttachIframeGuest( |
| 56 internalInstanceId, this.id, attachParams, contentWindow, |
| 57 callbackWrapper.bind(this, callback)); |
54 | 58 |
55 this.internalInstanceId = internalInstanceId; | 59 this.internalInstanceId = internalInstanceId; |
56 this.state = GuestViewImpl.GuestState.GUEST_STATE_ATTACHED; | 60 this.state = GuestViewImpl.GuestState.GUEST_STATE_ATTACHED; |
57 | 61 |
58 // Detach automatically when the container is destroyed. | 62 // Detach automatically when the container is destroyed. |
59 GuestViewInternalNatives.RegisterDestructionCallback( | 63 GuestViewInternalNatives.RegisterDestructionCallback( |
60 internalInstanceId, this.weakWrapper(function() { | 64 internalInstanceId, this.weakWrapper(function() { |
61 if (this.state != GuestViewImpl.GuestState.GUEST_STATE_ATTACHED || | 65 if (this.state != GuestViewImpl.GuestState.GUEST_STATE_ATTACHED || |
62 this.internalInstanceId != internalInstanceId) { | 66 this.internalInstanceId != internalInstanceId) { |
63 return; | 67 return; |
(...skipping 25 matching lines...) Expand all Loading... |
89 } | 93 } |
90 | 94 |
91 ResizeEvent.addListener(this.callOnResize, {instanceId: this.id}); | 95 ResizeEvent.addListener(this.callOnResize, {instanceId: this.id}); |
92 this.handleCallback(callback); | 96 this.handleCallback(callback); |
93 }; | 97 }; |
94 | 98 |
95 this.sendCreateRequest(createParams, callbackWrapper.bind(this, callback)); | 99 this.sendCreateRequest(createParams, callbackWrapper.bind(this, callback)); |
96 | 100 |
97 this.state = GuestViewImpl.GuestState.GUEST_STATE_CREATED; | 101 this.state = GuestViewImpl.GuestState.GUEST_STATE_CREATED; |
98 }; | 102 }; |
OLD | NEW |