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