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

Side by Side Diff: chrome/browser/resources/history/history.js

Issue 2203263002: History: Add load-time metric for non-MD and MD History WebUI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isherman@ review Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/history.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <include src="../uber/uber_utils.js"> 5 <include src="../uber/uber_utils.js">
6 <include src="history_focus_manager.js"> 6 <include src="history_focus_manager.js">
7 7
8 /////////////////////////////////////////////////////////////////////////////// 8 ///////////////////////////////////////////////////////////////////////////////
9 // Globals: 9 // Globals:
10 /** @const */ var RESULTS_PER_PAGE = 150; 10 /** @const */ var RESULTS_PER_PAGE = 150;
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 */ 932 */
933 function HistoryView(model) { 933 function HistoryView(model) {
934 this.editButtonTd_ = $('edit-button'); 934 this.editButtonTd_ = $('edit-button');
935 this.editingControlsDiv_ = $('editing-controls'); 935 this.editingControlsDiv_ = $('editing-controls');
936 this.resultDiv_ = $('results-display'); 936 this.resultDiv_ = $('results-display');
937 this.focusGrid_ = new cr.ui.FocusGrid(); 937 this.focusGrid_ = new cr.ui.FocusGrid();
938 this.pageDiv_ = $('results-pagination'); 938 this.pageDiv_ = $('results-pagination');
939 this.model_ = model; 939 this.model_ = model;
940 this.pageIndex_ = 0; 940 this.pageIndex_ = 0;
941 this.lastDisplayed_ = []; 941 this.lastDisplayed_ = [];
942 this.hasRenderedResults_ = false;
942 943
943 this.model_.setView(this); 944 this.model_.setView(this);
944 945
945 this.currentVisits_ = []; 946 this.currentVisits_ = [];
946 947
947 // If there is no search button, use the search button label as placeholder 948 // If there is no search button, use the search button label as placeholder
948 // text in the search field. 949 // text in the search field.
949 if ($('search-button').offsetWidth == 0) 950 if ($('search-button').offsetWidth == 0)
950 $('search-field').placeholder = $('search-button').value; 951 $('search-field').placeholder = $('search-button').value;
951 952
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 document.body.classList.toggle('has-results', hasResults); 1116 document.body.classList.toggle('has-results', hasResults);
1116 1117
1117 this.updateFocusGrid_(); 1118 this.updateFocusGrid_();
1118 this.updateNavBar_(); 1119 this.updateNavBar_();
1119 1120
1120 if (isMobileVersion()) { 1121 if (isMobileVersion()) {
1121 // Hide the search field if it is empty and there are no results. 1122 // Hide the search field if it is empty and there are no results.
1122 var isSearch = this.model_.getSearchText().length > 0; 1123 var isSearch = this.model_.getSearchText().length > 0;
1123 $('search-field').hidden = !(hasResults || isSearch); 1124 $('search-field').hidden = !(hasResults || isSearch);
1124 } 1125 }
1126
1127 if (!this.hasRenderedResults_) {
1128 this.hasRenderedResults_ = true;
1129 requestAnimationFrame(function() {
1130 chrome.send(
1131 'metricsHandler:recordTime',
1132 ['History.ResultsRenderedTime', window.performance.now()]);
1133 });
1134 }
1125 }; 1135 };
1126 1136
1127 /** 1137 /**
1128 * Enables or disables the buttons that control editing entries depending on 1138 * Enables or disables the buttons that control editing entries depending on
1129 * whether there are any checked boxes. 1139 * whether there are any checked boxes.
1130 */ 1140 */
1131 HistoryView.prototype.updateSelectionEditButtons = function() { 1141 HistoryView.prototype.updateSelectionEditButtons = function() {
1132 if (loadTimeData.getBoolean('allowDeletingHistory')) { 1142 if (loadTimeData.getBoolean('allowDeletingHistory')) {
1133 var anyChecked = document.querySelector('.entry input:checked') != null; 1143 var anyChecked = document.querySelector('.entry input:checked') != null;
1134 $('remove-selected').disabled = !anyChecked; 1144 $('remove-selected').disabled = !anyChecked;
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 historyView.reload(); 2413 historyView.reload();
2404 } 2414 }
2405 2415
2406 // Add handlers to HTML elements. 2416 // Add handlers to HTML elements.
2407 document.addEventListener('DOMContentLoaded', load); 2417 document.addEventListener('DOMContentLoaded', load);
2408 2418
2409 // This event lets us enable and disable menu items before the menu is shown. 2419 // This event lets us enable and disable menu items before the menu is shown.
2410 document.addEventListener('canExecute', function(e) { 2420 document.addEventListener('canExecute', function(e) {
2411 e.canExecute = true; 2421 e.canExecute = true;
2412 }); 2422 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/history.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698