Index: chrome/browser/download/download_request_limiter.h |
diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h |
index 63d13c5fcdc4ff9add900a2159254adf6adaf158..02ecf11fcd30e0e2b12903f1b007062b0b251002 100644 |
--- a/chrome/browser/download/download_request_limiter.h |
+++ b/chrome/browser/download/download_request_limiter.h |
@@ -16,9 +16,9 @@ |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/scoped_observer.h" |
+#include "components/content_settings/core/browser/content_settings_observer.h" |
#include "components/content_settings/core/common/content_settings.h" |
-#include "content/public/browser/notification_observer.h" |
-#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/resource_request_info.h" |
#include "content/public/browser/web_contents_observer.h" |
@@ -74,7 +74,7 @@ class DownloadRequestLimiter |
// TabDownloadState deletes itself (by invoking |
// DownloadRequestLimiter::Remove) as necessary. |
// TODO(gbillock): just make this class implement PermissionRequest. |
- class TabDownloadState : public content::NotificationObserver, |
+ class TabDownloadState : public content_settings::Observer, |
public content::WebContentsObserver { |
public: |
// Creates a new TabDownloadState. |controller| is the controller the |
@@ -89,9 +89,8 @@ class DownloadRequestLimiter |
~TabDownloadState() override; |
// Status of the download. |
dominickn
2017/01/24 06:46:17
Nit: "Sets the current limiter state and the under
alshabalin
2017/02/07 16:16:29
Done.
|
- void set_download_status(DownloadRequestLimiter::DownloadStatus status) { |
- status_ = status; |
- } |
+ void SetDownloadStatusAndNotify( |
+ DownloadRequestLimiter::DownloadStatus status); |
DownloadRequestLimiter::DownloadStatus download_status() const { |
return status_; |
} |
@@ -136,17 +135,19 @@ class DownloadRequestLimiter |
// given to the info bar delegate or permission bubble request. |
bool is_showing_prompt() const; |
- // content::NotificationObserver method. |
- void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) override; |
+ // content_settings::Observer overrides. |
+ void OnContentSettingChanged( |
+ const ContentSettingsPattern& primary_pattern, |
+ const ContentSettingsPattern& secondary_pattern, |
+ ContentSettingsType content_type, |
+ std::string resource_identifier) override; |
// Remember to either block or allow automatic downloads from this origin. |
void SetContentSetting(ContentSetting setting); |
// Notifies the callbacks as to whether the download is allowed or not. |
- // Updates status_ appropriately. |
- void NotifyCallbacks(bool allow); |
+ // Returns false if it didn't notify all callbacks. |
+ bool NotifyCallbacks(bool allow); |
content::WebContents* web_contents_; |
@@ -165,8 +166,8 @@ class DownloadRequestLimiter |
// callbacks. |
std::vector<DownloadRequestLimiter::Callback> callbacks_; |
- // Used to remove observers installed on NavigationController. |
- content::NotificationRegistrar registrar_; |
+ ScopedObserver<HostContentSettingsMap, content_settings::Observer> |
+ observer_; |
// Weak pointer factory for generating a weak pointer to pass to the |
// infobar. User responses to the throttling prompt will be returned |