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

Side by Side Diff: headless/lib/browser/headless_network_delegate.cc

Issue 2748743002: Headless: Strip X-DevTools-Emulate-Network-Conditions-Client-Id (Closed)
Patch Set: Change capitalization Created 3 years, 9 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 2017 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 #include "headless/lib/browser/headless_network_delegate.h"
6
7 #include "net/base/net_errors.h"
8 #include "net/http/http_request_headers.h"
9
10 #include "net/url_request/url_request.h"
11
12 namespace headless {
13
14 namespace {
15 // Keep in sync with X_DevTools_Emulate_Network_Conditions_Client_Id defined in
16 // HTTPNames.json5.
17 const char kDevToolsEmulateNetworkConditionsClientId[] =
18 "X-DevTools-Emulate-Network-Conditions-Client-Id";
19 } // namespace
20
21 HeadlessNetworkDelegate::HeadlessNetworkDelegate() {}
22 HeadlessNetworkDelegate::~HeadlessNetworkDelegate() {}
23
24 int HeadlessNetworkDelegate::OnBeforeURLRequest(
25 net::URLRequest* request,
26 const net::CompletionCallback& callback,
27 GURL* new_url) {
28 request->RemoveRequestHeaderByName(kDevToolsEmulateNetworkConditionsClientId);
29 return net::OK;
30 }
31
32 int HeadlessNetworkDelegate::OnBeforeStartTransaction(
33 net::URLRequest* request,
34 const net::CompletionCallback& callback,
35 net::HttpRequestHeaders* headers) {
36 return net::OK;
37 }
38
39 void HeadlessNetworkDelegate::OnStartTransaction(
40 net::URLRequest* request,
41 const net::HttpRequestHeaders& headers) {}
42
43 int HeadlessNetworkDelegate::OnHeadersReceived(
44 net::URLRequest* request,
45 const net::CompletionCallback& callback,
46 const net::HttpResponseHeaders* original_response_headers,
47 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
48 GURL* allowed_unsafe_redirect_url) {
49 return net::OK;
50 }
51
52 void HeadlessNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
53 const GURL& new_location) {}
54
55 void HeadlessNetworkDelegate::OnResponseStarted(net::URLRequest* request,
56 int net_error) {}
57
58 void HeadlessNetworkDelegate::OnCompleted(net::URLRequest* request,
59 bool started,
60 int net_error) {}
61
62 void HeadlessNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {}
63
64 void HeadlessNetworkDelegate::OnPACScriptError(int line_number,
65 const base::string16& error) {}
66
67 net::NetworkDelegate::AuthRequiredResponse
68 HeadlessNetworkDelegate::OnAuthRequired(net::URLRequest* request,
69 const net::AuthChallengeInfo& auth_info,
70 const AuthCallback& callback,
71 net::AuthCredentials* credentials) {
72 return NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
73 }
74
75 bool HeadlessNetworkDelegate::OnCanGetCookies(
76 const net::URLRequest& request,
77 const net::CookieList& cookie_list) {
78 return true;
79 }
80
81 bool HeadlessNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
82 const std::string& cookie_line,
83 net::CookieOptions* options) {
84 return true;
85 }
86
87 bool HeadlessNetworkDelegate::OnCanAccessFile(
88 const net::URLRequest& request,
89 const base::FilePath& path) const {
90 return true;
91 }
92
93 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_network_delegate.h ('k') | headless/lib/browser/headless_url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698