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 namespace ios_internal { |
| 11 |
| 12 // This structure represents the changes a session undergoes. |
| 13 // It is used to update the UICollectionView showing a set of tabs. |
| 14 class SessionChanges { |
| 15 public: |
| 16 SessionChanges(std::vector<size_t> const& tabHashesInInitialState, |
| 17 std::vector<size_t> const& tabHashesInFinalState); |
| 18 ~SessionChanges(); |
| 19 SessionChanges(const SessionChanges& sessionChanges) = delete; |
| 20 SessionChanges& operator=(const SessionChanges& sessionChanges) = delete; |
| 21 |
| 22 std::vector<size_t> const& deletions() const; |
| 23 std::vector<size_t> const& insertions() const; |
| 24 std::vector<size_t> const& updates() const; |
| 25 |
| 26 bool hasChanges() const; |
| 27 |
| 28 private: |
| 29 // Those vectors contain indexes of tabs. |
| 30 // The indexes are relative to a tab model snapshot, or a distant session. |
| 31 // To be in accordance with the UICollectionView's |performBatchUpdates| |
| 32 // method: |
| 33 // -the indexes in |updates| are relative to the previous state of the |
| 34 // session. |
| 35 // -the indexes in |deletions| are relative to the previous state of the |
| 36 // session. |
| 37 // -the indexes in |insertions| are relative to the final state of the |
| 38 // session. |
| 39 std::vector<size_t> deletions_; |
| 40 std::vector<size_t> insertions_; |
| 41 std::vector<size_t> updates_; |
| 42 }; |
| 43 |
| 44 } // namespace ios_internal |
| 45 |
| 46 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_SESSION_CHANGES_H_ |
OLD | NEW |