| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <set> | 11 #include <set> |
| 9 #include <string> | 12 #include <string> |
| 10 #include <vector> | 13 #include <vector> |
| 11 | 14 |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/bind.h" | 15 #include "base/bind.h" |
| 14 #include "base/callback.h" | 16 #include "base/callback.h" |
| 15 #include "base/callback_list.h" | 17 #include "base/callback_list.h" |
| 16 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 17 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
| 21 #include "base/observer_list.h" | 24 #include "base/observer_list.h" |
| 22 #include "base/strings/string16.h" | 25 #include "base/strings/string16.h" |
| 23 #include "base/task/cancelable_task_tracker.h" | 26 #include "base/task/cancelable_task_tracker.h" |
| 24 #include "base/threading/thread_checker.h" | 27 #include "base/threading/thread_checker.h" |
| 25 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 29 #include "build/build_config.h" |
| 26 #include "components/favicon_base/favicon_callback.h" | 30 #include "components/favicon_base/favicon_callback.h" |
| 27 #include "components/favicon_base/favicon_usage_data.h" | 31 #include "components/favicon_base/favicon_usage_data.h" |
| 28 #include "components/history/core/browser/delete_directive_handler.h" | 32 #include "components/history/core/browser/delete_directive_handler.h" |
| 29 #include "components/history/core/browser/history_types.h" | 33 #include "components/history/core/browser/history_types.h" |
| 30 #include "components/history/core/browser/keyword_id.h" | 34 #include "components/history/core/browser/keyword_id.h" |
| 31 #include "components/history/core/browser/typed_url_syncable_service.h" | 35 #include "components/history/core/browser/typed_url_syncable_service.h" |
| 32 #include "components/keyed_service/core/keyed_service.h" | 36 #include "components/keyed_service/core/keyed_service.h" |
| 33 #include "sql/init_status.h" | 37 #include "sql/init_status.h" |
| 34 #include "sync/api/syncable_service.h" | 38 #include "sync/api/syncable_service.h" |
| 35 #include "ui/base/page_transition_types.h" | 39 #include "ui/base/page_transition_types.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 423 |
| 420 // Begins a history request to create a new row for a download. 'info' | 424 // Begins a history request to create a new row for a download. 'info' |
| 421 // contains all the download's creation state, and 'callback' runs when the | 425 // contains all the download's creation state, and 'callback' runs when the |
| 422 // history service request is complete. The callback is called on the thread | 426 // history service request is complete. The callback is called on the thread |
| 423 // that calls CreateDownload(). | 427 // that calls CreateDownload(). |
| 424 void CreateDownload(const DownloadRow& info, | 428 void CreateDownload(const DownloadRow& info, |
| 425 const DownloadCreateCallback& callback); | 429 const DownloadCreateCallback& callback); |
| 426 | 430 |
| 427 // Implemented by the caller of 'GetNextDownloadId' below, and is called with | 431 // Implemented by the caller of 'GetNextDownloadId' below, and is called with |
| 428 // the maximum id of all downloads records in the database plus 1. | 432 // the maximum id of all downloads records in the database plus 1. |
| 429 typedef base::Callback<void(uint32)> DownloadIdCallback; | 433 typedef base::Callback<void(uint32_t)> DownloadIdCallback; |
| 430 | 434 |
| 431 // Responds on the calling thread with the maximum id of all downloads records | 435 // Responds on the calling thread with the maximum id of all downloads records |
| 432 // in the database plus 1. | 436 // in the database plus 1. |
| 433 void GetNextDownloadId(const DownloadIdCallback& callback); | 437 void GetNextDownloadId(const DownloadIdCallback& callback); |
| 434 | 438 |
| 435 // Implemented by the caller of 'QueryDownloads' below, and is called when the | 439 // Implemented by the caller of 'QueryDownloads' below, and is called when the |
| 436 // history service has retrieved a list of all download state. The call | 440 // history service has retrieved a list of all download state. The call |
| 437 typedef base::Callback<void(scoped_ptr<std::vector<DownloadRow>>)> | 441 typedef base::Callback<void(scoped_ptr<std::vector<DownloadRow>>)> |
| 438 DownloadQueryCallback; | 442 DownloadQueryCallback; |
| 439 | 443 |
| 440 // Begins a history request to retrieve the state of all downloads in the | 444 // Begins a history request to retrieve the state of all downloads in the |
| 441 // history db. 'callback' runs when the history service request is complete, | 445 // history db. 'callback' runs when the history service request is complete, |
| 442 // at which point 'info' contains an array of DownloadRow, one per | 446 // at which point 'info' contains an array of DownloadRow, one per |
| 443 // download. The callback is called on the thread that calls QueryDownloads(). | 447 // download. The callback is called on the thread that calls QueryDownloads(). |
| 444 void QueryDownloads(const DownloadQueryCallback& callback); | 448 void QueryDownloads(const DownloadQueryCallback& callback); |
| 445 | 449 |
| 446 // Called to update the history service about the current state of a download. | 450 // Called to update the history service about the current state of a download. |
| 447 // This is a 'fire and forget' query, so just pass the relevant state info to | 451 // This is a 'fire and forget' query, so just pass the relevant state info to |
| 448 // the database with no need for a callback. | 452 // the database with no need for a callback. |
| 449 void UpdateDownload(const DownloadRow& data); | 453 void UpdateDownload(const DownloadRow& data); |
| 450 | 454 |
| 451 // Permanently remove some downloads from the history system. This is a 'fire | 455 // Permanently remove some downloads from the history system. This is a 'fire |
| 452 // and forget' operation. | 456 // and forget' operation. |
| 453 void RemoveDownloads(const std::set<uint32>& ids); | 457 void RemoveDownloads(const std::set<uint32_t>& ids); |
| 454 | 458 |
| 455 // Keyword search terms ----------------------------------------------------- | 459 // Keyword search terms ----------------------------------------------------- |
| 456 | 460 |
| 457 // Sets the search terms for the specified url and keyword. url_id gives the | 461 // Sets the search terms for the specified url and keyword. url_id gives the |
| 458 // id of the url, keyword_id the id of the keyword and term the search term. | 462 // id of the url, keyword_id the id of the keyword and term the search term. |
| 459 void SetKeywordSearchTermsForURL(const GURL& url, | 463 void SetKeywordSearchTermsForURL(const GURL& url, |
| 460 KeywordID keyword_id, | 464 KeywordID keyword_id, |
| 461 const base::string16& term); | 465 const base::string16& term); |
| 462 | 466 |
| 463 // Deletes all search terms for the specified keyword. | 467 // Deletes all search terms for the specified keyword. |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 | 864 |
| 861 // All vended weak pointers are invalidated in Cleanup(). | 865 // All vended weak pointers are invalidated in Cleanup(). |
| 862 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 866 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 863 | 867 |
| 864 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 868 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 865 }; | 869 }; |
| 866 | 870 |
| 867 } // namespace history | 871 } // namespace history |
| 868 | 872 |
| 869 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 873 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| OLD | NEW |