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

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

Issue 2578013002: [MD History] clang-format all javascript. (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/app.crisper.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cr.define('md_history', function() { 5 cr.define('md_history', function() {
6 var lazyLoadPromise = null; 6 var lazyLoadPromise = null;
7 function ensureLazyLoaded() { 7 function ensureLazyLoaded() {
8 if (!lazyLoadPromise) { 8 if (!lazyLoadPromise) {
9 lazyLoadPromise = new Promise(function(resolve, reject) { 9 lazyLoadPromise = new Promise(function(resolve, reject) {
10 Polymer.Base.importHref( 10 Polymer.Base.importHref(
11 'chrome://history/lazy_load.html', resolve, reject, true); 11 'chrome://history/lazy_load.html', resolve, reject, true);
12 }); 12 });
13 } 13 }
14 return lazyLoadPromise; 14 return lazyLoadPromise;
15 } 15 }
16 16
17 return { 17 return {
18 ensureLazyLoaded: ensureLazyLoaded, 18 ensureLazyLoaded: ensureLazyLoaded,
19 }; 19 };
20 }); 20 });
21 21
22 Polymer({ 22 Polymer({
23 is: 'history-app', 23 is: 'history-app',
24 24
25 behaviors: [ 25 behaviors: [
26 Polymer.IronScrollTargetBehavior, 26 Polymer.IronScrollTargetBehavior,
27 ], 27 ],
28 28
29 properties: { 29 properties: {
30 // Used to display notices for profile sign-in status.
31 showSidebarFooter: Boolean,
32
33 hasSyncedResults: Boolean,
34
35 // The id of the currently selected page. 30 // The id of the currently selected page.
36 selectedPage_: {type: String, observer: 'selectedPageChanged_'}, 31 selectedPage_: {
32 type: String,
33 observer: 'selectedPageChanged_',
34 },
37 35
38 // Whether domain-grouped history is enabled. 36 // Whether domain-grouped history is enabled.
39 grouped_: {type: Boolean, reflectToAttribute: true}, 37 grouped_: {
38 type: Boolean,
39 reflectToAttribute: true,
40 },
40 41
41 /** @type {!QueryState} */ 42 /** @type {!QueryState} */
42 queryState_: { 43 queryState_: {
43 type: Object, 44 type: Object,
44 value: function() { 45 value: function() {
45 return { 46 return {
46 // Whether the most recent query was incremental. 47 // Whether the most recent query was incremental.
47 incremental: false, 48 incremental: false,
48 // A query is initiated by page load. 49 // A query is initiated by page load.
49 querying: true, 50 querying: true,
(...skipping 13 matching lines...) Expand all
63 type: Object, 64 type: Object,
64 value: function() { 65 value: function() {
65 return { 66 return {
66 info: null, 67 info: null,
67 results: null, 68 results: null,
68 sessionList: null, 69 sessionList: null,
69 }; 70 };
70 } 71 }
71 }, 72 },
72 73
73 // True if the window is narrow enough for the page to have a drawer.
74 hasDrawer_: Boolean,
75
76 isUserSignedIn_: { 74 isUserSignedIn_: {
77 type: Boolean, 75 type: Boolean,
78 // Updated on synced-device-manager attach by chrome.sending 76 // Updated on synced-device-manager attach by chrome.sending
79 // 'otherDevicesInitialized'. 77 // 'otherDevicesInitialized'.
80 value: loadTimeData.getBoolean('isUserSignedIn'), 78 value: loadTimeData.getBoolean('isUserSignedIn'),
81 }, 79 },
82 80
83 toolbarShadow_: { 81 toolbarShadow_: {
84 type: Boolean, 82 type: Boolean,
85 reflectToAttribute: true, 83 reflectToAttribute: true,
86 notify: true, 84 notify: true,
87 }, 85 },
88 86
89 showMenuPromo_: { 87 showMenuPromo_: {
90 type: Boolean, 88 type: Boolean,
91 value: function() { 89 value: function() { return loadTimeData.getBoolean('showMenuPromo'); },
92 return loadTimeData.getBoolean('showMenuPromo');
93 },
94 }, 90 },
91
92 // True if the window is narrow enough for the page to have a drawer.
93 hasDrawer_: Boolean,
94
95 // Used to display notices for profile sign-in status.
96 showSidebarFooter: Boolean,
97
98 hasSyncedResults: Boolean,
95 }, 99 },
96 100
97 listeners: { 101 listeners: {
98 'cr-toolbar-menu-promo-close': 'onCrToolbarMenuPromoClose_', 102 'cr-toolbar-menu-promo-close': 'onCrToolbarMenuPromoClose_',
99 'cr-toolbar-menu-promo-shown': 'onCrToolbarMenuPromoShown_', 103 'cr-toolbar-menu-promo-shown': 'onCrToolbarMenuPromoShown_',
100 'cr-toolbar-menu-tap': 'onCrToolbarMenuTap_', 104 'cr-toolbar-menu-tap': 'onCrToolbarMenuTap_',
101 'delete-selected': 'deleteSelected', 105 'delete-selected': 'deleteSelected',
102 'history-checkbox-select': 'checkboxSelected', 106 'history-checkbox-select': 'checkboxSelected',
103 'history-close-drawer': 'closeDrawer_', 107 'history-close-drawer': 'closeDrawer_',
104 'history-view-changed': 'historyViewChanged_', 108 'history-view-changed': 'historyViewChanged_',
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 }); 157 });
154 }, 158 },
155 159
156 /** Overridden from IronScrollTargetBehavior */ 160 /** Overridden from IronScrollTargetBehavior */
157 _scrollHandler: function() { 161 _scrollHandler: function() {
158 if (this.scrollTarget) 162 if (this.scrollTarget)
159 this.toolbarShadow_ = this.scrollTarget.scrollTop != 0; 163 this.toolbarShadow_ = this.scrollTarget.scrollTop != 0;
160 }, 164 },
161 165
162 /** @private */ 166 /** @private */
163 onCrToolbarMenuPromoClose_: function() { 167 onCrToolbarMenuPromoClose_: function() { this.showMenuPromo_ = false; },
164 this.showMenuPromo_ = false;
165 },
166 168
167 /** @private */ 169 /** @private */
168 onCrToolbarMenuPromoShown_: function() { 170 onCrToolbarMenuPromoShown_: function() {
169 md_history.BrowserService.getInstance().menuPromoShown(); 171 md_history.BrowserService.getInstance().menuPromoShown();
170 }, 172 },
171 173
172 /** @private */ 174 /** @private */
173 onCrToolbarMenuTap_: function() { 175 onCrToolbarMenuTap_: function() {
174 var drawer = this.$$('#drawer'); 176 var drawer = this.$$('#drawer');
175 if (drawer) 177 if (drawer)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 /** 230 /**
229 * Shows and focuses the search bar in the toolbar. 231 * Shows and focuses the search bar in the toolbar.
230 */ 232 */
231 focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); }, 233 focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); },
232 234
233 /** 235 /**
234 * @param {Event} e 236 * @param {Event} e
235 * @private 237 * @private
236 */ 238 */
237 onCanExecute_: function(e) { 239 onCanExecute_: function(e) {
238 e = /** @type {cr.ui.CanExecuteEvent} */(e); 240 e = /** @type {cr.ui.CanExecuteEvent} */ (e);
239 switch (e.command.id) { 241 switch (e.command.id) {
240 case 'find-command': 242 case 'find-command':
241 case 'toggle-grouped': 243 case 'toggle-grouped':
242 e.canExecute = true; 244 e.canExecute = true;
243 break; 245 break;
244 case 'slash-command': 246 case 'slash-command':
245 e.canExecute = !this.$.toolbar.searchField.isSearchFocused(); 247 e.canExecute = !this.$.toolbar.searchField.isSearchFocused();
246 break; 248 break;
247 case 'delete-command': 249 case 'delete-command':
248 e.canExecute = this.$.toolbar.count > 0; 250 e.canExecute = this.$.toolbar.count > 0;
(...skipping 18 matching lines...) Expand all
267 * @param {!Array<!ForeignSession>} sessionList Array of objects describing 269 * @param {!Array<!ForeignSession>} sessionList Array of objects describing
268 * the sessions from other devices. 270 * the sessions from other devices.
269 */ 271 */
270 setForeignSessions: function(sessionList) { 272 setForeignSessions: function(sessionList) {
271 this.set('queryResult_.sessionList', sessionList); 273 this.set('queryResult_.sessionList', sessionList);
272 }, 274 },
273 275
274 /** 276 /**
275 * Called when browsing data is cleared. 277 * Called when browsing data is cleared.
276 */ 278 */
277 historyDeleted: function() { 279 historyDeleted: function() { this.$.history.historyDeleted(); },
278 this.$.history.historyDeleted();
279 },
280 280
281 /** 281 /**
282 * Update sign in state of synced device manager after user logs in or out. 282 * Update sign in state of synced device manager after user logs in or out.
283 * @param {boolean} isUserSignedIn 283 * @param {boolean} isUserSignedIn
284 */ 284 */
285 updateSignInState: function(isUserSignedIn) { 285 updateSignInState: function(isUserSignedIn) {
286 this.isUserSignedIn_ = isUserSignedIn; 286 this.isUserSignedIn_ = isUserSignedIn;
287 }, 287 },
288 288
289 /** 289 /**
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 histogramValue = HistoryPageViewHistogram.GROUPED_WEEK; 380 histogramValue = HistoryPageViewHistogram.GROUPED_WEEK;
381 break; 381 break;
382 case HistoryRange.MONTH: 382 case HistoryRange.MONTH:
383 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; 383 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH;
384 break; 384 break;
385 } 385 }
386 break; 386 break;
387 } 387 }
388 388
389 md_history.BrowserService.getInstance().recordHistogram( 389 md_history.BrowserService.getInstance().recordHistogram(
390 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END 390 'History.HistoryPageView', histogramValue,
391 ); 391 HistoryPageViewHistogram.END);
392 }, 392 },
393 }); 393 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/app.crisper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698