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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_REPORTING_CONTENT_BROWSER_REPORTING_NETWORK_DELEGATE_H_
6 #define COMPONENTS_REPORTING_CONTENT_BROWSER_REPORTING_NETWORK_DELEGATE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h"
14 #include "components/reporting/core/common/reporting_export.h"
15 #include "net/base/layered_network_delegate.h"
16
17 namespace content {
18 class BrowserContext;
19 } // namespace content
20
21 namespace reporting {
22
23 class REPORTING_EXPORT ReportingNetworkDelegate
24 : 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.
25 public:
26 static const char kReportingHeaderName[];
27
28 struct Handle {
29 public:
30 Handle();
31 ~Handle();
32
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner;
34 base::Callback<bool(void)> browser_context_is_valid;
35 content::BrowserContext* browser_context;
36
37 private:
38 DISALLOW_COPY_AND_ASSIGN(Handle);
39 };
40
41 explicit ReportingNetworkDelegate(
42 std::unique_ptr<net::NetworkDelegate> nested_network_delegate,
43 std::unique_ptr<Handle> handle);
44
45 ~ReportingNetworkDelegate() override;
46
47 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.
48 void OnHeadersReceivedInternal(
49 net::URLRequest* request,
50 const net::CompletionCallback& callback,
51 const net::HttpResponseHeaders* original_response_headers,
52 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
53 GURL* allowed_unsafe_redirect_url) override;
54
55 private:
56 void ProcessHeader(const GURL& origin, const std::string& header_value);
57
58 static void ProcessHeaderOnUIThread(
59 const base::Callback<bool(void)>& browser_context_is_valid,
60 content::BrowserContext* browser_context,
61 const GURL& origin,
62 const std::string& header_value);
63
64 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
65 base::Callback<void(const GURL&, const std::string&)> ui_process_header_;
66
67 DISALLOW_COPY_AND_ASSIGN(ReportingNetworkDelegate);
68 };
69
70 } // namespace reporting
71
72 #endif // COMPONENTS_REPORTING_CONTENT_BROWSER_REPORTING_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698