OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_TAB_SWITCHER_UTILS_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_UTILS_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 class GURL; |
| 11 @class UIImage; |
| 12 namespace ios { |
| 13 class ChromeBrowserState; |
| 14 } // namespace ios |
| 15 |
| 16 namespace ios_internal { |
| 17 |
| 18 typedef void (^FaviconGetterCompletionBlock)(UIImage*); |
| 19 |
| 20 // Favicon for |url|, calls |block| when loaded. |
| 21 void GetFavicon(GURL const& url, |
| 22 ios::ChromeBrowserState* browserState, |
| 23 FaviconGetterCompletionBlock block); |
| 24 |
| 25 // Returns the substitutions/deletions/insertions needed to go from |initial| to |
| 26 // |final|. |
| 27 // To be in accordance with the UICollectionView's |performBatchUpdates| method: |
| 28 // -the indexes in |substitutions| are relative to |initial|. |
| 29 // -the indexes in |deletions| are relative to |initial|. |
| 30 // -the indexes in |insertions| are relative to |final|. |
| 31 // |
| 32 // The returned sequence is chosen with a preference of insertions and deletions |
| 33 // over substitutions. |
| 34 // For example, AB => BC could be done with 2 substitutions, but doing |
| 35 // 1 insertion and 1 deletion is preferable because it better communicates the |
| 36 // changes to the user in the UICollectionViews. |
| 37 void MinimalReplacementOperations(std::vector<size_t> const& initial, |
| 38 std::vector<size_t> const& final, |
| 39 std::vector<size_t>* substitutions, |
| 40 std::vector<size_t>* deletions, |
| 41 std::vector<size_t>* insertions); |
| 42 |
| 43 } // namespace ios_internal |
| 44 |
| 45 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_UTILS_H_ |
OLD | NEW |