OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" | 5 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 - (void)showMostVisitedUndoForURL:(NSURL*)url; | 342 - (void)showMostVisitedUndoForURL:(NSURL*)url; |
343 // If Google is not the default search engine, hide the logo, doodle and | 343 // If Google is not the default search engine, hide the logo, doodle and |
344 // fakebox. | 344 // fakebox. |
345 - (void)updateLogoAndFakeboxDisplay; | 345 - (void)updateLogoAndFakeboxDisplay; |
346 // Helper method to set UICollectionViewFlowLayout insets for most visited. | 346 // Helper method to set UICollectionViewFlowLayout insets for most visited. |
347 - (void)setFlowLayoutInset:(UICollectionViewFlowLayout*)layout; | 347 - (void)setFlowLayoutInset:(UICollectionViewFlowLayout*)layout; |
348 // Instructs the UICollectionView and UIView to reload it's data and layout. | 348 // Instructs the UICollectionView and UIView to reload it's data and layout. |
349 - (void)reloadData; | 349 - (void)reloadData; |
350 // Logs a histogram due to a Most Visited item being opened. | 350 // Logs a histogram due to a Most Visited item being opened. |
351 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex | 351 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex |
352 tileType:(ntp_tiles::metrics::MostVisitedTileType)tileType; | 352 tileType:(ntp_tiles::metrics::NTPTileType)tileType; |
353 // Returns the size of |_mostVisitedData|. | 353 // Returns the size of |_mostVisitedData|. |
354 - (NSUInteger)numberOfItems; | 354 - (NSUInteger)numberOfItems; |
355 // Returns the number of non empty tiles (as opposed to the placeholder tiles). | 355 // Returns the number of non empty tiles (as opposed to the placeholder tiles). |
356 - (NSInteger)numberOfNonEmptyTilesShown; | 356 - (NSInteger)numberOfNonEmptyTilesShown; |
357 // Returns the URL for the mosted visited item in |_mostVisitedData|. | 357 // Returns the URL for the mosted visited item in |_mostVisitedData|. |
358 - (GURL)urlForIndex:(NSUInteger)index; | 358 - (GURL)urlForIndex:(NSUInteger)index; |
359 // Removes a blacklisted URL in both |_mostVisitedData|. | 359 // Removes a blacklisted URL in both |_mostVisitedData|. |
360 - (void)removeBlacklistedURL:(const GURL&)url; | 360 - (void)removeBlacklistedURL:(const GURL&)url; |
361 // Adds URL to the blacklist in both |_mostVisitedData|. | 361 // Adds URL to the blacklist in both |_mostVisitedData|. |
362 - (void)addBlacklistedURL:(const GURL&)url; | 362 - (void)addBlacklistedURL:(const GURL&)url; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 | 1081 |
1082 if (percentComplete == 1.0) { | 1082 if (percentComplete == 1.0) { |
1083 [link invalidate]; | 1083 [link invalidate]; |
1084 // Reset |shiftTilesDownStartTime to its sentinal value. | 1084 // Reset |shiftTilesDownStartTime to its sentinal value. |
1085 _shiftTilesDownStartTime = -1; | 1085 _shiftTilesDownStartTime = -1; |
1086 [[_mostVisitedView collectionViewLayout] invalidateLayout]; | 1086 [[_mostVisitedView collectionViewLayout] invalidateLayout]; |
1087 } | 1087 } |
1088 } | 1088 } |
1089 | 1089 |
1090 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex | 1090 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex |
1091 tileType:(ntp_tiles::metrics::MostVisitedTileType)tileType { | 1091 tileType:(ntp_tiles::metrics::NTPTileType)tileType { |
1092 new_tab_page_uma::RecordAction( | 1092 new_tab_page_uma::RecordAction( |
1093 _browserState, new_tab_page_uma::ACTION_OPENED_MOST_VISITED_ENTRY); | 1093 _browserState, new_tab_page_uma::ACTION_OPENED_MOST_VISITED_ENTRY); |
1094 base::RecordAction(UserMetricsAction("MobileNTPMostVisited")); | 1094 base::RecordAction(UserMetricsAction("MobileNTPMostVisited")); |
1095 const ntp_tiles::NTPTile& tile = _mostVisitedData[visitedIndex]; | 1095 const ntp_tiles::NTPTile& tile = _mostVisitedData[visitedIndex]; |
1096 ntp_tiles::metrics::RecordTileClick(visitedIndex, tile.source, tileType); | 1096 ntp_tiles::metrics::RecordTileClick(visitedIndex, tile.source, tileType); |
1097 } | 1097 } |
1098 | 1098 |
1099 - (void)onMostVisitedURLsAvailable:(const ntp_tiles::NTPTilesVector&)data { | 1099 - (void)onMostVisitedURLsAvailable:(const ntp_tiles::NTPTilesVector&)data { |
1100 _mostVisitedData = data; | 1100 _mostVisitedData = data; |
1101 [self reloadData]; | 1101 [self reloadData]; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 if (!view) { | 1738 if (!view) { |
1739 return nil; | 1739 return nil; |
1740 } | 1740 } |
1741 if ([view isKindOfClass:aClass]) { | 1741 if ([view isKindOfClass:aClass]) { |
1742 return view; | 1742 return view; |
1743 } | 1743 } |
1744 return [self nearestAncestorOfView:[view superview] withClass:aClass]; | 1744 return [self nearestAncestorOfView:[view superview] withClass:aClass]; |
1745 } | 1745 } |
1746 | 1746 |
1747 @end | 1747 @end |
OLD | NEW |