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

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

Issue 2318643003: MD History: truncate title to 300 chars in C++ instead of JS (Closed)
Patch Set: more !android Created 4 years, 3 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 function PromiseResolver() { 4 function PromiseResolver() {
5 this.resolve_; 5 this.resolve_;
6 this.reject_; 6 this.reject_;
7 this.promise_ = new Promise(function(resolve, reject) { 7 this.promise_ = new Promise(function(resolve, reject) {
8 this.resolve_ = resolve; 8 this.resolve_ = resolve;
9 this.reject_ = reject; 9 this.reject_ = reject;
10 }.bind(this)); 10 }.bind(this));
(...skipping 6839 matching lines...) Expand 10 before | Expand all | Expand 10 after
6850 showIcon_: function() { 6850 showIcon_: function() {
6851 this.$.icon.style.backgroundImage = cr.icon.getFavicon(this.item.url); 6851 this.$.icon.style.backgroundImage = cr.icon.getFavicon(this.item.url);
6852 }, 6852 },
6853 selectionNotAllowed_: function() { 6853 selectionNotAllowed_: function() {
6854 return !loadTimeData.getBoolean('allowDeletingHistory'); 6854 return !loadTimeData.getBoolean('allowDeletingHistory');
6855 }, 6855 },
6856 cardTitle_: function(numberOfItems, historyDate, search) { 6856 cardTitle_: function(numberOfItems, historyDate, search) {
6857 if (!search) return this.item.dateRelativeDay; 6857 if (!search) return this.item.dateRelativeDay;
6858 var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults'; 6858 var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults';
6859 return loadTimeData.getStringF('foundSearchResults', numberOfItems, loadTi meData.getString(resultId), search); 6859 return loadTimeData.getStringF('foundSearchResults', numberOfItems, loadTi meData.getString(resultId), search);
6860 },
6861 cropItemTitle_: function(title) {
6862 return title.length > TITLE_MAX_LENGTH ? title.substr(0, TITLE_MAX_LENGTH) : title;
6863 } 6860 }
6864 }); 6861 });
6865 HistoryItem.needsTimeGap = function(visits, currentIndex, searchedTerm) { 6862 HistoryItem.needsTimeGap = function(visits, currentIndex, searchedTerm) {
6866 if (currentIndex >= visits.length - 1 || visits.length == 0) return false; 6863 if (currentIndex >= visits.length - 1 || visits.length == 0) return false;
6867 var currentItem = visits[currentIndex]; 6864 var currentItem = visits[currentIndex];
6868 var nextItem = visits[currentIndex + 1]; 6865 var nextItem = visits[currentIndex + 1];
6869 if (searchedTerm) return currentItem.dateShort != nextItem.dateShort; 6866 if (searchedTerm) return currentItem.dateShort != nextItem.dateShort;
6870 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && currentItem.d ateRelativeDay == nextItem.dateRelativeDay; 6867 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && currentItem.d ateRelativeDay == nextItem.dateRelativeDay;
6871 }; 6868 };
6872 return { 6869 return {
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
8794 8791
8795 case HistoryRange.MONTH: 8792 case HistoryRange.MONTH:
8796 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; 8793 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH;
8797 break; 8794 break;
8798 } 8795 }
8799 break; 8796 break;
8800 } 8797 }
8801 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END); 8798 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END);
8802 } 8799 }
8803 }); 8800 });
OLDNEW
« no previous file with comments | « chrome/browser/history/history_browsertest.cc ('k') | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698