Index: components/history/core/browser/web_history_service.h |
diff --git a/components/history/core/browser/web_history_service.h b/components/history/core/browser/web_history_service.h |
index 0b6c08bdc86839c3ef68300382d6a3bcb7c1ac5a..51d9db0d512e20890ef9ce89c5df52c2fc4e7106 100644 |
--- a/components/history/core/browser/web_history_service.h |
+++ b/components/history/core/browser/web_history_service.h |
@@ -14,6 +14,7 @@ |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
#include "components/history/core/browser/history_types.h" |
#include "components/keyed_service/core/keyed_service.h" |
@@ -34,11 +35,23 @@ class SigninManagerBase; |
namespace history { |
+class HistoryServiceObserver; |
+ |
// Provides an API for querying Google servers for a signed-in user's |
// synced history visits. It is roughly analogous to HistoryService, and |
// supports a similar API. |
class WebHistoryService : public KeyedService { |
public: |
+ // Observes WebHistoryService actions. Currently only history expiration |
+ // is supported. |
+ // TODO(msramek): Consider defining ObservableHistoryService as a common |
+ // abstract ancestor for HistoryService and WebHistoryService. Then, we could |
+ // change the signatures of HistoryServiceObserver to use it for both classes. |
+ class Observer { |
+ public: |
+ virtual void OnWebHistoryDeleted() = 0; |
+ }; |
+ |
// Handles all the work of making an API request. This class encapsulates |
// the entire state of the request. When an instance is destroyed, all |
// aspects of the request are cancelled. |
@@ -95,6 +108,9 @@ class WebHistoryService : public KeyedService { |
const scoped_refptr<net::URLRequestContextGetter>& request_context); |
~WebHistoryService() override; |
+ void AddObserver(Observer* observer); |
+ void RemoveObserver(Observer* observer); |
+ |
// Searches synced history for visits matching |text_query|. The timeframe to |
// search, along with other options, is specified in |options|. If |
// |text_query| is empty, all visits in the timeframe will be returned. |
@@ -219,6 +235,9 @@ class WebHistoryService : public KeyedService { |
// complete by profile shutdown. |
std::set<Request*> pending_other_forms_of_browsing_history_requests_; |
+ // Observers. |
+ base::ObserverList<Observer, true> observer_list_; |
+ |
base::WeakPtrFactory<WebHistoryService> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(WebHistoryService); |