OLD | NEW |
---|---|
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 * @param {Object} result An object containing the visit's data. | 80 * @param {Object} result An object containing the visit's data. |
81 * @param {boolean} continued Whether this visit is on the same day as the | 81 * @param {boolean} continued Whether this visit is on the same day as the |
82 * visit before it. | 82 * visit before it. |
83 * @param {HistoryModel} model The model object this entry belongs to. | 83 * @param {HistoryModel} model The model object this entry belongs to. |
84 * @constructor | 84 * @constructor |
85 */ | 85 */ |
86 function Visit(result, continued, model) { | 86 function Visit(result, continued, model) { |
87 this.model_ = model; | 87 this.model_ = model; |
88 this.title_ = result.title; | 88 this.title_ = result.title; |
89 this.url_ = result.url; | 89 this.url_ = result.url; |
90 this.displayableDomain_ = result.displayableDomain; | |
90 this.starred_ = result.starred; | 91 this.starred_ = result.starred; |
91 this.snippet_ = result.snippet || ''; | 92 this.snippet_ = result.snippet || ''; |
92 | 93 |
93 // These identify the name and type of the device on which this visit | 94 // These identify the name and type of the device on which this visit |
94 // occurred. They will be empty if the visit occurred on the current device. | 95 // occurred. They will be empty if the visit occurred on the current device. |
95 this.deviceName = result.deviceName; | 96 this.deviceName = result.deviceName; |
96 this.deviceType = result.deviceType; | 97 this.deviceType = result.deviceType; |
97 | 98 |
98 // The ID will be set according to when the visit was displayed, not | 99 // The ID will be set according to when the visit was displayed, not |
99 // received. Set to -1 to show that it has not been set yet. | 100 // received. Set to -1 to show that it has not been set yet. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 // Keep track of the drop down that triggered the menu, so we know | 170 // Keep track of the drop down that triggered the menu, so we know |
170 // which element to apply the command to. | 171 // which element to apply the command to. |
171 // TODO(dubroy): Ideally we'd use 'activate', but MenuButton swallows it. | 172 // TODO(dubroy): Ideally we'd use 'activate', but MenuButton swallows it. |
172 var self = this; | 173 var self = this; |
173 var setActiveVisit = function(e) { | 174 var setActiveVisit = function(e) { |
174 activeVisit = self; | 175 activeVisit = self; |
175 var menu = $('action-menu'); | 176 var menu = $('action-menu'); |
176 menu.dataset.devicename = self.deviceName; | 177 menu.dataset.devicename = self.deviceName; |
177 menu.dataset.devicetype = self.deviceType; | 178 menu.dataset.devicetype = self.deviceType; |
178 }; | 179 }; |
179 domain.textContent = this.getDomainFromURL_(this.url_); | 180 domain.textContent = this.displayableDomain_; |
brettw
2013/08/21 21:54:48
It seems like we should be updating every place wh
| |
180 | 181 |
181 entryBox.appendChild(time); | 182 entryBox.appendChild(time); |
182 | 183 |
183 var bookmarkSection = createElementWithClassName('div', 'bookmark-section'); | 184 var bookmarkSection = createElementWithClassName('div', 'bookmark-section'); |
184 if (this.starred_) { | 185 if (this.starred_) { |
185 bookmarkSection.classList.add('starred'); | 186 bookmarkSection.classList.add('starred'); |
186 bookmarkSection.addEventListener('click', function f(e) { | 187 bookmarkSection.addEventListener('click', function f(e) { |
187 recordUmaAction('HistoryPage_BookmarkStarClicked'); | 188 recordUmaAction('HistoryPage_BookmarkStarClicked'); |
188 bookmarkSection.classList.remove('starred'); | 189 bookmarkSection.classList.remove('starred'); |
189 chrome.send('removeBookmark', [self.url_]); | 190 chrome.send('removeBookmark', [self.url_]); |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1923 historyView.reload(); | 1924 historyView.reload(); |
1924 } | 1925 } |
1925 | 1926 |
1926 // Add handlers to HTML elements. | 1927 // Add handlers to HTML elements. |
1927 document.addEventListener('DOMContentLoaded', load); | 1928 document.addEventListener('DOMContentLoaded', load); |
1928 | 1929 |
1929 // This event lets us enable and disable menu items before the menu is shown. | 1930 // This event lets us enable and disable menu items before the menu is shown. |
1930 document.addEventListener('canExecute', function(e) { | 1931 document.addEventListener('canExecute', function(e) { |
1931 e.canExecute = true; | 1932 e.canExecute = true; |
1932 }); | 1933 }); |
OLD | NEW |