| 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" |
| 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 AllowRequest(const String& request_id, |
| 76 std::unique_ptr<AllowRequestCallback> callback) override; |
| 77 void BlockRequest(const String& request_id, |
| 78 const std::string& error_reason, |
| 79 std::unique_ptr<BlockRequestCallback> callback) override; |
| 80 void ModifyRequest(const std::string& request_id, |
| 81 Maybe<std::string> url, |
| 82 Maybe<std::string> method, |
| 83 Maybe<std::string> post_data, |
| 84 Maybe<protocol::Network::Headers> headers, |
| 85 std::unique_ptr<ModifyRequestCallback> callback) override; |
| 86 void MockResponse(const std::string& request_id, |
| 87 const std::string& raw_response, |
| 88 std::unique_ptr<MockResponseCallback> callback) override; |
| 89 |
| 68 void NavigationPreloadRequestSent(int worker_version_id, | 90 void NavigationPreloadRequestSent(int worker_version_id, |
| 69 const std::string& request_id, | 91 const std::string& request_id, |
| 70 const ResourceRequest& request); | 92 const ResourceRequest& request); |
| 71 void NavigationPreloadResponseReceived(int worker_version_id, | 93 void NavigationPreloadResponseReceived(int worker_version_id, |
| 72 const std::string& request_id, | 94 const std::string& request_id, |
| 73 const GURL& url, | 95 const GURL& url, |
| 74 const ResourceResponseHead& head); | 96 const ResourceResponseHead& head); |
| 75 void NavigationPreloadCompleted( | 97 void NavigationPreloadCompleted( |
| 76 const std::string& request_id, | 98 const std::string& request_id, |
| 77 const ResourceRequestCompletionStatus& completion_status); | 99 const ResourceRequestCompletionStatus& completion_status); |
| 78 void NavigationFailed(const CommonNavigationParams& common_params, | 100 void NavigationFailed(const CommonNavigationParams& common_params, |
| 79 const BeginNavigationParams& begin_params, | 101 const BeginNavigationParams& begin_params, |
| 80 net::Error error_code); | 102 net::Error error_code); |
| 81 | 103 |
| 82 bool enabled() const { return enabled_; } | 104 bool enabled() const { return enabled_; } |
| 83 std::string UserAgentOverride() const; | 105 std::string UserAgentOverride() const; |
| 84 | 106 |
| 107 Network::Frontend* frontend() const { return frontend_.get(); } |
| 108 |
| 109 static std::unique_ptr<Network::Request> CreateRequestFromURLRequest( |
| 110 const net::URLRequest* request); |
| 111 |
| 85 private: | 112 private: |
| 86 std::unique_ptr<Network::Frontend> frontend_; | 113 std::unique_ptr<Network::Frontend> frontend_; |
| 87 RenderFrameHostImpl* host_; | 114 RenderFrameHostImpl* host_; |
| 88 bool enabled_; | 115 bool enabled_; |
| 116 bool interception_enabled_; |
| 89 std::string user_agent_; | 117 std::string user_agent_; |
| 118 base::WeakPtrFactory<NetworkHandler> weak_factory_; |
| 90 | 119 |
| 91 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); | 120 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); |
| 92 }; | 121 }; |
| 93 | 122 |
| 94 } // namespace protocol | 123 } // namespace protocol |
| 95 } // namespace content | 124 } // namespace content |
| 96 | 125 |
| 97 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ | 126 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_NETWORK_HANDLER_H_ |
| OLD | NEW |