OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/synchronization/lock.h" | |
dgozman
2017/05/25 21:29:36
Unused?
alex clarke (OOO till 29th)
2017/05/26 19:37:03
Done.
| |
11 #include "content/browser/devtools/protocol/devtools_domain_handler.h" | 13 #include "content/browser/devtools/protocol/devtools_domain_handler.h" |
12 #include "content/browser/devtools/protocol/network.h" | 14 #include "content/browser/devtools/protocol/network.h" |
13 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
14 #include "net/cookies/canonical_cookie.h" | 16 #include "net/cookies/canonical_cookie.h" |
15 | 17 |
18 namespace net { | |
19 class URLRequest; | |
20 } // namespace net | |
21 | |
16 namespace content { | 22 namespace content { |
17 | 23 |
18 class DevToolsAgentHostImpl; | 24 class DevToolsAgentHostImpl; |
19 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
20 struct BeginNavigationParams; | 26 struct BeginNavigationParams; |
21 struct CommonNavigationParams; | 27 struct CommonNavigationParams; |
22 struct ResourceRequest; | 28 struct ResourceRequest; |
23 struct ResourceRequestCompletionStatus; | 29 struct ResourceRequestCompletionStatus; |
24 struct ResourceResponseHead; | 30 struct ResourceResponseHead; |
25 | 31 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 Maybe<std::string> path, | 64 Maybe<std::string> path, |
59 Maybe<bool> secure, | 65 Maybe<bool> secure, |
60 Maybe<bool> http_only, | 66 Maybe<bool> http_only, |
61 Maybe<std::string> same_site, | 67 Maybe<std::string> same_site, |
62 Maybe<double> expires, | 68 Maybe<double> expires, |
63 std::unique_ptr<SetCookieCallback> callback) override; | 69 std::unique_ptr<SetCookieCallback> callback) override; |
64 | 70 |
65 Response SetUserAgentOverride(const std::string& user_agent) override; | 71 Response SetUserAgentOverride(const std::string& user_agent) override; |
66 Response CanEmulateNetworkConditions(bool* result) override; | 72 Response CanEmulateNetworkConditions(bool* result) override; |
67 | 73 |
74 DispatchResponse EnableFetchInterception(bool enabled) override; | |
75 void ContinueRequest( | |
76 const std::string& request_id, | |
77 Maybe<std::string> error_reason, | |
78 Maybe<std::string> base64_raw_response, | |
79 Maybe<std::string> url, | |
80 Maybe<std::string> method, | |
81 Maybe<std::string> post_data, | |
82 Maybe<protocol::Network::Headers> headers, | |
83 std::unique_ptr<ContinueRequestCallback> callback) override; | |
84 | |
68 void NavigationPreloadRequestSent(int worker_version_id, | 85 void NavigationPreloadRequestSent(int worker_version_id, |
69 const std::string& request_id, | 86 const std::string& request_id, |
70 const ResourceRequest& request); | 87 const ResourceRequest& request); |
71 void NavigationPreloadResponseReceived(int worker_version_id, | 88 void NavigationPreloadResponseReceived(int worker_version_id, |
72 const std::string& request_id, | 89 const std::string& request_id, |
73 const GURL& url, | 90 const GURL& url, |
74 const ResourceResponseHead& head); | 91 const ResourceResponseHead& head); |
75 void NavigationPreloadCompleted( | 92 void NavigationPreloadCompleted( |
76 const std::string& request_id, | 93 const std::string& request_id, |
77 const ResourceRequestCompletionStatus& completion_status); | 94 const ResourceRequestCompletionStatus& completion_status); |
78 void NavigationFailed(const CommonNavigationParams& common_params, | 95 void NavigationFailed(const CommonNavigationParams& common_params, |
79 const BeginNavigationParams& begin_params, | 96 const BeginNavigationParams& begin_params, |
80 net::Error error_code); | 97 net::Error error_code); |
81 | 98 |
82 bool enabled() const { return enabled_; } | 99 bool enabled() const { return enabled_; } |
83 std::string UserAgentOverride() const; | 100 std::string UserAgentOverride() const; |
84 | 101 |
102 Network::Frontend* frontend() const { return frontend_.get(); } | |
103 | |
104 static std::unique_ptr<Network::Request> CreateRequestFromURLRequest( | |
105 const net::URLRequest* request); | |
106 | |
85 private: | 107 private: |
86 std::unique_ptr<Network::Frontend> frontend_; | 108 std::unique_ptr<Network::Frontend> frontend_; |
87 RenderFrameHostImpl* host_; | 109 RenderFrameHostImpl* host_; |
88 bool enabled_; | 110 bool enabled_; |
111 bool interception_enabled_; | |
89 std::string user_agent_; | 112 std::string user_agent_; |
113 base::WeakPtrFactory<NetworkHandler> weak_factory_; | |
90 | 114 |
91 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); | 115 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); |
92 }; | 116 }; |
93 | 117 |
94 } // namespace protocol | 118 } // namespace protocol |
95 } // namespace content | 119 } // namespace content |
96 | 120 |
97 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ | 121 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ |
OLD | NEW |