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

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

Issue 137263007: Move CancelableTaskTracker to //base/task/CancelableTaskTracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to base/task/cancelable_task_tracker* Created 6 years, 10 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
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_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/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/task/cancelable_task_tracker.h"
21 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
22 #include "base/time/time.h" 23 #include "base/time/time.h"
23 #include "chrome/browser/common/cancelable_request.h" 24 #include "chrome/browser/common/cancelable_request.h"
24 #include "chrome/browser/favicon/favicon_service.h" 25 #include "chrome/browser/favicon/favicon_service.h"
25 #include "chrome/browser/history/delete_directive_handler.h" 26 #include "chrome/browser/history/delete_directive_handler.h"
26 #include "chrome/browser/history/history_types.h" 27 #include "chrome/browser/history/history_types.h"
27 #include "chrome/browser/history/typed_url_syncable_service.h" 28 #include "chrome/browser/history/typed_url_syncable_service.h"
28 #include "chrome/browser/search_engines/template_url_id.h" 29 #include "chrome/browser/search_engines/template_url_id.h"
29 #include "chrome/common/cancelable_task_tracker.h"
30 #include "chrome/common/ref_counted_util.h" 30 #include "chrome/common/ref_counted_util.h"
31 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 31 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
32 #include "components/visitedlink/browser/visitedlink_delegate.h" 32 #include "components/visitedlink/browser/visitedlink_delegate.h"
33 #include "content/public/browser/download_manager_delegate.h" 33 #include "content/public/browser/download_manager_delegate.h"
34 #include "content/public/browser/notification_observer.h" 34 #include "content/public/browser/notification_observer.h"
35 #include "content/public/browser/notification_registrar.h" 35 #include "content/public/browser/notification_registrar.h"
36 #include "content/public/common/page_transition_types.h" 36 #include "content/public/common/page_transition_types.h"
37 #include "sql/init_status.h" 37 #include "sql/init_status.h"
38 #include "sync/api/syncable_service.h" 38 #include "sync/api/syncable_service.h"
39 #include "ui/base/layout.h" 39 #include "ui/base/layout.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // associated data. This function also deletes the associated 375 // associated data. This function also deletes the associated
376 // favicons, if they are no longer referenced. |callback| runs when 376 // favicons, if they are no longer referenced. |callback| runs when
377 // the expiration is complete. You may use null Time values to do an 377 // the expiration is complete. You may use null Time values to do an
378 // unbounded delete in either direction. 378 // unbounded delete in either direction.
379 // If |restrict_urls| is not empty, only visits to the URLs in this set are 379 // If |restrict_urls| is not empty, only visits to the URLs in this set are
380 // removed. 380 // removed.
381 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 381 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
382 base::Time begin_time, 382 base::Time begin_time,
383 base::Time end_time, 383 base::Time end_time,
384 const base::Closure& callback, 384 const base::Closure& callback,
385 CancelableTaskTracker* tracker); 385 base::CancelableTaskTracker* tracker);
386 386
387 // Removes all visits to specified URLs in specific time ranges. 387 // Removes all visits to specified URLs in specific time ranges.
388 // This is the equivalent ExpireHistoryBetween() once for each element in the 388 // This is the equivalent ExpireHistoryBetween() once for each element in the
389 // vector. The fields of |ExpireHistoryArgs| map directly to the arguments of 389 // vector. The fields of |ExpireHistoryArgs| map directly to the arguments of
390 // of ExpireHistoryBetween(). 390 // of ExpireHistoryBetween().
391 void ExpireHistory(const std::vector<history::ExpireHistoryArgs>& expire_list, 391 void ExpireHistory(const std::vector<history::ExpireHistoryArgs>& expire_list,
392 const base::Closure& callback, 392 const base::Closure& callback,
393 CancelableTaskTracker* tracker); 393 base::CancelableTaskTracker* tracker);
394 394
395 // Removes all visits to the given URLs in the specified time range. Calls 395 // Removes all visits to the given URLs in the specified time range. Calls
396 // ExpireHistoryBetween() to delete local visits, and handles deletion of 396 // ExpireHistoryBetween() to delete local visits, and handles deletion of
397 // synced visits if appropriate. 397 // synced visits if appropriate.
398 void ExpireLocalAndRemoteHistoryBetween( 398 void ExpireLocalAndRemoteHistoryBetween(const std::set<GURL>& restrict_urls,
399 const std::set<GURL>& restrict_urls, 399 base::Time begin_time,
400 base::Time begin_time, 400 base::Time end_time,
401 base::Time end_time, 401 const base::Closure& callback,
402 const base::Closure& callback, 402 base::CancelableTaskTracker* tracker);
403 CancelableTaskTracker* tracker);
404 403
405 // Processes the given |delete_directive| and sends it to the 404 // Processes the given |delete_directive| and sends it to the
406 // SyncChangeProcessor (if it exists). Returns any error resulting 405 // SyncChangeProcessor (if it exists). Returns any error resulting
407 // from sending the delete directive to sync. 406 // from sending the delete directive to sync.
408 syncer::SyncError ProcessLocalDeleteDirective( 407 syncer::SyncError ProcessLocalDeleteDirective(
409 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); 408 const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive);
410 409
411 // Downloads ----------------------------------------------------------------- 410 // Downloads -----------------------------------------------------------------
412 411
413 // Implemented by the caller of 'CreateDownload' below, and is called when the 412 // Implemented by the caller of 'CreateDownload' below, and is called when the
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // Used by FaviconService to get the favicon bitmaps from the history backend 658 // Used by FaviconService to get the favicon bitmaps from the history backend
660 // which most closely match |desired_size_in_dip| x |desired_size_in_dip| and 659 // which most closely match |desired_size_in_dip| x |desired_size_in_dip| and
661 // |desired_scale_factors| for |icon_types|. If |desired_size_in_dip| is 0, 660 // |desired_scale_factors| for |icon_types|. If |desired_size_in_dip| is 0,
662 // the largest favicon bitmap for |icon_types| is returned. The returned 661 // the largest favicon bitmap for |icon_types| is returned. The returned
663 // FaviconBitmapResults will have at most one result for each of 662 // FaviconBitmapResults will have at most one result for each of
664 // |desired_scale_factors|. If a favicon bitmap is determined to be the best 663 // |desired_scale_factors|. If a favicon bitmap is determined to be the best
665 // candidate for multiple scale factors there will be less results. 664 // candidate for multiple scale factors there will be less results.
666 // If |icon_types| has several types, results for only a single type will be 665 // If |icon_types| has several types, results for only a single type will be
667 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and 666 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and
668 // FAVICON. 667 // FAVICON.
669 CancelableTaskTracker::TaskId GetFavicons( 668 base::CancelableTaskTracker::TaskId GetFavicons(
670 const std::vector<GURL>& icon_urls, 669 const std::vector<GURL>& icon_urls,
671 int icon_types, 670 int icon_types,
672 int desired_size_in_dip, 671 int desired_size_in_dip,
673 const std::vector<ui::ScaleFactor>& desired_scale_factors, 672 const std::vector<ui::ScaleFactor>& desired_scale_factors,
674 const FaviconService::FaviconResultsCallback& callback, 673 const FaviconService::FaviconResultsCallback& callback,
675 CancelableTaskTracker* tracker); 674 base::CancelableTaskTracker* tracker);
676 675
677 // Used by the FaviconService to get favicons mapped to |page_url| for 676 // Used by the FaviconService to get favicons mapped to |page_url| for
678 // |icon_types| which most closely match |desired_size_in_dip| and 677 // |icon_types| which most closely match |desired_size_in_dip| and
679 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon 678 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon
680 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will 679 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will
681 // have at most one result for each of |desired_scale_factors|. If a favicon 680 // have at most one result for each of |desired_scale_factors|. If a favicon
682 // bitmap is determined to be the best candidate for multiple scale factors 681 // bitmap is determined to be the best candidate for multiple scale factors
683 // there will be less results. If |icon_types| has several types, results for 682 // there will be less results. If |icon_types| has several types, results for
684 // only a single type will be returned in the priority of 683 // only a single type will be returned in the priority of
685 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. 684 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON.
686 CancelableTaskTracker::TaskId GetFaviconsForURL( 685 base::CancelableTaskTracker::TaskId GetFaviconsForURL(
687 const GURL& page_url, 686 const GURL& page_url,
688 int icon_types, 687 int icon_types,
689 int desired_size_in_dip, 688 int desired_size_in_dip,
690 const std::vector<ui::ScaleFactor>& desired_scale_factors, 689 const std::vector<ui::ScaleFactor>& desired_scale_factors,
691 const FaviconService::FaviconResultsCallback& callback, 690 const FaviconService::FaviconResultsCallback& callback,
692 CancelableTaskTracker* tracker); 691 base::CancelableTaskTracker* tracker);
693 692
694 // Used by FaviconService to find the first favicon bitmap whose width and 693 // Used by FaviconService to find the first favicon bitmap whose width and
695 // height are greater than that of |minimum_size_in_pixels|. This searches 694 // height are greater than that of |minimum_size_in_pixels|. This searches
696 // for icons by IconType. Each element of |icon_types| is a bitmask of 695 // for icons by IconType. Each element of |icon_types| is a bitmask of
697 // IconTypes indicating the types to search for. 696 // IconTypes indicating the types to search for.
698 // If the largest icon of |icon_types[0]| is not larger than 697 // If the largest icon of |icon_types[0]| is not larger than
699 // |minimum_size_in_pixel|, the next icon types of 698 // |minimum_size_in_pixel|, the next icon types of
700 // |icon_types| will be searched and so on. 699 // |icon_types| will be searched and so on.
701 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all 700 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all
702 // icon types in |icon_types| is returned. 701 // icon types in |icon_types| is returned.
703 // This feature is especially useful when some types of icon is perfered as 702 // This feature is especially useful when some types of icon is perfered as
704 // long as its size is larger than a specific value. 703 // long as its size is larger than a specific value.
705 CancelableTaskTracker::TaskId GetLargestFaviconForURL( 704 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL(
706 const GURL& page_url, 705 const GURL& page_url,
707 const std::vector<int>& icon_types, 706 const std::vector<int>& icon_types,
708 int minimum_size_in_pixels, 707 int minimum_size_in_pixels,
709 const FaviconService::FaviconRawCallback& callback, 708 const FaviconService::FaviconRawCallback& callback,
710 CancelableTaskTracker* tracker); 709 base::CancelableTaskTracker* tracker);
711 710
712 // Used by the FaviconService to get the favicon bitmap which most closely 711 // Used by the FaviconService to get the favicon bitmap which most closely
713 // matches |desired_size_in_dip| and |desired_scale_factor| from the favicon 712 // matches |desired_size_in_dip| and |desired_scale_factor| from the favicon
714 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0, 713 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0,
715 // the largest favicon bitmap for |favicon_id| is returned. 714 // the largest favicon bitmap for |favicon_id| is returned.
716 CancelableTaskTracker::TaskId GetFaviconForID( 715 base::CancelableTaskTracker::TaskId GetFaviconForID(
717 chrome::FaviconID favicon_id, 716 chrome::FaviconID favicon_id,
718 int desired_size_in_dip, 717 int desired_size_in_dip,
719 ui::ScaleFactor desired_scale_factor, 718 ui::ScaleFactor desired_scale_factor,
720 const FaviconService::FaviconResultsCallback& callback, 719 const FaviconService::FaviconResultsCallback& callback,
721 CancelableTaskTracker* tracker); 720 base::CancelableTaskTracker* tracker);
722 721
723 // Used by the FaviconService to replace the favicon mappings to |page_url| 722 // Used by the FaviconService to replace the favicon mappings to |page_url|
724 // for |icon_types| on the history backend. 723 // for |icon_types| on the history backend.
725 // Sample |icon_urls|: 724 // Sample |icon_urls|:
726 // { ICON_URL1 -> TOUCH_ICON, known to the database, 725 // { ICON_URL1 -> TOUCH_ICON, known to the database,
727 // ICON_URL2 -> TOUCH_ICON, not known to the database, 726 // ICON_URL2 -> TOUCH_ICON, not known to the database,
728 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } 727 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database }
729 // The new mappings are computed from |icon_urls| with these rules: 728 // The new mappings are computed from |icon_urls| with these rules:
730 // 1) Any urls in |icon_urls| which are not already known to the database are 729 // 1) Any urls in |icon_urls| which are not already known to the database are
731 // rejected. 730 // rejected.
732 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } 731 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 }
733 // 2) If |icon_types| has multiple types, the mappings are only set for the 732 // 2) If |icon_types| has multiple types, the mappings are only set for the
734 // largest icon type. 733 // largest icon type.
735 // Sample new mappings to |page_url|: { ICON_URL3 } 734 // Sample new mappings to |page_url|: { ICON_URL3 }
736 // |icon_types| can only have multiple IconTypes if 735 // |icon_types| can only have multiple IconTypes if
737 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. 736 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON.
738 // The favicon bitmaps which most closely match |desired_size_in_dip| 737 // The favicon bitmaps which most closely match |desired_size_in_dip|
739 // and |desired_scale_factors| from the favicons which were just mapped 738 // and |desired_scale_factors| from the favicons which were just mapped
740 // to |page_url| are returned. If |desired_size_in_dip| is 0, the 739 // to |page_url| are returned. If |desired_size_in_dip| is 0, the
741 // largest favicon bitmap is returned. 740 // largest favicon bitmap is returned.
742 CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch( 741 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch(
743 const GURL& page_url, 742 const GURL& page_url,
744 const std::vector<GURL>& icon_urls, 743 const std::vector<GURL>& icon_urls,
745 int icon_types, 744 int icon_types,
746 int desired_size_in_dip, 745 int desired_size_in_dip,
747 const std::vector<ui::ScaleFactor>& desired_scale_factors, 746 const std::vector<ui::ScaleFactor>& desired_scale_factors,
748 const FaviconService::FaviconResultsCallback& callback, 747 const FaviconService::FaviconResultsCallback& callback,
749 CancelableTaskTracker* tracker); 748 base::CancelableTaskTracker* tracker);
750 749
751 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with 750 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with
752 // |pixel_size|. 751 // |pixel_size|.
753 // Example: 752 // Example:
754 // |page_url|: www.google.com 753 // |page_url|: www.google.com
755 // 2 favicons in history for |page_url|: 754 // 2 favicons in history for |page_url|:
756 // www.google.com/a.ico 16x16 755 // www.google.com/a.ico 16x16
757 // www.google.com/b.ico 32x32 756 // www.google.com/b.ico 32x32
758 // MergeFavicon(|page_url|, www.google.com/a.ico, ..., ..., 16x16) 757 // MergeFavicon(|page_url|, www.google.com/a.ico, ..., ..., 16x16)
759 // 758 //
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1064 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1066 1065
1067 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1066 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1068 1067
1069 history::DeleteDirectiveHandler delete_directive_handler_; 1068 history::DeleteDirectiveHandler delete_directive_handler_;
1070 1069
1071 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1070 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1072 }; 1071 };
1073 1072
1074 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 1073 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/android/sqlite_cursor.cc ('k') | chrome/browser/history/history_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698