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. |
678 ThumbnailScore current_score; | 677 ThumbnailScore current_score; |
679 if (is_known && | 678 if (top_sites->GetPageThumbnailScore(url, ¤t_score) && |
680 top_sites->GetPageThumbnailScore(url, ¤t_score) && | |
681 !current_score.ShouldConsiderUpdating()) | 679 !current_score.ShouldConsiderUpdating()) |
682 return false; | 680 return false; |
| 681 // Skip if we don't have to udpate the temporary thumbnail (i.e. the one |
| 682 // not yet saved). |
| 683 ThumbnailScore temporary_score; |
| 684 if (top_sites->GetTemporaryPageThumbnailScore(url, &temporary_score) && |
| 685 !temporary_score.ShouldConsiderUpdating()) |
| 686 return false; |
683 | 687 |
684 return true; | 688 return true; |
685 } | 689 } |
OLD | NEW |