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

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: @r166491 Created 8 years, 1 month 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 21 matching lines...) Expand all
32 #include "ui/base/layout.h" 32 #include "ui/base/layout.h"
33 33
34 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
35 #include "chrome/browser/history/android/android_history_provider_service.h" 35 #include "chrome/browser/history/android/android_history_provider_service.h"
36 #endif 36 #endif
37 37
38 class BookmarkService; 38 class BookmarkService;
39 class FilePath; 39 class FilePath;
40 class GURL; 40 class GURL;
41 class HistoryURLProvider; 41 class HistoryURLProvider;
42 struct HistoryURLProviderParams;
43 class PageUsageData; 42 class PageUsageData;
44 class PageUsageRequest; 43 class PageUsageRequest;
45 class Profile; 44 class Profile;
45 struct DownloadPersistentStoreInfo;
46 struct HistoryURLProviderParams;
46 47
47 namespace base { 48 namespace base {
48 class Thread; 49 class Thread;
49 } 50 }
50 51
51 namespace content {
52 struct DownloadPersistentStoreInfo;
53 }
54 52
55 namespace history { 53 namespace history {
56 class InMemoryHistoryBackend; 54 class InMemoryHistoryBackend;
57 class InMemoryURLIndex; 55 class InMemoryURLIndex;
58 class InMemoryURLIndexTest; 56 class InMemoryURLIndexTest;
59 struct HistoryAddPageArgs; 57 struct HistoryAddPageArgs;
60 class HistoryBackend; 58 class HistoryBackend;
61 class HistoryDatabase; 59 class HistoryDatabase;
62 struct HistoryDetails; 60 struct HistoryDetails;
63 class HistoryQueryTest; 61 class HistoryQueryTest;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 void(Handle, 352 void(Handle,
355 bool, // Were we able to determine the # of visits? 353 bool, // Were we able to determine the # of visits?
356 int, // Number of visits. 354 int, // Number of visits.
357 base::Time)> // Time of first visit. Only set if bool 355 base::Time)> // Time of first visit. Only set if bool
358 // is true and int is > 0. 356 // is true and int is > 0.
359 GetVisibleVisitCountToHostCallback; 357 GetVisibleVisitCountToHostCallback;
360 358
361 // Requests the number of user-visible visits (i.e. no redirects or subframes) 359 // Requests the number of user-visible visits (i.e. no redirects or subframes)
362 // to all urls on the same scheme/host/port as |url|. This is only valid for 360 // to all urls on the same scheme/host/port as |url|. This is only valid for
363 // HTTP and HTTPS URLs. 361 // HTTP and HTTPS URLs.
364 Handle GetVisibleVisitCountToHost( 362 virtual Handle GetVisibleVisitCountToHost(
365 const GURL& url, 363 const GURL& url,
366 CancelableRequestConsumerBase* consumer, 364 CancelableRequestConsumerBase* consumer,
367 const GetVisibleVisitCountToHostCallback& callback); 365 const GetVisibleVisitCountToHostCallback& callback);
368 366
369 // Called when QueryTopURLsAndRedirects completes. The vector contains a list 367 // Called when QueryTopURLsAndRedirects completes. The vector contains a list
370 // of the top |result_count| URLs. For each of these URLs, there is an entry 368 // of the top |result_count| URLs. For each of these URLs, there is an entry
371 // in the map containing redirects from the URL. For example, if we have the 369 // in the map containing redirects from the URL. For example, if we have the
372 // redirect chain A -> B -> C and A is a top visited URL, then A will be in 370 // redirect chain A -> B -> C and A is a top visited URL, then A will be in
373 // the vector and "A => {B -> C}" will be in the map. 371 // the vector and "A => {B -> C}" will be in the map.
374 typedef base::Callback< 372 typedef base::Callback<
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // either direction. 443 // either direction.
446 // If |restrict_urls| is not empty, only visits to the URLs in this set are 444 // If |restrict_urls| is not empty, only visits to the URLs in this set are
447 // removed. 445 // removed.
448 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 446 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
449 base::Time begin_time, base::Time end_time, 447 base::Time begin_time, base::Time end_time,
450 CancelableRequestConsumerBase* consumer, 448 CancelableRequestConsumerBase* consumer,
451 const base::Closure& callback); 449 const base::Closure& callback);
452 450
453 // Downloads ----------------------------------------------------------------- 451 // Downloads -----------------------------------------------------------------
454 452
453 // Downloads-related APIs are virtual in order to facilitate mocking.
454
455 // Implemented by the caller of 'CreateDownload' below, and is called when the 455 // Implemented by the caller of 'CreateDownload' below, and is called when the
456 // history service has created a new entry for a download in the history db. 456 // history service has created a new entry for a download in the history db.
457 typedef base::Callback<void(int32, int64)> DownloadCreateCallback; 457 typedef base::Callback<void(int64)> DownloadCreateCallback;
458 458
459 // Begins a history request to create a new persistent entry for a download. 459 // Begins a history request to create a new persistent entry for a download.
460 // 'info' contains all the download's creation state, and 'callback' runs 460 // 'info' contains all the download's creation state, and 'callback' runs
461 // when the history service request is complete. 461 // when the history service request is complete.
462 Handle CreateDownload(int32 id, 462 virtual Handle CreateDownload(
463 const content::DownloadPersistentStoreInfo& info, 463 const DownloadPersistentStoreInfo& info,
464 CancelableRequestConsumerBase* consumer, 464 CancelableRequestConsumerBase* consumer,
465 const DownloadCreateCallback& callback); 465 const DownloadCreateCallback& callback);
466 466
467 // Implemented by the caller of 'GetNextDownloadId' below. 467 // Implemented by the caller of 'GetNextDownloadId' below.
468 typedef base::Callback<void(int)> DownloadNextIdCallback; 468 typedef base::Callback<void(int)> DownloadNextIdCallback;
469 469
470 // Runs the callback with the next available download id. 470 // Runs the callback with the next available download id.
471 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer, 471 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer,
472 const DownloadNextIdCallback& callback); 472 const DownloadNextIdCallback& callback);
473 473
474 // Implemented by the caller of 'QueryDownloads' below, and is called when the 474 // Implemented by the caller of 'QueryDownloads' below, and is called when the
475 // history service has retrieved a list of all download state. The call 475 // history service has retrieved a list of all download state. The call
476 typedef base::Callback<void( 476 typedef base::Callback<void(
477 std::vector<content::DownloadPersistentStoreInfo>*)> 477 std::vector<DownloadPersistentStoreInfo>*)>
478 DownloadQueryCallback; 478 DownloadQueryCallback;
479 479
480 // Begins a history request to retrieve the state of all downloads in the 480 // Begins a history request to retrieve the state of all downloads in the
481 // history db. 'callback' runs when the history service request is complete, 481 // history db. 'callback' runs when the history service request is complete,
482 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one 482 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one
483 // per download. 483 // per download.
484 Handle QueryDownloads(CancelableRequestConsumerBase* consumer, 484 virtual Handle QueryDownloads(CancelableRequestConsumerBase* consumer,
485 const DownloadQueryCallback& callback); 485 const DownloadQueryCallback& callback);
486 486
487 // Begins a request to clean up entries that has been corrupted (because of 487 // Begins a request to clean up entries that has been corrupted (because of
488 // the crash, for example). 488 // the crash, for example).
489 void CleanUpInProgressEntries(); 489 void CleanUpInProgressEntries();
490 490
491 // Called to update the history service about the current state of a download. 491 // Called to update the history service about the current state of a download.
492 // This is a 'fire and forget' query, so just pass the relevant state info to 492 // This is a 'fire and forget' query, so just pass the relevant state info to
493 // the database with no need for a callback. 493 // the database with no need for a callback.
494 void UpdateDownload(const content::DownloadPersistentStoreInfo& data); 494 virtual void UpdateDownload(const DownloadPersistentStoreInfo& data);
495 495
496 // Called to update the history service about the path of a download. 496 // Permanently remove some downloads from the history system. This is a 'fire
497 // This is a 'fire and forget' query. 497 // and forget' operation.
498 void UpdateDownloadPath(const FilePath& path, int64 db_handle); 498 virtual void RemoveDownloads(const std::set<int64>& db_handles);
499
500 // Permanently remove a download from the history system. This is a 'fire and
501 // forget' operation.
502 void RemoveDownload(int64 db_handle);
503
504 // Permanently removes all completed download from the history system within
505 // the specified range. This function does not delete downloads that are in
506 // progress or in the process of being cancelled. This is a 'fire and forget'
507 // operation. You can pass is_null times to get unbounded time in either or
508 // both directions.
509 void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
510 499
511 // Visit Segments ------------------------------------------------------------ 500 // Visit Segments ------------------------------------------------------------
512 501
513 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)> 502 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)>
514 SegmentQueryCallback; 503 SegmentQueryCallback;
515 504
516 // Query usage data for all visit segments since the provided time. 505 // Query usage data for all visit segments since the provided time.
517 // 506 //
518 // The request is performed asynchronously and can be cancelled by using the 507 // The request is performed asynchronously and can be cancelled by using the
519 // returned handle. 508 // returned handle.
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // TODO(mrossetti): Move in_memory_url_index out of history_service. 1112 // TODO(mrossetti): Move in_memory_url_index out of history_service.
1124 // See http://crbug.com/138321 1113 // See http://crbug.com/138321
1125 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1114 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1126 1115
1127 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1116 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1128 1117
1129 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1118 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1130 }; 1119 };
1131 1120
1132 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ 1121 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698