Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/browser/history/history.h

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_H_ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "ui/base/layout.h" 29 #include "ui/base/layout.h"
30 30
31 #if defined(OS_ANDROID) 31 #if defined(OS_ANDROID)
32 #include "chrome/browser/history/android/android_history_provider_service.h" 32 #include "chrome/browser/history/android/android_history_provider_service.h"
33 #endif 33 #endif
34 34
35 class BookmarkService; 35 class BookmarkService;
36 class FilePath; 36 class FilePath;
37 class GURL; 37 class GURL;
38 class HistoryURLProvider; 38 class HistoryURLProvider;
39 struct HistoryURLProviderParams;
40 class PageUsageData; 39 class PageUsageData;
41 class PageUsageRequest; 40 class PageUsageRequest;
42 class Profile; 41 class Profile;
42 struct DownloadPersistentStoreInfo;
43 struct HistoryURLProviderParams;
43 44
44 namespace base { 45 namespace base {
45 class Thread; 46 class Thread;
46 } 47 }
47 48
48 namespace content {
49 struct DownloadPersistentStoreInfo;
50 }
51 49
52 namespace history { 50 namespace history {
53 class InMemoryHistoryBackend; 51 class InMemoryHistoryBackend;
54 class InMemoryURLIndex; 52 class InMemoryURLIndex;
55 class InMemoryURLIndexTest; 53 class InMemoryURLIndexTest;
56 struct HistoryAddPageArgs; 54 struct HistoryAddPageArgs;
57 class HistoryBackend; 55 class HistoryBackend;
58 class HistoryDatabase; 56 class HistoryDatabase;
59 struct HistoryDetails; 57 struct HistoryDetails;
60 class HistoryQueryTest; 58 class HistoryQueryTest;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 void(Handle, 330 void(Handle,
333 bool, // Were we able to determine the # of visits? 331 bool, // Were we able to determine the # of visits?
334 int, // Number of visits. 332 int, // Number of visits.
335 base::Time)> // Time of first visit. Only set if bool 333 base::Time)> // Time of first visit. Only set if bool
336 // is true and int is > 0. 334 // is true and int is > 0.
337 GetVisibleVisitCountToHostCallback; 335 GetVisibleVisitCountToHostCallback;
338 336
339 // Requests the number of user-visible visits (i.e. no redirects or subframes) 337 // Requests the number of user-visible visits (i.e. no redirects or subframes)
340 // to all urls on the same scheme/host/port as |url|. This is only valid for 338 // to all urls on the same scheme/host/port as |url|. This is only valid for
341 // HTTP and HTTPS URLs. 339 // HTTP and HTTPS URLs.
342 Handle GetVisibleVisitCountToHost( 340 virtual Handle GetVisibleVisitCountToHost(
343 const GURL& url, 341 const GURL& url,
344 CancelableRequestConsumerBase* consumer, 342 CancelableRequestConsumerBase* consumer,
345 const GetVisibleVisitCountToHostCallback& callback); 343 const GetVisibleVisitCountToHostCallback& callback);
346 344
347 // Called when QueryTopURLsAndRedirects completes. The vector contains a list 345 // Called when QueryTopURLsAndRedirects completes. The vector contains a list
348 // of the top |result_count| URLs. For each of these URLs, there is an entry 346 // of the top |result_count| URLs. For each of these URLs, there is an entry
349 // in the map containing redirects from the URL. For example, if we have the 347 // in the map containing redirects from the URL. For example, if we have the
350 // redirect chain A -> B -> C and A is a top visited URL, then A will be in 348 // redirect chain A -> B -> C and A is a top visited URL, then A will be in
351 // the vector and "A => {B -> C}" will be in the map. 349 // the vector and "A => {B -> C}" will be in the map.
352 typedef base::Callback< 350 typedef base::Callback<
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // removed. 423 // removed.
426 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 424 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
427 base::Time begin_time, base::Time end_time, 425 base::Time begin_time, base::Time end_time,
428 CancelableRequestConsumerBase* consumer, 426 CancelableRequestConsumerBase* consumer,
429 const base::Closure& callback); 427 const base::Closure& callback);
430 428
431 // Downloads ----------------------------------------------------------------- 429 // Downloads -----------------------------------------------------------------
432 430
433 // Implemented by the caller of 'CreateDownload' below, and is called when the 431 // Implemented by the caller of 'CreateDownload' below, and is called when the
434 // history service has created a new entry for a download in the history db. 432 // history service has created a new entry for a download in the history db.
435 typedef base::Callback<void(int32, int64)> DownloadCreateCallback; 433 typedef base::Callback<void(int64)> DownloadCreateCallback;
436 434
437 // Begins a history request to create a new persistent entry for a download. 435 // Begins a history request to create a new persistent entry for a download.
438 // 'info' contains all the download's creation state, and 'callback' runs 436 // 'info' contains all the download's creation state, and 'callback' runs
439 // when the history service request is complete. 437 // when the history service request is complete.
440 Handle CreateDownload(int32 id, 438 virtual Handle CreateDownload(
441 const content::DownloadPersistentStoreInfo& info, 439 const DownloadPersistentStoreInfo& info,
442 CancelableRequestConsumerBase* consumer, 440 CancelableRequestConsumerBase* consumer,
443 const DownloadCreateCallback& callback); 441 const DownloadCreateCallback& callback);
444 442
445 // Implemented by the caller of 'GetNextDownloadId' below. 443 // Implemented by the caller of 'GetNextDownloadId' below.
446 typedef base::Callback<void(int)> DownloadNextIdCallback; 444 typedef base::Callback<void(int)> DownloadNextIdCallback;
447 445
448 // Runs the callback with the next available download id. 446 // Runs the callback with the next available download id.
449 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer, 447 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer,
450 const DownloadNextIdCallback& callback); 448 const DownloadNextIdCallback& callback);
451 449
452 // Implemented by the caller of 'QueryDownloads' below, and is called when the 450 // Implemented by the caller of 'QueryDownloads' below, and is called when the
453 // history service has retrieved a list of all download state. The call 451 // history service has retrieved a list of all download state. The call
454 typedef base::Callback<void( 452 typedef base::Callback<void(
455 std::vector<content::DownloadPersistentStoreInfo>*)> 453 std::vector<DownloadPersistentStoreInfo>*)>
456 DownloadQueryCallback; 454 DownloadQueryCallback;
457 455
458 // Begins a history request to retrieve the state of all downloads in the 456 // Begins a history request to retrieve the state of all downloads in the
459 // history db. 'callback' runs when the history service request is complete, 457 // history db. 'callback' runs when the history service request is complete,
460 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one 458 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one
461 // per download. 459 // per download.
462 Handle QueryDownloads(CancelableRequestConsumerBase* consumer, 460 virtual Handle QueryDownloads(CancelableRequestConsumerBase* consumer,
463 const DownloadQueryCallback& callback); 461 const DownloadQueryCallback& callback);
464 462
465 // Begins a request to clean up entries that has been corrupted (because of 463 // Begins a request to clean up entries that has been corrupted (because of
466 // the crash, for example). 464 // the crash, for example).
467 void CleanUpInProgressEntries(); 465 void CleanUpInProgressEntries();
468 466
469 // Called to update the history service about the current state of a download. 467 // Called to update the history service about the current state of a download.
470 // This is a 'fire and forget' query, so just pass the relevant state info to 468 // This is a 'fire and forget' query, so just pass the relevant state info to
471 // the database with no need for a callback. 469 // the database with no need for a callback.
472 void UpdateDownload(const content::DownloadPersistentStoreInfo& data); 470 virtual void UpdateDownload(const DownloadPersistentStoreInfo& data);
473 471
474 // Called to update the history service about the path of a download. 472 // Permanently remove some downloads from the history system. This is a 'fire
475 // This is a 'fire and forget' query. 473 // and forget' operation.
476 void UpdateDownloadPath(const FilePath& path, int64 db_handle); 474 virtual void RemoveDownloads(const std::set<int64>& db_handles);
477
478 // Permanently remove a download from the history system. This is a 'fire and
479 // forget' operation.
480 void RemoveDownload(int64 db_handle);
481
482 // Permanently removes all completed download from the history system within
483 // the specified range. This function does not delete downloads that are in
484 // progress or in the process of being cancelled. This is a 'fire and forget'
485 // operation. You can pass is_null times to get unbounded time in either or
486 // both directions.
487 void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
488 475
489 // Visit Segments ------------------------------------------------------------ 476 // Visit Segments ------------------------------------------------------------
490 477
491 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)> 478 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)>
492 SegmentQueryCallback; 479 SegmentQueryCallback;
493 480
494 // Query usage data for all visit segments since the provided time. 481 // Query usage data for all visit segments since the provided time.
495 // 482 //
496 // The request is performed asynchronously and can be cancelled by using the 483 // The request is performed asynchronously and can be cancelled by using the
497 // returned handle. 484 // returned handle.
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 // The index used for quick history lookups. 1055 // The index used for quick history lookups.
1069 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1056 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1070 1057
1071 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > 1058 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> >
1072 visit_database_observers_; 1059 visit_database_observers_;
1073 1060
1074 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1061 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1075 }; 1062 };
1076 1063
1077 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ 1064 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698