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

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: @r165669 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 20 matching lines...) Expand all
31 #include "ui/base/layout.h" 31 #include "ui/base/layout.h"
32 32
33 #if defined(OS_ANDROID) 33 #if defined(OS_ANDROID)
34 #include "chrome/browser/history/android/android_history_provider_service.h" 34 #include "chrome/browser/history/android/android_history_provider_service.h"
35 #endif 35 #endif
36 36
37 class BookmarkService; 37 class BookmarkService;
38 class FilePath; 38 class FilePath;
39 class GURL; 39 class GURL;
40 class HistoryURLProvider; 40 class HistoryURLProvider;
41 struct HistoryURLProviderParams;
42 class PageUsageData; 41 class PageUsageData;
43 class PageUsageRequest; 42 class PageUsageRequest;
44 class Profile; 43 class Profile;
44 struct DownloadPersistentStoreInfo;
45 struct HistoryURLProviderParams;
45 46
46 namespace base { 47 namespace base {
47 class Thread; 48 class Thread;
48 } 49 }
49 50
50 namespace content {
51 struct DownloadPersistentStoreInfo;
52 }
53 51
54 namespace history { 52 namespace history {
55 class InMemoryHistoryBackend; 53 class InMemoryHistoryBackend;
56 class InMemoryURLIndex; 54 class InMemoryURLIndex;
57 class InMemoryURLIndexTest; 55 class InMemoryURLIndexTest;
58 struct HistoryAddPageArgs; 56 struct HistoryAddPageArgs;
59 class HistoryBackend; 57 class HistoryBackend;
60 class HistoryDatabase; 58 class HistoryDatabase;
61 struct HistoryDetails; 59 struct HistoryDetails;
62 class HistoryQueryTest; 60 class HistoryQueryTest;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void(Handle, 347 void(Handle,
350 bool, // Were we able to determine the # of visits? 348 bool, // Were we able to determine the # of visits?
351 int, // Number of visits. 349 int, // Number of visits.
352 base::Time)> // Time of first visit. Only set if bool 350 base::Time)> // Time of first visit. Only set if bool
353 // is true and int is > 0. 351 // is true and int is > 0.
354 GetVisibleVisitCountToHostCallback; 352 GetVisibleVisitCountToHostCallback;
355 353
356 // Requests the number of user-visible visits (i.e. no redirects or subframes) 354 // Requests the number of user-visible visits (i.e. no redirects or subframes)
357 // to all urls on the same scheme/host/port as |url|. This is only valid for 355 // to all urls on the same scheme/host/port as |url|. This is only valid for
358 // HTTP and HTTPS URLs. 356 // HTTP and HTTPS URLs.
359 Handle GetVisibleVisitCountToHost( 357 virtual Handle GetVisibleVisitCountToHost(
360 const GURL& url, 358 const GURL& url,
361 CancelableRequestConsumerBase* consumer, 359 CancelableRequestConsumerBase* consumer,
362 const GetVisibleVisitCountToHostCallback& callback); 360 const GetVisibleVisitCountToHostCallback& callback);
363 361
364 // Called when QueryTopURLsAndRedirects completes. The vector contains a list 362 // Called when QueryTopURLsAndRedirects completes. The vector contains a list
365 // of the top |result_count| URLs. For each of these URLs, there is an entry 363 // of the top |result_count| URLs. For each of these URLs, there is an entry
366 // in the map containing redirects from the URL. For example, if we have the 364 // in the map containing redirects from the URL. For example, if we have the
367 // redirect chain A -> B -> C and A is a top visited URL, then A will be in 365 // redirect chain A -> B -> C and A is a top visited URL, then A will be in
368 // the vector and "A => {B -> C}" will be in the map. 366 // the vector and "A => {B -> C}" will be in the map.
369 typedef base::Callback< 367 typedef base::Callback<
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // removed. 440 // removed.
443 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 441 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
444 base::Time begin_time, base::Time end_time, 442 base::Time begin_time, base::Time end_time,
445 CancelableRequestConsumerBase* consumer, 443 CancelableRequestConsumerBase* consumer,
446 const base::Closure& callback); 444 const base::Closure& callback);
447 445
448 // Downloads ----------------------------------------------------------------- 446 // Downloads -----------------------------------------------------------------
449 447
450 // Implemented by the caller of 'CreateDownload' below, and is called when the 448 // Implemented by the caller of 'CreateDownload' below, and is called when the
451 // history service has created a new entry for a download in the history db. 449 // history service has created a new entry for a download in the history db.
452 typedef base::Callback<void(int32, int64)> DownloadCreateCallback; 450 typedef base::Callback<void(int64)> DownloadCreateCallback;
453 451
454 // Begins a history request to create a new persistent entry for a download. 452 // Begins a history request to create a new persistent entry for a download.
455 // 'info' contains all the download's creation state, and 'callback' runs 453 // 'info' contains all the download's creation state, and 'callback' runs
456 // when the history service request is complete. 454 // when the history service request is complete.
457 Handle CreateDownload(int32 id, 455 virtual Handle CreateDownload(
Randy Smith (Not in Mondays) 2012/11/02 23:31:25 Probably worthwhile putting a note in here somewhe
benjhayden 2012/11/06 20:01:14 Added a note below the section header on L446. I'd
Randy Smith (Not in Mondays) 2012/11/07 21:10:29 I'm good with that, but I'd request that you speci
benjhayden 2012/11/08 21:40:03 Done.
458 const content::DownloadPersistentStoreInfo& info, 456 const DownloadPersistentStoreInfo& info,
459 CancelableRequestConsumerBase* consumer, 457 CancelableRequestConsumerBase* consumer,
460 const DownloadCreateCallback& callback); 458 const DownloadCreateCallback& callback);
461 459
462 // Implemented by the caller of 'GetNextDownloadId' below. 460 // Implemented by the caller of 'GetNextDownloadId' below.
463 typedef base::Callback<void(int)> DownloadNextIdCallback; 461 typedef base::Callback<void(int)> DownloadNextIdCallback;
464 462
465 // Runs the callback with the next available download id. 463 // Runs the callback with the next available download id.
466 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer, 464 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer,
467 const DownloadNextIdCallback& callback); 465 const DownloadNextIdCallback& callback);
468 466
469 // Implemented by the caller of 'QueryDownloads' below, and is called when the 467 // Implemented by the caller of 'QueryDownloads' below, and is called when the
470 // history service has retrieved a list of all download state. The call 468 // history service has retrieved a list of all download state. The call
471 typedef base::Callback<void( 469 typedef base::Callback<void(
472 std::vector<content::DownloadPersistentStoreInfo>*)> 470 std::vector<DownloadPersistentStoreInfo>*)>
473 DownloadQueryCallback; 471 DownloadQueryCallback;
474 472
475 // Begins a history request to retrieve the state of all downloads in the 473 // Begins a history request to retrieve the state of all downloads in the
476 // history db. 'callback' runs when the history service request is complete, 474 // history db. 'callback' runs when the history service request is complete,
477 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one 475 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one
478 // per download. 476 // per download.
479 Handle QueryDownloads(CancelableRequestConsumerBase* consumer, 477 virtual Handle QueryDownloads(CancelableRequestConsumerBase* consumer,
480 const DownloadQueryCallback& callback); 478 const DownloadQueryCallback& callback);
481 479
482 // Begins a request to clean up entries that has been corrupted (because of 480 // Begins a request to clean up entries that has been corrupted (because of
483 // the crash, for example). 481 // the crash, for example).
484 void CleanUpInProgressEntries(); 482 void CleanUpInProgressEntries();
485 483
486 // Called to update the history service about the current state of a download. 484 // Called to update the history service about the current state of a download.
487 // This is a 'fire and forget' query, so just pass the relevant state info to 485 // This is a 'fire and forget' query, so just pass the relevant state info to
488 // the database with no need for a callback. 486 // the database with no need for a callback.
489 void UpdateDownload(const content::DownloadPersistentStoreInfo& data); 487 virtual void UpdateDownload(const DownloadPersistentStoreInfo& data);
490 488
491 // Called to update the history service about the path of a download. 489 // Permanently remove some downloads from the history system. This is a 'fire
492 // This is a 'fire and forget' query. 490 // and forget' operation.
493 void UpdateDownloadPath(const FilePath& path, int64 db_handle); 491 virtual void RemoveDownloads(const std::set<int64>& db_handles);
494
495 // Permanently remove a download from the history system. This is a 'fire and
496 // forget' operation.
497 void RemoveDownload(int64 db_handle);
498
499 // Permanently removes all completed download from the history system within
500 // the specified range. This function does not delete downloads that are in
501 // progress or in the process of being cancelled. This is a 'fire and forget'
502 // operation. You can pass is_null times to get unbounded time in either or
503 // both directions.
504 void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
505 492
506 // Visit Segments ------------------------------------------------------------ 493 // Visit Segments ------------------------------------------------------------
507 494
508 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)> 495 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)>
509 SegmentQueryCallback; 496 SegmentQueryCallback;
510 497
511 // Query usage data for all visit segments since the provided time. 498 // Query usage data for all visit segments since the provided time.
512 // 499 //
513 // The request is performed asynchronously and can be cancelled by using the 500 // The request is performed asynchronously and can be cancelled by using the
514 // returned handle. 501 // returned handle.
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 // TODO(mrossetti): Move in_memory_url_index out of history_service. 1087 // TODO(mrossetti): Move in_memory_url_index out of history_service.
1101 // See http://crbug.com/138321 1088 // See http://crbug.com/138321
1102 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1089 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1103 1090
1104 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1091 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1105 1092
1106 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1093 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1107 }; 1094 };
1108 1095
1109 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ 1096 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698