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