| 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 23 matching lines...) Expand all Loading... |
| 34 const std::string& selection, | 34 const std::string& selection, |
| 35 const std::vector<base::string16>& selection_args) { | 35 const std::vector<base::string16>& selection_args) { |
| 36 int count = 0; | 36 int count = 0; |
| 37 if (android_provider_backend_) { | 37 if (android_provider_backend_) { |
| 38 android_provider_backend_->UpdateHistoryAndBookmarks( | 38 android_provider_backend_->UpdateHistoryAndBookmarks( |
| 39 row, selection, selection_args, &count); | 39 row, selection, selection_args, &count); |
| 40 } | 40 } |
| 41 return count; | 41 return count; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void HistoryBackend::DeleteHistoryAndBookmarks( | 44 int HistoryBackend::DeleteHistoryAndBookmarks( |
| 45 scoped_refptr<DeleteRequest> request, | |
| 46 const std::string& selection, | 45 const std::string& selection, |
| 47 const std::vector<base::string16>& selection_args) { | 46 const std::vector<base::string16>& selection_args) { |
| 48 if (request->canceled()) | |
| 49 return; | |
| 50 | |
| 51 int count = 0; | 47 int count = 0; |
| 52 bool result = false; | 48 if (android_provider_backend_) { |
| 53 if (android_provider_backend_) | 49 android_provider_backend_->DeleteHistoryAndBookmarks( |
| 54 result = android_provider_backend_->DeleteHistoryAndBookmarks(selection, | 50 selection, selection_args, &count); |
| 55 selection_args, &count); | 51 } |
| 56 | 52 return count; |
| 57 request->ForwardResult(request->handle(), result, count); | |
| 58 } | 53 } |
| 59 | 54 |
| 60 void HistoryBackend::DeleteHistory( | 55 int HistoryBackend::DeleteHistory( |
| 61 scoped_refptr<DeleteRequest> request, | |
| 62 const std::string& selection, | 56 const std::string& selection, |
| 63 const std::vector<base::string16>& selection_args) { | 57 const std::vector<base::string16>& selection_args) { |
| 64 if (request->canceled()) | |
| 65 return; | |
| 66 | |
| 67 int count = 0; | 58 int count = 0; |
| 68 bool result = false; | |
| 69 if (android_provider_backend_) { | 59 if (android_provider_backend_) { |
| 70 result = android_provider_backend_->DeleteHistory(selection, selection_args, | 60 android_provider_backend_->DeleteHistory(selection, selection_args, &count); |
| 71 &count); | |
| 72 } | 61 } |
| 73 request->ForwardResult(request->handle(), result, count); | 62 return count; |
| 74 } | 63 } |
| 75 | 64 |
| 76 // Statement ------------------------------------------------------------------- | 65 // Statement ------------------------------------------------------------------- |
| 77 | 66 |
| 78 int HistoryBackend::MoveStatement(history::AndroidStatement* statement, | 67 int HistoryBackend::MoveStatement(history::AndroidStatement* statement, |
| 79 int current_pos, | 68 int current_pos, |
| 80 int destination) { | 69 int destination) { |
| 81 DCHECK_LE(-1, current_pos); | 70 DCHECK_LE(-1, current_pos); |
| 82 DCHECK_LE(-1, destination); | 71 DCHECK_LE(-1, destination); |
| 83 | 72 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 112 const std::string& selection, | 101 const std::string& selection, |
| 113 const std::vector<base::string16> selection_args) { | 102 const std::vector<base::string16> selection_args) { |
| 114 int count = 0; | 103 int count = 0; |
| 115 if (android_provider_backend_) { | 104 if (android_provider_backend_) { |
| 116 android_provider_backend_->UpdateSearchTerms( | 105 android_provider_backend_->UpdateSearchTerms( |
| 117 row, selection, selection_args, &count); | 106 row, selection, selection_args, &count); |
| 118 } | 107 } |
| 119 return count; | 108 return count; |
| 120 } | 109 } |
| 121 | 110 |
| 122 void HistoryBackend::DeleteSearchTerms( | 111 int HistoryBackend::DeleteSearchTerms( |
| 123 scoped_refptr<DeleteRequest> request, | |
| 124 const std::string& selection, | 112 const std::string& selection, |
| 125 const std::vector<base::string16> selection_args) { | 113 const std::vector<base::string16> selection_args) { |
| 126 if (request->canceled()) | |
| 127 return; | |
| 128 | |
| 129 int count = 0; | 114 int count = 0; |
| 130 bool result = false; | |
| 131 if (android_provider_backend_) { | 115 if (android_provider_backend_) { |
| 132 result = android_provider_backend_->DeleteSearchTerms(selection, | 116 android_provider_backend_->DeleteSearchTerms( |
| 133 selection_args, &count); | 117 selection, selection_args, &count); |
| 134 } | 118 } |
| 135 | 119 return count; |
| 136 request->ForwardResult(request->handle(), result, count); | |
| 137 } | 120 } |
| 138 | 121 |
| 139 AndroidStatement* HistoryBackend::QuerySearchTerms( | 122 AndroidStatement* HistoryBackend::QuerySearchTerms( |
| 140 const std::vector<SearchRow::ColumnID>& projections, | 123 const std::vector<SearchRow::ColumnID>& projections, |
| 141 const std::string& selection, | 124 const std::string& selection, |
| 142 const std::vector<base::string16>& selection_args, | 125 const std::vector<base::string16>& selection_args, |
| 143 const std::string& sort_order) { | 126 const std::string& sort_order) { |
| 144 AndroidStatement* statement = NULL; | 127 AndroidStatement* statement = NULL; |
| 145 if (android_provider_backend_) { | 128 if (android_provider_backend_) { |
| 146 statement = android_provider_backend_->QuerySearchTerms(projections, | 129 statement = android_provider_backend_->QuerySearchTerms(projections, |
| 147 selection, selection_args, sort_order); | 130 selection, selection_args, sort_order); |
| 148 } | 131 } |
| 149 return statement; | 132 return statement; |
| 150 } | 133 } |
| 151 | 134 |
| 152 } // namespace history | 135 } // namespace history |
| OLD | NEW |