| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "content/browser/devtools/devtools_session.h" | 16 #include "content/browser/devtools/devtools_session.h" |
| 17 #include "content/browser/devtools/protocol/page.h" | 17 #include "content/browser/devtools/protocol/page.h" |
| 18 #include "content/browser/devtools/protocol/security.h" | 18 #include "content/browser/devtools/protocol/security.h" |
| 19 #include "content/browser/frame_host/frame_tree_node.h" | 19 #include "content/browser/frame_host/frame_tree_node.h" |
| 20 #include "content/browser/frame_host/render_frame_host_impl.h" | 20 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 21 #include "content/common/navigation_params.h" | 21 #include "content/common/navigation_params.h" |
| 22 #include "content/common/resource_request.h" | 22 #include "content/common/resource_request.h" |
| 23 #include "content/common/resource_request_completion_status.h" | 23 #include "content/common/resource_request_completion_status.h" |
| 24 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/browsing_data_remover.h" |
| 26 #include "content/public/browser/content_browser_client.h" | 27 #include "content/public/browser/content_browser_client.h" |
| 27 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
| 28 #include "content/public/browser/resource_context.h" | 29 #include "content/public/browser/resource_context.h" |
| 29 #include "content/public/browser/site_instance.h" | 30 #include "content/public/browser/site_instance.h" |
| 30 #include "content/public/browser/storage_partition.h" | 31 #include "content/public/browser/storage_partition.h" |
| 31 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/common/content_client.h" | 33 #include "content/public/common/content_client.h" |
| 33 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 34 #include "content/public/common/resource_devtools_info.h" | 35 #include "content/public/common/resource_devtools_info.h" |
| 35 #include "content/public/common/resource_response.h" | 36 #include "content/public/common/resource_response.h" |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 return Response::FallThrough(); | 448 return Response::FallThrough(); |
| 448 } | 449 } |
| 449 | 450 |
| 450 Response NetworkHandler::Disable() { | 451 Response NetworkHandler::Disable() { |
| 451 enabled_ = false; | 452 enabled_ = false; |
| 452 user_agent_ = std::string(); | 453 user_agent_ = std::string(); |
| 453 return Response::FallThrough(); | 454 return Response::FallThrough(); |
| 454 } | 455 } |
| 455 | 456 |
| 456 Response NetworkHandler::ClearBrowserCache() { | 457 Response NetworkHandler::ClearBrowserCache() { |
| 457 if (host_) | 458 if (host_) { |
| 458 GetContentClient()->browser()->ClearCache(host_); | 459 content::BrowsingDataRemover* remover = |
| 460 content::BrowserContext::GetBrowsingDataRemover( |
| 461 host_->GetSiteInstance()->GetProcess()->GetBrowserContext()); |
| 462 remover->Remove(base::Time(), base::Time::Max(), |
| 463 content::BrowsingDataRemover::DATA_TYPE_CACHE, |
| 464 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB); |
| 465 } |
| 466 |
| 459 return Response::OK(); | 467 return Response::OK(); |
| 460 } | 468 } |
| 461 | 469 |
| 462 void NetworkHandler::ClearBrowserCookies( | 470 void NetworkHandler::ClearBrowserCookies( |
| 463 std::unique_ptr<ClearBrowserCookiesCallback> callback) { | 471 std::unique_ptr<ClearBrowserCookiesCallback> callback) { |
| 464 if (!host_) { | 472 if (!host_) { |
| 465 callback->sendFailure(Response::InternalError()); | 473 callback->sendFailure(Response::InternalError()); |
| 466 return; | 474 return; |
| 467 } | 475 } |
| 468 | 476 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 static_cast<double>(base::Time::kMicrosecondsPerSecond), | 765 static_cast<double>(base::Time::kMicrosecondsPerSecond), |
| 758 Page::ResourceTypeEnum::Document, error_string, cancelled); | 766 Page::ResourceTypeEnum::Document, error_string, cancelled); |
| 759 } | 767 } |
| 760 | 768 |
| 761 std::string NetworkHandler::UserAgentOverride() const { | 769 std::string NetworkHandler::UserAgentOverride() const { |
| 762 return enabled_ ? user_agent_ : std::string(); | 770 return enabled_ ? user_agent_ : std::string(); |
| 763 } | 771 } |
| 764 | 772 |
| 765 } // namespace protocol | 773 } // namespace protocol |
| 766 } // namespace content | 774 } // namespace content |
| OLD | NEW |