Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: extensions/renderer/resources/guest_view/extension_options/extension_options_attributes.js

Issue 1026703004: Refactored extensionOptions to use the new guestViewAttributes module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Addressed Comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // This module implements the attributes of the <extensionoptions> tag.
6
7 var GuestViewAttributes = require('guestViewAttributes').GuestViewAttributes;
8 var ExtensionOptionsConstants =
9 require('extensionOptionsConstants').ExtensionOptionsConstants;
10 var ExtensionOptionsImpl = require('extensionOptions').ExtensionOptionsImpl;
11
12 // -----------------------------------------------------------------------------
13 // ExtensionAttribute object.
14
15 // Attribute that handles extension binded to the extensionoptions.
16 function ExtensionAttribute(view) {
17 GuestViewAttributes.Attribute.call(
18 this, ExtensionOptionsConstants.ATTRIBUTE_EXTENSION, view);
19 }
20
21 ExtensionAttribute.prototype.__proto__ =
22 GuestViewAttributes.Attribute.prototype;
23
24 ExtensionAttribute.prototype.handleMutation = function(oldValue, newValue) {
25 // We treat null attribute (attribute removed) and the empty string as
26 // one case.
27 oldValue = oldValue || '';
28 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.
29
30 if (oldValue === newValue || !this.elementAttached)
31 return;
32
33 this.view.createGuest();
34 };
35
36 // -----------------------------------------------------------------------------
37
38 // Sets up all of the extensionoptions attributes.
39 ExtensionOptionsImpl.prototype.setupAttributes = function() {
40 this.attributes[ExtensionOptionsConstants.ATTRIBUTE_EXTENSION] =
41 new ExtensionAttribute(this);
42 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698