| 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 /** |
| 49 * Returns true if the mobile (non-desktop) version is being shown. | 82 * Returns true if the mobile (non-desktop) version is being shown. |
| 50 * @return {boolean} true if the mobile version is being shown. | 83 * @return {boolean} true if the mobile version is being shown. |
| 51 */ | 84 */ |
| 52 function isMobileVersion() { | 85 function isMobileVersion() { |
| 53 return !document.body.classList.contains('uber-frame'); | 86 return !document.body.classList.contains('uber-frame'); |
| 54 } | 87 } |
| 55 | 88 |
| 56 /** | 89 /** |
| 57 * Record an action in UMA. | 90 * Record an action in UMA. |
| 58 * @param {string} actionDesc The name of the action to be logged. | 91 * @param {string} actionDesc The name of the action to be logged. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 137 |
| 105 this.isRendered = false; // Has the visit already been rendered on the page? | 138 this.isRendered = false; // Has the visit already been rendered on the page? |
| 106 | 139 |
| 107 // All the date information is public so that owners can compare properties of | 140 // All the date information is public so that owners can compare properties of |
| 108 // two items easily. | 141 // two items easily. |
| 109 | 142 |
| 110 this.date = new Date(result.time); | 143 this.date = new Date(result.time); |
| 111 | 144 |
| 112 // See comment in BrowsingHistoryHandler::QueryComplete - we won't always | 145 // See comment in BrowsingHistoryHandler::QueryComplete - we won't always |
| 113 // get all of these. | 146 // get all of these. |
| 114 this.dateRelativeDay = result.dateRelativeDay; | 147 this.dateRelativeDay = result.dateRelativeDay || ''; |
| 115 this.dateTimeOfDay = result.dateTimeOfDay; | 148 this.dateTimeOfDay = result.dateTimeOfDay || ''; |
| 116 this.dateShort = result.dateShort; | 149 this.dateShort = result.dateShort || ''; |
| 117 | 150 |
| 118 // Shows the filtering behavior for that host (only used for supervised | 151 // Shows the filtering behavior for that host (only used for supervised |
| 119 // users). | 152 // users). |
| 120 // A value of |SupervisedUserFilteringBehavior.ALLOW| is not displayed so it | 153 // A value of |SupervisedUserFilteringBehavior.ALLOW| is not displayed so it |
| 121 // is used as the default value. | 154 // is used as the default value. |
| 122 this.hostFilteringBehavior = SupervisedUserFilteringBehavior.ALLOW; | 155 this.hostFilteringBehavior = SupervisedUserFilteringBehavior.ALLOW; |
| 123 if (result.hostFilteringBehavior) | 156 if (typeof result.hostFilteringBehavior != 'undefined') |
| 124 this.hostFilteringBehavior = result.hostFilteringBehavior; | 157 this.hostFilteringBehavior = result.hostFilteringBehavior; |
| 125 | 158 |
| 126 this.blockedVisit = result.blockedVisit; | 159 this.blockedVisit = result.blockedVisit || false; |
| 127 | 160 |
| 128 // Whether this is the continuation of a previous day. | 161 // Whether this is the continuation of a previous day. |
| 129 this.continued = continued; | 162 this.continued = continued; |
| 130 | 163 |
| 131 this.allTimestamps = result.allTimestamps; | 164 this.allTimestamps = result.allTimestamps; |
| 132 } | 165 } |
| 133 | 166 |
| 134 // Visit, public: ------------------------------------------------------------- | 167 // Visit, public: ------------------------------------------------------------- |
| 135 | 168 |
| 136 /** | 169 /** |
| (...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 historyView.reload(); | 2379 historyView.reload(); |
| 2347 } | 2380 } |
| 2348 | 2381 |
| 2349 // Add handlers to HTML elements. | 2382 // Add handlers to HTML elements. |
| 2350 document.addEventListener('DOMContentLoaded', load); | 2383 document.addEventListener('DOMContentLoaded', load); |
| 2351 | 2384 |
| 2352 // This event lets us enable and disable menu items before the menu is shown. | 2385 // This event lets us enable and disable menu items before the menu is shown. |
| 2353 document.addEventListener('canExecute', function(e) { | 2386 document.addEventListener('canExecute', function(e) { |
| 2354 e.canExecute = true; | 2387 e.canExecute = true; |
| 2355 }); | 2388 }); |
| OLD | NEW |