| 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 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 bool result = false; | 79 bool result = false; |
| 80 if (android_provider_backend_) { | 80 if (android_provider_backend_) { |
| 81 result = android_provider_backend_->DeleteHistory(selection, selection_args, | 81 result = android_provider_backend_->DeleteHistory(selection, selection_args, |
| 82 &count); | 82 &count); |
| 83 } | 83 } |
| 84 request->ForwardResult(request->handle(), result, count); | 84 request->ForwardResult(request->handle(), result, count); |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Statement ------------------------------------------------------------------- | 87 // Statement ------------------------------------------------------------------- |
| 88 | 88 |
| 89 void HistoryBackend::MoveStatement( | 89 int HistoryBackend::MoveStatement(history::AndroidStatement* statement, |
| 90 scoped_refptr<MoveStatementRequest> request, | 90 int current_pos, |
| 91 history::AndroidStatement* statement, | 91 int destination) { |
| 92 int current_pos, | |
| 93 int destination) { | |
| 94 DCHECK_LE(-1, current_pos); | 92 DCHECK_LE(-1, current_pos); |
| 95 DCHECK_LE(-1, destination); | 93 DCHECK_LE(-1, destination); |
| 96 | 94 |
| 97 int cur = current_pos; | 95 int cur = current_pos; |
| 98 if (current_pos > destination) { | 96 if (current_pos > destination) { |
| 99 statement->statement()->Reset(false); | 97 statement->statement()->Reset(false); |
| 100 cur = -1; | 98 cur = -1; |
| 101 } | 99 } |
| 102 for (; cur < destination; ++cur) { | 100 for (; cur < destination; ++cur) { |
| 103 if (!statement->statement()->Step()) | 101 if (!statement->statement()->Step()) |
| 104 break; | 102 break; |
| 105 } | 103 } |
| 106 | 104 |
| 107 request->ForwardResult(request->handle(), cur); | 105 return cur; |
| 108 } | 106 } |
| 109 | 107 |
| 110 void HistoryBackend::CloseStatement(AndroidStatement* statement) { | 108 void HistoryBackend::CloseStatement(AndroidStatement* statement) { |
| 111 delete statement; | 109 delete statement; |
| 112 } | 110 } |
| 113 | 111 |
| 114 // Search Term ----------------------------------------------------------------- | 112 // Search Term ----------------------------------------------------------------- |
| 115 | 113 |
| 116 void HistoryBackend::InsertSearchTerm(scoped_refptr<InsertRequest> request, | 114 void HistoryBackend::InsertSearchTerm(scoped_refptr<InsertRequest> request, |
| 117 const SearchRow& row) { | 115 const SearchRow& row) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 const std::string& sort_order) { | 164 const std::string& sort_order) { |
| 167 AndroidStatement* statement = NULL; | 165 AndroidStatement* statement = NULL; |
| 168 if (android_provider_backend_) { | 166 if (android_provider_backend_) { |
| 169 statement = android_provider_backend_->QuerySearchTerms(projections, | 167 statement = android_provider_backend_->QuerySearchTerms(projections, |
| 170 selection, selection_args, sort_order); | 168 selection, selection_args, sort_order); |
| 171 } | 169 } |
| 172 return statement; | 170 return statement; |
| 173 } | 171 } |
| 174 | 172 |
| 175 } // namespace history | 173 } // namespace history |
| OLD | NEW |