1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
ash / webui / file_manager / resource_loader.cc [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/webui/file_manager/resource_loader.h"
#include "base/containers/contains.h"
#include "base/strings/string_util.h"
namespace ash {
namespace file_manager {
void AddFilesAppResources(content::WebUIDataSource* source,
base::span<const webui::ResourcePath> entries) {
for (const auto& entry : entries) {
std::string path(entry.path);
// Only load resources for Files app.
if (base::StartsWith(path, "file_manager/") &&
!base::Contains(path, "untrusted_resources/")) {
// Files app UI has all paths relative to //ui/file_manager/file_manager/
// so we remove the leading file_manager/ to match the existing paths.
base::ReplaceFirstSubstringAfterOffset(&path, 0, "file_manager/", "");
source->AddResourcePath(path, entry.id);
}
}
}
} // namespace file_manager
} // namespace ash