| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "components/drive/chromeos/search_metadata.h" | 5 #include "components/drive/chromeos/search_metadata.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Hidden entry should not be returned. | 151 // Hidden entry should not be returned. |
| 152 bool hidden = false; | 152 bool hidden = false; |
| 153 FileError error = hidden_entry_classifier->IsHidden(entry, &hidden); | 153 FileError error = hidden_entry_classifier->IsHidden(entry, &hidden); |
| 154 if (error != FILE_ERROR_OK || hidden) | 154 if (error != FILE_ERROR_OK || hidden) |
| 155 return error; | 155 return error; |
| 156 | 156 |
| 157 // Make space for |entry| when appropriate. | 157 // Make space for |entry| when appropriate. |
| 158 if (result_candidates->size() == at_most_num_matches) | 158 if (result_candidates->size() == at_most_num_matches) |
| 159 result_candidates->pop(); | 159 result_candidates->pop(); |
| 160 result_candidates->push( | 160 result_candidates->push( |
| 161 base::WrapUnique(new ResultCandidate(it->GetID(), entry, highlighted))); | 161 base::MakeUnique<ResultCandidate>(it->GetID(), entry, highlighted)); |
| 162 return FILE_ERROR_OK; | 162 return FILE_ERROR_OK; |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Implements SearchMetadata(). | 165 // Implements SearchMetadata(). |
| 166 FileError SearchMetadataOnBlockingPool(ResourceMetadata* resource_metadata, | 166 FileError SearchMetadataOnBlockingPool(ResourceMetadata* resource_metadata, |
| 167 const std::string& query_text, | 167 const std::string& query_text, |
| 168 const SearchMetadataPredicate& predicate, | 168 const SearchMetadataPredicate& predicate, |
| 169 int at_most_num_matches, | 169 int at_most_num_matches, |
| 170 MetadataSearchResultVector* results) { | 170 MetadataSearchResultVector* results) { |
| 171 ResultCandidateQueue result_candidates; | 171 ResultCandidateQueue result_candidates; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 DCHECK_GE(text16.size(), start_current_segment); | 349 DCHECK_GE(text16.size(), start_current_segment); |
| 350 AppendStringWithHighlight( | 350 AppendStringWithHighlight( |
| 351 text16, start_current_segment, text16.size() - start_current_segment, | 351 text16, start_current_segment, text16.size() - start_current_segment, |
| 352 highlights[start_current_segment], highlighted_text); | 352 highlights[start_current_segment], highlighted_text); |
| 353 | 353 |
| 354 return true; | 354 return true; |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace internal | 357 } // namespace internal |
| 358 } // namespace drive | 358 } // namespace drive |
| OLD | NEW |