Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 1128343004: Allow favicons for synced bookmarks to expire (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Sync calls MergeFavicon() for all of the favicons that it manages at
1607 bitmap_id_sizes[i].bitmap_id, base::Time::Now()); 1607 // startup. Do not update the "last updated" time if the favicon bitmap
1608 // data matches that in the database.
1609 // TODO: Pass in boolean to MergeFavicon() if any users of
1610 // MergeFavicon() want the last_updated time to be updated when the new
1611 // bitmap data is identical to the old.
1608 bitmap_identical = true; 1612 bitmap_identical = true;
1609 } else { 1613 } else {
1610 // Expire the favicon bitmap because sync can provide incorrect 1614 // Expire the favicon bitmap because sync can provide incorrect
1611 // |bitmap_data|. See crbug.com/474421 for more details. Expiring the 1615 // |bitmap_data|. See crbug.com/474421 for more details. Expiring the
1612 // favicon bitmap causes it to be redownloaded the next time that the 1616 // favicon bitmap causes it to be redownloaded the next time that the
1613 // user visits any page which uses |icon_url|. 1617 // user visits any page which uses |icon_url|.
1614 thumbnail_db_->SetFaviconBitmap(bitmap_id_sizes[i].bitmap_id, 1618 thumbnail_db_->SetFaviconBitmap(bitmap_id_sizes[i].bitmap_id,
1615 bitmap_data, base::Time()); 1619 bitmap_data, base::Time());
1616 replaced_bitmap = true; 1620 replaced_bitmap = true;
1617 } 1621 }
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 return true; 2643 return true;
2640 } 2644 }
2641 2645
2642 HistoryClient* HistoryBackend::GetHistoryClient() { 2646 HistoryClient* HistoryBackend::GetHistoryClient() {
2643 if (history_client_) 2647 if (history_client_)
2644 history_client_->BlockUntilBookmarksLoaded(); 2648 history_client_->BlockUntilBookmarksLoaded();
2645 return history_client_; 2649 return history_client_;
2646 } 2650 }
2647 2651
2648 } // namespace history 2652 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_backend.h ('k') | components/history/core/browser/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698