Index: net/reporting/reporting_delegate.cc |
diff --git a/net/reporting/reporting_delegate.cc b/net/reporting/reporting_delegate.cc |
index 88ff9139707a5e4d5af36b4dda7f2dc2a4c51891..25dfdf14b0c3088ca042e6103cd8e6a972a386da 100644 |
--- a/net/reporting/reporting_delegate.cc |
+++ b/net/reporting/reporting_delegate.cc |
@@ -5,6 +5,8 @@ |
#include "net/reporting/reporting_delegate.h" |
#include "base/memory/ptr_util.h" |
+#include "net/base/network_delegate.h" |
+#include "net/url_request/url_request_context.h" |
namespace net { |
@@ -12,30 +14,49 @@ namespace { |
class ReportingDelegateImpl : public ReportingDelegate { |
public: |
- ReportingDelegateImpl() {} |
+ ReportingDelegateImpl(URLRequestContext* request_context) |
+ : request_context_(request_context) { |
+ DCHECK(request_context); |
+ } |
~ReportingDelegateImpl() override {} |
- bool CanQueueReport(const url::Origin& origin) const override { return true; } |
+ bool CanQueueReport(const url::Origin& origin) const override { |
+ return network_delegate() && |
+ network_delegate()->CanQueueReportingReport(origin); |
+ } |
- bool CanSendReport(const url::Origin& origin) const override { return true; } |
+ bool CanSendReport(const url::Origin& origin) const override { |
+ return network_delegate() && |
+ network_delegate()->CanSendReportingReport(origin); |
+ } |
bool CanSetClient(const url::Origin& origin, |
const GURL& endpoint) const override { |
- return true; |
+ return network_delegate() && |
+ network_delegate()->CanSetReportingClient(origin, endpoint); |
} |
bool CanUseClient(const url::Origin& origin, |
const GURL& endpoint) const override { |
- return true; |
+ return network_delegate() && |
+ network_delegate()->CanUseReportingClient(origin, endpoint); |
} |
+ |
+ private: |
+ const NetworkDelegate* network_delegate() const { |
+ return request_context_->network_delegate(); |
+ } |
+ |
+ URLRequestContext* request_context_; |
}; |
} // namespace |
// static |
-std::unique_ptr<ReportingDelegate> ReportingDelegate::Create() { |
- return base::MakeUnique<ReportingDelegateImpl>(); |
+std::unique_ptr<ReportingDelegate> ReportingDelegate::Create( |
+ URLRequestContext* request_context) { |
+ return base::MakeUnique<ReportingDelegateImpl>(request_context); |
} |
ReportingDelegate::~ReportingDelegate() {} |