Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_mediator.h" | 5 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" |
| 6 | 6 |
| 7 #import "base/ios/weak_nsobject.h" | 7 #import "base/ios/weak_nsobject.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
| 10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 [self.consumer setLogoIsShowing:showLogo]; | 241 [self.consumer setLogoIsShowing:showLogo]; |
| 242 } | 242 } |
| 243 | 243 |
| 244 + (NSUInteger)maxSitesShown { | 244 + (NSUInteger)maxSitesShown { |
| 245 return kMaxNumMostVisitedFavicons; | 245 return kMaxNumMostVisitedFavicons; |
| 246 } | 246 } |
| 247 | 247 |
| 248 #pragma mark - MostVisitedSitesObserving | 248 #pragma mark - MostVisitedSitesObserving |
| 249 | 249 |
| 250 - (void)onMostVisitedURLsAvailable:(const ntp_tiles::NTPTilesVector&)data { | 250 - (void)onMostVisitedURLsAvailable:(const ntp_tiles::NTPTilesVector&)data { |
| 251 if (_mostVisitedData.size() > 0) { | 251 if (_mostVisitedData.size() > 0) { |
|
justincohen
2017/06/06 15:47:34
When you remove the last time isn't this 0, so it
gambard
2017/06/06 16:19:23
No, _mostVisitedData is the previous data (i.e. be
| |
| 252 // If some content is already displayed to the user, do not update it to | 252 // If some content is already displayed to the user, do not update it to |
| 253 // prevent updating the all the tiles without any action from the user. | 253 // prevent updating the all the tiles without any action from the user. |
| 254 self.freshMostVisitedData = data; | 254 self.freshMostVisitedData = data; |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 | 257 |
| 258 _mostVisitedData = data; | 258 _mostVisitedData = data; |
| 259 [self.consumer mostVisitedDataUpdated]; | 259 [self.consumer mostVisitedDataUpdated]; |
| 260 | 260 |
| 261 if (data.size() && !_recordedPageImpression) { | 261 if (data.size() && !_recordedPageImpression) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 [[GenericChromeCommand alloc] | 375 [[GenericChromeCommand alloc] |
| 376 initWithTag:_notification_promo->command_id()]); | 376 initWithTag:_notification_promo->command_id()]); |
| 377 [self.dispatcher chromeExecuteCommand:command]; | 377 [self.dispatcher chromeExecuteCommand:command]; |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 NOTREACHED(); | 380 NOTREACHED(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 #pragma mark - Private | 383 #pragma mark - Private |
| 384 | 384 |
| 385 - (void)useFreshData { | 385 - (void)useFreshData { |
|
justincohen
2017/06/06 15:47:34
Did we also want a DCHECK to confirm that |freshMo
gambard
2017/06/06 16:19:23
It seems complicated for a little gain in my opini
| |
| 386 if (self.freshMostVisitedData.size() == 0) { | |
| 387 return; | |
| 388 } | |
| 389 _mostVisitedData = self.freshMostVisitedData; | 386 _mostVisitedData = self.freshMostVisitedData; |
| 390 self.freshMostVisitedData.clear(); | |
| 391 [self.consumer mostVisitedDataUpdated]; | 387 [self.consumer mostVisitedDataUpdated]; |
| 392 } | 388 } |
| 393 | 389 |
| 394 @end | 390 @end |
| OLD | NEW |