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

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

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed local variables in tests Created 6 years 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
(...skipping 13 matching lines...) Expand all
24 #include "base/time/time.h" 24 #include "base/time/time.h"
25 #include "chrome/browser/history/delete_directive_handler.h" 25 #include "chrome/browser/history/delete_directive_handler.h"
26 #include "chrome/browser/history/typed_url_syncable_service.h" 26 #include "chrome/browser/history/typed_url_syncable_service.h"
27 #include "chrome/common/ref_counted_util.h" 27 #include "chrome/common/ref_counted_util.h"
28 #include "components/favicon_base/favicon_callback.h" 28 #include "components/favicon_base/favicon_callback.h"
29 #include "components/history/core/browser/history_client.h" 29 #include "components/history/core/browser/history_client.h"
30 #include "components/history/core/browser/keyword_id.h" 30 #include "components/history/core/browser/keyword_id.h"
31 #include "components/keyed_service/core/keyed_service.h" 31 #include "components/keyed_service/core/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"
35 #include "content/public/browser/notification_registrar.h"
36 #include "sql/init_status.h" 34 #include "sql/init_status.h"
37 #include "sync/api/syncable_service.h" 35 #include "sync/api/syncable_service.h"
38 #include "ui/base/page_transition_types.h" 36 #include "ui/base/page_transition_types.h"
39 37
40 #if defined(OS_ANDROID) 38 #if defined(OS_ANDROID)
41 class AndroidHistoryProviderService; 39 class AndroidHistoryProviderService;
42 #endif 40 #endif
43 41
44 class GURL; 42 class GURL;
45 class PageUsageData; 43 class PageUsageData;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 struct HistoryDetails; 78 struct HistoryDetails;
81 struct KeywordSearchTermVisit; 79 struct KeywordSearchTermVisit;
82 80
83 } // namespace history 81 } // namespace history
84 82
85 // The history service records page titles, and visit times, as well as 83 // The history service records page titles, and visit times, as well as
86 // (eventually) information about autocomplete. 84 // (eventually) information about autocomplete.
87 // 85 //
88 // This service is thread safe. Each request callback is invoked in the 86 // This service is thread safe. Each request callback is invoked in the
89 // thread that made the request. 87 // thread that made the request.
90 class HistoryService : public content::NotificationObserver, 88 class HistoryService : public syncer::SyncableService,
91 public syncer::SyncableService,
92 public KeyedService, 89 public KeyedService,
93 public visitedlink::VisitedLinkDelegate { 90 public visitedlink::VisitedLinkDelegate {
94 public: 91 public:
95 // Miscellaneous commonly-used types. 92 // Miscellaneous commonly-used types.
96 typedef std::vector<PageUsageData*> PageUsageDataList; 93 typedef std::vector<PageUsageData*> PageUsageDataList;
97 94
98 // Must call Init after construction. The |history::HistoryClient| object 95 // Must call Init after construction. The |history::HistoryClient| object
99 // must be valid for the whole lifetime of |HistoryService|. 96 // must be valid for the whole lifetime of |HistoryService|.
100 explicit HistoryService(history::HistoryClient* client, Profile* profile); 97 explicit HistoryService(history::HistoryClient* client, Profile* profile);
101 // The empty constructor is provided only for testing. 98 // The empty constructor is provided only for testing.
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // will release pointers to it. No other functions should be called once 550 // will release pointers to it. No other functions should be called once
554 // cleanup has happened that may dispatch to the history thread (because it 551 // cleanup has happened that may dispatch to the history thread (because it
555 // will be NULL). 552 // will be NULL).
556 // 553 //
557 // In practice, this will be called by the service manager (BrowserProcess) 554 // In practice, this will be called by the service manager (BrowserProcess)
558 // when it is being destroyed. Because that reference is being destroyed, it 555 // when it is being destroyed. Because that reference is being destroyed, it
559 // should be impossible for anybody else to call the service, even if it is 556 // should be impossible for anybody else to call the service, even if it is
560 // still in memory (pending requests may be holding a reference to us). 557 // still in memory (pending requests may be holding a reference to us).
561 void Cleanup(); 558 void Cleanup();
562 559
563 // Implementation of content::NotificationObserver.
564 void Observe(int type,
565 const content::NotificationSource& source,
566 const content::NotificationDetails& details) override;
567
568 // Implementation of visitedlink::VisitedLinkDelegate. 560 // Implementation of visitedlink::VisitedLinkDelegate.
569 void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override; 561 void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
570 562
571 // Low-level Init(). Same as the public version, but adds a |no_db| parameter 563 // Low-level Init(). Same as the public version, but adds a |no_db| parameter
572 // that is only set by unittests which causes the backend to not init its DB. 564 // that is only set by unittests which causes the backend to not init its DB.
573 bool Init(const base::FilePath& history_dir, bool no_db); 565 bool Init(const base::FilePath& history_dir, bool no_db);
574 566
575 // Called by the HistoryURLProvider class to schedule an autocomplete, it 567 // Called by the HistoryURLProvider class to schedule an autocomplete, it
576 // will be called back on the internal history thread with the history 568 // will be called back on the internal history thread with the history
577 // database so it can query. See history_autocomplete.cc for a diagram. 569 // database so it can query. See history_autocomplete.cc for a diagram.
(...skipping 28 matching lines...) Expand all
606 // |redirects| is an empty vector. 598 // |redirects| is an empty vector.
607 void NotifyURLVisited(ui::PageTransition transition, 599 void NotifyURLVisited(ui::PageTransition transition,
608 const history::URLRow& row, 600 const history::URLRow& row,
609 const history::RedirectList& redirects, 601 const history::RedirectList& redirects,
610 base::Time visit_time); 602 base::Time visit_time);
611 603
612 // Notify all HistoryServiceObservers registered that URLs have been added or 604 // Notify all HistoryServiceObservers registered that URLs have been added or
613 // modified. |changed_urls| contains the list of affects URLs. 605 // modified. |changed_urls| contains the list of affects URLs.
614 void NotifyURLsModified(const history::URLRows& changed_urls); 606 void NotifyURLsModified(const history::URLRows& changed_urls);
615 607
608 // Notify all HistoryServiceObservers registered that URLs have been deleted.
609 // |all_history| is set to true, if all the URLs are deleted.
610 // When set to true, |deleted_rows| and |favicon_urls| are
611 // undefined.
612 // |expired| is set to true, if the URL deletion is due to expiration.
613 // |deleted_rows| list of the deleted URLs.
614 // |favicon_urls| list of favicon URLs that correspond to the deleted URLs.
615 void NotifyURLsDeleted(bool all_history,
616 bool expired,
617 const history::URLRows& deleted_rows,
618 const std::set<GURL>& favicon_urls);
619
616 // Notify all HistoryServiceObservers registered that the 620 // Notify all HistoryServiceObservers registered that the
617 // HistoryService has finished loading. 621 // HistoryService has finished loading.
618 void NotifyHistoryServiceLoaded(); 622 void NotifyHistoryServiceLoaded();
619 623
620 // HistoryService is being deleted. 624 // Notify all HistoryServiceObservers registered that HistoryService is being
625 // deleted.
621 void NotifyHistoryServiceBeingDeleted(); 626 void NotifyHistoryServiceBeingDeleted();
622 627
623 // Favicon ------------------------------------------------------------------- 628 // Favicon -------------------------------------------------------------------
624 629
625 // These favicon methods are exposed to the FaviconService. Instead of calling 630 // These favicon methods are exposed to the FaviconService. Instead of calling
626 // these methods directly you should call the respective method on the 631 // these methods directly you should call the respective method on the
627 // FaviconService. 632 // FaviconService.
628 633
629 // Used by FaviconService to get the favicon bitmaps from the history backend 634 // Used by FaviconService to get the favicon bitmaps from the history backend
630 // whose edge sizes most closely match |desired_sizes| for |icon_types|. If 635 // whose edge sizes most closely match |desired_sizes| for |icon_types|. If
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 DCHECK(thread_checker_.CalledOnValidThread()); 861 DCHECK(thread_checker_.CalledOnValidThread());
857 ScheduleTask(priority, base::Bind(func, history_backend_.get(), 862 ScheduleTask(priority, base::Bind(func, history_backend_.get(),
858 a, b, c, d, e)); 863 a, b, c, d, e));
859 } 864 }
860 865
861 // TODO(sdefresne): http://crbug.com/430070 remove this method. 866 // TODO(sdefresne): http://crbug.com/430070 remove this method.
862 Profile* profile() { return profile_; } 867 Profile* profile() { return profile_; }
863 868
864 base::ThreadChecker thread_checker_; 869 base::ThreadChecker thread_checker_;
865 870
866 content::NotificationRegistrar registrar_;
867
868 // The thread used by the history service to run complicated operations. 871 // The thread used by the history service to run complicated operations.
869 // |thread_| is NULL once |Cleanup| is NULL. 872 // |thread_| is NULL once |Cleanup| is NULL.
870 base::Thread* thread_; 873 base::Thread* thread_;
871 874
872 // This class has most of the implementation and runs on the 'thread_'. 875 // This class has most of the implementation and runs on the 'thread_'.
873 // You MUST communicate with this class ONLY through the thread_'s 876 // You MUST communicate with this class ONLY through the thread_'s
874 // message_loop(). 877 // message_loop().
875 // 878 //
876 // This pointer will be NULL once Cleanup() has been called, meaning no 879 // This pointer will be NULL once Cleanup() has been called, meaning no
877 // more calls should be made to the history thread. 880 // more calls should be made to the history thread.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 916
914 history::DeleteDirectiveHandler delete_directive_handler_; 917 history::DeleteDirectiveHandler delete_directive_handler_;
915 918
916 // All vended weak pointers are invalidated in Cleanup(). 919 // All vended weak pointers are invalidated in Cleanup().
917 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; 920 base::WeakPtrFactory<HistoryService> weak_ptr_factory_;
918 921
919 DISALLOW_COPY_AND_ASSIGN(HistoryService); 922 DISALLOW_COPY_AND_ASSIGN(HistoryService);
920 }; 923 };
921 924
922 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 925 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698