#include "chrome/browser/ui/webui/devtools/devtools_ui_data_source.h"
#include <list>
#include <utility>
#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/devtools/devtools_ui_bindings.h"
#include "chrome/browser/devtools/url_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "content/public/browser/devtools_frontend_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "net/base/filename_util.h"
#include "net/base/load_flags.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "url/url_constants.h"
namespace {
std::string PathWithoutParams(const std::string& path) { … }
scoped_refptr<base::RefCountedMemory> CreateNotFoundResponse() { … }
std::string GetMimeTypeForUrl(const GURL& url) { … }
std::string StripDevToolsRevisionWithPrefix(const std::string& path,
const std::string& prefix) { … }
}
DevToolsDataSource::DevToolsDataSource(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
DevToolsDataSource::~DevToolsDataSource() { … }
std::string DevToolsDataSource::GetSource() { … }
GURL GetCustomDevToolsFrontendURL() { … }
bool DevToolsDataSource::MaybeHandleCustomRequest(const std::string& path,
GotDataCallback* callback) { … }
void DevToolsDataSource::StartDataRequest(
const GURL& url,
const content::WebContents::Getter& wc_getter,
GotDataCallback callback) { … }
std::string DevToolsDataSource::GetMimeType(const GURL& url) { … }
bool DevToolsDataSource::ShouldAddContentSecurityPolicy() { … }
bool DevToolsDataSource::ShouldDenyXFrameOptions() { … }
bool DevToolsDataSource::ShouldServeMimeTypeAsContentTypeHeader() { … }
void DevToolsDataSource::StartBundledDataRequest(
const std::string& path,
content::URLDataSource::GotDataCallback callback) { … }
void DevToolsDataSource::StartRemoteDataRequest(
const GURL& url,
content::URLDataSource::GotDataCallback callback) { … }
void DevToolsDataSource::StartCustomDataRequest(
const GURL& url,
content::URLDataSource::GotDataCallback callback) { … }
void DevToolsDataSource::StartNetworkRequest(
const GURL& url,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
int load_flags,
GotDataCallback callback) { … }
scoped_refptr<base::RefCountedMemory> ReadFileForDevTools(
const base::FilePath& path) { … }
void DevToolsDataSource::StartFileRequest(const std::string& path,
GotDataCallback callback) { … }
void DevToolsDataSource::OnLoadComplete(
std::list<PendingRequest>::iterator request_iter,
std::unique_ptr<std::string> response_body) { … }
DevToolsDataSource::PendingRequest::PendingRequest() = default;
DevToolsDataSource::PendingRequest::PendingRequest(PendingRequest&& other) =
default;
DevToolsDataSource::PendingRequest::~PendingRequest() { … }