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/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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 &icon_mappings)) | 1652 &icon_mappings)) |
1653 return; | 1653 return; |
1654 | 1654 |
1655 for (std::vector<IconMapping>::iterator m = icon_mappings.begin(); | 1655 for (std::vector<IconMapping>::iterator m = icon_mappings.begin(); |
1656 m != icon_mappings.end(); ++m) { | 1656 m != icon_mappings.end(); ++m) { |
1657 thumbnail_db_->SetFaviconLastUpdateTime(m->icon_id, Time()); | 1657 thumbnail_db_->SetFaviconLastUpdateTime(m->icon_id, Time()); |
1658 } | 1658 } |
1659 ScheduleCommit(); | 1659 ScheduleCommit(); |
1660 } | 1660 } |
1661 | 1661 |
| 1662 void HistoryBackend::CloneFavicon(const GURL& old_page_url, |
| 1663 const GURL& new_page_url) { |
| 1664 if (!thumbnail_db_.get()) |
| 1665 return; |
| 1666 |
| 1667 // Prevent cross-domain cloning. |
| 1668 if (old_page_url.GetOrigin() != new_page_url.GetOrigin()) |
| 1669 return; |
| 1670 |
| 1671 thumbnail_db_->CloneIconMapping(old_page_url, new_page_url); |
| 1672 ScheduleCommit(); |
| 1673 } |
| 1674 |
1662 void HistoryBackend::SetImportedFavicons( | 1675 void HistoryBackend::SetImportedFavicons( |
1663 const std::vector<ImportedFaviconUsage>& favicon_usage) { | 1676 const std::vector<ImportedFaviconUsage>& favicon_usage) { |
1664 if (!db_.get() || !thumbnail_db_.get()) | 1677 if (!db_.get() || !thumbnail_db_.get()) |
1665 return; | 1678 return; |
1666 | 1679 |
1667 Time now = Time::Now(); | 1680 Time now = Time::Now(); |
1668 | 1681 |
1669 // Track all URLs that had their favicons set or updated. | 1682 // Track all URLs that had their favicons set or updated. |
1670 std::set<GURL> favicons_changed; | 1683 std::set<GURL> favicons_changed; |
1671 | 1684 |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 break; | 2316 break; |
2304 } | 2317 } |
2305 } | 2318 } |
2306 } | 2319 } |
2307 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name | 2320 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name |
2308 TimeTicks::Now() - beginning_time); | 2321 TimeTicks::Now() - beginning_time); |
2309 return success; | 2322 return success; |
2310 } | 2323 } |
2311 | 2324 |
2312 } // namespace history | 2325 } // namespace history |
OLD | NEW |