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 "components/history/core/browser/thumbnail_database.h" | 5 #include "components/history/core/browser/thumbnail_database.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 return false; | 666 return false; |
667 | 667 |
668 bool result = false; | 668 bool result = false; |
669 for (std::vector<IconMapping>::iterator m = mapping_data.begin(); | 669 for (std::vector<IconMapping>::iterator m = mapping_data.begin(); |
670 m != mapping_data.end(); ++m) { | 670 m != mapping_data.end(); ++m) { |
671 if (m->icon_type & required_icon_types) { | 671 if (m->icon_type & required_icon_types) { |
672 result = true; | 672 result = true; |
673 if (!filtered_mapping_data) | 673 if (!filtered_mapping_data) |
674 return result; | 674 return result; |
675 | 675 |
676 // Restrict icon type of subsequent matches to |m->icon_type|. | |
677 // |m->icon_type| is the largest IconType in |mapping_data| because | |
678 // |mapping_data| is sorted in descending order of IconType. | |
679 required_icon_types = m->icon_type; | |
680 | |
681 filtered_mapping_data->push_back(*m); | 676 filtered_mapping_data->push_back(*m); |
682 } | 677 } |
683 } | 678 } |
684 return result; | 679 return result; |
685 } | 680 } |
686 | 681 |
687 bool ThumbnailDatabase::GetIconMappingsForPageURL( | 682 bool ThumbnailDatabase::GetIconMappingsForPageURL( |
688 const GURL& page_url, | 683 const GURL& page_url, |
689 std::vector<IconMapping>* mapping_data) { | 684 std::vector<IconMapping>* mapping_data) { |
690 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, | 685 sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 meta_table_.SetVersionNumber(8); | 1058 meta_table_.SetVersionNumber(8); |
1064 meta_table_.SetCompatibleVersionNumber(std::min(8, kCompatibleVersionNumber)); | 1059 meta_table_.SetCompatibleVersionNumber(std::min(8, kCompatibleVersionNumber)); |
1065 return true; | 1060 return true; |
1066 } | 1061 } |
1067 | 1062 |
1068 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { | 1063 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { |
1069 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); | 1064 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); |
1070 } | 1065 } |
1071 | 1066 |
1072 } // namespace history | 1067 } // namespace history |
OLD | NEW |