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

Side by Side Diff: chrome/browser/history/history_backend.cc

Issue 7046049: Restore favicons to chrome://extensions and chrome://bookmarks page (among probably other things). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
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/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 icon_url, icon_types, &favicon.icon_type); 1709 icon_url, icon_types, &favicon.icon_type);
1710 if (favicon_id) { 1710 if (favicon_id) {
1711 scoped_refptr<RefCountedBytes> data = new RefCountedBytes(); 1711 scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
1712 favicon.known_icon = true; 1712 favicon.known_icon = true;
1713 Time last_updated; 1713 Time last_updated;
1714 if (thumbnail_db_->GetFavicon(favicon_id, &last_updated, &data->data, 1714 if (thumbnail_db_->GetFavicon(favicon_id, &last_updated, &data->data,
1715 NULL)) { 1715 NULL)) {
1716 favicon.expired = (Time::Now() - last_updated) > 1716 favicon.expired = (Time::Now() - last_updated) >
1717 TimeDelta::FromDays(kFaviconRefetchDays); 1717 TimeDelta::FromDays(kFaviconRefetchDays);
1718 favicon.image_data = data; 1718 favicon.image_data = data;
1719 favicon.icon_type = history::FAVICON;
michaelbai 2011/06/09 15:49:44 The favicon.icon_type should be returned from line
1719 } 1720 }
1720 1721
1721 if (page_url) 1722 if (page_url)
1722 SetFaviconMapping(*page_url, favicon_id, favicon.icon_type); 1723 SetFaviconMapping(*page_url, favicon_id, favicon.icon_type);
1723 } 1724 }
1724 // else case, haven't cached entry yet. Caller is responsible for 1725 // else case, haven't cached entry yet. Caller is responsible for
1725 // downloading the favicon and invoking SetFavicon. 1726 // downloading the favicon and invoking SetFavicon.
1726 } 1727 }
1727 request->ForwardResult(GetFaviconRequest::TupleType( 1728 request->ForwardResult(GetFaviconRequest::TupleType(
1728 request->handle(), favicon)); 1729 request->handle(), favicon));
(...skipping 17 matching lines...) Expand all
1746 scoped_refptr<RefCountedBytes> data = new RefCountedBytes(); 1747 scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
1747 if (thumbnail_db_->GetIconMappingsForPageURL(page_url, &icon_mappings) && 1748 if (thumbnail_db_->GetIconMappingsForPageURL(page_url, &icon_mappings) &&
1748 (icon_mappings.front().icon_type & icon_types) && 1749 (icon_mappings.front().icon_type & icon_types) &&
1749 thumbnail_db_->GetFavicon(icon_mappings.front().icon_id, &last_updated, 1750 thumbnail_db_->GetFavicon(icon_mappings.front().icon_id, &last_updated,
1750 &data->data, &favicon.icon_url)) { 1751 &data->data, &favicon.icon_url)) {
1751 favicon.known_icon = true; 1752 favicon.known_icon = true;
1752 favicon.expired = (Time::Now() - last_updated) > 1753 favicon.expired = (Time::Now() - last_updated) >
1753 TimeDelta::FromDays(kFaviconRefetchDays); 1754 TimeDelta::FromDays(kFaviconRefetchDays);
1754 favicon.icon_type = icon_mappings.front().icon_type; 1755 favicon.icon_type = icon_mappings.front().icon_type;
1755 favicon.image_data = data; 1756 favicon.image_data = data;
1757 favicon.icon_type = history::FAVICON;
michaelbai 2011/06/09 15:49:44 The favicon.icon_type should be set in line 1755.
Finnur 2011/06/09 16:01:57 Ah, yes. You are right. I'll remove this file enti
1756 } 1758 }
1757 1759
1758 UMA_HISTOGRAM_TIMES("History.GetFavIconForURL", // historical name 1760 UMA_HISTOGRAM_TIMES("History.GetFavIconForURL", // historical name
1759 TimeTicks::Now() - beginning_time); 1761 TimeTicks::Now() - beginning_time);
1760 } 1762 }
1761 1763
1762 request->ForwardResult( 1764 request->ForwardResult(
1763 GetFaviconRequest::TupleType(request->handle(), favicon)); 1765 GetFaviconRequest::TupleType(request->handle(), favicon));
1764 } 1766 }
1765 1767
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 return true; 2248 return true;
2247 } 2249 }
2248 2250
2249 BookmarkService* HistoryBackend::GetBookmarkService() { 2251 BookmarkService* HistoryBackend::GetBookmarkService() {
2250 if (bookmark_service_) 2252 if (bookmark_service_)
2251 bookmark_service_->BlockTillLoaded(); 2253 bookmark_service_->BlockTillLoaded();
2252 return bookmark_service_; 2254 return bookmark_service_;
2253 } 2255 }
2254 2256
2255 } // namespace history 2257 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('j') | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698