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

Unified Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.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_switcher_utils.h
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h b/ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..cdae3c994fbe929c7700676ef597ccf587be3e5c
--- /dev/null
+++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h
@@ -0,0 +1,45 @@
+// Copyright 2015 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_SWITCHER_UTILS_H_
+#define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_UTILS_H_
+
+#include <vector>
+
+class GURL;
+@class UIImage;
+namespace ios {
+class ChromeBrowserState;
+} // namespace ios
+
+namespace ios_internal {
+
+typedef void (^FaviconGetterCompletionBlock)(UIImage*);
+
+// Favicon for |url|, calls |block| when loaded.
+void GetFavicon(GURL const& url,
+ ios::ChromeBrowserState* browserState,
+ FaviconGetterCompletionBlock block);
+
+// Returns the substitutions/deletions/insertions needed to go from |initial| to
+// |final|.
+// To be in accordance with the UICollectionView's |performBatchUpdates| method:
+// -the indexes in |substitutions| are relative to |initial|.
+// -the indexes in |deletions| are relative to |initial|.
+// -the indexes in |insertions| are relative to |final|.
+//
+// The returned sequence is chosen with a preference of insertions and deletions
+// over substitutions.
+// For example, AB => BC could be done with 2 substitutions, but doing
+// 1 insertion and 1 deletion is preferable because it better communicates the
+// changes to the user in the UICollectionViews.
+void MinimalReplacementOperations(std::vector<size_t> const& initial,
+ std::vector<size_t> const& final,
+ std::vector<size_t>* substitutions,
+ std::vector<size_t>* deletions,
+ std::vector<size_t>* insertions);
+
+} // namespace ios_internal
+
+#endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698