OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 | 863 |
864 // Update the full text index. | 864 // Update the full text index. |
865 if (text_database_.get()) | 865 if (text_database_.get()) |
866 text_database_->AddPageTitle(url, title); | 866 text_database_->AddPageTitle(url, title); |
867 | 867 |
868 // Only bother committing if things changed. | 868 // Only bother committing if things changed. |
869 if (!changed_urls.empty()) | 869 if (!changed_urls.empty()) |
870 ScheduleCommit(); | 870 ScheduleCommit(); |
871 } | 871 } |
872 | 872 |
| 873 void HistoryBackend::AddPageNoVisit(const GURL& url) { |
| 874 if (!db_.get()) |
| 875 return; |
| 876 |
| 877 URLRow url_info(url); |
| 878 URLID url_id = db_->GetRowForURL(url, &url_info); |
| 879 if (url_id) { |
| 880 // URL is already known, nothing to do. |
| 881 return; |
| 882 } |
| 883 url_info.set_last_visit(Time::Now()); |
| 884 // Mark the page hidden. If the user types it in, it'll unhide. |
| 885 url_info.set_hidden(true); |
| 886 |
| 887 db_->AddURL(url_info); |
| 888 } |
| 889 |
873 void HistoryBackend::IterateURLs(HistoryService::URLEnumerator* iterator) { | 890 void HistoryBackend::IterateURLs(HistoryService::URLEnumerator* iterator) { |
874 if (db_.get()) { | 891 if (db_.get()) { |
875 HistoryDatabase::URLEnumerator e; | 892 HistoryDatabase::URLEnumerator e; |
876 if (db_->InitURLEnumeratorForEverything(&e)) { | 893 if (db_->InitURLEnumeratorForEverything(&e)) { |
877 URLRow info; | 894 URLRow info; |
878 while (e.GetNextURL(&info)) { | 895 while (e.GetNextURL(&info)) { |
879 iterator->OnURL(info.url()); | 896 iterator->OnURL(info.url()); |
880 } | 897 } |
881 iterator->OnComplete(true); // Success. | 898 iterator->OnComplete(true); // Success. |
882 return; | 899 return; |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 return true; | 2182 return true; |
2166 } | 2183 } |
2167 | 2184 |
2168 BookmarkService* HistoryBackend::GetBookmarkService() { | 2185 BookmarkService* HistoryBackend::GetBookmarkService() { |
2169 if (bookmark_service_) | 2186 if (bookmark_service_) |
2170 bookmark_service_->BlockTillLoaded(); | 2187 bookmark_service_->BlockTillLoaded(); |
2171 return bookmark_service_; | 2188 return bookmark_service_; |
2172 } | 2189 } |
2173 | 2190 |
2174 } // namespace history | 2191 } // namespace history |
OLD | NEW |