| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * @private | 155 * @private |
| 156 */ | 156 */ |
| 157 AdView.prototype.setupAdviewNodeMethods_ = function() { | 157 AdView.prototype.setupAdviewNodeMethods_ = function() { |
| 158 // this.browserPluginNode_[apiMethod] are not necessarily defined immediately | 158 // this.browserPluginNode_[apiMethod] are not necessarily defined immediately |
| 159 // after the shadow object is appended to the shadow root. | 159 // after the shadow object is appended to the shadow root. |
| 160 var self = this; | 160 var self = this; |
| 161 $Array.forEach(AD_VIEW_API_METHODS, function(apiMethod) { | 161 $Array.forEach(AD_VIEW_API_METHODS, function(apiMethod) { |
| 162 self.adviewNode_[apiMethod] = function(var_args) { | 162 self.adviewNode_[apiMethod] = function(var_args) { |
| 163 return self.browserPluginNode_[apiMethod].apply( | 163 return $Function.apply(self.browserPluginNode_[apiMethod], |
| 164 self.browserPluginNode_, arguments); | 164 self.browserPluginNode_, arguments); |
| 165 }; | 165 }; |
| 166 }, this); | 166 }, this); |
| 167 } | 167 } |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * @private | 170 * @private |
| 171 */ | 171 */ |
| 172 AdView.prototype.setupAdviewNodeObservers_ = function() { | 172 AdView.prototype.setupAdviewNodeObservers_ = function() { |
| 173 // Map attribute modifications on the <adview> tag to property changes in | 173 // Map attribute modifications on the <adview> tag to property changes in |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // Dispatch event. | 465 // Dispatch event. |
| 466 this.adviewNode_.dispatchEvent(evt); | 466 this.adviewNode_.dispatchEvent(evt); |
| 467 } | 467 } |
| 468 | 468 |
| 469 // | 469 // |
| 470 // Hook up <adview> tag creation in DOM. | 470 // Hook up <adview> tag creation in DOM. |
| 471 // | 471 // |
| 472 window.addEventListener('DOMContentLoaded', function() { | 472 window.addEventListener('DOMContentLoaded', function() { |
| 473 watchForTag('ADVIEW', function(addedNode) { new AdView(addedNode); }); | 473 watchForTag('ADVIEW', function(addedNode) { new AdView(addedNode); }); |
| 474 }); | 474 }); |
| OLD | NEW |