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

Unified Diff: net/reporting/reporting_delegate.cc

Issue 2891133003: Reporting: Wire ReportingDelegate into ChromeNetworkDelegate (Closed)
Patch Set: Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/reporting/reporting_delegate.h ('k') | net/reporting/reporting_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
« no previous file with comments | « net/reporting/reporting_delegate.h ('k') | net/reporting/reporting_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698