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

Side by Side Diff: chrome/browser/resources/md_history/app.js

Issue 2042973002: [MD History] Add routing to the synced devices page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hide_search_bar
Patch Set: Created 4 years, 6 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 * @typedef {{querying: boolean, 6 * @typedef {{querying: boolean,
7 * searchTerm: string, 7 * searchTerm: string,
8 * results: ?Array<!HistoryEntry>, 8 * results: ?Array<!HistoryEntry>,
9 * info: ?HistoryQuery, 9 * info: ?HistoryQuery,
10 * range: HistoryRange, 10 * range: HistoryRange,
(...skipping 30 matching lines...) Expand all
41 searchTerm: '', 41 searchTerm: '',
42 results: null, 42 results: null,
43 info: null, 43 info: null,
44 range: HistoryRange.ALL_TIME, 44 range: HistoryRange.ALL_TIME,
45 // TODO(calamity): Make history toolbar buttons change the offset. 45 // TODO(calamity): Make history toolbar buttons change the offset.
46 groupedOffset: 0, 46 groupedOffset: 0,
47 sessionList: null, 47 sessionList: null,
48 }; 48 };
49 } 49 }
50 }, 50 },
51
52 // The top level route.
53 route: {
54 type: Object
55 },
56
57 // Route data for the current page.
58 routeData: {
59 type: Object,
60 observer: 'routeChanged_'
61 }
51 }, 62 },
52 63
53 observers: [ 64 observers: [
54 'searchTermChanged_(queryState_.searchTerm)', 65 'searchTermChanged_(queryState_.searchTerm)',
55 'groupedRangeChanged_(queryState_.range)', 66 'groupedRangeChanged_(queryState_.range)',
67 'routeChanged_(route)',
56 ], 68 ],
57 69
58 // TODO(calamity): Replace these event listeners with data bound properties. 70 // TODO(calamity): Replace these event listeners with data bound properties.
59 listeners: { 71 listeners: {
60 'history-checkbox-select': 'checkboxSelected', 72 'history-checkbox-select': 'checkboxSelected',
61 'unselect-all': 'unselectAll', 73 'unselect-all': 'unselectAll',
62 'delete-selected': 'deleteSelected', 74 'delete-selected': 'deleteSelected',
63 'search-domain': 'searchDomain_', 75 'search-domain': 'searchDomain_',
64 'load-more-history': 'loadMoreHistory_', 76 'load-more-history': 'loadMoreHistory_',
65 }, 77 },
66 78
67 ready: function() { 79 ready: function() {
68 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); 80 this.grouped_ = loadTimeData.getBoolean('groupByDomain');
69 }, 81 },
70 82
83 routeChanged_: function(route) {
84 var routeToElementId = {
85 'openTabs': 'history-synced-device-manager',
86 };
tsergeant 2016/06/08 03:42:17 I'm not a big fan of this (as I think you predicte
calamity 2016/06/14 05:05:50 Ok, so we'll be going with /, /grouped/week, /grou
87 var path = this.routeData.page;
88 var elementId = routeToElementId[path] || 'history-list';
89 this.selectedPage_ = elementId;
90 },
91
71 /** 92 /**
72 * Listens for history-item being selected or deselected (through checkbox) 93 * Listens for history-item being selected or deselected (through checkbox)
73 * and changes the view of the top toolbar. 94 * and changes the view of the top toolbar.
74 * @param {{detail: {countAddition: number}}} e 95 * @param {{detail: {countAddition: number}}} e
75 */ 96 */
76 checkboxSelected: function(e) { 97 checkboxSelected: function(e) {
77 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); 98 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar);
78 toolbar.count += e.detail.countAddition; 99 toolbar.count += e.detail.countAddition;
79 }, 100 },
80 101
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (selectedPage == 'history-list' && range != HistoryRange.ALL_TIME) 229 if (selectedPage == 'history-list' && range != HistoryRange.ALL_TIME)
209 return 'history-grouped-list'; 230 return 'history-grouped-list';
210 231
211 return selectedPage; 232 return selectedPage;
212 }, 233 },
213 234
214 syncedTabsSelected_(selectedPage) { 235 syncedTabsSelected_(selectedPage) {
215 return selectedPage == 'history-synced-device-manager'; 236 return selectedPage == 'history-synced-device-manager';
216 } 237 }
217 }); 238 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698