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 var g_browserBridge; | 5 var g_browserBridge; |
6 var g_mainView; | 6 var g_mainView; |
7 | 7 |
8 // TODO(eroman): The handling of "max" across snapshots is not correct. | 8 // TODO(eroman): The handling of "max" across snapshots is not correct. |
9 // For starters the browser needs to be aware to generate new maximums. | 9 // For starters the browser needs to be aware to generate new maximums. |
10 // Secondly, we need to take into account the "max" of intermediary snapshots, | 10 // Secondly, we need to take into account the "max" of intermediary snapshots, |
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 * order. | 2081 * order. |
2082 */ | 2082 */ |
2083 onClickColumn_: function(key, event) { | 2083 onClickColumn_: function(key, event) { |
2084 // If this property wants to start off in descending order rather then | 2084 // If this property wants to start off in descending order rather then |
2085 // ascending, flip it. | 2085 // ascending, flip it. |
2086 if (KEY_PROPERTIES[key].sortDescending) | 2086 if (KEY_PROPERTIES[key].sortDescending) |
2087 key = reverseSortKey(key); | 2087 key = reverseSortKey(key); |
2088 | 2088 |
2089 // Scan through our sort order and see if we are already sorted on this | 2089 // Scan through our sort order and see if we are already sorted on this |
2090 // key. If so, reverse that sort ordering. | 2090 // key. If so, reverse that sort ordering. |
2091 var found_i = -1; | 2091 var foundIndex = -1; |
2092 for (var i = 0; i < this.currentSortKeys_.length; ++i) { | 2092 for (var i = 0; i < this.currentSortKeys_.length; ++i) { |
2093 var curKey = this.currentSortKeys_[i]; | 2093 var curKey = this.currentSortKeys_[i]; |
2094 if (sortKeysMatch(curKey, key)) { | 2094 if (sortKeysMatch(curKey, key)) { |
2095 this.currentSortKeys_[i] = reverseSortKey(curKey); | 2095 this.currentSortKeys_[i] = reverseSortKey(curKey); |
2096 found_i = i; | 2096 foundIndex = i; |
2097 break; | 2097 break; |
2098 } | 2098 } |
2099 } | 2099 } |
2100 | 2100 |
2101 if (event.altKey) { | 2101 if (event.altKey) { |
2102 if (found_i == -1) { | 2102 if (foundIndex == -1) { |
2103 // If we weren't already sorted on the column that was alt-clicked, | 2103 // If we weren't already sorted on the column that was alt-clicked, |
2104 // then add it to our sort. | 2104 // then add it to our sort. |
2105 this.currentSortKeys_.push(key); | 2105 this.currentSortKeys_.push(key); |
2106 } | 2106 } |
2107 } else { | 2107 } else { |
2108 if (found_i != 0 || | 2108 if (foundIndex != 0 || |
2109 !sortKeysMatch(this.currentSortKeys_[found_i], key)) { | 2109 !sortKeysMatch(this.currentSortKeys_[foundIndex], key)) { |
2110 // If the column we left-clicked wasn't already our primary column, | 2110 // If the column we left-clicked wasn't already our primary column, |
2111 // make it so. | 2111 // make it so. |
2112 this.currentSortKeys_ = [key]; | 2112 this.currentSortKeys_ = [key]; |
2113 } else { | 2113 } else { |
2114 // If the column we left-clicked was already our primary column (and | 2114 // If the column we left-clicked was already our primary column (and |
2115 // we just reversed it), remove any secondary sorts. | 2115 // we just reversed it), remove any secondary sorts. |
2116 this.currentSortKeys_.length = 1; | 2116 this.currentSortKeys_.length = 1; |
2117 } | 2117 } |
2118 } | 2118 } |
2119 | 2119 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2214 groupKey.push(entry); | 2214 groupKey.push(entry); |
2215 } | 2215 } |
2216 | 2216 |
2217 return JSON.stringify(groupKey); | 2217 return JSON.stringify(groupKey); |
2218 }; | 2218 }; |
2219 }, | 2219 }, |
2220 }; | 2220 }; |
2221 | 2221 |
2222 return MainView; | 2222 return MainView; |
2223 })(); | 2223 })(); |
OLD | NEW |