OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Shim that simulates a <adview> tag via Mutation Observers. | 5 // Shim that simulates a <adview> tag via Mutation Observers. |
6 // | 6 // |
7 // The actual tag is implemented via the browser plugin. The internals of this | 7 // The actual tag is implemented via the browser plugin. The internals of this |
8 // are hidden via Shadow DOM. | 8 // are hidden via Shadow DOM. |
9 | 9 |
10 // TODO(rpaquay): This file is currently very similar to "web_view.js". Do we | 10 // TODO(rpaquay): This file is currently very similar to "web_view.js". Do we |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 }); | 94 }); |
95 return result; | 95 return result; |
96 } | 96 } |
97 | 97 |
98 /** | 98 /** |
99 * @constructor | 99 * @constructor |
100 */ | 100 */ |
101 function AdView(adviewNode) { | 101 function AdView(adviewNode) { |
102 this.adviewNode_ = adviewNode; | 102 this.adviewNode_ = adviewNode; |
103 this.browserPluginNode_ = this.createBrowserPluginNode_(); | 103 this.browserPluginNode_ = this.createBrowserPluginNode_(); |
104 var shadowRoot = this.adviewNode_.webkitCreateShadowRoot(); | 104 var shadowRoot = this.adviewNode_.createShadowRoot(); |
105 shadowRoot.appendChild(this.browserPluginNode_); | 105 shadowRoot.appendChild(this.browserPluginNode_); |
106 | 106 |
107 this.setupCustomAttributes_(); | 107 this.setupCustomAttributes_(); |
108 this.setupAdviewNodeObservers_(); | 108 this.setupAdviewNodeObservers_(); |
109 this.setupAdviewNodeMethods_(); | 109 this.setupAdviewNodeMethods_(); |
110 this.setupAdviewNodeProperties_(); | 110 this.setupAdviewNodeProperties_(); |
111 this.setupAdviewNodeEvents_(); | 111 this.setupAdviewNodeEvents_(); |
112 this.setupBrowserPluginNodeObservers_(); | 112 this.setupBrowserPluginNodeObservers_(); |
113 } | 113 } |
114 | 114 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 var evt = new Event(eventname, { bubbles: true }); | 386 var evt = new Event(eventname, { bubbles: true }); |
387 for(var item in detail) { | 387 for(var item in detail) { |
388 evt[item] = detail[item]; | 388 evt[item] = detail[item]; |
389 } | 389 } |
390 | 390 |
391 // Dispatch event. | 391 // Dispatch event. |
392 this.adviewNode_.dispatchEvent(evt); | 392 this.adviewNode_.dispatchEvent(evt); |
393 } | 393 } |
394 | 394 |
395 addTagWatcher('ADVIEW', function(addedNode) { new AdView(addedNode); }); | 395 addTagWatcher('ADVIEW', function(addedNode) { new AdView(addedNode); }); |
OLD | NEW |