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 "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 url_info.set_title(base::UTF8ToUTF16(url.spec())); | 918 url_info.set_title(base::UTF8ToUTF16(url.spec())); |
919 } | 919 } |
920 | 920 |
921 url_info.set_last_visit(Time::Now()); | 921 url_info.set_last_visit(Time::Now()); |
922 // Mark the page hidden. If the user types it in, it'll unhide. | 922 // Mark the page hidden. If the user types it in, it'll unhide. |
923 url_info.set_hidden(true); | 923 url_info.set_hidden(true); |
924 | 924 |
925 db_->AddURL(url_info); | 925 db_->AddURL(url_info); |
926 } | 926 } |
927 | 927 |
928 void HistoryBackend::IterateURLs( | |
929 const scoped_refptr<visitedlink::VisitedLinkDelegate::URLEnumerator>& | |
930 iterator) { | |
931 if (db_) { | |
932 HistoryDatabase::URLEnumerator e; | |
933 if (db_->InitURLEnumeratorForEverything(&e)) { | |
934 URLRow info; | |
935 while (e.GetNextURL(&info)) { | |
936 iterator->OnURL(info.url()); | |
937 } | |
938 iterator->OnComplete(true); // Success. | |
939 return; | |
940 } | |
941 } | |
942 iterator->OnComplete(false); // Failure. | |
943 } | |
944 | |
945 bool HistoryBackend::GetAllTypedURLs(URLRows* urls) { | 928 bool HistoryBackend::GetAllTypedURLs(URLRows* urls) { |
946 if (db_) | 929 if (db_) |
947 return db_->GetAllTypedUrls(urls); | 930 return db_->GetAllTypedUrls(urls); |
948 return false; | 931 return false; |
949 } | 932 } |
950 | 933 |
951 bool HistoryBackend::GetVisitsForURL(URLID id, VisitVector* visits) { | 934 bool HistoryBackend::GetVisitsForURL(URLID id, VisitVector* visits) { |
952 if (db_) | 935 if (db_) |
953 return db_->GetVisitsForURL(id, visits); | 936 return db_->GetVisitsForURL(id, visits); |
954 return false; | 937 return false; |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2689 info.url_id = visit.url_id; | 2672 info.url_id = visit.url_id; |
2690 info.time = visit.visit_time; | 2673 info.time = visit.visit_time; |
2691 info.transition = visit.transition; | 2674 info.transition = visit.transition; |
2692 // If we don't have a delegate yet during setup or shutdown, we will drop | 2675 // If we don't have a delegate yet during setup or shutdown, we will drop |
2693 // these notifications. | 2676 // these notifications. |
2694 if (delegate_) | 2677 if (delegate_) |
2695 delegate_->NotifyAddVisit(info); | 2678 delegate_->NotifyAddVisit(info); |
2696 } | 2679 } |
2697 | 2680 |
2698 } // namespace history | 2681 } // namespace history |
OLD | NEW |