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 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 | 1730 |
1731 this.model = model; | 1731 this.model = model; |
1732 this.view = view; | 1732 this.view = view; |
1733 | 1733 |
1734 if (typeof this.checker_ != 'undefined' && this.checker_) { | 1734 if (typeof this.checker_ != 'undefined' && this.checker_) { |
1735 clearInterval(this.checker_); | 1735 clearInterval(this.checker_); |
1736 } | 1736 } |
1737 | 1737 |
1738 // TODO(glen): Replace this with a bound method so we don't need | 1738 // TODO(glen): Replace this with a bound method so we don't need |
1739 // public model and view. | 1739 // public model and view. |
1740 this.checker_ = window.setInterval(function(stateObj) { | 1740 this.checker_ = window.setInterval(function() { |
1741 var hashData = stateObj.getHashData(); | 1741 var hashData = this.getHashData(); |
1742 var page = parseInt(hashData.page, 10); | 1742 var page = parseInt(hashData.page, 10); |
1743 var range = parseInt(hashData.range, 10); | 1743 var range = parseInt(hashData.range, 10); |
1744 var offset = parseInt(hashData.offset, 10); | 1744 var offset = parseInt(hashData.offset, 10); |
1745 if (hashData.q != stateObj.model.getSearchText() || | 1745 if (hashData.q != this.model.getSearchText() || |
1746 page != stateObj.view.getPage() || | 1746 page != this.view.getPage() || |
1747 range != stateObj.model.rangeInDays || | 1747 range != this.model.rangeInDays || |
1748 offset != stateObj.model.offset) { | 1748 offset != this.model.offset) { |
1749 stateObj.view.setPageState(hashData.q, page, range, offset); | 1749 this.view.setPageState(hashData.q, page, range, offset); |
1750 } | 1750 } |
1751 }, 50, this); | 1751 }.bind(this), 50); |
1752 } | 1752 } |
1753 | 1753 |
1754 /** | 1754 /** |
1755 * Holds the singleton instance. | 1755 * Holds the singleton instance. |
1756 */ | 1756 */ |
1757 PageState.instance = null; | 1757 PageState.instance = null; |
1758 | 1758 |
1759 /** | 1759 /** |
1760 * @return {Object} An object containing parameters from our window hash. | 1760 * @return {Object} An object containing parameters from our window hash. |
1761 */ | 1761 */ |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2275 historyView.reload(); | 2275 historyView.reload(); |
2276 } | 2276 } |
2277 | 2277 |
2278 // Add handlers to HTML elements. | 2278 // Add handlers to HTML elements. |
2279 document.addEventListener('DOMContentLoaded', load); | 2279 document.addEventListener('DOMContentLoaded', load); |
2280 | 2280 |
2281 // This event lets us enable and disable menu items before the menu is shown. | 2281 // This event lets us enable and disable menu items before the menu is shown. |
2282 document.addEventListener('canExecute', function(e) { | 2282 document.addEventListener('canExecute', function(e) { |
2283 e.canExecute = true; | 2283 e.canExecute = true; |
2284 }); | 2284 }); |
OLD | NEW |