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

Side by Side Diff: ios/chrome/browser/ui/ntp/google_landing_controller.mm

Issue 2790463003: ntp_tiles: Cleanup enum names (Closed)
Patch Set: add back histogram enums Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 - (void)showMostVisitedUndoForURL:(NSURL*)url; 307 - (void)showMostVisitedUndoForURL:(NSURL*)url;
308 // If Google is not the default search engine, hide the logo, doodle and 308 // If Google is not the default search engine, hide the logo, doodle and
309 // fakebox. 309 // fakebox.
310 - (void)updateLogoAndFakeboxDisplay; 310 - (void)updateLogoAndFakeboxDisplay;
311 // Helper method to set UICollectionViewFlowLayout insets for most visited. 311 // Helper method to set UICollectionViewFlowLayout insets for most visited.
312 - (void)setFlowLayoutInset:(UICollectionViewFlowLayout*)layout; 312 - (void)setFlowLayoutInset:(UICollectionViewFlowLayout*)layout;
313 // Instructs the UICollectionView and UIView to reload it's data and layout. 313 // Instructs the UICollectionView and UIView to reload it's data and layout.
314 - (void)reloadData; 314 - (void)reloadData;
315 // Logs a histogram due to a Most Visited item being opened. 315 // Logs a histogram due to a Most Visited item being opened.
316 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex 316 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex
317 tileType:(ntp_tiles::metrics::MostVisitedTileType)tileType; 317 tileType:(ntp_tiles::TileVisualType)tileType;
318 // Returns the size of |_mostVisitedData|. 318 // Returns the size of |_mostVisitedData|.
319 - (NSUInteger)numberOfItems; 319 - (NSUInteger)numberOfItems;
320 // Returns the number of non empty tiles (as opposed to the placeholder tiles). 320 // Returns the number of non empty tiles (as opposed to the placeholder tiles).
321 - (NSInteger)numberOfNonEmptyTilesShown; 321 - (NSInteger)numberOfNonEmptyTilesShown;
322 // Returns the URL for the mosted visited item in |_mostVisitedData|. 322 // Returns the URL for the mosted visited item in |_mostVisitedData|.
323 - (GURL)urlForIndex:(NSUInteger)index; 323 - (GURL)urlForIndex:(NSUInteger)index;
324 // Removes a blacklisted URL in both |_mostVisitedData|. 324 // Removes a blacklisted URL in both |_mostVisitedData|.
325 - (void)removeBlacklistedURL:(const GURL&)url; 325 - (void)removeBlacklistedURL:(const GURL&)url;
326 // Adds URL to the blacklist in both |_mostVisitedData|. 326 // Adds URL to the blacklist in both |_mostVisitedData|.
327 - (void)addBlacklistedURL:(const GURL&)url; 327 - (void)addBlacklistedURL:(const GURL&)url;
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1046
1047 if (percentComplete == 1.0) { 1047 if (percentComplete == 1.0) {
1048 [link invalidate]; 1048 [link invalidate];
1049 // Reset |shiftTilesDownStartTime to its sentinal value. 1049 // Reset |shiftTilesDownStartTime to its sentinal value.
1050 _shiftTilesDownStartTime = -1; 1050 _shiftTilesDownStartTime = -1;
1051 [[_mostVisitedView collectionViewLayout] invalidateLayout]; 1051 [[_mostVisitedView collectionViewLayout] invalidateLayout];
1052 } 1052 }
1053 } 1053 }
1054 1054
1055 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex 1055 - (void)logMostVisitedClick:(const NSUInteger)visitedIndex
1056 tileType:(ntp_tiles::metrics::MostVisitedTileType)tileType { 1056 tileType:(ntp_tiles::TileVisualType)tileType {
1057 new_tab_page_uma::RecordAction( 1057 new_tab_page_uma::RecordAction(
1058 _browserState, new_tab_page_uma::ACTION_OPENED_MOST_VISITED_ENTRY); 1058 _browserState, new_tab_page_uma::ACTION_OPENED_MOST_VISITED_ENTRY);
1059 base::RecordAction(UserMetricsAction("MobileNTPMostVisited")); 1059 base::RecordAction(UserMetricsAction("MobileNTPMostVisited"));
1060 const ntp_tiles::NTPTile& tile = _mostVisitedData[visitedIndex]; 1060 const ntp_tiles::NTPTile& tile = _mostVisitedData[visitedIndex];
1061 ntp_tiles::metrics::RecordTileClick(visitedIndex, tile.source, tileType); 1061 ntp_tiles::metrics::RecordTileClick(visitedIndex, tile.source, tileType);
1062 } 1062 }
1063 1063
1064 - (void)reloadData { 1064 - (void)reloadData {
1065 // -reloadData updates from |_mostVisitedData|. 1065 // -reloadData updates from |_mostVisitedData|.
1066 // -invalidateLayout is necessary because sometimes the flowLayout has the 1066 // -invalidateLayout is necessary because sometimes the flowLayout has the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 #pragma mark - MostVisitedSitesObserving 1101 #pragma mark - MostVisitedSitesObserving
1102 1102
1103 - (void)onMostVisitedURLsAvailable:(const ntp_tiles::NTPTilesVector&)data { 1103 - (void)onMostVisitedURLsAvailable:(const ntp_tiles::NTPTilesVector&)data {
1104 _mostVisitedData = data; 1104 _mostVisitedData = data;
1105 [self reloadData]; 1105 [self reloadData];
1106 1106
1107 if (data.size() && !_recordedPageImpression) { 1107 if (data.size() && !_recordedPageImpression) {
1108 _recordedPageImpression = YES; 1108 _recordedPageImpression = YES;
1109 std::vector<ntp_tiles::metrics::TileImpression> tiles; 1109 std::vector<ntp_tiles::metrics::TileImpression> tiles;
1110 for (const ntp_tiles::NTPTile& ntpTile : data) { 1110 for (const ntp_tiles::NTPTile& ntpTile : data) {
1111 tiles.emplace_back(ntpTile.source, ntp_tiles::metrics::UNKNOWN_TILE_TYPE, 1111 tiles.emplace_back(ntpTile.source, ntp_tiles::UNKNOWN_TILE_TYPE,
1112 ntpTile.url); 1112 ntpTile.url);
1113 } 1113 }
1114 ntp_tiles::metrics::RecordPageImpression( 1114 ntp_tiles::metrics::RecordPageImpression(
1115 tiles, GetApplicationContext()->GetRapporServiceImpl()); 1115 tiles, GetApplicationContext()->GetRapporServiceImpl());
1116 } 1116 }
1117 } 1117 }
1118 1118
1119 - (void)onIconMadeAvailable:(const GURL&)siteUrl { 1119 - (void)onIconMadeAvailable:(const GURL&)siteUrl {
1120 for (size_t i = 0; i < [self numberOfItems]; ++i) { 1120 for (size_t i = 0; i < [self numberOfItems]; ++i) {
1121 const ntp_tiles::NTPTile& ntpTile = _mostVisitedData[i]; 1121 const ntp_tiles::NTPTile& ntpTile = _mostVisitedData[i];
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 if (!view) { 1705 if (!view) {
1706 return nil; 1706 return nil;
1707 } 1707 }
1708 if ([view isKindOfClass:aClass]) { 1708 if ([view isKindOfClass:aClass]) {
1709 return view; 1709 return view;
1710 } 1710 }
1711 return [self nearestAncestorOfView:[view superview] withClass:aClass]; 1711 return [self nearestAncestorOfView:[view superview] withClass:aClass];
1712 } 1712 }
1713 1713
1714 @end 1714 @end
OLDNEW
« no previous file with comments | « components/ntp_tiles/webui/ntp_tiles_internals_message_handler_client.h ('k') | ios/chrome/browser/ui/ntp/most_visited_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698