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 #include "content/browser/devtools/protocol/network_handler.h" | 5 #include "content/browser/devtools/protocol/network_handler.h" |
6 | 6 |
| 7 #include "content/public/browser/content_browser_client.h" |
| 8 #include "content/public/common/content_client.h" |
| 9 |
7 namespace content { | 10 namespace content { |
8 namespace devtools { | 11 namespace devtools { |
9 namespace network { | 12 namespace network { |
10 | 13 |
11 typedef DevToolsProtocolClient::Response Response; | 14 typedef DevToolsProtocolClient::Response Response; |
12 | 15 |
13 NetworkHandler::NetworkHandler() { | 16 NetworkHandler::NetworkHandler() : host_(nullptr) { |
14 } | 17 } |
15 | 18 |
16 NetworkHandler::~NetworkHandler() { | 19 NetworkHandler::~NetworkHandler() { |
17 } | 20 } |
18 | 21 |
| 22 void NetworkHandler::SetRenderViewHost(RenderViewHost* host) { |
| 23 host_ = host; |
| 24 } |
| 25 |
19 Response NetworkHandler::ClearBrowserCache() { | 26 Response NetworkHandler::ClearBrowserCache() { |
20 return Response::FallThrough(); | 27 GetContentClient()->browser()->ClearCache(host_); |
| 28 return Response::OK(); |
21 } | 29 } |
22 | 30 |
23 Response NetworkHandler::ClearBrowserCookies() { | 31 Response NetworkHandler::ClearBrowserCookies() { |
24 return Response::FallThrough(); | 32 GetContentClient()->browser()->ClearCookies(host_); |
| 33 return Response::OK(); |
25 } | 34 } |
26 | 35 |
27 Response NetworkHandler::CanEmulateNetworkConditions(bool* result) { | 36 Response NetworkHandler::CanEmulateNetworkConditions(bool* result) { |
28 return Response::FallThrough(); | 37 *result = false; |
| 38 return Response::OK(); |
29 } | 39 } |
30 | 40 |
31 Response NetworkHandler::EmulateNetworkConditions(bool offline, | 41 Response NetworkHandler::EmulateNetworkConditions(bool offline, |
32 double latency, | 42 double latency, |
33 double download_throughput, | 43 double download_throughput, |
34 double upload_throughput) { | 44 double upload_throughput) { |
35 return Response::FallThrough(); | 45 return Response::FallThrough(); |
36 } | 46 } |
37 | 47 |
38 } // namespace dom | 48 } // namespace dom |
39 } // namespace devtools | 49 } // namespace devtools |
40 } // namespace content | 50 } // namespace content |
OLD | NEW |