| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <limits> | 5 #include <limits> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "chrome/browser/history/text_database.h" | 9 #include "chrome/browser/history/text_database.h" |
| 10 | 10 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 &match_positions); | 360 &match_positions); |
| 361 | 361 |
| 362 // Compute the snippet based on those matches. | 362 // Compute the snippet based on those matches. |
| 363 std::string body = statement.ColumnString(4); | 363 std::string body = statement.ColumnString(4); |
| 364 match.snippet.ComputeSnippet(match_positions, body); | 364 match.snippet.ComputeSnippet(match_positions, body); |
| 365 } | 365 } |
| 366 | 366 |
| 367 // When we have returned all the results possible (or determined that there | 367 // When we have returned all the results possible (or determined that there |
| 368 // are none), then we have searched all the time requested, so we can | 368 // are none), then we have searched all the time requested, so we can |
| 369 // set the first_time_searched to that value. | 369 // set the first_time_searched to that value. |
| 370 if (results->size() == 0 || | 370 if (results->empty() || |
| 371 options.max_count == 0 || // Special case for wanting all the results. | 371 options.max_count == 0 || // Special case for wanting all the results. |
| 372 static_cast<int>(results->size()) < options.max_count) { | 372 static_cast<int>(results->size()) < options.max_count) { |
| 373 *first_time_searched = options.begin_time; | 373 *first_time_searched = options.begin_time; |
| 374 } else { | 374 } else { |
| 375 // Since we got the results in order, we know the last item is the last | 375 // Since we got the results in order, we know the last item is the last |
| 376 // time we considered. | 376 // time we considered. |
| 377 *first_time_searched = results->back().time; | 377 *first_time_searched = results->back().time; |
| 378 } | 378 } |
| 379 | 379 |
| 380 statement.Reset(); | 380 statement.Reset(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace history | 383 } // namespace history |
| OLD | NEW |