chore: don't duplicate devtools constants (#24440)

This commit is contained in:
Shelley Vohr 2020-07-07 14:04:23 -07:00 committed by GitHub
parent 7fd96cd188
commit 446100cdfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 13 deletions

View file

@ -11,6 +11,7 @@
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/common/webui_url_constants.h"
#include "content/public/browser/devtools_frontend_host.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
@ -20,9 +21,6 @@ namespace electron {
namespace {
const char kChromeUIDevToolsHost[] = "devtools";
const char kChromeUIDevToolsBundledPath[] = "bundled";
std::string PathWithoutParams(const std::string& path) {
return GURL(std::string("devtools://devtools/") + path).path().substr(1);
}
@ -59,14 +57,14 @@ class BundledDataSource : public content::URLDataSource {
~BundledDataSource() override = default;
// content::URLDataSource implementation.
std::string GetSource() override { return kChromeUIDevToolsHost; }
std::string GetSource() override { return chrome::kChromeUIDevToolsHost; }
void StartDataRequest(const GURL& url,
const content::WebContents::Getter& wc_getter,
GotDataCallback callback) override {
const std::string path = content::URLDataSource::URLToRequestPath(url);
// Serve request from local bundle.
std::string bundled_path_prefix(kChromeUIDevToolsBundledPath);
std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath);
bundled_path_prefix += "/";
if (base::StartsWith(path, bundled_path_prefix,
base::CompareCase::INSENSITIVE_ASCII)) {