OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/thumbnail_generator.h" | 5 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 const GURL& url) { | 664 const GURL& url) { |
665 if (!profile || !top_sites) | 665 if (!profile || !top_sites) |
666 return false; | 666 return false; |
667 // Skip if it's in the incognito mode. | 667 // Skip if it's in the incognito mode. |
668 if (profile->IsOffTheRecord()) | 668 if (profile->IsOffTheRecord()) |
669 return false; | 669 return false; |
670 // Skip if the given URL is not appropriate for history. | 670 // Skip if the given URL is not appropriate for history. |
671 if (!HistoryService::CanAddURL(url)) | 671 if (!HistoryService::CanAddURL(url)) |
672 return false; | 672 return false; |
673 // Skip if the top sites list is full, and the URL is not known. | 673 // Skip if the top sites list is full, and the URL is not known. |
674 const bool is_known = top_sites->IsKnownURL(url); | 674 if (top_sites->IsFull() && !top_sites->IsKnownURL(url)) |
675 if (top_sites->IsFull() && !is_known) | |
676 return false; | 675 return false; |
677 // Skip if we don't have to udpate the existing thumbnail. | 676 // Skip if we don't have to udpate the existing thumbnail. Note that an |
| 677 // unknown URL can have a thumbnail score. This can happen if a |
| 678 // thumbnail is set but not yet saved. |
678 ThumbnailScore current_score; | 679 ThumbnailScore current_score; |
679 if (is_known && | 680 if (top_sites->GetPageThumbnailScore(url, ¤t_score) && |
680 top_sites->GetPageThumbnailScore(url, ¤t_score) && | |
681 !current_score.ShouldConsiderUpdating()) | 681 !current_score.ShouldConsiderUpdating()) |
682 return false; | 682 return false; |
683 | 683 |
684 return true; | 684 return true; |
685 } | 685 } |
OLD | NEW |