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 "components/history/core/browser/history_backend.h" | 5 #include "components/history/core/browser/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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 result->success = db_ && db_->GetRowForURL(url, &result->row); | 1047 result->success = db_ && db_->GetRowForURL(url, &result->row); |
1048 // Optionally query the visits. | 1048 // Optionally query the visits. |
1049 if (result->success && want_visits) | 1049 if (result->success && want_visits) |
1050 db_->GetVisitsForURL(result->row.id(), &result->visits); | 1050 db_->GetVisitsForURL(result->row.id(), &result->visits); |
1051 } | 1051 } |
1052 | 1052 |
1053 TypedUrlSyncableService* HistoryBackend::GetTypedUrlSyncableService() const { | 1053 TypedUrlSyncableService* HistoryBackend::GetTypedUrlSyncableService() const { |
1054 return typed_url_syncable_service_.get(); | 1054 return typed_url_syncable_service_.get(); |
1055 } | 1055 } |
1056 | 1056 |
| 1057 // Statistics ------------------------------------------------------------------ |
| 1058 |
| 1059 int HistoryBackend::CountURLs() { |
| 1060 if (!db_) |
| 1061 return 0; |
| 1062 else |
| 1063 return db_->GetCountOfURLsWithVisibleVisit(); |
| 1064 } |
| 1065 |
1057 // Keyword visits -------------------------------------------------------------- | 1066 // Keyword visits -------------------------------------------------------------- |
1058 | 1067 |
1059 void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url, | 1068 void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url, |
1060 KeywordID keyword_id, | 1069 KeywordID keyword_id, |
1061 const base::string16& term) { | 1070 const base::string16& term) { |
1062 if (!db_) | 1071 if (!db_) |
1063 return; | 1072 return; |
1064 | 1073 |
1065 // Get the ID for this URL. | 1074 // Get the ID for this URL. |
1066 URLRow row; | 1075 URLRow row; |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 // transaction is currently open. | 2716 // transaction is currently open. |
2708 db_->CommitTransaction(); | 2717 db_->CommitTransaction(); |
2709 db_->Vacuum(); | 2718 db_->Vacuum(); |
2710 db_->BeginTransaction(); | 2719 db_->BeginTransaction(); |
2711 db_->GetStartDate(&first_recorded_time_); | 2720 db_->GetStartDate(&first_recorded_time_); |
2712 | 2721 |
2713 return true; | 2722 return true; |
2714 } | 2723 } |
2715 | 2724 |
2716 } // namespace history | 2725 } // namespace history |
OLD | NEW |