Commit d7689e98 authored by Joe Mason's avatar Joe Mason Committed by Commit Bot

Move chrome_prompt.mojom and kChromeMojoPipeTokenSwitch into chrome/chrome_cleaner

These no longer need to be in the shared components/chrome_cleaner directory
because new versions of Chrome do not use them to communicate with the cleaner.
The cleaner itself still needs to build against them so that the cleaner can
communicate with older versions of chrome that set kChromeMojoPipeTokenSwitch
on the command-line.

Also split out FilePath, RegistryKey and ExtensionId into a new
footprints.mojom interface, to eliminate some bogus dependencies on
chrome_prompt.mojom.

R=proberge

Bug: 969139
Change-Id: Ib6f5b2dbf6f08d389453bcea86d52cdc5b078bec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903956Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Reviewed-by: default avatarCait Phillips <caitkp@chromium.org>
Reviewed-by: default avatarproberge <proberge@chromium.org>
Commit-Queue: Joe Mason <joenotcharles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714502}
parent 8b7b9e27
......@@ -78,6 +78,10 @@ const char kLogInterfaceCallsToSwitch[] = "log-interface-calls-to";
// Specify the time to wait between logs upload retries, in minutes.
const char kLogUploadRetryIntervalSwitch[] = "logs-upload-retry-interval";
// The Mojo pipe token for IPC communication between the Software Reporter and
// Chrome. Dropped in M80.
const char kChromeMojoPipeTokenSwitch[] = "chrome-mojo-pipe-token";
// Prevent the crash client from uploading crash reports.
const char kNoCrashUploadSwitch[] = "no-crash-upload";
......
......@@ -54,6 +54,13 @@ extern const char kAllowUnsecureDLLsSwitch[];
extern const char kRunWithoutSandboxForTestingSwitch[];
#endif
// Deprecated switches that were set by older Chrome versions.
// These must still be handled until we drop support for those versions.
// The Mojo pipe token for IPC communication between the Software Reporter and
// Chrome. Dropped in M80.
extern const char kChromeMojoPipeTokenSwitch[];
} // namespace chrome_cleaner
#endif // CHROME_CHROME_CLEANER_CONSTANTS_CHROME_CLEANER_SWITCHES_H_
......@@ -31,7 +31,7 @@ source_set("chrome_prompt_ipc") {
deps = [
":mojo_task_runner",
"//base",
"//components/chrome_cleaner/public/interfaces",
"//chrome/chrome_cleaner/mojom:chrome_prompt_interface",
"//mojo/public/cpp/platform",
"//mojo/public/cpp/system",
]
......@@ -106,11 +106,11 @@ source_set("unittest_sources") {
"//base/test:test_support",
"//chrome/chrome_cleaner:buildflags",
"//chrome/chrome_cleaner/logging:common",
"//chrome/chrome_cleaner/mojom:chrome_prompt_interface",
"//chrome/chrome_cleaner/mojom:mojo_sandbox_hooks_test_interface",
"//chrome/chrome_cleaner/os:common_os",
"//chrome/chrome_cleaner/test:test_util",
"//components/chrome_cleaner/public/constants",
"//components/chrome_cleaner/public/interfaces",
"//components/chrome_cleaner/public/proto",
"//components/chrome_cleaner/public/proto:test_only_proto",
"//components/chrome_cleaner/test:test_name_helper",
......
......@@ -14,7 +14,7 @@
#include "base/strings/string16.h"
#include "chrome/chrome_cleaner/ipc/chrome_prompt_ipc.h"
#include "chrome/chrome_cleaner/ipc/mojo_task_runner.h"
#include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h"
#include "chrome/chrome_cleaner/mojom/chrome_prompt.mojom.h"
namespace chrome_cleaner {
......
......@@ -18,8 +18,8 @@
#include "base/threading/sequenced_task_runner_handle.h"
#include "chrome/chrome_cleaner/ipc/ipc_test_util.h"
#include "chrome/chrome_cleaner/logging/scoped_logging.h"
#include "chrome/chrome_cleaner/mojom/chrome_prompt.mojom.h"
#include "chrome/chrome_cleaner/test/test_util.h"
#include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h"
#include "components/chrome_cleaner/public/proto/chrome_prompt.pb.h"
#include "components/chrome_cleaner/test/test_name_helper.h"
#include "mojo/public/cpp/bindings/binding.h"
......
......@@ -18,6 +18,26 @@ template("chrome_cleaner_mojom") {
}
}
chrome_cleaner_mojom("chrome_prompt_interface") {
sources = [
"chrome_prompt.mojom",
]
deps = [
":footprints_interface",
]
# NOTE: We avoid scrambling message IDs here because these messages cross an
# IPC boundary to an external program built from a different source tree.
scramble_message_ids = false
}
chrome_cleaner_mojom("footprints_interface") {
sources = [
"footprints.mojom",
]
}
chrome_cleaner_mojom("engine_sandbox_interface") {
sources = [
"cleaner_engine_requests.mojom",
......@@ -29,7 +49,7 @@ chrome_cleaner_mojom("engine_sandbox_interface") {
"windows_handle.mojom",
]
deps = [
"//components/chrome_cleaner/public/interfaces",
":footprints_interface",
"//mojo/public/mojom/base",
]
}
......
......@@ -4,15 +4,23 @@
module chrome_cleaner.mojom;
// IMPORTANT NOTE: Avoid adding dependencies to typemapped .mojom files.
// Enabling typemaps currently (as of July 2017) requires indirectly depending
// on all existing typemap definitions. The Chrome Cleaner is built
// independently from Chromium and would like to avoid these dependencies.
// This interface was used to communicate between Chrome and the Chrome Cleanup
// until M80, when it was replaced by
// components/chrome_cleaner/public/proto/chrome_prompt.proto. It must be
// supported until we drop support for Chrome M79 and earlier.
// IMPORTANT NOTE: Avoid adding dependencies to typemapped .mojom files outside
// the chrome/chrome_cleaner directory. Enabling typemaps currently (as of
// July 2017) requires indirectly depending on all existing typemap
// definitions. The Chrome Cleaner is built independently from Chromium and
// would like to avoid these dependencies.
// Once it's possible to specify a limited subset of typemaps to use, be
// careful not to add dependencies to [Native] mojo structures. The wire format
// for [Native] structs is not guaranteed to be consistent between versions.
import "chrome/chrome_cleaner/mojom/footprints.mojom";
[Extensible]
enum PromptAcceptance {
UNSPECIFIED = 0,
......@@ -27,21 +35,6 @@ enum PromptAcceptance {
NUM_VALUES,
};
struct FilePath {
array<uint16> value;
};
struct RegistryKey {
// A string formatted for display to the user.
// Example: HKCU:32\software\unwanted_software
array<uint16> value;
};
struct ExtensionId {
// A 32-character extension ID.
array<uint16> value;
};
// Service provided by Chrome to prompt the user to start a cleanup if the
// Chrome Cleanup Tool detects unwanted software on the system.
interface ChromePrompt {
......
......@@ -4,8 +4,8 @@
module chrome_cleaner.mojom;
import "chrome/chrome_cleaner/mojom/footprints.mojom";
import "chrome/chrome_cleaner/mojom/string16_embedded_nulls.mojom";
import "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom";
import "mojo/public/mojom/base/string16.mojom";
// Passes requests that can mutate the system from the low-privilege sandbox
......
......@@ -4,7 +4,7 @@
module chrome_cleaner.mojom;
import "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom";
import "chrome/chrome_cleaner/mojom/footprints.mojom";
// Handles returned by FindFirstFile aren't real handles, so we can't pass them
// through mojo as handles, since they can't be duplicated.
......
......@@ -4,9 +4,9 @@
module chrome_cleaner.mojom;
import "chrome/chrome_cleaner/mojom/footprints.mojom";
import "chrome/chrome_cleaner/mojom/string16_embedded_nulls.mojom";
import "chrome/chrome_cleaner/mojom/windows_handle.mojom";
import "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom";
import "mojo/public/mojom/base/process_id.mojom";
import "mojo/public/mojom/base/string16.mojom";
......
......@@ -4,11 +4,11 @@
module chrome_cleaner.mojom;
import "chrome/chrome_cleaner/mojom/footprints.mojom";
import "chrome/chrome_cleaner/mojom/cleaner_engine_requests.mojom";
import "chrome/chrome_cleaner/mojom/engine_requests.mojom";
import "chrome/chrome_cleaner/mojom/engine_file_requests.mojom";
import "chrome/chrome_cleaner/mojom/pup.mojom";
import "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom";
// All result_code parameters and return values in these interfaces are either
// an EngineResultCode or, if higher than EngineResultCode::kEngineInternal, an
......
// Copyright 2019 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_cleaner.mojom;
struct FilePath {
array<uint16> value;
};
struct RegistryKey {
// A string formatted for display to the user.
// Example: HKCU:32\software\unwanted_software
array<uint16> value;
};
struct ExtensionId {
// A 32-character extension ID.
array<uint16> value;
};
......@@ -4,8 +4,7 @@
module chrome_cleaner.mojom;
// chrome_prompt included for the FilePath struct.
import "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom";
import "chrome/chrome_cleaner/mojom/footprints.mojom";
// Typemapped to chrome_cleaner::UwS::TraceLocation enumeration from
// chrome_cleaner/logging/proto/shared_data.proto.
......
include_rules = [
# Unlike the rest of chrome/chrome_cleaner this might be built on non-Windows
# platforms because it's included from the global
# chromium_bindings_configuration.gni. So it needs macros from
# build/build_config.h to check the platform.
'+build',
# Allow unit tests to set up a mojo embedder.
'+mojo/core/embedder',
]
......@@ -2,16 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
mojom = "//components/chrome_cleaner/public/interfaces/chrome_prompt.mojom"
mojom = "//chrome/chrome_cleaner/mojom/footprints.mojom"
public_headers = [
"//base/files/file_path.h",
"//base/strings/string16.h",
]
traits_headers = [
"//components/chrome_cleaner/public/typemaps/chrome_prompt_mojom_traits.h",
]
traits_headers =
[ "//chrome/chrome_cleaner/mojom/typemaps/footprints_mojom_traits.h" ]
sources = [
"//components/chrome_cleaner/public/typemaps/chrome_prompt_mojom_traits.cc",
"//chrome/chrome_cleaner/mojom/typemaps/footprints_mojom_traits.cc",
]
type_mappings = [
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/chrome_cleaner/public/typemaps/chrome_prompt_mojom_traits.h"
#include "chrome/chrome_cleaner/mojom/typemaps/footprints_mojom_traits.h"
#include "build/build_config.h"
namespace mojo {
......
......@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_CHROME_CLEANER_PUBLIC_TYPEMAPS_CHROME_PROMPT_MOJOM_TRAITS_H_
#define COMPONENTS_CHROME_CLEANER_PUBLIC_TYPEMAPS_CHROME_PROMPT_MOJOM_TRAITS_H_
#ifndef CHROME_CHROME_CLEANER_MOJOM_TYPEMAPS_FOOTPRINTS_MOJOM_TRAITS_H_
#define CHROME_CHROME_CLEANER_MOJOM_TYPEMAPS_FOOTPRINTS_MOJOM_TRAITS_H_
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/strings/string16.h"
#include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h"
#include "chrome/chrome_cleaner/mojom/footprints.mojom.h"
namespace mojo {
......@@ -37,4 +37,4 @@ struct StructTraits<chrome_cleaner::mojom::ExtensionIdDataView,
} // namespace mojo
#endif // COMPONENTS_CHROME_CLEANER_PUBLIC_TYPEMAPS_CHROME_PROMPT_MOJOM_TRAITS_H_
#endif // CHROME_CHROME_CLEANER_MOJOM_TYPEMAPS_FOOTPRINTS_MOJOM_TRAITS_H_
......@@ -5,7 +5,7 @@
#include "chrome/chrome_cleaner/mojom/typemaps/pup_mojom_traits.h"
#include "chrome/chrome_cleaner/logging/proto/shared_data.pb.h"
#include "components/chrome_cleaner/public/typemaps/chrome_prompt_mojom_traits.h"
#include "chrome/chrome_cleaner/mojom/typemaps/footprints_mojom_traits.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
namespace mojo {
......
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
typemaps = [
"//chrome/chrome_cleaner/mojom/typemaps/footprints.typemap",
"//chrome/chrome_cleaner/mojom/typemaps/pup.typemap",
"//chrome/chrome_cleaner/mojom/typemaps/string16_embedded_nulls.typemap",
"//chrome/chrome_cleaner/mojom/typemaps/windows_handle.typemap",
......
......@@ -9,7 +9,6 @@ namespace chrome_cleaner {
// Command line switches.
const char kChromeChannelSwitch[] = "chrome-channel";
const char kChromeExePathSwitch[] = "chrome-exe-path";
const char kChromeMojoPipeTokenSwitch[] = "chrome-mojo-pipe-token";
const char kChromePromptSwitch[] = "chrome-prompt";
const char kChromeReadHandleSwitch[] = "chrome-read-handle";
const char kChromeWriteHandleSwitch[] = "chrome-write-handle";
......
......@@ -23,10 +23,6 @@ extern const char kChromeChannelSwitch[];
// The path to Chrome's executable.
extern const char kChromeExePathSwitch[];
// The Mojo pipe token for IPC communication between the Software Reporter and
// Chrome.
extern const char kChromeMojoPipeTokenSwitch[];
// Indicates that a cleaner run was started by Chrome.
extern const char kChromePromptSwitch[];
......
# Copyright 2017 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("//mojo/public/tools/bindings/mojom.gni")
# TODO(crbug.com/969139): This target uses a non-standard name because it is
# mirrored at
# https://chromium.googlesource.com/chromium/src/components/chrome_cleaner so
# that it can be used from the internal Chrome Cleanup tool repo which is
# released on a different schedule from Chrome. Coordinating the renaming from
# interfaces -> mojom in the internal repo is tricky. Once crbug.com/969139 is
# implemented we we will delete this interface anyway.
mojom("interfaces") {
sources = [
"chrome_prompt.mojom",
]
# NOTE: We avoid scrambling message IDs here because these messages cross an
# IPC boundary to an external program built from a different source tree.
scramble_message_ids = false
}
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
# TEAM: security-dev@chromium.org
# COMPONENT: UI>Browser>Preferences>Protector
# Allow the typemaps to access their dependencies.
include_rules = [
'+base/containers/span.h',
'+base/files/file_path.h',
'+base/strings/string16.h',
'+build/build_config.h',
]
set noparent
file://ipc/SECURITY_OWNERS
per-file *_mojom_traits*.*=set noparent
per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
per-file *.typemap=set noparent
per-file *.typemap=file://ipc/SECURITY_OWNERS
......@@ -5,7 +5,6 @@
typemaps = [
"//components/account_id/mojom/account_id.typemap",
"//components/autofill/core/common/mojom/autofill_types.typemap",
"//components/chrome_cleaner/public/typemaps/chrome_prompt.typemap",
"//components/content_capture/common/content_capture.typemap",
"//components/content_settings/core/common/content_settings.typemap",
"//components/nacl/common/nacl.typemap",
......
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