Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 * supervised_user_url_filter.h. | 39 * supervised_user_url_filter.h. |
| 40 * @enum {number} | 40 * @enum {number} |
| 41 */ | 41 */ |
| 42 var SupervisedUserFilteringBehavior = { | 42 var SupervisedUserFilteringBehavior = { |
| 43 ALLOW: 0, | 43 ALLOW: 0, |
| 44 WARN: 1, | 44 WARN: 1, |
| 45 BLOCK: 2 | 45 BLOCK: 2 |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * The type of the history result object. The definition is based on | |
| 50 * chrome/browser/ui/webui/history_ui.cc: | |
| 51 * BrowsingHistoryHandler::HistoryEntry::ToValue() | |
| 52 * @typedef {{allTimestamps: Array<number>, | |
| 53 * blockedVisit: (boolean|undefined), | |
| 54 * dateRelativeDay: (string|undefined), | |
| 55 * dateShort: string, | |
| 56 * dateTimeOfDay: (string|undefined), | |
| 57 * deviceName: string, | |
| 58 * deviceType: string, | |
| 59 * domain: string, | |
| 60 * hostFilteringBehavior: (number|undefined), | |
| 61 * snippet: (string|undefined), | |
| 62 * starred: boolean, | |
| 63 * time: number, | |
| 64 * title: string, | |
| 65 * url: string}} | |
| 66 */ | |
| 67 var HistoryEntry; | |
| 68 | |
| 69 /** | |
| 70 * The type of the history results info object. The definition is based on | |
| 71 * chrome/browser/ui/webui/history_ui.cc: | |
| 72 * BrowsingHistoryHandler::QueryComplete() | |
| 73 * @typedef {{finished: boolean, | |
| 74 * hasSyncedResults: (boolean|undefined), | |
| 75 * queryEndTime: string, | |
| 76 * queryStartTime: string, | |
| 77 * term: string}} | |
| 78 */ | |
| 79 var HistoryQuery; | |
| 80 | |
| 81 /** | |
| 82 * Returns true if the mobile (non-desktop) version is being shown. | 49 * Returns true if the mobile (non-desktop) version is being shown. |
| 83 * @return {boolean} true if the mobile version is being shown. | 50 * @return {boolean} true if the mobile version is being shown. |
| 84 */ | 51 */ |
| 85 function isMobileVersion() { | 52 function isMobileVersion() { |
| 86 return !document.body.classList.contains('uber-frame'); | 53 return !document.body.classList.contains('uber-frame'); |
| 87 } | 54 } |
| 88 | 55 |
| 89 /** | 56 /** |
| 90 * Record an action in UMA. | 57 * Record an action in UMA. |
| 91 * @param {string} actionDesc The name of the action to be logged. | 58 * @param {string} actionDesc The name of the action to be logged. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 104 |
| 138 this.isRendered = false; // Has the visit already been rendered on the page? | 105 this.isRendered = false; // Has the visit already been rendered on the page? |
| 139 | 106 |
| 140 // All the date information is public so that owners can compare properties of | 107 // All the date information is public so that owners can compare properties of |
| 141 // two items easily. | 108 // two items easily. |
| 142 | 109 |
| 143 this.date = new Date(result.time); | 110 this.date = new Date(result.time); |
| 144 | 111 |
| 145 // See comment in BrowsingHistoryHandler::QueryComplete - we won't always | 112 // See comment in BrowsingHistoryHandler::QueryComplete - we won't always |
| 146 // get all of these. | 113 // get all of these. |
| 147 this.dateRelativeDay = result.dateRelativeDay || ''; | 114 this.dateRelativeDay = result.dateRelativeDay; |
| 148 this.dateTimeOfDay = result.dateTimeOfDay || ''; | 115 this.dateTimeOfDay = result.dateTimeOfDay; |
| 149 this.dateShort = result.dateShort || ''; | 116 this.dateShort = result.dateShort; |
| 150 | 117 |
| 151 // Shows the filtering behavior for that host (only used for supervised | 118 // Shows the filtering behavior for that host (only used for supervised |
| 152 // users). | 119 // users). |
| 153 // A value of |SupervisedUserFilteringBehavior.ALLOW| is not displayed so it | 120 // A value of |SupervisedUserFilteringBehavior.ALLOW| is not displayed so it |
| 154 // is used as the default value. | 121 // is used as the default value. |
| 155 this.hostFilteringBehavior = SupervisedUserFilteringBehavior.ALLOW; | 122 this.hostFilteringBehavior = SupervisedUserFilteringBehavior.ALLOW; |
| 156 if (typeof result.hostFilteringBehavior != 'undefined') | 123 if (result.hostFilteringBehavior != '') |
|
Dan Beam
2016/01/27 03:07:30
nit: just if (result.hostFilteringBehavior)
yingran
2016/01/27 05:05:03
Done.
| |
| 157 this.hostFilteringBehavior = result.hostFilteringBehavior; | 124 this.hostFilteringBehavior = result.hostFilteringBehavior; |
| 158 | 125 |
| 159 this.blockedVisit = result.blockedVisit || false; | 126 this.blockedVisit = result.blockedVisit; |
| 160 | 127 |
| 161 // Whether this is the continuation of a previous day. | 128 // Whether this is the continuation of a previous day. |
| 162 this.continued = continued; | 129 this.continued = continued; |
| 163 | 130 |
| 164 this.allTimestamps = result.allTimestamps; | 131 this.allTimestamps = result.allTimestamps; |
| 165 } | 132 } |
| 166 | 133 |
| 167 // Visit, public: ------------------------------------------------------------- | 134 // Visit, public: ------------------------------------------------------------- |
| 168 | 135 |
| 169 /** | 136 /** |
| (...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2379 historyView.reload(); | 2346 historyView.reload(); |
| 2380 } | 2347 } |
| 2381 | 2348 |
| 2382 // Add handlers to HTML elements. | 2349 // Add handlers to HTML elements. |
| 2383 document.addEventListener('DOMContentLoaded', load); | 2350 document.addEventListener('DOMContentLoaded', load); |
| 2384 | 2351 |
| 2385 // This event lets us enable and disable menu items before the menu is shown. | 2352 // This event lets us enable and disable menu items before the menu is shown. |
| 2386 document.addEventListener('canExecute', function(e) { | 2353 document.addEventListener('canExecute', function(e) { |
| 2387 e.canExecute = true; | 2354 e.canExecute = true; |
| 2388 }); | 2355 }); |
| OLD | NEW |