Index: chrome/browser/safe_browsing/safe_browsing_service.h |
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h |
index 7e7668e6afa2e9886ecc0e9f1e9ea0adb26b30df..666d7aacaeb6124b377c49efd443836bcd46832e 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_service.h |
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h |
@@ -122,7 +122,7 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
return services_delegate_->GetDownloadService(); |
} |
- net::URLRequestContextGetter* url_request_context(); |
+ scoped_refptr<net::URLRequestContextGetter> url_request_context(); |
const scoped_refptr<SafeBrowsingUIManager>& ui_manager() const; |
@@ -163,6 +163,7 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
// Type for subscriptions to SafeBrowsing service state. |
typedef base::CallbackList<void(void)>::Subscription StateSubscription; |
+ typedef base::CallbackList<void(void)>::Subscription ShutdownSubscription; |
// Adds a listener for when SafeBrowsing preferences might have changed. |
// To get the current state, the callback should call enabled_by_prefs(). |
@@ -170,6 +171,12 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
std::unique_ptr<StateSubscription> RegisterStateCallback( |
const base::Callback<void(void)>& callback); |
+ // Adds a listener for when SafeBrowsingService starts shutting down. |
+ // The callbacks run on the UI thread, and give the subscribers an opportunity |
+ // to clean up any references they hold to SafeBrowsingService. |
+ std::unique_ptr<ShutdownSubscription> RegisterShutdownCallback( |
+ const base::Callback<void(void)>& callback); |
+ |
// Sends serialized download report to backend. |
virtual void SendSerializedDownloadReport(const std::string& report); |
@@ -287,6 +294,10 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
// Should only be accessed on the UI thread. |
base::CallbackList<void(void)> state_callback_list_; |
+ // Callbacks when SafeBrowsing service starts shutting down. |
+ // Should only be accessed on the UI thread. |
+ base::CallbackList<void(void)> shutdown_callback_list_; |
+ |
// The UI manager handles showing interstitials. Accessed on both UI and IO |
// thread. |
scoped_refptr<SafeBrowsingUIManager> ui_manager_; |