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

Side by Side Diff: chrome/browser/thumbnails/thumbnail_service_impl.cc

Issue 53283004: Adding support for forced URLs to TopSites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed GetAllMostVisited. Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/thumbnails/thumbnail_service_impl.h" 5 #include "chrome/browser/thumbnails/thumbnail_service_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "chrome/browser/history/history_service.h" 9 #include "chrome/browser/history/history_service.h"
10 #include "chrome/browser/search/search.h" 10 #include "chrome/browser/search/search.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 bool ThumbnailServiceImpl::ShouldAcquirePageThumbnail(const GURL& url) { 72 bool ThumbnailServiceImpl::ShouldAcquirePageThumbnail(const GURL& url) {
73 scoped_refptr<history::TopSites> local_ptr(top_sites_); 73 scoped_refptr<history::TopSites> local_ptr(top_sites_);
74 74
75 if (local_ptr.get() == NULL) 75 if (local_ptr.get() == NULL)
76 return false; 76 return false;
77 77
78 // Skip if the given URL is not appropriate for history. 78 // Skip if the given URL is not appropriate for history.
79 if (!HistoryService::CanAddURL(url)) 79 if (!HistoryService::CanAddURL(url))
80 return false; 80 return false;
81 // Skip if the top sites list is full, and the URL is not known. 81 // Skip if the top sites list is full, and the URL is not known.
82 if (local_ptr->IsFull() && !local_ptr->IsKnownURL(url)) 82 if (local_ptr->IsNonForcedFull() && !local_ptr->IsKnownURL(url))
83 return false; 83 return false;
84 // Skip if we don't have to udpate the existing thumbnail. 84 // Skip if we don't have to udpate the existing thumbnail.
85 ThumbnailScore current_score; 85 ThumbnailScore current_score;
86 if (local_ptr->GetPageThumbnailScore(url, &current_score) && 86 if (local_ptr->GetPageThumbnailScore(url, &current_score) &&
87 !current_score.ShouldConsiderUpdating()) 87 !current_score.ShouldConsiderUpdating())
88 return false; 88 return false;
89 // Skip if we don't have to udpate the temporary thumbnail (i.e. the one 89 // Skip if we don't have to udpate the temporary thumbnail (i.e. the one
90 // not yet saved). 90 // not yet saved).
91 ThumbnailScore temporary_score; 91 ThumbnailScore temporary_score;
92 if (local_ptr->GetTemporaryPageThumbnailScore(url, &temporary_score) && 92 if (local_ptr->GetTemporaryPageThumbnailScore(url, &temporary_score) &&
93 !temporary_score.ShouldConsiderUpdating()) 93 !temporary_score.ShouldConsiderUpdating())
94 return false; 94 return false;
95 95
96 return true; 96 return true;
97 } 97 }
98 98
99 void ThumbnailServiceImpl::ShutdownOnUIThread() { 99 void ThumbnailServiceImpl::ShutdownOnUIThread() {
100 // Since each call uses its own scoped_refptr, we can just clear the reference 100 // Since each call uses its own scoped_refptr, we can just clear the reference
101 // here by assigning null. If another call is completed, it added its own 101 // here by assigning null. If another call is completed, it added its own
102 // reference. 102 // reference.
103 top_sites_ = NULL; 103 top_sites_ = NULL;
104 } 104 }
105 105
106 } // namespace thumbnails 106 } // namespace thumbnails
OLDNEW
« no previous file with comments | « chrome/browser/search/instant_service.cc ('k') | chrome/browser/thumbnails/thumbnail_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698