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 #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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)), | 171 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)), |
172 weak_ptr_factory_(this) { | 172 weak_ptr_factory_(this) { |
173 DCHECK(suggestions_service_); | 173 DCHECK(suggestions_service_); |
174 supervisor_->SetObserver(this); | 174 supervisor_->SetObserver(this); |
175 } | 175 } |
176 | 176 |
177 MostVisitedSites::~MostVisitedSites() { | 177 MostVisitedSites::~MostVisitedSites() { |
178 supervisor_->SetObserver(nullptr); | 178 supervisor_->SetObserver(nullptr); |
179 } | 179 } |
180 | 180 |
181 #if defined(OS_ANDROID) | |
182 // static | |
183 bool MostVisitedSites::Register(JNIEnv* env) { | |
184 return RegisterNativesImpl(env); | |
185 } | |
186 #endif | |
187 | |
188 void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer, | 181 void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer, |
189 int num_sites) { | 182 int num_sites) { |
190 DCHECK(observer); | 183 DCHECK(observer); |
191 observer_ = observer; | 184 observer_ = observer; |
192 num_sites_ = num_sites; | 185 num_sites_ = num_sites; |
193 | 186 |
194 if (popular_sites_ && ShouldShowPopularSites() && | 187 if (popular_sites_ && ShouldShowPopularSites() && |
195 NeedPopularSites(prefs_, num_sites_)) { | 188 NeedPopularSites(prefs_, num_sites_)) { |
196 popular_sites_->StartFetch( | 189 popular_sites_->StartFetch( |
197 false, base::Bind(&MostVisitedSites::OnPopularSitesAvailable, | 190 false, base::Bind(&MostVisitedSites::OnPopularSitesAvailable, |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 552 |
560 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, | 553 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, |
561 ChangeReason change_reason) { | 554 ChangeReason change_reason) { |
562 if (mv_source_ == TOP_SITES) { | 555 if (mv_source_ == TOP_SITES) { |
563 // The displayed suggestions are invalidated. | 556 // The displayed suggestions are invalidated. |
564 InitiateTopSitesQuery(); | 557 InitiateTopSitesQuery(); |
565 } | 558 } |
566 } | 559 } |
567 | 560 |
568 } // namespace ntp_tiles | 561 } // namespace ntp_tiles |
OLD | NEW |