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

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

Issue 872313005: Remove dependency on visitedlink from history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@init-prefs
Patch Set: Rebase Created 5 years, 10 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 "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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 origin_loop_->PostTask( 165 origin_loop_->PostTask(
166 FROM_HERE, 166 FROM_HERE,
167 base::Bind(&base::DeletePointer<HistoryDBTask>, 167 base::Bind(&base::DeletePointer<HistoryDBTask>,
168 base::Unretained(task_.release()))); 168 base::Unretained(task_.release())));
169 } 169 }
170 170
171 bool QueuedHistoryDBTask::is_canceled() { 171 bool QueuedHistoryDBTask::is_canceled() {
172 return is_canceled_.Run(); 172 return is_canceled_.Run();
173 } 173 }
174 174
175 bool QueuedHistoryDBTask::Run(HistoryBackend* backend, 175 bool QueuedHistoryDBTask::Run(HistoryBackend* backend, HistoryDatabase* db) {
176 HistoryDatabase* db) {
177 return task_->RunOnDBThread(backend, db); 176 return task_->RunOnDBThread(backend, db);
178 } 177 }
179 178
180 void QueuedHistoryDBTask::DoneRun() { 179 void QueuedHistoryDBTask::DoneRun() {
181 origin_loop_->PostTask( 180 origin_loop_->PostTask(
182 FROM_HERE, 181 FROM_HERE,
183 base::Bind(&RunUnlessCanceled, 182 base::Bind(&RunUnlessCanceled,
184 base::Bind(&HistoryDBTask::DoneRunOnMainThread, 183 base::Bind(&HistoryDBTask::DoneRunOnMainThread,
185 base::Unretained(task_.get())), 184 base::Unretained(task_.get())),
186 is_canceled_)); 185 is_canceled_));
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 url_info.set_title(base::UTF8ToUTF16(url.spec())); 916 url_info.set_title(base::UTF8ToUTF16(url.spec()));
918 } 917 }
919 918
920 url_info.set_last_visit(Time::Now()); 919 url_info.set_last_visit(Time::Now());
921 // Mark the page hidden. If the user types it in, it'll unhide. 920 // Mark the page hidden. If the user types it in, it'll unhide.
922 url_info.set_hidden(true); 921 url_info.set_hidden(true);
923 922
924 db_->AddURL(url_info); 923 db_->AddURL(url_info);
925 } 924 }
926 925
927 void HistoryBackend::IterateURLs(
928 const scoped_refptr<visitedlink::VisitedLinkDelegate::URLEnumerator>&
929 iterator) {
930 if (db_) {
931 HistoryDatabase::URLEnumerator e;
932 if (db_->InitURLEnumeratorForEverything(&e)) {
933 URLRow info;
934 while (e.GetNextURL(&info)) {
935 iterator->OnURL(info.url());
936 }
937 iterator->OnComplete(true); // Success.
938 return;
939 }
940 }
941 iterator->OnComplete(false); // Failure.
942 }
943
944 bool HistoryBackend::GetAllTypedURLs(URLRows* urls) { 926 bool HistoryBackend::GetAllTypedURLs(URLRows* urls) {
945 if (db_) 927 if (db_)
946 return db_->GetAllTypedUrls(urls); 928 return db_->GetAllTypedUrls(urls);
947 return false; 929 return false;
948 } 930 }
949 931
950 bool HistoryBackend::GetVisitsForURL(URLID id, VisitVector* visits) { 932 bool HistoryBackend::GetVisitsForURL(URLID id, VisitVector* visits) {
951 if (db_) 933 if (db_)
952 return db_->GetVisitsForURL(id, visits); 934 return db_->GetVisitsForURL(id, visits);
953 return false; 935 return false;
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 info.url_id = visit.url_id; 2670 info.url_id = visit.url_id;
2689 info.time = visit.visit_time; 2671 info.time = visit.visit_time;
2690 info.transition = visit.transition; 2672 info.transition = visit.transition;
2691 // If we don't have a delegate yet during setup or shutdown, we will drop 2673 // If we don't have a delegate yet during setup or shutdown, we will drop
2692 // these notifications. 2674 // these notifications.
2693 if (delegate_) 2675 if (delegate_)
2694 delegate_->NotifyAddVisit(info); 2676 delegate_->NotifyAddVisit(info);
2695 } 2677 }
2696 2678
2697 } // namespace history 2679 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698