Update indexeddb-internals to generate grd files
Updates the indexeddb-internals page to generate grd files automatically instead of listing them manually. Bug: 1132403 Change-Id: I404db7d75490b17159b52d78edeb0145ac73dd5f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3834942 Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org> Reviewed-by: Evan Stade <estade@chromium.org> Commit-Queue: Nathan Memmott <memmott@chromium.org> Cr-Commit-Position: refs/heads/main@{#1042346}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
af073b7fe7
commit
9d3559704d
@ -100,6 +100,7 @@ template("chrome_extra_paks") {
|
||||
"$root_gen_dir/components/autofill/core/browser/autofill_address_rewriter_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/content/content_resources.pak",
|
||||
"$root_gen_dir/content/indexed_db_resources.pak",
|
||||
"$root_gen_dir/content/quota_internals_resources.pak",
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
@ -119,6 +120,7 @@ template("chrome_extra_paks") {
|
||||
"//components/optimization_guide/optimization_guide_internals/resources",
|
||||
"//components/resources",
|
||||
"//content:content_resources",
|
||||
"//content/browser/resources/indexed_db:resources",
|
||||
"//content/browser/resources/quota:resources",
|
||||
"//mojo/public/js:resources",
|
||||
"//net:net_resources",
|
||||
|
@ -13,7 +13,8 @@
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "base/values.h"
|
||||
#include "content/grit/dev_ui_content_resources.h"
|
||||
#include "content/grit/indexed_db_resources.h"
|
||||
#include "content/grit/indexed_db_resources_map.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@ -45,11 +46,9 @@ IndexedDBInternalsUI::IndexedDBInternalsUI(WebUI* web_ui)
|
||||
network::mojom::CSPDirectiveName::TrustedTypes,
|
||||
"trusted-types jstemplate;");
|
||||
source->UseStringsJs();
|
||||
source->AddResourcePath("indexeddb_internals.js",
|
||||
IDR_INDEXED_DB_INTERNALS_JS);
|
||||
source->AddResourcePath("indexeddb_internals.css",
|
||||
IDR_INDEXED_DB_INTERNALS_CSS);
|
||||
source->SetDefaultResource(IDR_INDEXED_DB_INTERNALS_HTML);
|
||||
source->AddResourcePaths(
|
||||
base::make_span(kIndexedDbResources, kIndexedDbResourcesSize));
|
||||
source->AddResourcePath("", IDR_INDEXED_DB_INDEXEDDB_INTERNALS_HTML);
|
||||
}
|
||||
|
||||
IndexedDBInternalsUI::~IndexedDBInternalsUI() = default;
|
||||
@ -84,26 +83,25 @@ void IndexedDBInternalsHandler::GetAllBuckets(const base::Value::List& args) {
|
||||
BrowserContext* browser_context =
|
||||
web_ui()->GetWebContents()->GetBrowserContext();
|
||||
|
||||
browser_context->ForEachStoragePartition(
|
||||
base::BindRepeating(
|
||||
[](base::WeakPtr<IndexedDBInternalsHandler> handler,
|
||||
StoragePartition* partition) {
|
||||
if (!handler)
|
||||
return;
|
||||
auto& control = partition->GetIndexedDBControl();
|
||||
control.GetAllBucketsDetails(base::BindOnce(
|
||||
[](base::WeakPtr<IndexedDBInternalsHandler> handler,
|
||||
base::FilePath partition_path, bool incognito,
|
||||
base::Value::List info_list) {
|
||||
if (!handler)
|
||||
return;
|
||||
browser_context->ForEachStoragePartition(base::BindRepeating(
|
||||
[](base::WeakPtr<IndexedDBInternalsHandler> handler,
|
||||
StoragePartition* partition) {
|
||||
if (!handler)
|
||||
return;
|
||||
auto& control = partition->GetIndexedDBControl();
|
||||
control.GetAllBucketsDetails(base::BindOnce(
|
||||
[](base::WeakPtr<IndexedDBInternalsHandler> handler,
|
||||
base::FilePath partition_path, bool incognito,
|
||||
base::Value::List info_list) {
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
handler->OnBucketsReady(
|
||||
info_list, incognito ? base::FilePath() : partition_path);
|
||||
},
|
||||
handler, partition->GetPath()));
|
||||
},
|
||||
weak_factory_.GetWeakPtr()));
|
||||
handler->OnBucketsReady(
|
||||
info_list, incognito ? base::FilePath() : partition_path);
|
||||
},
|
||||
handler, partition->GetPath()));
|
||||
},
|
||||
weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void IndexedDBInternalsHandler::OnBucketsReady(
|
||||
|
@ -3,5 +3,8 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
group("resources") {
|
||||
public_deps = [ "quota:resources" ]
|
||||
public_deps = [
|
||||
"indexed_db:resources",
|
||||
"quota:resources",
|
||||
]
|
||||
}
|
||||
|
34
content/browser/resources/indexed_db/BUILD.gn
Normal file
34
content/browser/resources/indexed_db/BUILD.gn
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright 2022 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
import("//chrome/common/features.gni")
|
||||
import("//tools/grit/grit_rule.gni")
|
||||
import("//ui/webui/resources/tools/generate_grd.gni")
|
||||
|
||||
grit("resources") {
|
||||
defines = chrome_grit_defines
|
||||
|
||||
# These arguments are needed since the grd is generated at build time.
|
||||
enable_input_discovery_for_gn_analyze = false
|
||||
source = "$target_gen_dir/resources.grd"
|
||||
deps = [ ":build_grd" ]
|
||||
|
||||
outputs = [
|
||||
"grit/indexed_db_resources.h",
|
||||
"grit/indexed_db_resources_map.cc",
|
||||
"grit/indexed_db_resources_map.h",
|
||||
"indexed_db_resources.pak",
|
||||
]
|
||||
output_dir = "$root_gen_dir/content"
|
||||
}
|
||||
|
||||
generate_grd("build_grd") {
|
||||
grd_prefix = "indexed_db"
|
||||
out_grd = "$target_gen_dir/resources.grd"
|
||||
input_files_base_dir = rebase_path(".", "//")
|
||||
input_files = [
|
||||
"indexeddb_internals.css",
|
||||
"indexeddb_internals.html",
|
||||
"indexeddb_internals.js",
|
||||
]
|
||||
}
|
@ -39,9 +39,6 @@ files that belong there instead.
|
||||
<include name="IDR_GPU_INTERNALS_INFO_VIEW_TABLE_ROW_HTML_JS" file="${root_gen_dir}/content/browser/resources/gpu/info_view_table_row.html.js" use_base_dir="false" type="BINDATA" />
|
||||
<include name="IDR_GPU_INTERNALS_INFO_VIEW_TABLE_ROW_JS" file="browser/resources/gpu/info_view_table_row.js" type="BINDATA" />
|
||||
<include name="IDR_GPU_VULKAN_INFO_JS" file="browser/resources/gpu/vulkan_info.js" type="BINDATA" />
|
||||
<include name="IDR_INDEXED_DB_INTERNALS_HTML" file="browser/resources/indexed_db/indexeddb_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
|
||||
<include name="IDR_INDEXED_DB_INTERNALS_JS" file="browser/resources/indexed_db/indexeddb_internals.js" type="BINDATA" />
|
||||
<include name="IDR_INDEXED_DB_INTERNALS_CSS" file="browser/resources/indexed_db/indexeddb_internals.css" type="BINDATA" />
|
||||
<include name="IDR_NETWORK_ERROR_LISTING_HTML" file="browser/resources/net/network_errors_listing.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
|
||||
<include name="IDR_NETWORK_ERROR_LISTING_JS" file="browser/resources/net/network_errors_listing.js" type="BINDATA" />
|
||||
<include name="IDR_NETWORK_ERROR_LISTING_CSS" file="browser/resources/net/network_errors_listing.css" type="BINDATA" />
|
||||
|
@ -435,6 +435,10 @@
|
||||
"components/resources/dev_ui_components_resources.grd": {
|
||||
"includes": [2560],
|
||||
},
|
||||
"<(SHARED_INTERMEDIATE_DIR)/content/browser/resources/indexed_db/resources.grd": {
|
||||
"META": {"sizes": {"includes": [10]}},
|
||||
"includes": [2570],
|
||||
},
|
||||
"<(SHARED_INTERMEDIATE_DIR)/content/browser/resources/media/resources.grd": {
|
||||
"META": {"sizes": {"includes": [10],}},
|
||||
"includes": [2580],
|
||||
|
Reference in New Issue
Block a user