Chromium Code Reviews| Index: extensions/renderer/resources/guest_view/extension_options/extension_options_attributes.js |
| diff --git a/extensions/renderer/resources/guest_view/extension_options/extension_options_attributes.js b/extensions/renderer/resources/guest_view/extension_options/extension_options_attributes.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..33cd86228c3b1b9b3b462686bd2de98e7989418f |
| --- /dev/null |
| +++ b/extensions/renderer/resources/guest_view/extension_options/extension_options_attributes.js |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This module implements the attributes of the <extensionoptions> tag. |
| + |
| +var GuestViewAttributes = require('guestViewAttributes').GuestViewAttributes; |
| +var ExtensionOptionsConstants = |
| + require('extensionOptionsConstants').ExtensionOptionsConstants; |
| +var ExtensionOptionsImpl = require('extensionOptions').ExtensionOptionsImpl; |
| + |
| +// ----------------------------------------------------------------------------- |
| +// ExtensionAttribute object. |
| + |
| +// Attribute that handles extension binded to the extensionoptions. |
| +function ExtensionAttribute(view) { |
| + GuestViewAttributes.Attribute.call( |
| + this, ExtensionOptionsConstants.ATTRIBUTE_EXTENSION, view); |
| +} |
| + |
| +ExtensionAttribute.prototype.__proto__ = |
| + GuestViewAttributes.Attribute.prototype; |
| + |
| +ExtensionAttribute.prototype.handleMutation = function(oldValue, newValue) { |
| + // We treat null attribute (attribute removed) and the empty string as |
| + // one case. |
| + oldValue = oldValue || ''; |
| + newValue = newValue || ''; |
|
Fady Samuel
2015/03/24 17:37:29
This behavior is really confusing. This should beh
paulmeyer
2015/03/24 18:13:40
Done.
|
| + |
| + if (oldValue === newValue || !this.elementAttached) |
| + return; |
| + |
| + this.view.createGuest(); |
| +}; |
| + |
| +// ----------------------------------------------------------------------------- |
| + |
| +// Sets up all of the extensionoptions attributes. |
| +ExtensionOptionsImpl.prototype.setupAttributes = function() { |
| + this.attributes[ExtensionOptionsConstants.ATTRIBUTE_EXTENSION] = |
| + new ExtensionAttribute(this); |
| +}; |