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 CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/callback_list.h" | 14 #include "base/callback_list.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "base/task/cancelable_task_tracker.h" | 22 #include "base/task/cancelable_task_tracker.h" |
23 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "chrome/browser/history/delete_directive_handler.h" | 25 #include "chrome/browser/history/delete_directive_handler.h" |
26 #include "chrome/browser/history/typed_url_syncable_service.h" | 26 #include "chrome/browser/history/typed_url_syncable_service.h" |
27 #include "chrome/common/ref_counted_util.h" | |
28 #include "components/favicon_base/favicon_callback.h" | 27 #include "components/favicon_base/favicon_callback.h" |
29 #include "components/history/core/browser/history_client.h" | 28 #include "components/history/core/browser/history_client.h" |
30 #include "components/history/core/browser/keyword_id.h" | 29 #include "components/history/core/browser/keyword_id.h" |
31 #include "components/keyed_service/core/keyed_service.h" | 30 #include "components/keyed_service/core/keyed_service.h" |
32 #include "components/visitedlink/browser/visitedlink_delegate.h" | 31 #include "components/visitedlink/browser/visitedlink_delegate.h" |
33 #include "content/public/browser/download_manager_delegate.h" | |
34 #include "sql/init_status.h" | 32 #include "sql/init_status.h" |
35 #include "sync/api/syncable_service.h" | 33 #include "sync/api/syncable_service.h" |
36 #include "ui/base/page_transition_types.h" | 34 #include "ui/base/page_transition_types.h" |
37 | 35 |
38 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
39 class AndroidHistoryProviderService; | 37 class AndroidHistoryProviderService; |
40 #endif | 38 #endif |
41 | 39 |
42 class GURL; | 40 class GURL; |
43 class PageUsageData; | 41 class PageUsageData; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 typedef base::Callback<void(bool)> DownloadCreateCallback; | 370 typedef base::Callback<void(bool)> DownloadCreateCallback; |
373 | 371 |
374 // Begins a history request to create a new row for a download. 'info' | 372 // Begins a history request to create a new row for a download. 'info' |
375 // contains all the download's creation state, and 'callback' runs when the | 373 // contains all the download's creation state, and 'callback' runs when the |
376 // history service request is complete. The callback is called on the thread | 374 // history service request is complete. The callback is called on the thread |
377 // that calls CreateDownload(). | 375 // that calls CreateDownload(). |
378 void CreateDownload( | 376 void CreateDownload( |
379 const history::DownloadRow& info, | 377 const history::DownloadRow& info, |
380 const DownloadCreateCallback& callback); | 378 const DownloadCreateCallback& callback); |
381 | 379 |
| 380 // Implemented by the caller of 'GetNextDownloadId' below, and is called with |
| 381 // the maximum id of all downloads records in the database plus 1. |
| 382 typedef base::Callback<void(uint32)> DownloadIdCallback; |
| 383 |
382 // Responds on the calling thread with the maximum id of all downloads records | 384 // Responds on the calling thread with the maximum id of all downloads records |
383 // in the database plus 1. | 385 // in the database plus 1. |
384 void GetNextDownloadId(const content::DownloadIdCallback& callback); | 386 void GetNextDownloadId(const DownloadIdCallback& callback); |
385 | 387 |
386 // Implemented by the caller of 'QueryDownloads' below, and is called when the | 388 // Implemented by the caller of 'QueryDownloads' below, and is called when the |
387 // history service has retrieved a list of all download state. The call | 389 // history service has retrieved a list of all download state. The call |
388 typedef base::Callback<void( | 390 typedef base::Callback<void( |
389 scoped_ptr<std::vector<history::DownloadRow> >)> | 391 scoped_ptr<std::vector<history::DownloadRow> >)> |
390 DownloadQueryCallback; | 392 DownloadQueryCallback; |
391 | 393 |
392 // Begins a history request to retrieve the state of all downloads in the | 394 // Begins a history request to retrieve the state of all downloads in the |
393 // history db. 'callback' runs when the history service request is complete, | 395 // history db. 'callback' runs when the history service request is complete, |
394 // at which point 'info' contains an array of history::DownloadRow, one per | 396 // at which point 'info' contains an array of history::DownloadRow, one per |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 | 838 |
837 history::DeleteDirectiveHandler delete_directive_handler_; | 839 history::DeleteDirectiveHandler delete_directive_handler_; |
838 | 840 |
839 // All vended weak pointers are invalidated in Cleanup(). | 841 // All vended weak pointers are invalidated in Cleanup(). |
840 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 842 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
841 | 843 |
842 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 844 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
843 }; | 845 }; |
844 | 846 |
845 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 847 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
OLD | NEW |