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

Unified Diff: components/reporting/content/browser/reporting_network_delegate.h

Issue 2249213002: [OBSOLETE] Reporting: Initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ProfileImplIOData Created 4 years, 2 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
Index: components/reporting/content/browser/reporting_network_delegate.h
diff --git a/components/reporting/content/browser/reporting_network_delegate.h b/components/reporting/content/browser/reporting_network_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..1140e015faa234ea772e0b7c06d769466c661abd
--- /dev/null
+++ b/components/reporting/content/browser/reporting_network_delegate.h
@@ -0,0 +1,72 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_REPORTING_CONTENT_BROWSER_REPORTING_NETWORK_DELEGATE_H_
+#define COMPONENTS_REPORTING_CONTENT_BROWSER_REPORTING_NETWORK_DELEGATE_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/single_thread_task_runner.h"
+#include "components/reporting/core/common/reporting_export.h"
+#include "net/base/layered_network_delegate.h"
+
+namespace content {
+class BrowserContext;
+} // namespace content
+
+namespace reporting {
+
+class REPORTING_EXPORT ReportingNetworkDelegate
+ : public net::LayeredNetworkDelegate {
Randy Smith (Not in Mondays) 2016/10/21 20:15:11 nit: Call out with comment implementation of Layer
Julia Tuttle 2016/11/02 20:44:39 Done.
+ public:
+ static const char kReportingHeaderName[];
+
+ struct Handle {
+ public:
+ Handle();
+ ~Handle();
+
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner;
+ base::Callback<bool(void)> browser_context_is_valid;
+ content::BrowserContext* browser_context;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Handle);
+ };
+
+ explicit ReportingNetworkDelegate(
+ std::unique_ptr<net::NetworkDelegate> nested_network_delegate,
+ std::unique_ptr<Handle> handle);
+
+ ~ReportingNetworkDelegate() override;
+
+ protected:
Randy Smith (Not in Mondays) 2016/10/21 20:15:11 Why? Nothing inherits from this, does it? (I'm
Julia Tuttle 2016/11/02 20:44:39 Done.
+ void OnHeadersReceivedInternal(
+ net::URLRequest* request,
+ const net::CompletionCallback& callback,
+ const net::HttpResponseHeaders* original_response_headers,
+ scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
+ GURL* allowed_unsafe_redirect_url) override;
+
+ private:
+ void ProcessHeader(const GURL& origin, const std::string& header_value);
+
+ static void ProcessHeaderOnUIThread(
+ const base::Callback<bool(void)>& browser_context_is_valid,
+ content::BrowserContext* browser_context,
+ const GURL& origin,
+ const std::string& header_value);
+
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
+ base::Callback<void(const GURL&, const std::string&)> ui_process_header_;
+
+ DISALLOW_COPY_AND_ASSIGN(ReportingNetworkDelegate);
+};
+
+} // namespace reporting
+
+#endif // COMPONENTS_REPORTING_CONTENT_BROWSER_REPORTING_NETWORK_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698