| 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/history_backend.h" | 5 #include "components/history/core/browser/history_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 std::vector<FaviconBitmapIDSize> bitmap_id_sizes; | 1596 std::vector<FaviconBitmapIDSize> bitmap_id_sizes; |
| 1597 thumbnail_db_->GetFaviconBitmapIDSizes(favicon_id, &bitmap_id_sizes); | 1597 thumbnail_db_->GetFaviconBitmapIDSizes(favicon_id, &bitmap_id_sizes); |
| 1598 | 1598 |
| 1599 // If there is already a favicon bitmap of |pixel_size| at |icon_url|, | 1599 // If there is already a favicon bitmap of |pixel_size| at |icon_url|, |
| 1600 // replace it. | 1600 // replace it. |
| 1601 bool bitmap_identical = false; | 1601 bool bitmap_identical = false; |
| 1602 bool replaced_bitmap = false; | 1602 bool replaced_bitmap = false; |
| 1603 for (size_t i = 0; i < bitmap_id_sizes.size(); ++i) { | 1603 for (size_t i = 0; i < bitmap_id_sizes.size(); ++i) { |
| 1604 if (bitmap_id_sizes[i].pixel_size == pixel_size) { | 1604 if (bitmap_id_sizes[i].pixel_size == pixel_size) { |
| 1605 if (IsFaviconBitmapDataEqual(bitmap_id_sizes[i].bitmap_id, bitmap_data)) { | 1605 if (IsFaviconBitmapDataEqual(bitmap_id_sizes[i].bitmap_id, bitmap_data)) { |
| 1606 thumbnail_db_->SetFaviconBitmapLastUpdateTime( | 1606 // TODO: Pass in boolean to MergeFavicon() if any users of |
| 1607 bitmap_id_sizes[i].bitmap_id, base::Time::Now()); | 1607 // MergeFavicon() want the last_updated time to be updated when the new |
| 1608 // bitmap data is identical to the old. |
| 1608 bitmap_identical = true; | 1609 bitmap_identical = true; |
| 1609 } else { | 1610 } else { |
| 1610 // Expire the favicon bitmap because sync can provide incorrect | 1611 // Expire the favicon bitmap because sync can provide incorrect |
| 1611 // |bitmap_data|. See crbug.com/474421 for more details. Expiring the | 1612 // |bitmap_data|. See crbug.com/474421 for more details. Expiring the |
| 1612 // favicon bitmap causes it to be redownloaded the next time that the | 1613 // favicon bitmap causes it to be redownloaded the next time that the |
| 1613 // user visits any page which uses |icon_url|. | 1614 // user visits any page which uses |icon_url|. |
| 1614 thumbnail_db_->SetFaviconBitmap(bitmap_id_sizes[i].bitmap_id, | 1615 thumbnail_db_->SetFaviconBitmap(bitmap_id_sizes[i].bitmap_id, |
| 1615 bitmap_data, base::Time()); | 1616 bitmap_data, base::Time()); |
| 1616 replaced_bitmap = true; | 1617 replaced_bitmap = true; |
| 1617 } | 1618 } |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 return true; | 2640 return true; |
| 2640 } | 2641 } |
| 2641 | 2642 |
| 2642 HistoryClient* HistoryBackend::GetHistoryClient() { | 2643 HistoryClient* HistoryBackend::GetHistoryClient() { |
| 2643 if (history_client_) | 2644 if (history_client_) |
| 2644 history_client_->BlockUntilBookmarksLoaded(); | 2645 history_client_->BlockUntilBookmarksLoaded(); |
| 2645 return history_client_; | 2646 return history_client_; |
| 2646 } | 2647 } |
| 2647 | 2648 |
| 2648 } // namespace history | 2649 } // namespace history |
| OLD | NEW |