Commit e7bbf38e authored by Maxim Kolosovskiy's avatar Maxim Kolosovskiy Committed by Commit Bot

Revert "Adds icon loading service with sandbox for Windows."

This reverts commit c3de1340.

Reason for revert: IconLoaderBrowserTest.LoadGroup failures.
Builder: https://ci.chromium.org/p/chromium/builders/ci/Linux%20MSan%20Tests
First failed build: https://ci.chromium.org/p/chromium/builders/ci/Linux%20MSan%20Tests/24355?blamelist=1#blamelist-tab

Original CL: https://chromium-review.googlesource.com/c/chromium/src/+/1987273

TBR=avi@chromium.org,robliao@chromium.org,wfh@chromium.org

Change-Id: I90479f28ef4849c382b28cfdbd40db4b84ad3a69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2250202Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarMaxim Kolosovskiy <kolos@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779801}
parent 31e09a8a
...@@ -4129,8 +4129,6 @@ static_library("browser") { ...@@ -4129,8 +4129,6 @@ static_library("browser") {
"sync/roaming_profile_directory_deleter_win.h", "sync/roaming_profile_directory_deleter_win.h",
"taskbar/taskbar_decorator_win.cc", "taskbar/taskbar_decorator_win.cc",
"taskbar/taskbar_decorator_win.h", "taskbar/taskbar_decorator_win.h",
"win/icon_reader_service.cc",
"win/icon_reader_service.h",
"win/parental_controls.cc", "win/parental_controls.cc",
"win/parental_controls.h", "win/parental_controls.h",
"win/util_win_service.cc", "win/util_win_service.cc",
......
...@@ -3738,7 +3738,6 @@ base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType( ...@@ -3738,7 +3738,6 @@ base::string16 ChromeContentBrowserClient::GetAppContainerSidForSandboxType(
case service_manager::SandboxType::kPdfConversion: case service_manager::SandboxType::kPdfConversion:
case service_manager::SandboxType::kSharingService: case service_manager::SandboxType::kSharingService:
case service_manager::SandboxType::kVideoCapture: case service_manager::SandboxType::kVideoCapture:
case service_manager::SandboxType::kIconReader:
// Should never reach here. // Should never reach here.
CHECK(0); CHECK(0);
return base::string16(); return base::string16();
......
...@@ -40,11 +40,9 @@ IconLoader::IconLoader(const base::FilePath& file_path, ...@@ -40,11 +40,9 @@ IconLoader::IconLoader(const base::FilePath& file_path,
IconLoader::~IconLoader() {} IconLoader::~IconLoader() {}
#if !defined(OS_WIN)
void IconLoader::ReadGroup() { void IconLoader::ReadGroup() {
group_ = GroupForFilepath(file_path_); group_ = GroupForFilepath(file_path_);
GetReadIconTaskRunner()->PostTask( GetReadIconTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&IconLoader::ReadIcon, base::Unretained(this))); FROM_HERE, base::BindOnce(&IconLoader::ReadIcon, base::Unretained(this)));
} }
#endif // !defined(OS_WIN)
...@@ -72,11 +72,6 @@ class IconLoader { ...@@ -72,11 +72,6 @@ class IconLoader {
void ReadGroup(); void ReadGroup();
void ReadIcon(); void ReadIcon();
#if defined(OS_WIN)
// Reads an icon in a sandboxed service. Use this when the file itself must
// be parsed.
void ReadIconInSandbox();
#endif
// The traits of the tasks posted to base::ThreadPool by this class. These // The traits of the tasks posted to base::ThreadPool by this class. These
// operations may block, because they are fetching icons from the disk, yet // operations may block, because they are fetching icons from the disk, yet
......
// Copyright 2020 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.
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "build/build_config.h"
#include "chrome/browser/icon_loader.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/browser_test.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/gfx/image/image.h"
using IconLoaderBrowserTest = InProcessBrowserTest;
class TestIconLoader {
public:
explicit TestIconLoader(base::OnceClosure quit_closure)
: quit_closure_(std::move(quit_closure)) {}
~TestIconLoader() {
if (!quit_closure_.is_null()) {
std::move(quit_closure_).Run();
}
}
bool load_succeeded() const { return load_succeeded_; }
bool TryLoadIcon(const base::FilePath& file_path, IconLoader::IconSize size) {
// |loader| is self deleting. |this| will live as long as the
// test.
auto* loader = IconLoader::Create(
file_path, size,
base::BindOnce(&TestIconLoader::OnIconLoaded, base::Unretained(this)));
loader->Start();
return true;
}
private:
void OnIconLoaded(gfx::Image img, const IconLoader::IconGroup& group) {
if (!img.IsEmpty())
load_succeeded_ = true;
Quit();
}
void Quit() {
EXPECT_FALSE(quit_closure_.is_null());
std::move(quit_closure_).Run();
}
bool load_succeeded_ = false;
base::OnceClosure quit_closure_;
DISALLOW_COPY_AND_ASSIGN(TestIconLoader);
};
const base::FilePath::CharType kGroupOnlyFilename[] =
FILE_PATH_LITERAL("unlikely-to-exist-file.txt");
IN_PROC_BROWSER_TEST_F(IconLoaderBrowserTest, LoadGroup) {
// Test that an icon for a file type (group) can be loaded even
// where a file does not exist. Should work cross platform.
base::RunLoop runner;
TestIconLoader test_loader(runner.QuitClosure());
test_loader.TryLoadIcon(base::FilePath(kGroupOnlyFilename),
IconLoader::NORMAL);
runner.Run();
EXPECT_TRUE(test_loader.load_succeeded());
}
#if defined(OS_WIN)
IN_PROC_BROWSER_TEST_F(IconLoaderBrowserTest, LoadExeIcon) {
base::RunLoop runner;
TestIconLoader test_loader(runner.QuitClosure());
base::FilePath exe_path;
base::PathService::Get(base::FILE_EXE, &exe_path);
test_loader.TryLoadIcon(exe_path, IconLoader::NORMAL);
runner.Run();
EXPECT_TRUE(test_loader.load_succeeded());
}
#endif
...@@ -8,114 +8,14 @@ ...@@ -8,114 +8,14 @@
#include <shellapi.h> #include <shellapi.h>
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "chrome/browser/win/icon_reader_service.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "ui/display/win/dpi.h" #include "ui/display/win/dpi.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/gfx/icon_util.h" #include "ui/gfx/icon_util.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
namespace {
// Helper class to manage lifetime of icon reader service.
class IconLoaderHelper {
public:
static void ExecuteLoadIcon(
base::FilePath filename,
chrome::mojom::IconSize size,
scoped_refptr<base::SingleThreadTaskRunner> target_task_runner,
IconLoader::IconLoadedCallback icon_loaded_callback);
IconLoaderHelper(base::FilePath filename, chrome::mojom::IconSize size);
private:
void StartReadIconRequest();
void OnConnectionError();
void OnReadIconExecuted(const gfx::ImageSkia& icon,
const base::string16& group);
using IconLoaderHelperCallback =
base::OnceCallback<void(gfx::Image image,
const IconLoader::IconGroup& icon_group)>;
void set_finally(IconLoaderHelperCallback finally) {
finally_ = std::move(finally);
}
mojo::Remote<chrome::mojom::UtilReadIcon> remote_read_icon_;
base::FilePath filename_;
chrome::mojom::IconSize size_;
// This callback owns the object until work is done.
IconLoaderHelperCallback finally_;
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(IconLoaderHelper);
};
void IconLoaderHelper::ExecuteLoadIcon(
base::FilePath filename,
chrome::mojom::IconSize size,
scoped_refptr<base::SingleThreadTaskRunner> target_task_runner,
IconLoader::IconLoadedCallback icon_loaded_callback) {
// Self-deleting helper manages service lifetime.
auto helper = std::make_unique<IconLoaderHelper>(filename, size);
auto* helper_raw = helper.get();
// This callback owns the helper and extinguishes itself once work is done.
auto finally_callback = base::BindOnce(
[](std::unique_ptr<IconLoaderHelper> helper,
IconLoader::IconLoadedCallback icon_loaded_callback,
scoped_refptr<base::SingleThreadTaskRunner> target_task_runner,
gfx::Image image, const IconLoader::IconGroup& icon_group) {
target_task_runner->PostTask(
FROM_HERE, base::BindOnce(std::move(icon_loaded_callback),
std::move(image), icon_group));
},
std::move(helper), std::move(icon_loaded_callback), target_task_runner);
helper_raw->set_finally(std::move(finally_callback));
helper_raw->StartReadIconRequest();
}
IconLoaderHelper::IconLoaderHelper(base::FilePath filename,
chrome::mojom::IconSize size)
: filename_(filename), size_(size) {
remote_read_icon_ = LaunchIconReaderInstance();
remote_read_icon_.set_disconnect_handler(base::BindOnce(
&IconLoaderHelper::OnConnectionError, base::Unretained(this)));
}
void IconLoaderHelper::StartReadIconRequest() {
remote_read_icon_->ReadIcon(
filename_, size_,
base::BindOnce(&IconLoaderHelper::OnReadIconExecuted,
base::Unretained(this)));
}
void IconLoaderHelper::OnConnectionError() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (finally_.is_null())
return;
gfx::Image image;
std::move(finally_).Run(std::move(image), filename_.value());
}
void IconLoaderHelper::OnReadIconExecuted(const gfx::ImageSkia& icon,
const base::string16& group) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
gfx::Image image(icon);
std::move(finally_).Run(std::move(image), group);
}
} // namespace
// static // static
IconLoader::IconGroup IconLoader::GroupForFilepath( IconLoader::IconGroup IconLoader::GroupForFilepath(
const base::FilePath& file_path) { const base::FilePath& file_path) {
...@@ -135,23 +35,6 @@ scoped_refptr<base::TaskRunner> IconLoader::GetReadIconTaskRunner() { ...@@ -135,23 +35,6 @@ scoped_refptr<base::TaskRunner> IconLoader::GetReadIconTaskRunner() {
return base::ThreadPool::CreateCOMSTATaskRunner(traits()); return base::ThreadPool::CreateCOMSTATaskRunner(traits());
} }
void IconLoader::ReadGroup() {
group_ = GroupForFilepath(file_path_);
if (group_ == file_path_.value()) {
// Calls a Windows API that parses the file so must be sandboxed. Call on
// target sequence as we don't need COM in this process.
target_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&IconLoader::ReadIconInSandbox, base::Unretained(this)));
} else {
// Looks up generic icons for groups based only on the file's extension.
GetReadIconTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&IconLoader::ReadIcon, base::Unretained(this)));
}
}
void IconLoader::ReadIcon() { void IconLoader::ReadIcon() {
int size = 0; int size = 0;
switch (icon_size_) { switch (icon_size_) {
...@@ -172,16 +55,16 @@ void IconLoader::ReadIcon() { ...@@ -172,16 +55,16 @@ void IconLoader::ReadIcon() {
SHFILEINFO file_info = { 0 }; SHFILEINFO file_info = { 0 };
if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
sizeof(file_info), sizeof(SHFILEINFO),
SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) { SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) {
const SkBitmap bitmap = IconUtil::CreateSkBitmapFromHICON(file_info.hIcon); const SkBitmap bitmap = IconUtil::CreateSkBitmapFromHICON(file_info.hIcon);
if (!bitmap.isNull()) { if (!bitmap.isNull()) {
gfx::ImageSkia image_skia( gfx::ImageSkia image_skia(
gfx::ImageSkiaRep(bitmap, display::win::GetDPIScale())); gfx::ImageSkiaRep(bitmap, display::win::GetDPIScale()));
image_skia.MakeThreadSafe(); image_skia.MakeThreadSafe();
image = gfx::Image(image_skia); image = gfx::Image(image_skia);
DestroyIcon(file_info.hIcon);
} }
DestroyIcon(file_info.hIcon);
} }
target_task_runner_->PostTask( target_task_runner_->PostTask(
...@@ -189,25 +72,3 @@ void IconLoader::ReadIcon() { ...@@ -189,25 +72,3 @@ void IconLoader::ReadIcon() {
base::BindOnce(std::move(callback_), std::move(image), group_)); base::BindOnce(std::move(callback_), std::move(image), group_));
delete this; delete this;
} }
void IconLoader::ReadIconInSandbox() {
chrome::mojom::IconSize size = chrome::mojom::IconSize::kNormal;
switch (icon_size_) {
case IconLoader::SMALL:
size = chrome::mojom::IconSize::kSmall;
break;
case IconLoader::NORMAL:
size = chrome::mojom::IconSize::kNormal;
break;
case IconLoader::LARGE:
size = chrome::mojom::IconSize::kLarge;
break;
default:
NOTREACHED();
}
IconLoaderHelper::ExecuteLoadIcon(base::FilePath(group_), size,
target_task_runner_, std::move(callback_));
delete this;
}
...@@ -34,21 +34,6 @@ content::GetServiceSandboxType<chrome::mojom::RemovableStorageWriter>() { ...@@ -34,21 +34,6 @@ content::GetServiceSandboxType<chrome::mojom::RemovableStorageWriter>() {
#endif // !defined(OS_WIN) #endif // !defined(OS_WIN)
} }
// chrome::mojom::UtilReadIcon
#if defined(OS_WIN)
namespace chrome {
namespace mojom {
class UtilReadIcon;
}
} // namespace chrome
template <>
inline content::SandboxType
content::GetServiceSandboxType<chrome::mojom::UtilReadIcon>() {
return content::SandboxType::kIconReader;
}
#endif // defined(OS_WIN)
// chrome::mojom::UtilWin // chrome::mojom::UtilWin
#if defined(OS_WIN) #if defined(OS_WIN)
namespace chrome { namespace chrome {
......
// Copyright 2020 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.
#include "chrome/browser/win/icon_reader_service.h"
#include "chrome/browser/service_sandbox_type.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/service_process_host.h"
mojo::Remote<chrome::mojom::UtilReadIcon> LaunchIconReaderInstance() {
return content::ServiceProcessHost::Launch<chrome::mojom::UtilReadIcon>(
content::ServiceProcessHost::Options()
.WithDisplayName(IDS_UTILITY_PROCESS_UTILITY_WIN_NAME)
.Pass());
}
// Copyright 2020 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.
#ifndef CHROME_BROWSER_WIN_ICON_READER_SERVICE_H_
#define CHROME_BROWSER_WIN_ICON_READER_SERVICE_H_
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
// Spawns a new isolated instance of the Windows icon utility service and
// returns a remote interface to it. The lifetime of the service process is tied
// strictly to the lifetime of the returned Remote.
mojo::Remote<chrome::mojom::UtilReadIcon> LaunchIconReaderInstance();
#endif // CHROME_BROWSER_WIN_ICON_READER_SERVICE_H_
...@@ -10,8 +10,6 @@ source_set("lib") { ...@@ -10,8 +10,6 @@ source_set("lib") {
"av_products.h", "av_products.h",
"processor_metrics.cc", "processor_metrics.cc",
"processor_metrics.h", "processor_metrics.h",
"util_read_icon.cc",
"util_read_icon.h",
"util_win_impl.cc", "util_win_impl.cc",
"util_win_impl.h", "util_win_impl.h",
] ]
......
...@@ -5,13 +5,7 @@ ...@@ -5,13 +5,7 @@
import("//mojo/public/tools/bindings/mojom.gni") import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") { mojom("mojom") {
sources = [ sources = [ "util_win.mojom" ]
"util_read_icon.mojom",
"util_win.mojom",
]
public_deps = [ public_deps = [ "//mojo/public/mojom/base" ]
"//mojo/public/mojom/base",
"//ui/gfx/image/mojom",
]
} }
// Copyright 2020 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.
module chrome.mojom;
import "mojo/public/mojom/base/file_path.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "ui/gfx/image/mojom/image.mojom";
// Correspond to SHGFI_*ICON.
enum IconSize {
kSmall,
kNormal,
kLarge,
};
// Utility process interface exposed to the browser process on OS_WIN. Allows
// for sandboxing when reading icons from downloaded files.
interface UtilReadIcon {
// Reads the primary icon from |file| using |size| as a hint.
ReadIcon(mojo_base.mojom.FilePath filename, IconSize size) =>
(gfx.mojom.ImageSkia? icon, mojo_base.mojom.String16 group);
};
// Copyright 2020 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.
#include "chrome/services/util_win/util_read_icon.h"
#include <windows.h>
#include "base/files/file_path.h"
#include "base/strings/string16.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/display/win/dpi.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/icon_util.h"
#include "ui/gfx/image/image_skia.h"
namespace {
// Provides storage for icon handles.
struct ScopedIconHandles {
public:
explicit ScopedIconHandles(size_t n)
: handles(std::vector<HICON>(n, nullptr)),
resources(std::vector<UINT>(n, 0)) {}
~ScopedIconHandles() {
for (HICON icon : handles) {
if (icon) {
DeleteObject(icon);
}
}
}
std::vector<HICON> handles;
std::vector<UINT> resources;
};
} // namespace
using chrome::mojom::IconSize;
UtilReadIcon::UtilReadIcon(
mojo::PendingReceiver<chrome::mojom::UtilReadIcon> receiver)
: receiver_(this, std::move(receiver)) {}
UtilReadIcon::~UtilReadIcon() = default;
// This is exposed to the browser process only. |filename| is a path to
// a downloaded file, such as an |.exe|.
void UtilReadIcon::ReadIcon(const base::FilePath& filename,
IconSize icon_size,
ReadIconCallback callback) {
int size = 0;
// See IconLoader::IconSize.
switch (icon_size) {
case IconSize::kSmall:
size = 16;
break;
case IconSize::kNormal:
size = 32;
break;
case IconSize::kLarge:
size = 48;
break;
default:
NOTREACHED();
}
gfx::ImageSkia image_ret;
// Returns number of icons, or 0 on failure.
UINT nIcons = PrivateExtractIconsW(filename.value().c_str(), 0, 0, 0, nullptr,
nullptr, 0, 0);
if (nIcons == 0) {
std::move(callback).Run(std::move(image_ret), filename.value());
return;
}
ScopedIconHandles icons(nIcons);
UINT ret = PrivateExtractIconsW(filename.value().c_str(), 0, size, size,
icons.handles.data(), icons.resources.data(),
nIcons, 0);
if (ret != nIcons) {
std::move(callback).Run(std::move(image_ret), filename.value());
return;
}
// Use icon with lowest resource value, or first if no hints available.
UINT best = 0xFFFFFFFF;
HICON selected = icons.handles.at(0);
for (size_t i = 0; i < icons.handles.size(); i++) {
if (icons.resources.at(i) < best) {
best = icons.resources.at(i);
selected = icons.handles.at(i);
}
}
const SkBitmap bitmap = IconUtil::CreateSkBitmapFromHICON(selected);
if (!bitmap.isNull()) {
gfx::ImageSkia image_skia(
gfx::ImageSkiaRep(bitmap, display::win::GetDPIScale()));
image_skia.MakeThreadSafe();
image_ret = std::move(image_skia);
}
std::move(callback).Run(std::move(image_ret), filename.value());
}
// Copyright 2020 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.
#ifndef CHROME_SERVICES_UTIL_WIN_UTIL_READ_ICON_H_
#define CHROME_SERVICES_UTIL_WIN_UTIL_READ_ICON_H_
#include "base/macros.h"
#include "base/strings/string16.h"
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
class UtilReadIcon : public chrome::mojom::UtilReadIcon {
public:
explicit UtilReadIcon(
mojo::PendingReceiver<chrome::mojom::UtilReadIcon> receiver);
~UtilReadIcon() override;
private:
// chrome::mojom::UtilReadIcon:
void ReadIcon(const base::FilePath& filename,
chrome::mojom::IconSize icon_size,
ReadIconCallback callback) override;
mojo::Receiver<chrome::mojom::UtilReadIcon> receiver_;
base::WeakPtrFactory<UtilReadIcon> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(UtilReadIcon);
};
#endif // CHROME_SERVICES_UTIL_WIN_UTIL_READ_ICON_H_
...@@ -885,7 +885,6 @@ if (!is_android) { ...@@ -885,7 +885,6 @@ if (!is_android) {
"../browser/heavy_ad_intervention/heavy_ad_helper_browsertest.cc", "../browser/heavy_ad_intervention/heavy_ad_helper_browsertest.cc",
"../browser/history/history_browsertest.cc", "../browser/history/history_browsertest.cc",
"../browser/history/redirect_browsertest.cc", "../browser/history/redirect_browsertest.cc",
"../browser/icon_loader_browsertest.cc",
"../browser/idle/idle_browsertest.cc", "../browser/idle/idle_browsertest.cc",
"../browser/iframe_browsertest.cc", "../browser/iframe_browsertest.cc",
"../browser/image_fetcher/image_fetcher_impl_browsertest.cc", "../browser/image_fetcher/image_fetcher_impl_browsertest.cc",
......
...@@ -15,7 +15,6 @@ include_rules = [ ...@@ -15,7 +15,6 @@ include_rules = [
"+chrome/services/removable_storage_writer", "+chrome/services/removable_storage_writer",
"+chrome/services/sharing", "+chrome/services/sharing",
"+chrome/services/speech/speech_recognition_service_impl.h", "+chrome/services/speech/speech_recognition_service_impl.h",
"+chrome/services/util_win/util_read_icon.h",
"+chrome/services/util_win/util_win_impl.h", "+chrome/services/util_win/util_win_impl.h",
"+chrome/services/util_win/public/mojom", "+chrome/services/util_win/public/mojom",
"+chromeos/assistant/buildflags.h", "+chromeos/assistant/buildflags.h",
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
#include "printing/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/services/util_win/public/mojom/util_read_icon.mojom.h"
#include "chrome/services/util_win/public/mojom/util_win.mojom.h" #include "chrome/services/util_win/public/mojom/util_win.mojom.h"
#include "chrome/services/util_win/util_read_icon.h"
#include "chrome/services/util_win/util_win_impl.h" #include "chrome/services/util_win/util_win_impl.h"
#include "components/services/quarantine/public/cpp/quarantine_features_win.h" // nogncheck #include "components/services/quarantine/public/cpp/quarantine_features_win.h" // nogncheck
#include "components/services/quarantine/public/mojom/quarantine.mojom.h" // nogncheck #include "components/services/quarantine/public/mojom/quarantine.mojom.h" // nogncheck
...@@ -128,11 +126,6 @@ auto RunQuarantineService( ...@@ -128,11 +126,6 @@ auto RunQuarantineService(
auto RunWindowsUtility(mojo::PendingReceiver<chrome::mojom::UtilWin> receiver) { auto RunWindowsUtility(mojo::PendingReceiver<chrome::mojom::UtilWin> receiver) {
return std::make_unique<UtilWinImpl>(std::move(receiver)); return std::make_unique<UtilWinImpl>(std::move(receiver));
} }
auto RunWindowsIconReader(
mojo::PendingReceiver<chrome::mojom::UtilReadIcon> receiver) {
return std::make_unique<UtilReadIcon>(std::move(receiver));
}
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
...@@ -275,7 +268,6 @@ mojo::ServiceFactory* GetMainThreadServiceFactory() { ...@@ -275,7 +268,6 @@ mojo::ServiceFactory* GetMainThreadServiceFactory() {
#if defined(OS_WIN) #if defined(OS_WIN)
RunQuarantineService, RunQuarantineService,
RunWindowsUtility, RunWindowsUtility,
RunWindowsIconReader,
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_CHROMEOS) #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_CHROMEOS)
......
...@@ -81,7 +81,6 @@ class UtilitySandboxedProcessLauncherDelegate ...@@ -81,7 +81,6 @@ class UtilitySandboxedProcessLauncherDelegate
sandbox_type_ == service_manager::SandboxType::kXrCompositing || sandbox_type_ == service_manager::SandboxType::kXrCompositing ||
sandbox_type_ == service_manager::SandboxType::kProxyResolver || sandbox_type_ == service_manager::SandboxType::kProxyResolver ||
sandbox_type_ == service_manager::SandboxType::kPdfConversion || sandbox_type_ == service_manager::SandboxType::kPdfConversion ||
sandbox_type_ == service_manager::SandboxType::kIconReader ||
#endif #endif
sandbox_type_ == service_manager::SandboxType::kUtility || sandbox_type_ == service_manager::SandboxType::kUtility ||
sandbox_type_ == service_manager::SandboxType::kNetwork || sandbox_type_ == service_manager::SandboxType::kNetwork ||
...@@ -152,31 +151,6 @@ class UtilitySandboxedProcessLauncherDelegate ...@@ -152,31 +151,6 @@ class UtilitySandboxedProcessLauncherDelegate
return true; return true;
} }
if (sandbox_type_ == service_manager::SandboxType::kIconReader) {
policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS,
sandbox::USER_LOCKDOWN);
policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED);
policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW);
policy->SetLockdownDefaultDacl();
policy->SetAlternateDesktop(true);
sandbox::MitigationFlags flags = policy->GetDelayedProcessMitigations();
flags |= sandbox::MITIGATION_DYNAMIC_CODE_DISABLE;
if (sandbox::SBOX_ALL_OK != policy->SetDelayedProcessMitigations(flags))
return false;
// Allow file read. These should match IconLoader::GroupForFilepath().
policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
L"\\??\\*.exe");
policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
L"\\??\\*.dll");
policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
L"\\??\\*.ico");
}
if (sandbox_type_ == service_manager::SandboxType::kXrCompositing && if (sandbox_type_ == service_manager::SandboxType::kXrCompositing &&
base::FeatureList::IsEnabled(service_manager::features::kXRSandbox)) { base::FeatureList::IsEnabled(service_manager::features::kXRSandbox)) {
// There were issues with some mitigations, causing an inability // There were issues with some mitigations, causing an inability
......
...@@ -27,7 +27,6 @@ bool IsUnsandboxedSandboxType(SandboxType sandbox_type) { ...@@ -27,7 +27,6 @@ bool IsUnsandboxedSandboxType(SandboxType sandbox_type) {
service_manager::features::kXRSandbox); service_manager::features::kXRSandbox);
case SandboxType::kProxyResolver: case SandboxType::kProxyResolver:
case SandboxType::kPdfConversion: case SandboxType::kPdfConversion:
case SandboxType::kIconReader:
return false; return false;
#endif #endif
case SandboxType::kAudio: case SandboxType::kAudio:
...@@ -119,7 +118,6 @@ void SetCommandLineFlagsForSandboxType(base::CommandLine* command_line, ...@@ -119,7 +118,6 @@ void SetCommandLineFlagsForSandboxType(base::CommandLine* command_line,
case SandboxType::kXrCompositing: case SandboxType::kXrCompositing:
case SandboxType::kProxyResolver: case SandboxType::kProxyResolver:
case SandboxType::kPdfConversion: case SandboxType::kPdfConversion:
case SandboxType::kIconReader:
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
case SandboxType::kIme: case SandboxType::kIme:
...@@ -242,8 +240,6 @@ std::string StringFromUtilitySandboxType(SandboxType sandbox_type) { ...@@ -242,8 +240,6 @@ std::string StringFromUtilitySandboxType(SandboxType sandbox_type) {
return switches::kProxyResolverSandbox; return switches::kProxyResolverSandbox;
case SandboxType::kPdfConversion: case SandboxType::kPdfConversion:
return switches::kPdfConversionSandbox; return switches::kPdfConversionSandbox;
case SandboxType::kIconReader:
return switches::kIconReaderSandbox;
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
case SandboxType::kIme: case SandboxType::kIme:
...@@ -296,8 +292,6 @@ SandboxType UtilitySandboxTypeFromString(const std::string& sandbox_string) { ...@@ -296,8 +292,6 @@ SandboxType UtilitySandboxTypeFromString(const std::string& sandbox_string) {
return SandboxType::kProxyResolver; return SandboxType::kProxyResolver;
if (sandbox_string == switches::kPdfConversionSandbox) if (sandbox_string == switches::kPdfConversionSandbox)
return SandboxType::kPdfConversion; return SandboxType::kPdfConversion;
if (sandbox_string == switches::kIconReaderSandbox)
return SandboxType::kIconReader;
#endif #endif
if (sandbox_string == switches::kAudioSandbox) if (sandbox_string == switches::kAudioSandbox)
return SandboxType::kAudio; return SandboxType::kAudio;
......
...@@ -30,9 +30,6 @@ enum class SandboxType { ...@@ -30,9 +30,6 @@ enum class SandboxType {
// The PDF conversion service process used in printing. // The PDF conversion service process used in printing.
kPdfConversion, kPdfConversion,
// The icon reader service.
kIconReader,
#endif #endif
#if defined(OS_FUCHSIA) #if defined(OS_FUCHSIA)
......
...@@ -36,7 +36,6 @@ const char kVideoCaptureSandbox[] = "video_capture"; ...@@ -36,7 +36,6 @@ const char kVideoCaptureSandbox[] = "video_capture";
const char kPdfConversionSandbox[] = "pdf_conversion"; const char kPdfConversionSandbox[] = "pdf_conversion";
const char kProxyResolverSandbox[] = "proxy_resolver"; const char kProxyResolverSandbox[] = "proxy_resolver";
const char kXrCompositingSandbox[] = "xr_compositing"; const char kXrCompositingSandbox[] = "xr_compositing";
const char kIconReaderSandbox[] = "icon_reader";
#endif // OS_WIN #endif // OS_WIN
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -35,7 +35,6 @@ SERVICE_MANAGER_SANDBOX_EXPORT extern const char kVideoCaptureSandbox[]; ...@@ -35,7 +35,6 @@ SERVICE_MANAGER_SANDBOX_EXPORT extern const char kVideoCaptureSandbox[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kPdfConversionSandbox[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kPdfConversionSandbox[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kProxyResolverSandbox[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kProxyResolverSandbox[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kXrCompositingSandbox[]; SERVICE_MANAGER_SANDBOX_EXPORT extern const char kXrCompositingSandbox[];
SERVICE_MANAGER_SANDBOX_EXPORT extern const char kIconReaderSandbox[];
#endif // OS_WIN #endif // OS_WIN
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -952,8 +952,7 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess( ...@@ -952,8 +952,7 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess(
if (!cmd_line->HasSwitch(switches::kAllowThirdPartyModules)) if (!cmd_line->HasSwitch(switches::kAllowThirdPartyModules))
mitigations |= sandbox::MITIGATION_FORCE_MS_SIGNED_BINS; mitigations |= sandbox::MITIGATION_FORCE_MS_SIGNED_BINS;
if (sandbox_type == SandboxType::kNetwork || if (sandbox_type == SandboxType::kNetwork ||
sandbox_type == SandboxType::kAudio || sandbox_type == SandboxType::kAudio) {
sandbox_type == SandboxType::kIconReader) {
mitigations |= sandbox::MITIGATION_DYNAMIC_CODE_DISABLE; mitigations |= sandbox::MITIGATION_DYNAMIC_CODE_DISABLE;
} }
// TODO(wfh): Relax strict handle checks for network process until root cause // TODO(wfh): Relax strict handle checks for network process until root cause
...@@ -1129,8 +1128,6 @@ std::string SandboxWin::GetSandboxTypeInEnglish(SandboxType sandbox_type) { ...@@ -1129,8 +1128,6 @@ std::string SandboxWin::GetSandboxTypeInEnglish(SandboxType sandbox_type) {
return "Sharing"; return "Sharing";
case SandboxType::kVideoCapture: case SandboxType::kVideoCapture:
return "Video Capture"; return "Video Capture";
case SandboxType::kIconReader:
return "Icon Reader";
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment