Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.h

Issue 2588733002: Upstream Chrome on iOS source code [9/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.h
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.h b/ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.h
new file mode 100644
index 0000000000000000000000000000000000000000..7096138df450c08753ef9724b153e69b85e151d1
--- /dev/null
+++ b/ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.h
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_MODEL_SNAPSHOT_H_
+#define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_MODEL_SNAPSHOT_H_
+
+#import <Foundation/Foundation.h>
+#include <vector>
+
+#import "base/ios/weak_nsobject.h"
+
+@class TabModel;
+@class Tab;
+
+// Contains an approximate snapshot of the tab model passed to the initializer.
+// Used to feed the cells to UICollectionViews, and to compute the changes
+// required to update UICollectionViews.
+// The changes are computed based on a list of hashes of the tabs.
+// One resulting limitation is that there is no differenciation between a tab
+// that is partially updated (because the snapshot changed), and a completely
+// new tab replacing an older tab. This limitation has little impact because
+// very few navigations occur when the tab switcher is shown.
+class TabModelSnapshot {
+ public:
+ // Default constructor. |tabModel| can be nil.
+ explicit TabModelSnapshot(TabModel* tabModel);
+ ~TabModelSnapshot();
+ // Returns the list of hashes for every tabs contained in the TabModel during
+ // the initialization.
+ std::vector<size_t> const& hashes() const;
+ // Returns a list of weak pointers to the tabs.
+ std::vector<base::WeakNSObject<Tab>> const& tabs() const;
+ // Returns a hash of the properties of a tab that are visible in the tab
+ // switcher's UI.
+ static size_t hashOfTheVisiblePropertiesOfATab(Tab* tab);
+
+ private:
+ std::vector<base::WeakNSObject<Tab>> _tabs;
+ std::vector<size_t> _hashes;
+};
+
+#endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_MODEL_SNAPSHOT_H_
« no previous file with comments | « ios/chrome/browser/ui/tab_switcher/session_changes.mm ('k') | ios/chrome/browser/ui/tab_switcher/tab_model_snapshot.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698