| 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 /** | 5 /** |
| 6 * @fileoverview A behavior for managing a tree of cookies. | 6 * @fileoverview A behavior for managing a tree of cookies. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /** @polymerBehavior */ | 9 /** @polymerBehavior */ |
| 10 var CookieTreeBehaviorImpl = { | 10 var CookieTreeBehaviorImpl = { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 var loadChildrenRecurse = function(childList) { | 41 var loadChildrenRecurse = function(childList) { |
| 42 var parentId = childList.id; | 42 var parentId = childList.id; |
| 43 var children = childList.children; | 43 var children = childList.children; |
| 44 var prefix = ''; | 44 var prefix = ''; |
| 45 if (parentId !== null) { | 45 if (parentId !== null) { |
| 46 this.rootCookieNode.populateChildNodes(parentId, | 46 this.rootCookieNode.populateChildNodes(parentId, |
| 47 this.rootCookieNode, children); | 47 this.rootCookieNode, children); |
| 48 prefix = parentId + ', '; | 48 prefix = parentId + ', '; |
| 49 } | 49 } |
| 50 var promises = []; | 50 var promises = []; |
| 51 for (let child of children) { | 51 for (var i = 0; i < children.length; i++) { |
| 52 var child = children[i]; |
| 52 if (child.hasChildren) { | 53 if (child.hasChildren) { |
| 53 promises.push(this.browserProxy.loadCookieChildren( | 54 promises.push(this.browserProxy.loadCookieChildren( |
| 54 prefix + child.id).then(loadChildrenRecurse.bind(this))); | 55 prefix + child.id).then(loadChildrenRecurse.bind(this))); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 return Promise.all(promises); | 58 return Promise.all(promises); |
| 58 }.bind(this); | 59 }.bind(this); |
| 59 | 60 |
| 60 // New root being added, clear the list and add the nodes. | 61 // New root being added, clear the list and add the nodes. |
| 61 this.sites = []; | 62 this.sites = []; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 90 * @return {Promise} | 91 * @return {Promise} |
| 91 */ | 92 */ |
| 92 removeAllCookies: function() { | 93 removeAllCookies: function() { |
| 93 return this.browserProxy.removeAllCookies().then( | 94 return this.browserProxy.removeAllCookies().then( |
| 94 this.loadChildren_.bind(this)); | 95 this.loadChildren_.bind(this)); |
| 95 }, | 96 }, |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 /** @polymerBehavior */ | 99 /** @polymerBehavior */ |
| 99 var CookieTreeBehavior = [SiteSettingsBehavior, CookieTreeBehaviorImpl]; | 100 var CookieTreeBehavior = [SiteSettingsBehavior, CookieTreeBehaviorImpl]; |
| OLD | NEW |