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

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: @r159248 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 void(Handle, 343 void(Handle,
346 bool, // Were we able to determine the # of visits? 344 bool, // Were we able to determine the # of visits?
347 int, // Number of visits. 345 int, // Number of visits.
348 base::Time)> // Time of first visit. Only set if bool 346 base::Time)> // Time of first visit. Only set if bool
349 // is true and int is > 0. 347 // is true and int is > 0.
350 GetVisibleVisitCountToHostCallback; 348 GetVisibleVisitCountToHostCallback;
351 349
352 // Requests the number of user-visible visits (i.e. no redirects or subframes) 350 // Requests the number of user-visible visits (i.e. no redirects or subframes)
353 // to all urls on the same scheme/host/port as |url|. This is only valid for 351 // to all urls on the same scheme/host/port as |url|. This is only valid for
354 // HTTP and HTTPS URLs. 352 // HTTP and HTTPS URLs.
355 Handle GetVisibleVisitCountToHost( 353 virtual Handle GetVisibleVisitCountToHost(
356 const GURL& url, 354 const GURL& url,
357 CancelableRequestConsumerBase* consumer, 355 CancelableRequestConsumerBase* consumer,
358 const GetVisibleVisitCountToHostCallback& callback); 356 const GetVisibleVisitCountToHostCallback& callback);
359 357
360 // Called when QueryTopURLsAndRedirects completes. The vector contains a list 358 // Called when QueryTopURLsAndRedirects completes. The vector contains a list
361 // of the top |result_count| URLs. For each of these URLs, there is an entry 359 // of the top |result_count| URLs. For each of these URLs, there is an entry
362 // in the map containing redirects from the URL. For example, if we have the 360 // in the map containing redirects from the URL. For example, if we have the
363 // redirect chain A -> B -> C and A is a top visited URL, then A will be in 361 // redirect chain A -> B -> C and A is a top visited URL, then A will be in
364 // the vector and "A => {B -> C}" will be in the map. 362 // the vector and "A => {B -> C}" will be in the map.
365 typedef base::Callback< 363 typedef base::Callback<
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // removed. 436 // removed.
439 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 437 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
440 base::Time begin_time, base::Time end_time, 438 base::Time begin_time, base::Time end_time,
441 CancelableRequestConsumerBase* consumer, 439 CancelableRequestConsumerBase* consumer,
442 const base::Closure& callback); 440 const base::Closure& callback);
443 441
444 // Downloads ----------------------------------------------------------------- 442 // Downloads -----------------------------------------------------------------
445 443
446 // Implemented by the caller of 'CreateDownload' below, and is called when the 444 // Implemented by the caller of 'CreateDownload' below, and is called when the
447 // history service has created a new entry for a download in the history db. 445 // history service has created a new entry for a download in the history db.
448 typedef base::Callback<void(int32, int64)> DownloadCreateCallback; 446 typedef base::Callback<void(int64)> DownloadCreateCallback;
449 447
450 // Begins a history request to create a new persistent entry for a download. 448 // Begins a history request to create a new persistent entry for a download.
451 // 'info' contains all the download's creation state, and 'callback' runs 449 // 'info' contains all the download's creation state, and 'callback' runs
452 // when the history service request is complete. 450 // when the history service request is complete.
453 Handle CreateDownload(int32 id, 451 virtual Handle CreateDownload(
454 const content::DownloadPersistentStoreInfo& info, 452 const DownloadPersistentStoreInfo& info,
455 CancelableRequestConsumerBase* consumer, 453 CancelableRequestConsumerBase* consumer,
456 const DownloadCreateCallback& callback); 454 const DownloadCreateCallback& callback);
457 455
458 // Implemented by the caller of 'GetNextDownloadId' below. 456 // Implemented by the caller of 'GetNextDownloadId' below.
459 typedef base::Callback<void(int)> DownloadNextIdCallback; 457 typedef base::Callback<void(int)> DownloadNextIdCallback;
460 458
461 // Runs the callback with the next available download id. 459 // Runs the callback with the next available download id.
462 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer, 460 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer,
463 const DownloadNextIdCallback& callback); 461 const DownloadNextIdCallback& callback);
464 462
465 // Implemented by the caller of 'QueryDownloads' below, and is called when the 463 // Implemented by the caller of 'QueryDownloads' below, and is called when the
466 // history service has retrieved a list of all download state. The call 464 // history service has retrieved a list of all download state. The call
467 typedef base::Callback<void( 465 typedef base::Callback<void(
468 std::vector<content::DownloadPersistentStoreInfo>*)> 466 std::vector<DownloadPersistentStoreInfo>*)>
469 DownloadQueryCallback; 467 DownloadQueryCallback;
470 468
471 // Begins a history request to retrieve the state of all downloads in the 469 // Begins a history request to retrieve the state of all downloads in the
472 // history db. 'callback' runs when the history service request is complete, 470 // history db. 'callback' runs when the history service request is complete,
473 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one 471 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one
474 // per download. 472 // per download.
475 Handle QueryDownloads(CancelableRequestConsumerBase* consumer, 473 virtual Handle QueryDownloads(CancelableRequestConsumerBase* consumer,
476 const DownloadQueryCallback& callback); 474 const DownloadQueryCallback& callback);
477 475
478 // Begins a request to clean up entries that has been corrupted (because of 476 // Begins a request to clean up entries that has been corrupted (because of
479 // the crash, for example). 477 // the crash, for example).
480 void CleanUpInProgressEntries(); 478 void CleanUpInProgressEntries();
481 479
482 // Called to update the history service about the current state of a download. 480 // Called to update the history service about the current state of a download.
483 // This is a 'fire and forget' query, so just pass the relevant state info to 481 // This is a 'fire and forget' query, so just pass the relevant state info to
484 // the database with no need for a callback. 482 // the database with no need for a callback.
485 void UpdateDownload(const content::DownloadPersistentStoreInfo& data); 483 virtual void UpdateDownload(const DownloadPersistentStoreInfo& data);
486 484
487 // Called to update the history service about the path of a download. 485 // Permanently remove some downloads from the history system. This is a 'fire
488 // This is a 'fire and forget' query. 486 // and forget' operation.
489 void UpdateDownloadPath(const FilePath& path, int64 db_handle); 487 virtual void RemoveDownloads(const std::set<int64>& db_handles);
490
491 // Permanently remove a download from the history system. This is a 'fire and
492 // forget' operation.
493 void RemoveDownload(int64 db_handle);
494
495 // Permanently removes all completed download from the history system within
496 // the specified range. This function does not delete downloads that are in
497 // progress or in the process of being cancelled. This is a 'fire and forget'
498 // operation. You can pass is_null times to get unbounded time in either or
499 // both directions.
500 void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
501 488
502 // Visit Segments ------------------------------------------------------------ 489 // Visit Segments ------------------------------------------------------------
503 490
504 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)> 491 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)>
505 SegmentQueryCallback; 492 SegmentQueryCallback;
506 493
507 // Query usage data for all visit segments since the provided time. 494 // Query usage data for all visit segments since the provided time.
508 // 495 //
509 // The request is performed asynchronously and can be cancelled by using the 496 // The request is performed asynchronously and can be cancelled by using the
510 // returned handle. 497 // returned handle.
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 // See http://crbug.com/138321 1076 // See http://crbug.com/138321
1090 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1077 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1091 1078
1092 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > 1079 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> >
1093 visit_database_observers_; 1080 visit_database_observers_;
1094 1081
1095 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1082 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1096 }; 1083 };
1097 1084
1098 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ 1085 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698