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 | 7 |
8 #include "chrome/browser/history/text_database.h" | 8 #include "chrome/browser/history/text_database.h" |
9 | 9 |
10 #include "app/sql/connection.h" | 10 #include "app/sql/connection.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 statement.BindInt64(1, effective_begin_time); | 319 statement.BindInt64(1, effective_begin_time); |
320 statement.BindInt64(2, effective_end_time); | 320 statement.BindInt64(2, effective_end_time); |
321 statement.BindInt(3, effective_max_count); | 321 statement.BindInt(3, effective_max_count); |
322 | 322 |
323 while (statement.Step()) { | 323 while (statement.Step()) { |
324 // TODO(brettw) allow canceling the query in the middle. | 324 // TODO(brettw) allow canceling the query in the middle. |
325 // if (canceled_or_something) | 325 // if (canceled_or_something) |
326 // break; | 326 // break; |
327 | 327 |
328 GURL url(statement.ColumnString(0)); | 328 GURL url(statement.ColumnString(0)); |
329 if (options.most_recent_visit_only) { | 329 URLSet::const_iterator found_url = found_urls->find(url); |
330 URLSet::const_iterator found_url = found_urls->find(url); | 330 if (found_url != found_urls->end()) |
331 if (found_url != found_urls->end()) | 331 continue; // Don't add this duplicate. |
332 continue; // Don't add this duplicate when unique URLs are requested. | |
333 } | |
334 | 332 |
335 // Fill the results into the vector (avoid copying the URL with Swap()). | 333 // Fill the results into the vector (avoid copying the URL with Swap()). |
336 results->resize(results->size() + 1); | 334 results->resize(results->size() + 1); |
337 Match& match = results->at(results->size() - 1); | 335 Match& match = results->at(results->size() - 1); |
338 match.url.Swap(&url); | 336 match.url.Swap(&url); |
339 | 337 |
340 match.title = UTF8ToWide(statement.ColumnString(1)); | 338 match.title = UTF8ToWide(statement.ColumnString(1)); |
341 match.time = base::Time::FromInternalValue(statement.ColumnInt64(2)); | 339 match.time = base::Time::FromInternalValue(statement.ColumnInt64(2)); |
342 | 340 |
343 // Extract any matches in the title. | 341 // Extract any matches in the title. |
(...skipping 23 matching lines...) Expand all Loading... |
367 } else { | 365 } else { |
368 // Since we got the results in order, we know the last item is the last | 366 // Since we got the results in order, we know the last item is the last |
369 // time we considered. | 367 // time we considered. |
370 *first_time_searched = results->back().time; | 368 *first_time_searched = results->back().time; |
371 } | 369 } |
372 | 370 |
373 statement.Reset(); | 371 statement.Reset(); |
374 } | 372 } |
375 | 373 |
376 } // namespace history | 374 } // namespace history |
OLD | NEW |