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

Side by Side Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2395483002: Allow top_sites to be null. (Closed)
Patch Set: Add comment/TODO. Created 4 years, 2 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
« no previous file with comments | « components/ntp_tiles/most_visited_sites.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/ntp_tiles/most_visited_sites.h" 5 #include "components/ntp_tiles/most_visited_sites.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 supervisor_(supervisor), 152 supervisor_(supervisor),
153 observer_(nullptr), 153 observer_(nullptr),
154 num_sites_(0), 154 num_sites_(0),
155 waiting_for_most_visited_sites_(true), 155 waiting_for_most_visited_sites_(true),
156 waiting_for_popular_sites_(true), 156 waiting_for_popular_sites_(true),
157 recorded_uma_(false), 157 recorded_uma_(false),
158 top_sites_observer_(this), 158 top_sites_observer_(this),
159 mv_source_(NTPTileSource::SUGGESTIONS_SERVICE), 159 mv_source_(NTPTileSource::SUGGESTIONS_SERVICE),
160 weak_ptr_factory_(this) { 160 weak_ptr_factory_(this) {
161 DCHECK(prefs_); 161 DCHECK(prefs_);
162 DCHECK(top_sites_); 162 // top_sites_ can be null in tests.
163 // TODO(sfiera): have iOS use a dummy TopSites in its tests.
163 DCHECK(suggestions_service_); 164 DCHECK(suggestions_service_);
164 if (supervisor_) 165 if (supervisor_)
165 supervisor_->SetObserver(this); 166 supervisor_->SetObserver(this);
166 } 167 }
167 168
168 MostVisitedSites::~MostVisitedSites() { 169 MostVisitedSites::~MostVisitedSites() {
169 if (supervisor_) 170 if (supervisor_)
170 supervisor_->SetObserver(nullptr); 171 supervisor_->SetObserver(nullptr);
171 } 172 }
172 173
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 545
545 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 546 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
546 ChangeReason change_reason) { 547 ChangeReason change_reason) {
547 if (mv_source_ == NTPTileSource::TOP_SITES) { 548 if (mv_source_ == NTPTileSource::TOP_SITES) {
548 // The displayed tiles are invalidated. 549 // The displayed tiles are invalidated.
549 InitiateTopSitesQuery(); 550 InitiateTopSitesQuery();
550 } 551 }
551 } 552 }
552 553
553 } // namespace ntp_tiles 554 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « components/ntp_tiles/most_visited_sites.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698