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" |
11 #include "content/browser/devtools/protocol/devtools_domain_handler.h" | 12 #include "content/browser/devtools/protocol/devtools_domain_handler.h" |
12 #include "content/browser/devtools/protocol/network.h" | 13 #include "content/browser/devtools/protocol/network.h" |
13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
14 #include "net/cookies/canonical_cookie.h" | 15 #include "net/cookies/canonical_cookie.h" |
15 | 16 |
| 17 namespace net { |
| 18 class URLRequest; |
| 19 } // namespace net |
| 20 |
16 namespace content { | 21 namespace content { |
17 | 22 |
18 class DevToolsAgentHostImpl; | 23 class DevToolsAgentHostImpl; |
19 class RenderFrameHostImpl; | 24 class RenderFrameHostImpl; |
20 struct BeginNavigationParams; | 25 struct BeginNavigationParams; |
21 struct CommonNavigationParams; | 26 struct CommonNavigationParams; |
22 struct ResourceRequest; | 27 struct ResourceRequest; |
23 struct ResourceRequestCompletionStatus; | 28 struct ResourceRequestCompletionStatus; |
24 struct ResourceResponseHead; | 29 struct ResourceResponseHead; |
25 | 30 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 Maybe<std::string> path, | 63 Maybe<std::string> path, |
59 Maybe<bool> secure, | 64 Maybe<bool> secure, |
60 Maybe<bool> http_only, | 65 Maybe<bool> http_only, |
61 Maybe<std::string> same_site, | 66 Maybe<std::string> same_site, |
62 Maybe<double> expires, | 67 Maybe<double> expires, |
63 std::unique_ptr<SetCookieCallback> callback) override; | 68 std::unique_ptr<SetCookieCallback> callback) override; |
64 | 69 |
65 Response SetUserAgentOverride(const std::string& user_agent) override; | 70 Response SetUserAgentOverride(const std::string& user_agent) override; |
66 Response CanEmulateNetworkConditions(bool* result) override; | 71 Response CanEmulateNetworkConditions(bool* result) override; |
67 | 72 |
| 73 DispatchResponse EnableRequestInterception(bool enabled) override; |
| 74 void ContinueInterceptedRequest( |
| 75 const std::string& request_id, |
| 76 Maybe<std::string> error_reason, |
| 77 Maybe<std::string> base64_raw_response, |
| 78 Maybe<std::string> url, |
| 79 Maybe<std::string> method, |
| 80 Maybe<std::string> post_data, |
| 81 Maybe<protocol::Network::Headers> headers, |
| 82 std::unique_ptr<ContinueInterceptedRequestCallback> callback) override; |
| 83 |
68 void NavigationPreloadRequestSent(int worker_version_id, | 84 void NavigationPreloadRequestSent(int worker_version_id, |
69 const std::string& request_id, | 85 const std::string& request_id, |
70 const ResourceRequest& request); | 86 const ResourceRequest& request); |
71 void NavigationPreloadResponseReceived(int worker_version_id, | 87 void NavigationPreloadResponseReceived(int worker_version_id, |
72 const std::string& request_id, | 88 const std::string& request_id, |
73 const GURL& url, | 89 const GURL& url, |
74 const ResourceResponseHead& head); | 90 const ResourceResponseHead& head); |
75 void NavigationPreloadCompleted( | 91 void NavigationPreloadCompleted( |
76 const std::string& request_id, | 92 const std::string& request_id, |
77 const ResourceRequestCompletionStatus& completion_status); | 93 const ResourceRequestCompletionStatus& completion_status); |
78 void NavigationFailed(const CommonNavigationParams& common_params, | 94 void NavigationFailed(const CommonNavigationParams& common_params, |
79 const BeginNavigationParams& begin_params, | 95 const BeginNavigationParams& begin_params, |
80 net::Error error_code); | 96 net::Error error_code); |
81 | 97 |
82 bool enabled() const { return enabled_; } | 98 bool enabled() const { return enabled_; } |
83 std::string UserAgentOverride() const; | 99 std::string UserAgentOverride() const; |
84 | 100 |
| 101 Network::Frontend* frontend() const { return frontend_.get(); } |
| 102 |
| 103 static std::unique_ptr<Network::Request> CreateRequestFromURLRequest( |
| 104 const net::URLRequest* request); |
| 105 |
85 private: | 106 private: |
86 std::unique_ptr<Network::Frontend> frontend_; | 107 std::unique_ptr<Network::Frontend> frontend_; |
87 RenderFrameHostImpl* host_; | 108 RenderFrameHostImpl* host_; |
88 bool enabled_; | 109 bool enabled_; |
| 110 bool interception_enabled_; |
89 std::string user_agent_; | 111 std::string user_agent_; |
| 112 base::WeakPtrFactory<NetworkHandler> weak_factory_; |
90 | 113 |
91 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); | 114 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); |
92 }; | 115 }; |
93 | 116 |
94 } // namespace protocol | 117 } // namespace protocol |
95 } // namespace content | 118 } // namespace content |
96 | 119 |
97 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ | 120 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ |
OLD | NEW |