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

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

Issue 2020963002: MD History: Add responsive layout which hides the sidebar in thin windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and closure 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 * incremental: boolean, 10 * incremental: boolean,
11 * range: HistoryRange, 11 * range: HistoryRange,
12 * groupedOffset: number, 12 * groupedOffset: number,
13 * sessionList: ?Array<!ForeignSession>}} 13 * sessionList: ?Array<!ForeignSession>}}
14 */ 14 */
15 var QueryState; 15 var QueryState;
16 16
17 Polymer({ 17 Polymer({
18 is: 'history-app', 18 is: 'history-app',
19 19
20 properties: { 20 properties: {
21 // The id of the currently selected page. 21 // The id of the currently selected page.
22 selectedPage_: String, 22 selectedPage_: {
23 type: String,
24 value: 'history-list',
25 observer: 'unselectAll'
26 },
23 27
24 // Whether domain-grouped history is enabled. 28 // Whether domain-grouped history is enabled.
25 grouped_: Boolean, 29 grouped_: Boolean,
26 30
27 // Whether the first set of results have returned. 31 // Whether the first set of results have returned.
28 firstLoad_: { type: Boolean, value: true }, 32 firstLoad_: { type: Boolean, value: true },
29 33
30 // True if the history queries are disabled. 34 // True if the history queries are disabled.
31 queryingDisabled_: Boolean, 35 queryingDisabled_: Boolean,
32 36
(...skipping 20 matching lines...) Expand all
53 }, 57 },
54 }, 58 },
55 59
56 observers: [ 60 observers: [
57 'searchTermChanged_(queryState_.searchTerm)', 61 'searchTermChanged_(queryState_.searchTerm)',
58 'groupedRangeChanged_(queryState_.range)', 62 'groupedRangeChanged_(queryState_.range)',
59 ], 63 ],
60 64
61 // TODO(calamity): Replace these event listeners with data bound properties. 65 // TODO(calamity): Replace these event listeners with data bound properties.
62 listeners: { 66 listeners: {
67 'cr-toolbar-menu-click': 'onMenuClick_',
63 'history-checkbox-select': 'checkboxSelected', 68 'history-checkbox-select': 'checkboxSelected',
64 'unselect-all': 'unselectAll', 69 'unselect-all': 'unselectAll',
65 'delete-selected': 'deleteSelected', 70 'delete-selected': 'deleteSelected',
66 'search-domain': 'searchDomain_', 71 'search-domain': 'searchDomain_',
67 'load-more-history': 'loadMoreHistory_', 72 'load-more-history': 'loadMoreHistory_',
68 }, 73 },
69 74
70 /** @override */ 75 /** @override */
71 ready: function() { 76 ready: function() {
72 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); 77 this.grouped_ = loadTimeData.getBoolean('groupByDomain');
73 }, 78 },
74 79
80 onMenuClick_: function() {
81 this.$['side-bar'].toggle();
82 },
83
75 /** 84 /**
76 * Listens for history-item being selected or deselected (through checkbox) 85 * Listens for history-item being selected or deselected (through checkbox)
77 * and changes the view of the top toolbar. 86 * and changes the view of the top toolbar.
78 * @param {{detail: {countAddition: number}}} e 87 * @param {{detail: {countAddition: number}}} e
79 */ 88 */
80 checkboxSelected: function(e) { 89 checkboxSelected: function(e) {
81 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); 90 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar);
82 toolbar.count += e.detail.countAddition; 91 toolbar.count += e.detail.countAddition;
83 }, 92 },
84 93
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 * @param {boolean} incremental 244 * @param {boolean} incremental
236 * @param {string} searchTerm 245 * @param {string} searchTerm
237 * @return {boolean} Whether a loading spinner should be shown (implies the 246 * @return {boolean} Whether a loading spinner should be shown (implies the
238 * backend is querying a new search term). 247 * backend is querying a new search term).
239 * @private 248 * @private
240 */ 249 */
241 shouldShowSpinner_: function(querying, incremental, searchTerm) { 250 shouldShowSpinner_: function(querying, incremental, searchTerm) {
242 return querying && !incremental && searchTerm != ''; 251 return querying && !incremental && searchTerm != '';
243 } 252 }
244 }); 253 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698