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

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: Address nits 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 /** 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_: { 29 grouped_: {
26 type: Boolean, 30 type: Boolean,
27 reflectToAttribute: true 31 reflectToAttribute: true
28 }, 32 },
29 33
30 // Whether the first set of results have returned. 34 // Whether the first set of results have returned.
31 firstLoad_: { type: Boolean, value: true }, 35 firstLoad_: { type: Boolean, value: true },
32 36
(...skipping 23 matching lines...) Expand all
56 }, 60 },
57 }, 61 },
58 62
59 observers: [ 63 observers: [
60 'searchTermChanged_(queryState_.searchTerm)', 64 'searchTermChanged_(queryState_.searchTerm)',
61 'groupedRangeChanged_(queryState_.range)', 65 'groupedRangeChanged_(queryState_.range)',
62 ], 66 ],
63 67
64 // TODO(calamity): Replace these event listeners with data bound properties. 68 // TODO(calamity): Replace these event listeners with data bound properties.
65 listeners: { 69 listeners: {
70 'cr-menu-tap': 'onMenuTap_',
66 'history-checkbox-select': 'checkboxSelected', 71 'history-checkbox-select': 'checkboxSelected',
67 'unselect-all': 'unselectAll', 72 'unselect-all': 'unselectAll',
68 'delete-selected': 'deleteSelected', 73 'delete-selected': 'deleteSelected',
69 'search-domain': 'searchDomain_', 74 'search-domain': 'searchDomain_',
70 'load-more-history': 'loadMoreHistory_', 75 'load-more-history': 'loadMoreHistory_',
71 }, 76 },
72 77
73 /** @override */ 78 /** @override */
74 ready: function() { 79 ready: function() {
75 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); 80 this.grouped_ = loadTimeData.getBoolean('groupByDomain');
76 }, 81 },
77 82
83 /** @private */
84 onMenuTap_: function() {
85 this.$['side-bar'].toggle();
86 },
87
78 /** 88 /**
79 * Listens for history-item being selected or deselected (through checkbox) 89 * Listens for history-item being selected or deselected (through checkbox)
80 * and changes the view of the top toolbar. 90 * and changes the view of the top toolbar.
81 * @param {{detail: {countAddition: number}}} e 91 * @param {{detail: {countAddition: number}}} e
82 */ 92 */
83 checkboxSelected: function(e) { 93 checkboxSelected: function(e) {
84 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); 94 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar);
85 toolbar.count += e.detail.countAddition; 95 toolbar.count += e.detail.countAddition;
86 }, 96 },
87 97
88 /** 98 /**
89 * Listens for call to cancel selection and loops through all items to set 99 * Listens for call to cancel selection and loops through all items to set
90 * checkbox to be unselected. 100 * checkbox to be unselected.
101 * @private
91 */ 102 */
92 unselectAll: function() { 103 unselectAll: function() {
93 var historyList = 104 var historyList =
94 /** @type {HistoryListElement} */(this.$['history-list']); 105 /** @type {HistoryListElement} */(this.$['history-list']);
95 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); 106 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar);
96 historyList.unselectAllItems(toolbar.count); 107 historyList.unselectAllItems(toolbar.count);
97 toolbar.count = 0; 108 toolbar.count = 0;
98 }, 109 },
99 110
100 /** 111 /**
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 * @param {boolean} incremental 260 * @param {boolean} incremental
250 * @param {string} searchTerm 261 * @param {string} searchTerm
251 * @return {boolean} Whether a loading spinner should be shown (implies the 262 * @return {boolean} Whether a loading spinner should be shown (implies the
252 * backend is querying a new search term). 263 * backend is querying a new search term).
253 * @private 264 * @private
254 */ 265 */
255 shouldShowSpinner_: function(querying, incremental, searchTerm) { 266 shouldShowSpinner_: function(querying, incremental, searchTerm) {
256 return querying && !incremental && searchTerm != ''; 267 return querying && !incremental && searchTerm != '';
257 } 268 }
258 }); 269 });
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