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