| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // | 633 // |
| 634 // However, in most cases, we'll get at least a title and usually contents, | 634 // However, in most cases, we'll get at least a title and usually contents, |
| 635 // and this add will be redundant, slowing everything down. As a result, | 635 // and this add will be redundant, slowing everything down. As a result, |
| 636 // we ignore this edge case. | 636 // we ignore this edge case. |
| 637 } | 637 } |
| 638 | 638 |
| 639 // Add the visit with the time to the database. | 639 // Add the visit with the time to the database. |
| 640 VisitRow visit_info(url_id, time, referring_visit, transition, 0); | 640 VisitRow visit_info(url_id, time, referring_visit, transition, 0); |
| 641 VisitID visit_id = db_->AddVisit(&visit_info); | 641 VisitID visit_id = db_->AddVisit(&visit_info); |
| 642 | 642 |
| 643 if (visit_info.visit_time < first_recorded_time_) |
| 644 first_recorded_time_ = visit_info.visit_time; |
| 645 |
| 643 // Broadcast a notification of the visit. | 646 // Broadcast a notification of the visit. |
| 644 if (visit_id) { | 647 if (visit_id) { |
| 645 URLVisitedDetails* details = new URLVisitedDetails; | 648 URLVisitedDetails* details = new URLVisitedDetails; |
| 646 details->row = url_info; | 649 details->row = url_info; |
| 647 BroadcastNotifications(NotificationType::HISTORY_URL_VISITED, details); | 650 BroadcastNotifications(NotificationType::HISTORY_URL_VISITED, details); |
| 648 } | 651 } |
| 649 | 652 |
| 650 return std::make_pair(url_id, visit_id); | 653 return std::make_pair(url_id, visit_id); |
| 651 } | 654 } |
| 652 | 655 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 | 713 |
| 711 // Make up a visit to correspond to that page. | 714 // Make up a visit to correspond to that page. |
| 712 VisitRow visit_info(url_id, i->last_visit(), 0, | 715 VisitRow visit_info(url_id, i->last_visit(), 0, |
| 713 PageTransition::LINK | PageTransition::CHAIN_START | | 716 PageTransition::LINK | PageTransition::CHAIN_START | |
| 714 PageTransition::CHAIN_END, 0); | 717 PageTransition::CHAIN_END, 0); |
| 715 visit_info.is_indexed = has_indexed; | 718 visit_info.is_indexed = has_indexed; |
| 716 if (!visit_database->AddVisit(&visit_info)) { | 719 if (!visit_database->AddVisit(&visit_info)) { |
| 717 NOTREACHED() << "Adding visit failed."; | 720 NOTREACHED() << "Adding visit failed."; |
| 718 return; | 721 return; |
| 719 } | 722 } |
| 723 |
| 724 if (visit_info.visit_time < first_recorded_time_) |
| 725 first_recorded_time_ = visit_info.visit_time; |
| 720 } | 726 } |
| 721 | 727 |
| 722 // Broadcast a notification for typed URLs that have been modified. This | 728 // Broadcast a notification for typed URLs that have been modified. This |
| 723 // will be picked up by the in-memory URL database on the main thread. | 729 // will be picked up by the in-memory URL database on the main thread. |
| 724 // | 730 // |
| 725 // TODO(brettw) bug 1140015: Add an "add page" notification so the history | 731 // TODO(brettw) bug 1140015: Add an "add page" notification so the history |
| 726 // views can keep in sync. | 732 // views can keep in sync. |
| 727 BroadcastNotifications(NotificationType::HISTORY_TYPED_URLS_MODIFIED, | 733 BroadcastNotifications(NotificationType::HISTORY_TYPED_URLS_MODIFIED, |
| 728 modified); | 734 modified); |
| 729 | 735 |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 return true; | 1853 return true; |
| 1848 } | 1854 } |
| 1849 | 1855 |
| 1850 BookmarkService* HistoryBackend::GetBookmarkService() { | 1856 BookmarkService* HistoryBackend::GetBookmarkService() { |
| 1851 if (bookmark_service_) | 1857 if (bookmark_service_) |
| 1852 bookmark_service_->BlockTillLoaded(); | 1858 bookmark_service_->BlockTillLoaded(); |
| 1853 return bookmark_service_; | 1859 return bookmark_service_; |
| 1854 } | 1860 } |
| 1855 | 1861 |
| 1856 } // namespace history | 1862 } // namespace history |
| OLD | NEW |