Chromium Code Reviews| Index: chrome/browser/history/history.h |
| diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h |
| index e3a24e730cc8eeb5f9b43aed7f9dbc8c0b15f94e..c4a6ec6d61ccc5336bea290a08b69958209f6b2b 100644 |
| --- a/chrome/browser/history/history.h |
| +++ b/chrome/browser/history/history.h |
| @@ -25,6 +25,10 @@ |
| #include "content/public/common/page_transition_types.h" |
| #include "sql/init_status.h" |
| +#if defined(OS_ANDROID) |
| +#include "chrome/browser/android_provider_service.h" |
| +#endif |
| + |
| class BookmarkService; |
| class FilePath; |
| class GURL; |
| @@ -607,6 +611,9 @@ class HistoryService : public CancelableRequestProvider, |
| private: |
| class BackendDelegate; |
| +#if defined(OS_ANDROID) |
| + friend class AndroidProviderService; |
| +#endif |
| friend class base::RefCountedThreadSafe<HistoryService>; |
| friend class BackendDelegate; |
| friend class FaviconService; |
| @@ -793,6 +800,31 @@ class HistoryService : public CancelableRequestProvider, |
| return request->handle(); |
| } |
| + template<typename BackendFunc, |
| + class RequestType, // Descendant of CancelableRequstBase. |
| + typename ArgA, |
| + typename ArgB, |
| + typename ArgC, |
| + typename ArgD> |
| + Handle Schedule(SchedulePriority priority, |
| + BackendFunc func, // Function to call on the HistoryBackend. |
| + CancelableRequestConsumerBase* consumer, |
| + RequestType* request, |
| + const ArgA& a, |
| + const ArgB& b, |
| + const ArgC& c, |
| + const ArgD& d) { |
| + DCHECK(thread_) << "History service being called after cleanup"; |
| + LoadBackendIfNecessary(); |
| + if (consumer) |
| + AddRequest(request, consumer); |
| + ScheduleTask(priority, |
| + base::Bind(func, history_backend_.get(), |
| + scoped_refptr<RequestType>(request), |
| + a, b, c, d)); |
| + return request->handle(); |
| + } |
| + |
| // ScheduleAndForget --------------------------------------------------------- |
| // |
| // Functions for scheduling operations on the history thread that do not need |
| @@ -853,6 +885,79 @@ class HistoryService : public CancelableRequestProvider, |
| a, b, c, d)); |
| } |
| +#if defined(OS_ANDROID) |
|
sky
2012/04/25 15:57:25
Why do any of these methods need to be here? If yo
michaelbai
2012/04/26 05:32:48
I followed the pattern of the FaviconService, if y
sky
2012/04/27 21:37:22
I would rather put them in AndroidHistoryProviderS
|
| + // Android Provider --------------------------------------------------------- |
| + // |
| + // These Android provider related methods are exposed to the |
| + // AndroidProviderService. Instead of calling these methods directly you |
| + // should call the respective method on the AndroidProviderService. |
| + |
| + // Used by the AndroidProviderService to add the history and the bookmarks. |
| + void InsertHistoryAndBookmark( |
| + AndroidProviderService::InsertRequest* request, |
| + const history::HistoryAndBookmarkRow& row); |
| + |
| + // Used by the AndroidProviderService to query the history and the bookmarks. |
| + void QueryHistoryAndBookmarks( |
| + AndroidProviderService::QueryRequest* request, |
| + const std::vector<history::HistoryAndBookmarkRow::ColumnID>& projections, |
| + const std::string& selection, |
| + const std::vector<string16>& selection_args, |
| + const std::string& sort_order); |
| + |
| + // Used by the AndroidProviderService to update the history and the bookmarks. |
| + void UpdateHistoryAndBookmarks( |
| + AndroidProviderService::UpdateRequest* request, |
| + const history::HistoryAndBookmarkRow& row, |
| + const std::string& selection, |
| + const std::vector<string16>& selection_args); |
| + |
| + // Used by the AndroidProviderService to delete the history and the bookmarks. |
| + void DeleteHistoryAndBookmarks( |
| + AndroidProviderService::DeleteRequest* request, |
| + const std::string& selection, |
| + const std::vector<string16>& selection_args); |
| + |
| + // Used by the AndroidProviderService to delete the history. |
| + void DeleteHistory(AndroidProviderService::DeleteRequest* request, |
| + const std::string& selection, |
| + const std::vector<string16>& selection_args); |
| + |
| + // Used by the AndroidProviderService to move the given |statement|'s current |
| + // row to |destination|. |
| + void MoveStatement(AndroidProviderService::MoveStatementRequest* request, |
| + history::AndroidStatement* statement, |
| + int current_pos, |
| + int destination); |
| + |
| + // Used by the AndroidProviderService to close the statement in db thread. |
| + void CloseStatement(history::AndroidStatement* statement); |
| + |
| + // Used by the AndroidProviderService to add the search term. |
| + void InsertSearchTerm(AndroidProviderService::InsertRequest* request, |
| + const history::SearchRow& row); |
| + |
| + // Used by the AndroidProviderService to update the search terms. |
| + void UpdateSearchTerms(AndroidProviderService::UpdateRequest* request, |
| + const history::SearchRow& row, |
| + const std::string& selection, |
| + const std::vector<string16>& selection_arg); |
| + |
| + // Used by the AndroidProviderService to delete the search terms. |
| + void DeleteSearchTerms(AndroidProviderService::DeleteRequest* request, |
| + const std::string& selection, |
|
sky
2012/04/25 15:57:25
spacing is off
michaelbai
2012/04/26 05:32:48
Done.
|
| + const std::vector<string16>& selection_arg); |
| + |
| + // Used by the AndroidProviderService to query the search terms. |
| + void QuerySearchTerms( |
| + AndroidProviderService::QueryRequest* request, |
| + const std::vector<history::SearchRow::ColumnID>& projections, |
| + const std::string& selection, |
| + const std::vector<string16>& selection_args, |
| + const std::string& sort_order); |
| + |
| +#endif // defined(OS_ANDROID) |
| + |
| content::NotificationRegistrar registrar_; |
| // Some void primitives require some internal processing in the main thread |