OLD | NEW |
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 Loading... |
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, ¤t_score) && | 86 if (local_ptr->GetPageThumbnailScore(url, ¤t_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 |
OLD | NEW |