OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 // Notification that a URL is no longer bookmarked. If there are no visits | 328 // Notification that a URL is no longer bookmarked. If there are no visits |
329 // for the specified url, it is deleted. | 329 // for the specified url, it is deleted. |
330 void URLsNoLongerBookmarked(const std::set<GURL>& urls); | 330 void URLsNoLongerBookmarked(const std::set<GURL>& urls); |
331 | 331 |
332 // Testing ------------------------------------------------------------------- | 332 // Testing ------------------------------------------------------------------- |
333 | 333 |
334 // Sets the task to run and the message loop to run it on when this object | 334 // Sets the task to run and the message loop to run it on when this object |
335 // is destroyed. See HistoryService::SetOnBackendDestroyTask for a more | 335 // is destroyed. See HistoryService::SetOnBackendDestroyTask for a more |
336 // complete description. | 336 // complete description. |
337 void SetOnBackendDestroyTask(MessageLoop* message_loop, Task* task); | 337 void SetOnBackendDestroyTask(MessageLoop* message_loop, |
| 338 const base::Closure& task); |
338 | 339 |
339 // Adds the given rows to the database if it doesn't exist. A visit will be | 340 // Adds the given rows to the database if it doesn't exist. A visit will be |
340 // added for each given URL at the last visit time in the URLRow if the | 341 // added for each given URL at the last visit time in the URLRow if the |
341 // passed visit type != SOURCE_SYNCED (the sync code manages visits itself). | 342 // passed visit type != SOURCE_SYNCED (the sync code manages visits itself). |
342 // Each visit will have the visit_source type set. | 343 // Each visit will have the visit_source type set. |
343 void AddPagesWithDetails(const std::vector<URLRow>& info, | 344 void AddPagesWithDetails(const std::vector<URLRow>& info, |
344 VisitSource visit_source); | 345 VisitSource visit_source); |
345 | 346 |
346 #if defined(UNIT_TEST) | 347 #if defined(UNIT_TEST) |
347 HistoryDatabase* db() const { return db_.get(); } | 348 HistoryDatabase* db() const { return db_.get(); } |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 609 |
609 // Timestamp of the last page addition, as it was recorded in the database. | 610 // Timestamp of the last page addition, as it was recorded in the database. |
610 // If two or more requests come in at the same time, we increment that time | 611 // If two or more requests come in at the same time, we increment that time |
611 // by 1 us between them so it's more likely to be unique in the database. | 612 // by 1 us between them so it's more likely to be unique in the database. |
612 // This keeps track of that higher-resolution timestamp. | 613 // This keeps track of that higher-resolution timestamp. |
613 base::Time last_recorded_time_; | 614 base::Time last_recorded_time_; |
614 | 615 |
615 // Timestamp of the first entry in our database. | 616 // Timestamp of the first entry in our database. |
616 base::Time first_recorded_time_; | 617 base::Time first_recorded_time_; |
617 | 618 |
618 // When non-NULL, this is the task that should be invoked on | 619 // When set, this is the task that should be invoked on destruction. |
619 MessageLoop* backend_destroy_message_loop_; | 620 MessageLoop* backend_destroy_message_loop_; |
620 Task* backend_destroy_task_; | 621 base::Closure backend_destroy_task_; |
621 | 622 |
622 // Tracks page transition types. | 623 // Tracks page transition types. |
623 VisitTracker tracker_; | 624 VisitTracker tracker_; |
624 | 625 |
625 // A boolean variable to track whether we have already purged obsolete segment | 626 // A boolean variable to track whether we have already purged obsolete segment |
626 // data. | 627 // data. |
627 bool segment_queried_; | 628 bool segment_queried_; |
628 | 629 |
629 // HistoryDBTasks to run. Be sure to AddRef when adding, and Release when | 630 // HistoryDBTasks to run. Be sure to AddRef when adding, and Release when |
630 // done. | 631 // done. |
631 std::list<HistoryDBTaskRequest*> db_task_requests_; | 632 std::list<HistoryDBTaskRequest*> db_task_requests_; |
632 | 633 |
633 // Used to determine if a URL is bookmarked. This is owned by the Profile and | 634 // Used to determine if a URL is bookmarked. This is owned by the Profile and |
634 // may be NULL (during testing). | 635 // may be NULL (during testing). |
635 // | 636 // |
636 // Use GetBookmarkService to access this, which makes sure the service is | 637 // Use GetBookmarkService to access this, which makes sure the service is |
637 // loaded. | 638 // loaded. |
638 BookmarkService* bookmark_service_; | 639 BookmarkService* bookmark_service_; |
639 | 640 |
640 // Publishes the history to all indexers which are registered to receive | 641 // Publishes the history to all indexers which are registered to receive |
641 // history data from us. Can be NULL if there are no listeners. | 642 // history data from us. Can be NULL if there are no listeners. |
642 scoped_ptr<HistoryPublisher> history_publisher_; | 643 scoped_ptr<HistoryPublisher> history_publisher_; |
643 | 644 |
644 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 645 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
645 }; | 646 }; |
646 | 647 |
647 } // namespace history | 648 } // namespace history |
648 | 649 |
649 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 650 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
OLD | NEW |