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

Side by Side Diff: chrome/browser/android/ntp/popular_sites.cc

Issue 1919823002: Update MostVisitedSites observer interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/popular_sites.h" 5 #include "chrome/browser/android/ntp/popular_sites.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 sites->push_back(PopularSites::Site(title, GURL(url), GURL(favicon_url), 157 sites->push_back(PopularSites::Site(title, GURL(url), GURL(favicon_url),
158 GURL(large_icon_url), 158 GURL(large_icon_url),
159 GURL(thumbnail_url))); 159 GURL(thumbnail_url)));
160 } 160 }
161 161
162 return sites; 162 return sites;
163 } 163 }
164 164
165 } // namespace 165 } // namespace
166 166
167 PopularSites::Site::Site(const base::string16& title, 167 PopularSites_Site::PopularSites_Site(const base::string16& title,
168 const GURL& url, 168 const GURL& url,
169 const GURL& favicon_url, 169 const GURL& favicon_url,
170 const GURL& large_icon_url, 170 const GURL& large_icon_url,
171 const GURL& thumbnail_url) 171 const GURL& thumbnail_url)
172 : title(title), 172 : title(title),
173 url(url), 173 url(url),
174 favicon_url(favicon_url), 174 favicon_url(favicon_url),
175 large_icon_url(large_icon_url), 175 large_icon_url(large_icon_url),
176 thumbnail_url(thumbnail_url) {} 176 thumbnail_url(thumbnail_url) {}
177 177
178 PopularSites::Site::Site(const Site& other) = default; 178 PopularSites_Site::PopularSites_Site(const PopularSites_Site& other)
179 = default;
179 180
180 PopularSites::Site::~Site() {} 181 PopularSites_Site::~PopularSites_Site() {}
181 182
182 PopularSites::PopularSites(Profile* profile, 183 PopularSites::PopularSites(Profile* profile,
183 const std::string& override_country, 184 const std::string& override_country,
184 const std::string& override_version, 185 const std::string& override_version,
185 bool force_download, 186 bool force_download,
186 const FinishedCallback& callback) 187 const FinishedCallback& callback)
187 : PopularSites(profile, 188 : PopularSites(profile,
188 GetCountryToUse(profile, override_country), 189 GetCountryToUse(profile, override_country),
189 GetVersionToUse(override_version), 190 GetVersionToUse(override_version),
190 GURL(), 191 GURL(),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 base::Bind(&PopularSites::OnJsonParsed, weak_ptr_factory_.GetWeakPtr())); 304 base::Bind(&PopularSites::OnJsonParsed, weak_ptr_factory_.GetWeakPtr()));
304 } 305 }
305 306
306 void PopularSites::OnJsonParsed(std::unique_ptr<std::vector<Site>> sites) { 307 void PopularSites::OnJsonParsed(std::unique_ptr<std::vector<Site>> sites) {
307 if (sites) 308 if (sites)
308 sites_.swap(*sites); 309 sites_.swap(*sites);
309 else 310 else
310 sites_.clear(); 311 sites_.clear();
311 callback_.Run(!!sites); 312 callback_.Run(!!sites);
312 } 313 }
OLDNEW
« chrome/browser/android/ntp/most_visited_sites.h ('K') | « chrome/browser/android/ntp/popular_sites.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698