Chromium Code Reviews| 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/in_memory_url_index.h" | 5 #include "chrome/browser/history/in_memory_url_index.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/api/bookmarks/bookmark_service.h" | |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | |
| 9 #include "chrome/browser/history/history_notifications.h" | 12 #include "chrome/browser/history/history_notifications.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
| 11 #include "chrome/browser/history/url_database.h" | 14 #include "chrome/browser/history/url_database.h" |
| 12 #include "chrome/browser/history/url_index_private_data.h" | 15 #include "chrome/browser/history/url_index_private_data.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 16 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 if (history_dir_.empty()) | 157 if (history_dir_.empty()) |
| 155 return false; | 158 return false; |
| 156 *file_path = history_dir_.Append(FILE_PATH_LITERAL("History Provider Cache")); | 159 *file_path = history_dir_.Append(FILE_PATH_LITERAL("History Provider Cache")); |
| 157 return true; | 160 return true; |
| 158 } | 161 } |
| 159 | 162 |
| 160 // Querying -------------------------------------------------------------------- | 163 // Querying -------------------------------------------------------------------- |
| 161 | 164 |
| 162 ScoredHistoryMatches InMemoryURLIndex::HistoryItemsForTerms( | 165 ScoredHistoryMatches InMemoryURLIndex::HistoryItemsForTerms( |
| 163 const string16& term_string) { | 166 const string16& term_string) { |
| 164 return private_data_->HistoryItemsForTerms(term_string); | 167 BookmarkService* bookmark_service = |
| 168 BookmarkModelFactory::GetForProfile(profile_); | |
|
Peter Kasting
2012/09/05 22:50:06
Nit: Or inline into next statement
mrossetti
2012/09/06 00:33:45
Done.
| |
| 169 return private_data_->HistoryItemsForTerms(term_string, bookmark_service); | |
| 165 } | 170 } |
| 166 | 171 |
| 167 // Updating -------------------------------------------------------------------- | 172 // Updating -------------------------------------------------------------------- |
| 168 | 173 |
| 169 void InMemoryURLIndex::Observe(int notification_type, | 174 void InMemoryURLIndex::Observe(int notification_type, |
| 170 const content::NotificationSource& source, | 175 const content::NotificationSource& source, |
| 171 const content::NotificationDetails& details) { | 176 const content::NotificationDetails& details) { |
| 172 switch (notification_type) { | 177 switch (notification_type) { |
| 173 case chrome::NOTIFICATION_HISTORY_URL_VISITED: | 178 case chrome::NOTIFICATION_HISTORY_URL_VISITED: |
| 174 OnURLVisited(content::Details<URLVisitedDetails>(details).ptr()); | 179 OnURLVisited(content::Details<URLVisitedDetails>(details).ptr()); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 } | 333 } |
| 329 } | 334 } |
| 330 | 335 |
| 331 void InMemoryURLIndex::OnCacheSaveDone( | 336 void InMemoryURLIndex::OnCacheSaveDone( |
| 332 scoped_refptr<RefCountedBool> succeeded) { | 337 scoped_refptr<RefCountedBool> succeeded) { |
| 333 if (save_cache_observer_) | 338 if (save_cache_observer_) |
| 334 save_cache_observer_->OnCacheSaveFinished(succeeded->value()); | 339 save_cache_observer_->OnCacheSaveFinished(succeeded->value()); |
| 335 } | 340 } |
| 336 | 341 |
| 337 } // namespace history | 342 } // namespace history |
| OLD | NEW |