OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_HISTORY_HISTORY_TYPES_H__ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_TYPES_H__ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_TYPES_H__ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_TYPES_H__ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // than we were allowed to return, this represents the first date considered | 370 // than we were allowed to return, this represents the first date considered |
371 // in the query (this will be before the first result if there was time | 371 // in the query (this will be before the first result if there was time |
372 // queried with no results). | 372 // queried with no results). |
373 // | 373 // |
374 // TODO(brettw): bug 1203054: This field is not currently set properly! Do | 374 // TODO(brettw): bug 1203054: This field is not currently set properly! Do |
375 // not use until the bug is fixed. | 375 // not use until the bug is fixed. |
376 base::Time first_time_searched() const { return first_time_searched_; } | 376 base::Time first_time_searched() const { return first_time_searched_; } |
377 void set_first_time_searched(base::Time t) { first_time_searched_ = t; } | 377 void set_first_time_searched(base::Time t) { first_time_searched_ = t; } |
378 // Note: If you need end_time_searched, it can be added. | 378 // Note: If you need end_time_searched, it can be added. |
379 | 379 |
| 380 void set_reached_beginning(bool reached) { reached_beginning_ = reached; } |
| 381 bool reached_beginning() { return reached_beginning_; } |
| 382 |
380 size_t size() const { return results_.size(); } | 383 size_t size() const { return results_.size(); } |
381 | 384 |
382 URLResult& operator[](size_t i) { return *results_[i]; } | 385 URLResult& operator[](size_t i) { return *results_[i]; } |
383 const URLResult& operator[](size_t i) const { return *results_[i]; } | 386 const URLResult& operator[](size_t i) const { return *results_[i]; } |
384 | 387 |
385 // Returns a pointer to the beginning of an array of all matching indices | 388 // Returns a pointer to the beginning of an array of all matching indices |
386 // for entries with the given URL. The array will be |*num_matches| long. | 389 // for entries with the given URL. The array will be |*num_matches| long. |
387 // |num_matches| can be NULL if the caller is not interested in the number of | 390 // |num_matches| can be NULL if the caller is not interested in the number of |
388 // results (commonly it will only be interested in the first one and can test | 391 // results (commonly it will only be interested in the first one and can test |
389 // the pointer for NULL). | 392 // the pointer for NULL). |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // Inserts an entry into the |url_to_results_| map saying that the given URL | 427 // Inserts an entry into the |url_to_results_| map saying that the given URL |
425 // is at the given index in the results_. | 428 // is at the given index in the results_. |
426 void AddURLUsageAtIndex(const GURL& url, size_t index); | 429 void AddURLUsageAtIndex(const GURL& url, size_t index); |
427 | 430 |
428 // Adds |delta| to each index in url_to_results_ in the range [begin,end] | 431 // Adds |delta| to each index in url_to_results_ in the range [begin,end] |
429 // (this is inclusive). This is used when inserting or deleting. | 432 // (this is inclusive). This is used when inserting or deleting. |
430 void AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta); | 433 void AdjustResultMap(size_t begin, size_t end, ptrdiff_t delta); |
431 | 434 |
432 base::Time first_time_searched_; | 435 base::Time first_time_searched_; |
433 | 436 |
| 437 // Whether the query reaches the beginning of the database. |
| 438 bool reached_beginning_; |
| 439 |
434 // The ordered list of results. The pointers inside this are owned by this | 440 // The ordered list of results. The pointers inside this are owned by this |
435 // QueryResults object. | 441 // QueryResults object. |
436 URLResultVector results_; | 442 URLResultVector results_; |
437 | 443 |
438 // Maps URLs to entries in results_. | 444 // Maps URLs to entries in results_. |
439 URLToResultIndices url_to_results_; | 445 URLToResultIndices url_to_results_; |
440 | 446 |
441 DISALLOW_EVIL_CONSTRUCTORS(QueryResults); | 447 DISALLOW_EVIL_CONSTRUCTORS(QueryResults); |
442 }; | 448 }; |
443 | 449 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 // The time of the visit. | 497 // The time of the visit. |
492 base::Time time; | 498 base::Time time; |
493 | 499 |
494 // The search term that was used. | 500 // The search term that was used. |
495 std::wstring term; | 501 std::wstring term; |
496 }; | 502 }; |
497 | 503 |
498 } // history | 504 } // history |
499 | 505 |
500 #endif // CHROME_BROWSER_HISTORY_HISTORY_TYPES_H__ | 506 #endif // CHROME_BROWSER_HISTORY_HISTORY_TYPES_H__ |
OLD | NEW |