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

Unified Diff: chrome/browser/history/history.h

Issue 10217010: Completed the code path from AndroidProviderService to HistoryBackend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address the comments Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/history.h
diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h
index bebf21783f6c7fd7947a5a28673d32ca6fc70eaf..a86ea71e96dbf4649730895bbb1dc0ae163b861b 100644
--- a/chrome/browser/history/history.h
+++ b/chrome/browser/history/history.h
@@ -26,6 +26,10 @@
#include "content/public/common/page_transition_types.h"
#include "sql/init_status.h"
+#if defined(OS_ANDROID)
+#include "chrome/browser/history/android/android_history_provider_service.h"
+#endif
+
class BookmarkService;
class FilePath;
class GURL;
@@ -617,6 +621,9 @@ class HistoryService : public CancelableRequestProvider,
private:
class BackendDelegate;
+#if defined(OS_ANDROID)
+ friend class AndroidHistoryProviderService;
+#endif
friend class base::RefCountedThreadSafe<HistoryService>;
friend class BackendDelegate;
friend class FaviconService;
@@ -803,6 +810,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
@@ -863,6 +895,85 @@ class HistoryService : public CancelableRequestProvider,
a, b, c, d));
}
+#if defined(OS_ANDROID)
+ // Android Provider ---------------------------------------------------------
+ //
+ // These Android provider related methods are exposed to the
+ // AndroidHistoryProviderService. Instead of calling these methods directly
+ // you should call the respective method on the AndroidHistoryProviderService.
+
+ // Used by the AndroidHistoryProviderService to add the history and the
+ // bookmarks.
+ void InsertHistoryAndBookmark(
+ AndroidHistoryProviderService::InsertRequest* request,
+ const history::HistoryAndBookmarkRow& row);
+
+ // Used by the AndroidHistoryProviderService to query the history and the
+ // bookmarks.
+ void QueryHistoryAndBookmarks(
+ AndroidHistoryProviderService::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 AndroidHistoryProviderService to update the history and the
+ // bookmarks.
+ void UpdateHistoryAndBookmarks(
+ AndroidHistoryProviderService::UpdateRequest* request,
+ const history::HistoryAndBookmarkRow& row,
+ const std::string& selection,
+ const std::vector<string16>& selection_args);
+
+ // Used by the AndroidHistoryProviderService to delete the history and the
+ // bookmarks.
+ void DeleteHistoryAndBookmarks(
+ AndroidHistoryProviderService::DeleteRequest* request,
+ const std::string& selection,
+ const std::vector<string16>& selection_args);
+
+ // Used by the AndroidHistoryProviderService to delete the history.
+ void DeleteHistory(AndroidHistoryProviderService::DeleteRequest* request,
+ const std::string& selection,
+ const std::vector<string16>& selection_args);
+
+ // Used by the AndroidHistoryProviderService to move the given |statement|'s
+ // current row to |destination|.
+ void MoveStatement(
+ AndroidHistoryProviderService::MoveStatementRequest* request,
+ history::AndroidStatement* statement,
+ int current_pos,
+ int destination);
+
+ // Used by the AndroidHistoryProviderService to close the statement in db
+ // thread.
+ void CloseStatement(history::AndroidStatement* statement);
+
+ // Used by the AndroidHistoryProviderService to add the search term.
+ void InsertSearchTerm(AndroidHistoryProviderService::InsertRequest* request,
+ const history::SearchRow& row);
+
+ // Used by the AndroidHistoryProviderService to update the search terms.
+ void UpdateSearchTerms(AndroidHistoryProviderService::UpdateRequest* request,
+ const history::SearchRow& row,
+ const std::string& selection,
+ const std::vector<string16>& selection_arg);
+
+ // Used by the AndroidHistoryProviderService to delete the search terms.
+ void DeleteSearchTerms(AndroidHistoryProviderService::DeleteRequest* request,
+ const std::string& selection,
+ const std::vector<string16>& selection_arg);
+
+ // Used by the AndroidHistoryProviderService to query the search terms.
+ void QuerySearchTerms(
+ AndroidHistoryProviderService::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

Powered by Google App Engine
This is Rietveld 408576698