| 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 "chrome/browser/android/ntp/most_visited_sites.h" | 5 #include "chrome/browser/android/ntp/most_visited_sites.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } // namespace | 170 } // namespace |
| 171 | 171 |
| 172 MostVisitedSites::Suggestion::Suggestion() : provider_index(-1) {} | 172 MostVisitedSites::Suggestion::Suggestion() : provider_index(-1) {} |
| 173 | 173 |
| 174 MostVisitedSites::Suggestion::~Suggestion() {} | 174 MostVisitedSites::Suggestion::~Suggestion() {} |
| 175 | 175 |
| 176 MostVisitedSites::Suggestion::Suggestion(Suggestion&&) = default; | 176 MostVisitedSites::Suggestion::Suggestion(Suggestion&&) = default; |
| 177 MostVisitedSites::Suggestion& | 177 MostVisitedSites::Suggestion& |
| 178 MostVisitedSites::Suggestion::operator=(Suggestion&&) = default; | 178 MostVisitedSites::Suggestion::operator=(Suggestion&&) = default; |
| 179 | 179 |
| 180 MostVisitedSites::MostVisitedSites(Profile* profile) | 180 MostVisitedSites::MostVisitedSites( |
| 181 : profile_(profile), top_sites_(TopSitesFactory::GetForProfile(profile)), | 181 Profile* profile, |
| 182 variations::VariationsService* variations_service) |
| 183 : profile_(profile), variations_service_(variations_service), |
| 184 top_sites_(TopSitesFactory::GetForProfile(profile)), |
| 182 suggestions_service_(SuggestionsServiceFactory::GetForProfile(profile_)), | 185 suggestions_service_(SuggestionsServiceFactory::GetForProfile(profile_)), |
| 183 observer_(nullptr), num_sites_(0), | 186 observer_(nullptr), num_sites_(0), |
| 184 received_most_visited_sites_(false), received_popular_sites_(false), | 187 received_most_visited_sites_(false), received_popular_sites_(false), |
| 185 recorded_uma_(false), scoped_observer_(this), | 188 recorded_uma_(false), scoped_observer_(this), |
| 186 mv_source_(SUGGESTIONS_SERVICE), weak_ptr_factory_(this) { | 189 mv_source_(SUGGESTIONS_SERVICE), weak_ptr_factory_(this) { |
| 187 // Register the thumbnails debugging page. | 190 // Register the thumbnails debugging page. |
| 188 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 191 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
| 189 | 192 |
| 190 SupervisedUserService* supervised_user_service = | 193 SupervisedUserService* supervised_user_service = |
| 191 SupervisedUserServiceFactory::GetForProfile(profile_); | 194 SupervisedUserServiceFactory::GetForProfile(profile_); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 202 MostVisitedSites::Observer* observer, int num_sites) { | 205 MostVisitedSites::Observer* observer, int num_sites) { |
| 203 DCHECK(observer); | 206 DCHECK(observer); |
| 204 observer_ = observer; | 207 observer_ = observer; |
| 205 num_sites_ = num_sites; | 208 num_sites_ = num_sites; |
| 206 | 209 |
| 207 if (ShouldShowPopularSites() && | 210 if (ShouldShowPopularSites() && |
| 208 NeedPopularSites(profile_->GetPrefs(), num_sites_)) { | 211 NeedPopularSites(profile_->GetPrefs(), num_sites_)) { |
| 209 popular_sites_.reset(new PopularSites( | 212 popular_sites_.reset(new PopularSites( |
| 210 profile_->GetPrefs(), | 213 profile_->GetPrefs(), |
| 211 TemplateURLServiceFactory::GetForProfile(profile_), | 214 TemplateURLServiceFactory::GetForProfile(profile_), |
| 215 variations_service_, |
| 212 profile_->GetRequestContext(), | 216 profile_->GetRequestContext(), |
| 213 GetPopularSitesCountry(), | 217 GetPopularSitesCountry(), |
| 214 GetPopularSitesVersion(), | 218 GetPopularSitesVersion(), |
| 215 false, | 219 false, |
| 216 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, | 220 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, |
| 217 base::Unretained(this)))); | 221 base::Unretained(this)))); |
| 218 } else { | 222 } else { |
| 219 received_popular_sites_ = true; | 223 received_popular_sites_ = true; |
| 220 } | 224 } |
| 221 | 225 |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 | 776 |
| 773 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} | 777 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} |
| 774 | 778 |
| 775 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, | 779 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, |
| 776 ChangeReason change_reason) { | 780 ChangeReason change_reason) { |
| 777 if (mv_source_ == TOP_SITES) { | 781 if (mv_source_ == TOP_SITES) { |
| 778 // The displayed suggestions are invalidated. | 782 // The displayed suggestions are invalidated. |
| 779 InitiateTopSitesQuery(); | 783 InitiateTopSitesQuery(); |
| 780 } | 784 } |
| 781 } | 785 } |
| OLD | NEW |