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 #ifndef CHROME_BROWSER_HISTORY_ANDROID_ANDROID_HISTORY_PROVIDER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_ANDROID_HISTORY_PROVIDER_SERVICE_H_ |
6 #define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_HISTORY_PROVIDER_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_HISTORY_PROVIDER_SERVICE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 InsertCallback; | 43 InsertCallback; |
44 typedef CancelableRequest<InsertCallback> InsertRequest; | 44 typedef CancelableRequest<InsertCallback> InsertRequest; |
45 | 45 |
46 typedef base::Callback<void( | 46 typedef base::Callback<void( |
47 Handle, // handle | 47 Handle, // handle |
48 bool, // true if the deletion succeeded. | 48 bool, // true if the deletion succeeded. |
49 int)> // the number of row deleted. | 49 int)> // the number of row deleted. |
50 DeleteCallback; | 50 DeleteCallback; |
51 typedef CancelableRequest<DeleteCallback> DeleteRequest; | 51 typedef CancelableRequest<DeleteCallback> DeleteRequest; |
52 | 52 |
53 typedef base::Callback<void( | 53 // Callback invoked when a method moving an |AndroidStatement| is complete. |
54 Handle, // handle | 54 // The value passed to the callback is the new position, or in case of |
55 int)> // the new position. | 55 // failure, the old position. |
56 MoveStatementCallback; | 56 typedef base::Callback<void(int)> MoveStatementCallback; |
57 typedef CancelableRequest<MoveStatementCallback> MoveStatementRequest; | |
58 | 57 |
59 // History and Bookmarks ---------------------------------------------------- | 58 // History and Bookmarks ---------------------------------------------------- |
60 // | 59 // |
61 // Runs the given query on history backend, and invokes the |callback| to | 60 // Runs the given query on history backend, and invokes the |callback| to |
62 // return the result. | 61 // return the result. |
63 // | 62 // |
64 // |projections| is the vector of the result columns. | 63 // |projections| is the vector of the result columns. |
65 // |selection| is the SQL WHERE clause without 'WHERE'. | 64 // |selection| is the SQL WHERE clause without 'WHERE'. |
66 // |selection_args| is the arguments for WHERE clause. | 65 // |selection_args| is the arguments for WHERE clause. |
67 // |sort_order| is the SQL ORDER clause. | 66 // |sort_order| is the SQL ORDER clause. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // the row deleted from the |callback|. | 108 // the row deleted from the |callback|. |
110 Handle DeleteHistory(const std::string& selection, | 109 Handle DeleteHistory(const std::string& selection, |
111 const std::vector<base::string16>& selection_args, | 110 const std::vector<base::string16>& selection_args, |
112 CancelableRequestConsumerBase* consumer, | 111 CancelableRequestConsumerBase* consumer, |
113 const DeleteCallback& callback); | 112 const DeleteCallback& callback); |
114 | 113 |
115 // Statement ---------------------------------------------------------------- | 114 // Statement ---------------------------------------------------------------- |
116 // Moves the statement's current row from |current_pos| to |destination| in DB | 115 // Moves the statement's current row from |current_pos| to |destination| in DB |
117 // thread. The new position is returned to the callback. The result supplied | 116 // thread. The new position is returned to the callback. The result supplied |
118 // the callback is constrained by the number of rows might. | 117 // the callback is constrained by the number of rows might. |
119 Handle MoveStatement(history::AndroidStatement* statement, | 118 base::CancelableTaskTracker::TaskId MoveStatement( |
120 int current_pos, | 119 history::AndroidStatement* statement, |
121 int destination, | 120 int current_pos, |
122 CancelableRequestConsumerBase* consumer, | 121 int destination, |
123 const MoveStatementCallback& callback); | 122 const MoveStatementCallback& callback, |
| 123 base::CancelableTaskTracker* tracker); |
124 | 124 |
125 // Closes the statement in db thread. The AndroidHistoryProviderService takes | 125 // Closes the statement in db thread. The AndroidHistoryProviderService takes |
126 // the ownership of |statement|. | 126 // the ownership of |statement|. |
127 void CloseStatement(history::AndroidStatement* statement); | 127 void CloseStatement(history::AndroidStatement* statement); |
128 | 128 |
129 // Search term -------------------------------------------------------------- | 129 // Search term -------------------------------------------------------------- |
130 // Inserts the given values and returns the SearchTermID of the inserted row | 130 // Inserts the given values and returns the SearchTermID of the inserted row |
131 // from the |callback| on success. | 131 // from the |callback| on success. |
132 Handle InsertSearchTerm(const history::SearchRow& row, | 132 Handle InsertSearchTerm(const history::SearchRow& row, |
133 CancelableRequestConsumerBase* consumer, | 133 CancelableRequestConsumerBase* consumer, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 const QueryCallback& callback, | 171 const QueryCallback& callback, |
172 base::CancelableTaskTracker* tracker); | 172 base::CancelableTaskTracker* tracker); |
173 | 173 |
174 private: | 174 private: |
175 Profile* profile_; | 175 Profile* profile_; |
176 | 176 |
177 DISALLOW_COPY_AND_ASSIGN(AndroidHistoryProviderService); | 177 DISALLOW_COPY_AND_ASSIGN(AndroidHistoryProviderService); |
178 }; | 178 }; |
179 | 179 |
180 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_HISTORY_PROVIDER_SERVICE_H_ | 180 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_HISTORY_PROVIDER_SERVICE_H_ |
OLD | NEW |