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

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

Issue 2122823002: [MD History] Fix issues caused by refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@funky_fresh
Patch Set: fix nit 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
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 Polymer({ 5 Polymer({
6 is: 'history-app', 6 is: 'history-app',
7 7
8 properties: { 8 properties: {
9 // The id of the currently selected page. 9 // The id of the currently selected page.
10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, 10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'},
11 11
12 // Whether domain-grouped history is enabled. 12 // Whether domain-grouped history is enabled.
13 grouped_: {type: Boolean, reflectToAttribute: true}, 13 grouped_: {type: Boolean, reflectToAttribute: true},
14 14
15 /** @type {!QueryState} */ 15 /** @type {!QueryState} */
16 queryState_: { 16 queryState_: {
17 type: Object, 17 type: Object,
18 value: function() { 18 value: function() {
19 return { 19 return {
20 // Whether the most recent query was incremental. 20 // Whether the most recent query was incremental.
21 incremental: false, 21 incremental: false,
22 // A query is initiated by page load. 22 // A query is initiated by page load.
23 querying: true, 23 querying: true,
24 queryingDisabled: Boolean, 24 queryingDisabled: false,
25 _range: HistoryRange.ALL_TIME, 25 _range: HistoryRange.ALL_TIME,
26 searchTerm: '', 26 searchTerm: '',
27 // TODO(calamity): Make history toolbar buttons change the offset 27 // TODO(calamity): Make history toolbar buttons change the offset
28 groupedOffset: 0, 28 groupedOffset: 0,
29 29
30 set range(val) { this._range = Number(val); }, 30 set range(val) { this._range = Number(val); },
31 get range() { return this._range; }, 31 get range() { return this._range; },
32 }; 32 };
33 } 33 }
34 }, 34 },
35 35
36 sessionList: Array, 36 /** @type {!QueryResult} */
37 queryResult_: {
38 type: Object,
39 value: function() {
40 return {
41 info: null,
42 results: null,
43 sessionList: null,
44 };
45 }
46 },
37 }, 47 },
38 48
39 listeners: { 49 listeners: {
40 'cr-menu-tap': 'onMenuTap_', 50 'cr-menu-tap': 'onMenuTap_',
41 'history-checkbox-select': 'checkboxSelected', 51 'history-checkbox-select': 'checkboxSelected',
42 'unselect-all': 'unselectAll', 52 'unselect-all': 'unselectAll',
43 'delete-selected': 'deleteSelected', 53 'delete-selected': 'deleteSelected',
44 'search-domain': 'searchDomain_', 54 'search-domain': 'searchDomain_',
45 }, 55 },
46 56
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 .deleteSelected(); 99 .deleteSelected();
90 }, 100 },
91 101
92 /** 102 /**
93 * @param {HistoryQuery} info An object containing information about the 103 * @param {HistoryQuery} info An object containing information about the
94 * query. 104 * query.
95 * @param {!Array<HistoryEntry>} results A list of results. 105 * @param {!Array<HistoryEntry>} results A list of results.
96 */ 106 */
97 historyResult: function(info, results) { 107 historyResult: function(info, results) {
98 this.set('queryState_.querying', false); 108 this.set('queryState_.querying', false);
109 this.set('queryResult_.info', info);
110 this.set('queryResult_.results', results);
99 var listContainer = 111 var listContainer =
100 /** @type {HistoryListContainerElement} */ (this.$['history']); 112 /** @type {HistoryListContainerElement} */ (this.$['history']);
101 listContainer.historyResult(info, results); 113 listContainer.historyResult(info, results);
102 }, 114 },
103 115
104 /** 116 /**
105 * Fired when the user presses 'More from this site'. 117 * Fired when the user presses 'More from this site'.
106 * @param {{detail: {domain: string}}} e 118 * @param {{detail: {domain: string}}} e
107 */ 119 */
108 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, 120 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); },
109 121
110 /** 122 /**
111 * @param {!Array<!ForeignSession>} sessionList Array of objects describing 123 * @param {!Array<!ForeignSession>} sessionList Array of objects describing
112 * the sessions from other devices. 124 * the sessions from other devices.
113 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? 125 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile?
114 */ 126 */
115 setForeignSessions: function(sessionList, isTabSyncEnabled) { 127 setForeignSessions: function(sessionList, isTabSyncEnabled) {
116 if (!isTabSyncEnabled) 128 if (!isTabSyncEnabled)
117 return; 129 return;
118 130
119 this.sessionList = sessionList; 131 this.set('queryResult_.sessionList', sessionList);
120 }, 132 },
121 133
122 /** 134 /**
123 * Update sign in state of synced device manager after user logs in or out. 135 * Update sign in state of synced device manager after user logs in or out.
124 * @param {boolean} isUserSignedIn 136 * @param {boolean} isUserSignedIn
125 */ 137 */
126 updateSignInState: function(isUserSignedIn) { 138 updateSignInState: function(isUserSignedIn) {
127 var syncedDeviceManagerElem = 139 var syncedDeviceManagerElem =
128 /** @type {HistorySyncedDeviceManagerElement} */this 140 /** @type {HistorySyncedDeviceManagerElement} */this
129 .$$('history-synced-device-manager'); 141 .$$('history-synced-device-manager');
(...skipping 14 matching lines...) Expand all
144 * @param {boolean} incremental 156 * @param {boolean} incremental
145 * @param {string} searchTerm 157 * @param {string} searchTerm
146 * @return {boolean} Whether a loading spinner should be shown (implies the 158 * @return {boolean} Whether a loading spinner should be shown (implies the
147 * backend is querying a new search term). 159 * backend is querying a new search term).
148 * @private 160 * @private
149 */ 161 */
150 shouldShowSpinner_: function(querying, incremental, searchTerm) { 162 shouldShowSpinner_: function(querying, incremental, searchTerm) {
151 return querying && !incremental && searchTerm != ''; 163 return querying && !incremental && searchTerm != '';
152 }, 164 },
153 }); 165 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/app.html ('k') | chrome/browser/resources/md_history/compiled_resources2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698