| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_CHROME_BROWSER_UI_TAB_SWITCHER_SESSION_CHANGES_H_ | |
| 6 #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_SESSION_CHANGES_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 // This structure represents the changes a session undergoes. | |
| 11 // It is used to update the UICollectionView showing a set of tabs. | |
| 12 class SessionChanges { | |
| 13 public: | |
| 14 SessionChanges(std::vector<size_t> const& tabHashesInInitialState, | |
| 15 std::vector<size_t> const& tabHashesInFinalState); | |
| 16 ~SessionChanges(); | |
| 17 SessionChanges(const SessionChanges& sessionChanges) = delete; | |
| 18 SessionChanges& operator=(const SessionChanges& sessionChanges) = delete; | |
| 19 | |
| 20 std::vector<size_t> const& deletions() const; | |
| 21 std::vector<size_t> const& insertions() const; | |
| 22 std::vector<size_t> const& updates() const; | |
| 23 | |
| 24 bool hasChanges() const; | |
| 25 | |
| 26 private: | |
| 27 // Those vectors contain indexes of tabs. | |
| 28 // The indexes are relative to a tab model snapshot, or a distant session. | |
| 29 // To be in accordance with the UICollectionView's |performBatchUpdates| | |
| 30 // method: | |
| 31 // -the indexes in |updates| are relative to the previous state of the | |
| 32 // session. | |
| 33 // -the indexes in |deletions| are relative to the previous state of the | |
| 34 // session. | |
| 35 // -the indexes in |insertions| are relative to the final state of the | |
| 36 // session. | |
| 37 std::vector<size_t> deletions_; | |
| 38 std::vector<size_t> insertions_; | |
| 39 std::vector<size_t> updates_; | |
| 40 }; | |
| 41 | |
| 42 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_SESSION_CHANGES_H_ | |
| OLD | NEW |