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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 this.focusGrid_.setGrid(grid); | 1675 this.focusGrid_.setGrid(grid); |
1676 }; | 1676 }; |
1677 | 1677 |
1678 /** | 1678 /** |
1679 * Update the visibility of the page navigation buttons. | 1679 * Update the visibility of the page navigation buttons. |
1680 * @private | 1680 * @private |
1681 */ | 1681 */ |
1682 HistoryView.prototype.updateNavBar_ = function() { | 1682 HistoryView.prototype.updateNavBar_ = function() { |
1683 this.updateRangeButtons_(); | 1683 this.updateRangeButtons_(); |
1684 | 1684 |
1685 // Supervised users have the control bar on top, don't show it on the bottom | 1685 // If grouping by domain is enabled, there's a control bar on top, don't show |
1686 // as well. | 1686 // the one on the bottom as well. |
1687 if (!loadTimeData.getBoolean('isSupervisedProfile')) { | 1687 if (!loadTimeData.getBoolean('groupByDomain')) { |
1688 $('newest-button').hidden = this.pageIndex_ == 0; | 1688 $('newest-button').hidden = this.pageIndex_ == 0; |
1689 $('newer-button').hidden = this.pageIndex_ == 0; | 1689 $('newer-button').hidden = this.pageIndex_ == 0; |
1690 $('older-button').hidden = | 1690 $('older-button').hidden = |
1691 this.model_.rangeInDays_ != HistoryModel.Range.ALL_TIME || | 1691 this.model_.rangeInDays_ != HistoryModel.Range.ALL_TIME || |
1692 !this.model_.hasMoreResults(); | 1692 !this.model_.hasMoreResults(); |
1693 } | 1693 } |
1694 }; | 1694 }; |
1695 | 1695 |
1696 /** | 1696 /** |
1697 * Updates the visibility of the 'Clear browsing data' button. | 1697 * Updates the visibility of the 'Clear browsing data' button. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 var mayRemoveVisits = loadTimeData.getBoolean('allowDeletingHistory'); | 1917 var mayRemoveVisits = loadTimeData.getBoolean('allowDeletingHistory'); |
1918 $('remove-visit').disabled = !mayRemoveVisits; | 1918 $('remove-visit').disabled = !mayRemoveVisits; |
1919 | 1919 |
1920 if (mayRemoveVisits) { | 1920 if (mayRemoveVisits) { |
1921 $('remove-visit').addEventListener('activate', function(e) { | 1921 $('remove-visit').addEventListener('activate', function(e) { |
1922 activeVisit.removeFromHistory(); | 1922 activeVisit.removeFromHistory(); |
1923 activeVisit = null; | 1923 activeVisit = null; |
1924 }); | 1924 }); |
1925 } | 1925 } |
1926 | 1926 |
1927 if (!loadTimeData.getBoolean('showDeleteVisitUI')) | 1927 if (loadTimeData.getBoolean('hideDeleteVisitUI')) |
1928 $('remove-visit').hidden = true; | 1928 $('remove-visit').hidden = true; |
1929 | 1929 |
1930 searchField.addEventListener('search', doSearch); | 1930 searchField.addEventListener('search', doSearch); |
1931 $('search-button').addEventListener('click', doSearch); | 1931 $('search-button').addEventListener('click', doSearch); |
1932 | 1932 |
1933 $('more-from-site').addEventListener('activate', function(e) { | 1933 $('more-from-site').addEventListener('activate', function(e) { |
1934 activeVisit.showMoreFromSite_(); | 1934 activeVisit.showMoreFromSite_(); |
1935 activeVisit = null; | 1935 activeVisit = null; |
1936 }); | 1936 }); |
1937 | 1937 |
1938 // Only show the controls if the command line switch is activated. | 1938 // Only show the controls if the command line switch is activated or the user |
1939 if (loadTimeData.getBoolean('groupByDomain') || | 1939 // is supervised. |
1940 loadTimeData.getBoolean('isSupervisedProfile')) { | 1940 if (loadTimeData.getBoolean('groupByDomain')) { |
1941 // Hide the top container which has the "Clear browsing data" and "Remove | |
1942 // selected entries" buttons since they're unavailable for supervised users. | |
1943 $('top-container').hidden = true; | |
1944 $('history-page').classList.add('big-topbar-page'); | 1941 $('history-page').classList.add('big-topbar-page'); |
1945 $('filter-controls').hidden = false; | 1942 $('filter-controls').hidden = false; |
1946 } | 1943 } |
| 1944 // Hide the top container which has the "Clear browsing data" and "Remove |
| 1945 // selected entries" buttons if deleting history is not allowed. |
| 1946 if (!loadTimeData.getBoolean('allowDeletingHistory')) |
| 1947 $('top-container').hidden = true; |
1947 | 1948 |
1948 uber.setTitle(loadTimeData.getString('title')); | 1949 uber.setTitle(loadTimeData.getString('title')); |
1949 | 1950 |
1950 // Adjust the position of the notification bar when the window size changes. | 1951 // Adjust the position of the notification bar when the window size changes. |
1951 window.addEventListener('resize', | 1952 window.addEventListener('resize', |
1952 historyView.positionNotificationBar.bind(historyView)); | 1953 historyView.positionNotificationBar.bind(historyView)); |
1953 | 1954 |
1954 if (isMobileVersion()) { | 1955 if (isMobileVersion()) { |
1955 // Move the search box out of the header. | 1956 // Move the search box out of the header. |
1956 var resultsDisplay = $('results-display'); | 1957 var resultsDisplay = $('results-display'); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 historyView.reload(); | 2322 historyView.reload(); |
2322 } | 2323 } |
2323 | 2324 |
2324 // Add handlers to HTML elements. | 2325 // Add handlers to HTML elements. |
2325 document.addEventListener('DOMContentLoaded', load); | 2326 document.addEventListener('DOMContentLoaded', load); |
2326 | 2327 |
2327 // This event lets us enable and disable menu items before the menu is shown. | 2328 // This event lets us enable and disable menu items before the menu is shown. |
2328 document.addEventListener('canExecute', function(e) { | 2329 document.addEventListener('canExecute', function(e) { |
2329 e.canExecute = true; | 2330 e.canExecute = true; |
2330 }); | 2331 }); |
OLD | NEW |