electron/shell/browser/ui/devtools_ui_bundle_data_source.h
trop[bot] eddae27077
fix: add theme data source for devtools. (#44635)
* fix: add theme data source for devtools.

Co-authored-by: Bill Shen <shenyb32768@gmail.com>

* chore: add ut.

Co-authored-by: bill.shen <shenyb32768@gmail.com>

* chore: remove recording histograms

Co-authored-by: Bill Shen <shenyb32768@gmail.com>

* fix: add theme data source for devtools.

Co-authored-by: Bill Shen <shenyb32768@gmail.com>

* chore: separate files

Co-authored-by: Bill Shen <shenyb32768@gmail.com>

* chore: separate files

Co-authored-by: Bill Shen <shenyb32768@gmail.com>

* chore: remove pragma once

Co-authored-by: Bill Shen <shenyb32768@gmail.com>

* chore: fix lint issue.

Co-authored-by: bill.shen <shenyb32768@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Bill Shen <shenyb32768@gmail.com>
2024-11-13 16:04:39 +01:00

40 lines
1.4 KiB
C++

// Copyright (c) 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_UI_DEVTOOLS_UI_BUNDLE_DATA_SOURCE_H_
#define ELECTRON_SHELL_BROWSER_UI_DEVTOOLS_UI_BUNDLE_DATA_SOURCE_H_
#include "content/public/browser/url_data_source.h"
namespace electron {
// A BundledDataSource implementation that handles devtools://devtools/
// requests.
class BundledDataSource : public content::URLDataSource {
public:
BundledDataSource() = default;
~BundledDataSource() override = default;
// disable copy
BundledDataSource(const BundledDataSource&) = delete;
BundledDataSource& operator=(const BundledDataSource&) = delete;
std::string GetSource() override;
void StartDataRequest(const GURL& url,
const content::WebContents::Getter& wc_getter,
GotDataCallback callback) override;
private:
std::string GetMimeType(const GURL& url) override;
bool ShouldAddContentSecurityPolicy() override;
bool ShouldDenyXFrameOptions() override;
bool ShouldServeMimeTypeAsContentTypeHeader() override;
void StartBundledDataRequest(const std::string& path,
GotDataCallback callback);
};
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_UI_DEVTOOLS_UI_BUNDLE_DATA_SOURCE_H_