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/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include "chrome/browser/history/android/android_provider_backend.h" | 7 #include "chrome/browser/history/android/android_provider_backend.h" |
8 | 8 |
9 namespace history { | 9 namespace history { |
10 | 10 |
11 void HistoryBackend::InsertHistoryAndBookmark( | 11 void HistoryBackend::InsertHistoryAndBookmark( |
12 scoped_refptr<InsertRequest> request, | 12 scoped_refptr<InsertRequest> request, |
13 const HistoryAndBookmarkRow& row) { | 13 const HistoryAndBookmarkRow& row) { |
14 if (request->canceled()) | 14 if (request->canceled()) |
15 return; | 15 return; |
16 | 16 |
17 AndroidURLID id = 0; | 17 AndroidURLID id = 0; |
18 if (android_provider_backend_) | 18 if (android_provider_backend_) |
19 id = android_provider_backend_->InsertHistoryAndBookmark(row); | 19 id = android_provider_backend_->InsertHistoryAndBookmark(row); |
20 | 20 |
21 request->ForwardResult(request->handle(), id != 0, id); | 21 request->ForwardResult(request->handle(), id != 0, id); |
22 } | 22 } |
23 | 23 |
24 void HistoryBackend::QueryHistoryAndBookmarks( | 24 AndroidStatement* HistoryBackend::QueryHistoryAndBookmarks( |
25 scoped_refptr<QueryRequest> request, | |
26 const std::vector<HistoryAndBookmarkRow::ColumnID>& projections, | 25 const std::vector<HistoryAndBookmarkRow::ColumnID>& projections, |
27 const std::string& selection, | 26 const std::string& selection, |
28 const std::vector<base::string16>& selection_args, | 27 const std::vector<base::string16>& selection_args, |
29 const std::string& sort_order) { | 28 const std::string& sort_order) { |
30 if (request->canceled()) | |
31 return; | |
32 | |
33 AndroidStatement* statement = NULL; | 29 AndroidStatement* statement = NULL; |
34 if (android_provider_backend_) { | 30 if (android_provider_backend_) { |
35 statement = android_provider_backend_->QueryHistoryAndBookmarks( | 31 statement = android_provider_backend_->QueryHistoryAndBookmarks( |
36 projections, selection, selection_args, sort_order); | 32 projections, selection, selection_args, sort_order); |
37 } | 33 } |
38 request->ForwardResult(request->handle(), statement, statement); | 34 return statement; |
39 } | 35 } |
40 | 36 |
41 void HistoryBackend::UpdateHistoryAndBookmarks( | 37 void HistoryBackend::UpdateHistoryAndBookmarks( |
42 scoped_refptr<UpdateRequest> request, | 38 scoped_refptr<UpdateRequest> request, |
43 const HistoryAndBookmarkRow& row, | 39 const HistoryAndBookmarkRow& row, |
44 const std::string& selection, | 40 const std::string& selection, |
45 const std::vector<base::string16>& selection_args) { | 41 const std::vector<base::string16>& selection_args) { |
46 if (request->canceled()) | 42 if (request->canceled()) |
47 return; | 43 return; |
48 | 44 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 int count = 0; | 152 int count = 0; |
157 bool result = false; | 153 bool result = false; |
158 if (android_provider_backend_) { | 154 if (android_provider_backend_) { |
159 result = android_provider_backend_->DeleteSearchTerms(selection, | 155 result = android_provider_backend_->DeleteSearchTerms(selection, |
160 selection_args, &count); | 156 selection_args, &count); |
161 } | 157 } |
162 | 158 |
163 request->ForwardResult(request->handle(), result, count); | 159 request->ForwardResult(request->handle(), result, count); |
164 } | 160 } |
165 | 161 |
166 void HistoryBackend::QuerySearchTerms( | 162 AndroidStatement* HistoryBackend::QuerySearchTerms( |
167 scoped_refptr<QueryRequest> request, | |
168 const std::vector<SearchRow::ColumnID>& projections, | 163 const std::vector<SearchRow::ColumnID>& projections, |
169 const std::string& selection, | 164 const std::string& selection, |
170 const std::vector<base::string16>& selection_args, | 165 const std::vector<base::string16>& selection_args, |
171 const std::string& sort_order) { | 166 const std::string& sort_order) { |
172 if (request->canceled()) | |
173 return; | |
174 | |
175 AndroidStatement* statement = NULL; | 167 AndroidStatement* statement = NULL; |
176 if (android_provider_backend_) | 168 if (android_provider_backend_) { |
177 statement = android_provider_backend_->QuerySearchTerms(projections, | 169 statement = android_provider_backend_->QuerySearchTerms(projections, |
178 selection, selection_args, sort_order); | 170 selection, selection_args, sort_order); |
179 | 171 } |
180 request->ForwardResult(request->handle(), statement, statement); | 172 return statement; |
181 } | 173 } |
182 | 174 |
183 } // namespace history | 175 } // namespace history |
OLD | NEW |