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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_data.js

Issue 2115833003: Site Settings Desktop: Implement the cookies list and details dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 years, 5 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 2016 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 /**
6 * @fileoverview
7 * 'media-picker' handles showing the dropdown allowing users to select the
michaelpg 2016/07/04 19:44:21 update
Finnur 2016/07/05 11:04:49 Done.
8 * default camera/microphone.
9 */
10
11 Polymer({
12 is: 'site-data',
13
14 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
15
16 properties: {
17 /**
18 * A summary list of all sites and how many entities each contain.
19 * @type Array<CookieDataSummaryItem>.
michaelpg 2016/07/04 19:44:21 @type {Array...}
Finnur 2016/07/05 11:04:49 Done.
20 */
21 sites: Array,
22
23 /**
24 * The cookie tree with the details needed to display individual sites and
25 * their contained data.
26 * @type {!settings.CookieTreeNode}
27 */
28 treeNodes_: Object,
29
30 /**
31 * Keeps track of how many outstanding requests for more data there are.
32 */
33 requests_: Number,
34 },
35
36 ready: function() {
37 this.addWebUIListener('loadChildren', this.loadChildren_.bind(this));
38 this.addWebUIListener('onTreeItemRemoved',
39 this.onTreeItemRemoved_.bind(this));
40 this.treeNodes_ = new settings.CookieTreeNode(null);
41 // Start the initial request.
42 this.browserProxy.reloadCookies();
43 this.requests_ = 1;
44 },
45
46 loadChildren_: function(list) {
47 var parentId = list[0];
48 var data = list[1];
49
50 if (parentId == null) {
51 this.treeNodes_.addChildNodes(this.treeNodes_, data);
52 } else {
53 this.treeNodes_.populateChildNodes(parentId, this.treeNodes_, data);
54 }
55
56 for (var i = 0; i < data.length; ++i) {
57 var prefix = parentId == null ? '' : parentId + ', ';
58 if (data[i].hasChildren) {
59 this.requests_ += 1;
60 this.browserProxy.loadCookieChildren(prefix + data[i].id);
61 }
62 }
63
64 if (--this.requests_ == 0)
65 this.sites = this.treeNodes_.getSummaryList();
66 },
67
68 /**
69 * Called when an item is removed.
70 */
71 onTreeItemRemoved_: function(args) {
72 this.treeNodes_.removeByParentId(args[0], args[1], args[2]);
73 this.sites = this.treeNodes_.getSummaryList();
74 },
75
76 /**
77 * @param {!{model: !{item: !{title: string, id: string}}}} event
78 * @private
79 */
80 onSiteTap_: function(event) {
81 var dialog = document.createElement('site-data-details-dialog');
82 dialog.category = this.category;
83 this.shadowRoot.appendChild(dialog);
84
85 var node = this.treeNodes_.fetchNodeById(event.model.item.id, false);
86 dialog.open(node);
87
88 dialog.addEventListener('iron-overlay-closed', function(event) {
89 // The drop-down box in the dialog also generates iron-overlay-closed.
90 // Ignore anything but that event coming from a dialog object.
91 if (event.path[0].id == 'dialog')
92 dialog.remove();
93 });
94 },
95 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698