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

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

Issue 2000653002: Replace the usage of SkBitmap with gfx::Image in the suggestion service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: accidental up load. This patchset was not committed with this CL Created 4 years, 6 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 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 "chrome/browser/android/ntp/most_visited_sites.h"
6 6
7 #include <algorithm>
8 #include <set>
9 #include <utility> 7 #include <utility>
10 8
11 #include "base/callback.h" 9 #include "base/callback.h"
12 #include "base/command_line.h" 10 #include "base/command_line.h"
13 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
15 #include "base/metrics/sparse_histogram.h" 13 #include "base/metrics/sparse_histogram.h"
16 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
20 #include "base/time/time.h" 18 #include "base/time/time.h"
21 #include "components/history/core/browser/top_sites.h" 19 #include "components/history/core/browser/top_sites.h"
22 #include "components/ntp_tiles/pref_names.h" 20 #include "components/ntp_tiles/pref_names.h"
23 #include "components/ntp_tiles/switches.h" 21 #include "components/ntp_tiles/switches.h"
24 #include "components/pref_registry/pref_registry_syncable.h" 22 #include "components/pref_registry/pref_registry_syncable.h"
25 #include "components/prefs/pref_service.h" 23 #include "components/prefs/pref_service.h"
26 #include "components/variations/variations_associated_data.h" 24 #include "components/variations/variations_associated_data.h"
25 #include "content/public/browser/browser_thread.h"
27 #include "third_party/skia/include/core/SkBitmap.h" 26 #include "third_party/skia/include/core/SkBitmap.h"
28 #include "ui/gfx/codec/jpeg_codec.h" 27 #include "ui/gfx/codec/jpeg_codec.h"
29 #include "url/gurl.h" 28 #include "url/gurl.h"
30 29
30 using content::BrowserThread;
31 using history::TopSites; 31 using history::TopSites;
32 using suggestions::ChromeSuggestion; 32 using suggestions::ChromeSuggestion;
33 using suggestions::SuggestionsProfile; 33 using suggestions::SuggestionsProfile;
34 using suggestions::SuggestionsService; 34 using suggestions::SuggestionsService;
35 35
36 namespace { 36 namespace {
37 37
38 // Identifiers for the various tile sources. 38 // Identifiers for the various tile sources.
39 const char kHistogramClientName[] = "client"; 39 const char kHistogramClientName[] = "client";
40 const char kHistogramServerName[] = "server"; 40 const char kHistogramServerName[] = "server";
(...skipping 15 matching lines...) Expand all
56 NONE, 56 NONE,
57 // The item displays a site's actual favicon or touch icon. 57 // The item displays a site's actual favicon or touch icon.
58 ICON_REAL, 58 ICON_REAL,
59 // The item displays a color derived from the site's favicon or touch icon. 59 // The item displays a color derived from the site's favicon or touch icon.
60 ICON_COLOR, 60 ICON_COLOR,
61 // The item displays a default gray box in place of an icon. 61 // The item displays a default gray box in place of an icon.
62 ICON_DEFAULT, 62 ICON_DEFAULT,
63 NUM_TILE_TYPES, 63 NUM_TILE_TYPES,
64 }; 64 };
65 65
66 // May only be called from blocking thread pool. 66 std::unique_ptr<SkBitmap> MaybeFetchLocalThumbnail(
67 std::unique_ptr<SkBitmap> TryFetchLocalThumbnail(
68 const GURL& url, 67 const GURL& url,
69 const scoped_refptr<TopSites>& top_sites) { 68 const scoped_refptr<TopSites>& top_sites) {
69 DCHECK_CURRENTLY_ON(BrowserThread::DB);
70 scoped_refptr<base::RefCountedMemory> image; 70 scoped_refptr<base::RefCountedMemory> image;
71 std::unique_ptr<SkBitmap> bitmap; 71 std::unique_ptr<SkBitmap> bitmap;
72 if (top_sites->GetPageThumbnail(url, false, &image)) 72 if (top_sites && top_sites->GetPageThumbnail(url, false, &image))
73 bitmap = gfx::JPEGCodec::Decode(image->front(), image->size()); 73 bitmap = gfx::JPEGCodec::Decode(image->front(), image->size());
74 return bitmap; 74 return bitmap;
75 } 75 }
76 76
77 // Log an event for a given |histogram| at a given element |position|. This 77 // Log an event for a given |histogram| at a given element |position|. This
78 // routine exists because regular histogram macros are cached thus can't be used 78 // routine exists because regular histogram macros are cached thus can't be used
79 // if the name of the histogram will change at a given call site. 79 // if the name of the histogram will change at a given call site.
80 void LogHistogramEvent(const std::string& histogram, 80 void LogHistogramEvent(const std::string& histogram,
81 int position, 81 int position,
82 int num_sites) { 82 int num_sites) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 MostVisitedSites::Suggestion::Suggestion() : provider_index(-1) {} 163 MostVisitedSites::Suggestion::Suggestion() : provider_index(-1) {}
164 164
165 MostVisitedSites::Suggestion::~Suggestion() {} 165 MostVisitedSites::Suggestion::~Suggestion() {}
166 166
167 MostVisitedSites::Suggestion::Suggestion(Suggestion&&) = default; 167 MostVisitedSites::Suggestion::Suggestion(Suggestion&&) = default;
168 MostVisitedSites::Suggestion& 168 MostVisitedSites::Suggestion&
169 MostVisitedSites::Suggestion::operator=(Suggestion&&) = default; 169 MostVisitedSites::Suggestion::operator=(Suggestion&&) = default;
170 170
171 MostVisitedSites::MostVisitedSites( 171 MostVisitedSites::MostVisitedSites(
172 scoped_refptr<base::SequencedWorkerPool> blocking_pool,
173 PrefService* prefs, 172 PrefService* prefs,
174 const TemplateURLService* template_url_service, 173 const TemplateURLService* template_url_service,
175 variations::VariationsService* variations_service, 174 variations::VariationsService* variations_service,
176 net::URLRequestContextGetter* download_context, 175 net::URLRequestContextGetter* download_context,
177 const base::FilePath& popular_sites_directory, 176 const base::FilePath& popular_sites_directory,
178 scoped_refptr<history::TopSites> top_sites, 177 scoped_refptr<history::TopSites> top_sites,
179 SuggestionsService* suggestions, 178 SuggestionsService* suggestions,
180 MostVisitedSitesSupervisor* supervisor) 179 MostVisitedSitesSupervisor* supervisor)
181 : prefs_(prefs), 180 : prefs_(prefs),
182 template_url_service_(template_url_service), 181 template_url_service_(template_url_service),
183 variations_service_(variations_service), 182 variations_service_(variations_service),
184 download_context_(download_context), 183 download_context_(download_context),
185 popular_sites_directory_(popular_sites_directory), 184 popular_sites_directory_(popular_sites_directory),
186 top_sites_(top_sites), 185 top_sites_(top_sites),
187 suggestions_service_(suggestions), 186 suggestions_service_(suggestions),
188 supervisor_(supervisor), 187 supervisor_(supervisor),
189 observer_(nullptr), 188 observer_(nullptr),
190 num_sites_(0), 189 num_sites_(0),
191 received_most_visited_sites_(false), 190 received_most_visited_sites_(false),
192 received_popular_sites_(false), 191 received_popular_sites_(false),
193 recorded_uma_(false), 192 recorded_uma_(false),
194 scoped_observer_(this), 193 scoped_observer_(this),
195 mv_source_(SUGGESTIONS_SERVICE), 194 mv_source_(SUGGESTIONS_SERVICE),
196 blocking_pool_(std::move(blocking_pool)),
197 blocking_runner_(blocking_pool_->GetTaskRunnerWithShutdownBehavior(
198 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)),
199 weak_ptr_factory_(this) { 195 weak_ptr_factory_(this) {
200 DCHECK(top_sites_);
201 DCHECK(suggestions_service_);
202 supervisor_->SetObserver(this); 196 supervisor_->SetObserver(this);
203 } 197 }
204 198
205 MostVisitedSites::~MostVisitedSites() { 199 MostVisitedSites::~MostVisitedSites() {
206 supervisor_->SetObserver(nullptr); 200 supervisor_->SetObserver(nullptr);
207 } 201 }
208 202
209 void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer, 203 void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer,
210 int num_sites) { 204 int num_sites) {
211 DCHECK(observer); 205 DCHECK(observer);
212 observer_ = observer; 206 observer_ = observer;
213 num_sites_ = num_sites; 207 num_sites_ = num_sites;
214 208
215 if (ShouldShowPopularSites() && 209 if (ShouldShowPopularSites() &&
216 NeedPopularSites(prefs_, num_sites_)) { 210 NeedPopularSites(prefs_, num_sites_)) {
217 popular_sites_.reset(new PopularSites( 211 popular_sites_.reset(new PopularSites(
218 blocking_pool_, prefs_, template_url_service_, variations_service_, 212 prefs_, template_url_service_, variations_service_, download_context_,
219 download_context_, popular_sites_directory_, GetPopularSitesCountry(), 213 popular_sites_directory_, GetPopularSitesCountry(),
220 GetPopularSitesVersion(), false, 214 GetPopularSitesVersion(), false,
221 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, 215 base::Bind(&MostVisitedSites::OnPopularSitesAvailable,
222 base::Unretained(this)))); 216 base::Unretained(this))));
223 } else { 217 } else {
224 received_popular_sites_ = true; 218 received_popular_sites_ = true;
225 } 219 }
226 220
227 // TopSites updates itself after a delay. To ensure up-to-date results, 221 // TODO(treib): Can |top_sites_| ever be null? If not, remove these checks.
228 // force an update now. 222 if (top_sites_) {
229 top_sites_->SyncWithHistory(); 223 // TopSites updates itself after a delay. To ensure up-to-date results,
224 // force an update now.
225 top_sites_->SyncWithHistory();
230 226
231 // Register as TopSitesObserver so that we can update ourselves when the 227 // Register as TopSitesObserver so that we can update ourselves when the
232 // TopSites changes. 228 // TopSites changes.
233 scoped_observer_.Add(top_sites_.get()); 229 scoped_observer_.Add(top_sites_.get());
230 }
234 231
235 suggestions_subscription_ = suggestions_service_->AddCallback( 232 suggestions_subscription_ = suggestions_service_->AddCallback(
236 base::Bind(&MostVisitedSites::OnSuggestionsProfileAvailable, 233 base::Bind(&MostVisitedSites::OnSuggestionsProfileAvailable,
237 base::Unretained(this))); 234 base::Unretained(this)));
238 235
239 // Immediately build the current suggestions, getting personal suggestions 236 // Immediately build the current suggestions, getting personal suggestions
240 // from the SuggestionsService's cache or, if that is empty, from TopSites. 237 // from the SuggestionsService's cache or, if that is empty, from TopSites.
241 BuildCurrentSuggestions(); 238 BuildCurrentSuggestions();
242 // Also start a request for fresh suggestions. 239 // Also start a request for fresh suggestions.
243 suggestions_service_->FetchSuggestionsData(); 240 suggestions_service_->FetchSuggestionsData();
244 } 241 }
245 242
246 void MostVisitedSites::GetURLThumbnail(const GURL& url, 243 void MostVisitedSites::GetURLThumbnail(const GURL& url,
247 const ThumbnailCallback& callback) { 244 const ThumbnailCallback& callback) {
248 DCHECK(thread_checker_.CalledOnValidThread()); 245 DCHECK_CURRENTLY_ON(BrowserThread::UI);
249 246
250 base::PostTaskAndReplyWithResult( 247 // TODO(treib): Move this to the blocking pool? Doesn't seem related to DB.
251 blocking_runner_.get(), FROM_HERE, 248 BrowserThread::PostTaskAndReplyWithResult(
252 base::Bind(&TryFetchLocalThumbnail, url, top_sites_), 249 BrowserThread::DB, FROM_HERE,
250 base::Bind(&MaybeFetchLocalThumbnail, url, top_sites_),
253 base::Bind(&MostVisitedSites::OnLocalThumbnailFetched, 251 base::Bind(&MostVisitedSites::OnLocalThumbnailFetched,
254 weak_ptr_factory_.GetWeakPtr(), url, callback)); 252 weak_ptr_factory_.GetWeakPtr(), url, callback));
255 } 253 }
256 254
257 void MostVisitedSites::OnLocalThumbnailFetched( 255 void MostVisitedSites::OnLocalThumbnailFetched(
258 const GURL& url, 256 const GURL& url,
259 const ThumbnailCallback& callback, 257 const ThumbnailCallback& callback,
260 std::unique_ptr<SkBitmap> bitmap) { 258 std::unique_ptr<SkBitmap> bitmap) {
261 DCHECK(thread_checker_.CalledOnValidThread()); 259 DCHECK_CURRENTLY_ON(BrowserThread::UI);
262 if (bitmap.get()) { 260 if (bitmap.get()) {
263 callback.Run(true /* is_local_thumbnail */, bitmap.get()); 261 callback.Run(true /* is_local_thumbnail */, bitmap.get());
264 return; 262 return;
265 } 263 }
266 264
267 // A thumbnail is not locally available for |url|. Make sure it is put in 265 // A thumbnail is not locally available for |url|. Make sure it is put in
268 // the list to be fetched at the next visit to this site. 266 // the list to be fetched at the next visit to this site.
269 top_sites_->AddForcedURL(url, base::Time::Now()); 267 if (top_sites_)
268 top_sites_->AddForcedURL(url, base::Time::Now());
270 // Also fetch a remote thumbnail if possible. PopularSites or the 269 // Also fetch a remote thumbnail if possible. PopularSites or the
271 // SuggestionsService can supply a thumbnail download URL. 270 // SuggestionsService can supply a thumbnail download URL.
272 if (popular_sites_) { 271 if (popular_sites_) {
273 const std::vector<PopularSites::Site>& sites = popular_sites_->sites(); 272 const std::vector<PopularSites::Site>& sites = popular_sites_->sites();
274 auto it = std::find_if( 273 auto it = std::find_if(
275 sites.begin(), sites.end(), 274 sites.begin(), sites.end(),
276 [&url](const PopularSites::Site& site) { return site.url == url; }); 275 [&url](const PopularSites::Site& site) { return site.url == url; });
277 if (it != sites.end() && it->thumbnail_url.is_valid()) { 276 if (it != sites.end() && it->thumbnail_url.is_valid()) {
278 return suggestions_service_->GetPageThumbnailWithURL( 277 return suggestions_service_->GetPageThumbnailWithURL(
279 url, it->thumbnail_url, 278 url, it->thumbnail_url,
280 base::Bind(&MostVisitedSites::OnObtainedThumbnail, 279 base::Bind(&MostVisitedSites::OnObtainedThumbnail,
281 weak_ptr_factory_.GetWeakPtr(), false, callback)); 280 weak_ptr_factory_.GetWeakPtr(), false, callback));
282 } 281 }
283 } 282 }
284 if (mv_source_ == SUGGESTIONS_SERVICE) { 283 if (mv_source_ == SUGGESTIONS_SERVICE) {
285 return suggestions_service_->GetPageThumbnail( 284 return suggestions_service_->GetPageThumbnail(
286 url, base::Bind(&MostVisitedSites::OnObtainedThumbnail, 285 url, base::Bind(&MostVisitedSites::OnObtainedThumbnail,
287 weak_ptr_factory_.GetWeakPtr(), false, callback)); 286 weak_ptr_factory_.GetWeakPtr(), false, callback));
288 } 287 }
289 // If no bitmap could be fetched and neither PopularSites nor the 288 // If no bitmap could be fetched and neither PopularSites nor the
290 // SuggestionsService is available then a nullptr is passed to the callback. 289 // SuggestionsService is available then a nullptr is passed to the callback.
291 callback.Run(true /* is_local_thumbnail */, nullptr); 290 callback.Run(true /* is_local_thumbnail */, nullptr);
292 } 291 }
293 292
294 void MostVisitedSites::OnObtainedThumbnail(bool is_local_thumbnail, 293 void MostVisitedSites::OnObtainedThumbnail(bool is_local_thumbnail,
295 const ThumbnailCallback& callback, 294 const ThumbnailCallback& callback,
296 const GURL& url, 295 const GURL& url,
297 const gfx::Image& image) { 296 const gfx::Image& image) {
298 DCHECK(thread_checker_.CalledOnValidThread()); 297 DCHECK_CURRENTLY_ON(BrowserThread::UI);
299 const SkBitmap* bitmap = nullptr; 298 const SkBitmap* bitmap = nullptr;
300 if (!image.IsEmpty()) 299 if (!image.IsEmpty())
301 bitmap = image.ToSkBitmap(); 300 bitmap = image.ToSkBitmap();
302 callback.Run(is_local_thumbnail, bitmap); 301 callback.Run(is_local_thumbnail, bitmap);
303 } 302 }
304 303
305 void MostVisitedSites::AddOrRemoveBlacklistedUrl(const GURL& url, 304 void MostVisitedSites::AddOrRemoveBlacklistedUrl(const GURL& url,
306 bool add_url) { 305 bool add_url) {
307 // Always blacklist in the local TopSites. 306 // Always blacklist in the local TopSites.
308 if (add_url) 307 if (top_sites_) {
309 top_sites_->AddBlacklistedURL(url); 308 if (add_url)
310 else 309 top_sites_->AddBlacklistedURL(url);
311 top_sites_->RemoveBlacklistedURL(url); 310 else
311 top_sites_->RemoveBlacklistedURL(url);
312 }
312 313
313 // Only blacklist in the server-side suggestions service if it's active. 314 // Only blacklist in the server-side suggestions service if it's active.
314 if (mv_source_ == SUGGESTIONS_SERVICE) { 315 if (mv_source_ == SUGGESTIONS_SERVICE) {
315 if (add_url) 316 if (add_url)
316 suggestions_service_->BlacklistURL(url); 317 suggestions_service_->BlacklistURL(url);
317 else 318 else
318 suggestions_service_->UndoBlacklistURL(url); 319 suggestions_service_->UndoBlacklistURL(url);
319 } 320 }
320 } 321 }
321 322
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 372 }
372 373
373 void MostVisitedSites::BuildCurrentSuggestions() { 374 void MostVisitedSites::BuildCurrentSuggestions() {
374 // Get the current suggestions from cache. If the cache is empty, this will 375 // Get the current suggestions from cache. If the cache is empty, this will
375 // fall back to TopSites. 376 // fall back to TopSites.
376 OnSuggestionsProfileAvailable( 377 OnSuggestionsProfileAvailable(
377 suggestions_service_->GetSuggestionsDataFromCache()); 378 suggestions_service_->GetSuggestionsDataFromCache());
378 } 379 }
379 380
380 void MostVisitedSites::InitiateTopSitesQuery() { 381 void MostVisitedSites::InitiateTopSitesQuery() {
382 if (!top_sites_)
383 return;
384
381 top_sites_->GetMostVisitedURLs( 385 top_sites_->GetMostVisitedURLs(
382 base::Bind(&MostVisitedSites::OnMostVisitedURLsAvailable, 386 base::Bind(&MostVisitedSites::OnMostVisitedURLsAvailable,
383 weak_ptr_factory_.GetWeakPtr()), 387 weak_ptr_factory_.GetWeakPtr()),
384 false); 388 false);
385 } 389 }
386 390
387 base::FilePath MostVisitedSites::GetWhitelistLargeIconPath(const GURL& url) { 391 base::FilePath MostVisitedSites::GetWhitelistLargeIconPath(const GURL& url) {
388 for (const auto& whitelist : supervisor_->whitelists()) { 392 for (const auto& whitelist : supervisor_->whitelists()) {
389 if (AreURLsEquivalent(whitelist.entry_point, url)) 393 if (AreURLsEquivalent(whitelist.entry_point, url))
390 return whitelist.large_icon_path; 394 return whitelist.large_icon_path;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 468
465 size_t num_whitelist_suggestions = num_sites_ - num_personal_suggestions; 469 size_t num_whitelist_suggestions = num_sites_ - num_personal_suggestions;
466 SuggestionsPtrVector whitelist_suggestions; 470 SuggestionsPtrVector whitelist_suggestions;
467 471
468 std::set<std::string> personal_hosts; 472 std::set<std::string> personal_hosts;
469 for (const auto& suggestion : personal_suggestions) 473 for (const auto& suggestion : personal_suggestions)
470 personal_hosts.insert(suggestion->url.host()); 474 personal_hosts.insert(suggestion->url.host());
471 475
472 for (const auto& whitelist : supervisor_->whitelists()) { 476 for (const auto& whitelist : supervisor_->whitelists()) {
473 // Skip blacklisted sites. 477 // Skip blacklisted sites.
474 if (top_sites_->IsBlacklisted(whitelist.entry_point)) 478 if (top_sites_ && top_sites_->IsBlacklisted(whitelist.entry_point))
475 continue; 479 continue;
476 480
477 // Skip suggestions already present. 481 // Skip suggestions already present.
478 if (personal_hosts.find(whitelist.entry_point.host()) != 482 if (personal_hosts.find(whitelist.entry_point.host()) !=
479 personal_hosts.end()) 483 personal_hosts.end())
480 continue; 484 continue;
481 485
482 // Skip whitelist entry points that are manually blocked. 486 // Skip whitelist entry points that are manually blocked.
483 if (supervisor_->IsBlocked(whitelist.entry_point)) 487 if (supervisor_->IsBlocked(whitelist.entry_point))
484 continue; 488 continue;
(...skipping 30 matching lines...) Expand all
515 SuggestionsPtrVector popular_sites_suggestions; 519 SuggestionsPtrVector popular_sites_suggestions;
516 520
517 if (num_popular_sites_suggestions > 0 && popular_sites_) { 521 if (num_popular_sites_suggestions > 0 && popular_sites_) {
518 std::set<std::string> hosts; 522 std::set<std::string> hosts;
519 for (const auto& suggestion : personal_suggestions) 523 for (const auto& suggestion : personal_suggestions)
520 hosts.insert(suggestion->url.host()); 524 hosts.insert(suggestion->url.host());
521 for (const auto& suggestion : whitelist_suggestions) 525 for (const auto& suggestion : whitelist_suggestions)
522 hosts.insert(suggestion->url.host()); 526 hosts.insert(suggestion->url.host());
523 for (const PopularSites::Site& popular_site : popular_sites_->sites()) { 527 for (const PopularSites::Site& popular_site : popular_sites_->sites()) {
524 // Skip blacklisted sites. 528 // Skip blacklisted sites.
525 if (top_sites_->IsBlacklisted(popular_site.url)) 529 if (top_sites_ && top_sites_->IsBlacklisted(popular_site.url))
526 continue; 530 continue;
527 std::string host = popular_site.url.host(); 531 std::string host = popular_site.url.host();
528 // Skip suggestions already present in personal or whitelists. 532 // Skip suggestions already present in personal or whitelists.
529 if (hosts.find(host) != hosts.end()) 533 if (hosts.find(host) != hosts.end())
530 continue; 534 continue;
531 535
532 std::unique_ptr<Suggestion> suggestion(new Suggestion()); 536 std::unique_ptr<Suggestion> suggestion(new Suggestion());
533 suggestion->title = popular_site.title; 537 suggestion->title = popular_site.title;
534 suggestion->url = GURL(popular_site.url); 538 suggestion->url = GURL(popular_site.url);
535 suggestion->source = POPULAR; 539 suggestion->source = POPULAR;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 653
650 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} 654 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {}
651 655
652 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 656 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
653 ChangeReason change_reason) { 657 ChangeReason change_reason) {
654 if (mv_source_ == TOP_SITES) { 658 if (mv_source_ == TOP_SITES) {
655 // The displayed suggestions are invalidated. 659 // The displayed suggestions are invalidated.
656 InitiateTopSitesQuery(); 660 InitiateTopSitesQuery();
657 } 661 }
658 } 662 }
OLDNEW
« no previous file with comments | « chrome/browser/android/ntp/most_visited_sites.h ('k') | chrome/browser/android/ntp/most_visited_sites_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698