summaryrefslogtreecommitdiff
path: root/chromium/components/arc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/arc')
-rw-r--r--chromium/components/arc/BUILD.gn5
-rw-r--r--chromium/components/arc/DEPS1
-rw-r--r--chromium/components/arc/arc_features.cc7
-rw-r--r--chromium/components/arc/arc_features.h1
-rw-r--r--chromium/components/arc/arc_features_parser.cc25
-rw-r--r--chromium/components/arc/arc_util.cc26
-rw-r--r--chromium/components/arc/arc_util.h7
-rw-r--r--chromium/components/arc/arc_util_unittest.cc29
-rw-r--r--chromium/components/arc/camera/arc_camera_bridge.cc10
-rw-r--r--chromium/components/arc/ime/arc_ime_service.cc31
-rw-r--r--chromium/components/arc/ime/arc_ime_service.h22
-rw-r--r--chromium/components/arc/ime/arc_ime_service_unittest.cc18
-rw-r--r--chromium/components/arc/intent_helper/DEPS2
-rw-r--r--chromium/components/arc/intent_helper/activity_icon_loader.cc3
-rw-r--r--chromium/components/arc/intent_helper/arc_intent_helper_bridge.cc1
-rw-r--r--chromium/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc6
-rw-r--r--chromium/components/arc/intent_helper/custom_tab.cc160
-rw-r--r--chromium/components/arc/intent_helper/custom_tab.h76
-rw-r--r--chromium/components/arc/intent_helper/intent_filter.cc19
-rw-r--r--chromium/components/arc/intent_helper/intent_filter.h8
-rw-r--r--chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc13
-rw-r--r--chromium/components/arc/intent_helper/intent_filter_mojom_traits.h10
-rw-r--r--chromium/components/arc/intent_helper/intent_filter_unittest.cc7
-rw-r--r--chromium/components/arc/midis/arc_midis_bridge.cc17
-rw-r--r--chromium/components/arc/midis/arc_midis_bridge.h13
-rw-r--r--chromium/components/arc/mojom/BUILD.gn20
-rw-r--r--chromium/components/arc/mojom/accessibility_helper.mojom33
-rw-r--r--chromium/components/arc/mojom/app.mojom17
-rw-r--r--chromium/components/arc/mojom/appfuse.mojom2
-rw-r--r--chromium/components/arc/mojom/arc_bridge.mojom134
-rw-r--r--chromium/components/arc/mojom/audio.mojom4
-rw-r--r--chromium/components/arc/mojom/auth.mojom4
-rw-r--r--chromium/components/arc/mojom/bluetooth.mojom4
-rw-r--r--chromium/components/arc/mojom/boot_phase_monitor.mojom4
-rw-r--r--chromium/components/arc/mojom/camera.mojom4
-rw-r--r--chromium/components/arc/mojom/cert_store.mojom6
-rw-r--r--chromium/components/arc/mojom/clipboard.mojom4
-rw-r--r--chromium/components/arc/mojom/crash_collector.mojom4
-rw-r--r--chromium/components/arc/mojom/disk_quota.mojom3
-rw-r--r--chromium/components/arc/mojom/enterprise_reporting.mojom5
-rw-r--r--chromium/components/arc/mojom/file_system.mojom4
-rw-r--r--chromium/components/arc/mojom/ime.mojom17
-rw-r--r--chromium/components/arc/mojom/ime.typemap10
-rw-r--r--chromium/components/arc/mojom/ime_mojom_traits.cc42
-rw-r--r--chromium/components/arc/mojom/ime_mojom_traits.h29
-rw-r--r--chromium/components/arc/mojom/ime_mojom_traits_unittest.cc45
-rw-r--r--chromium/components/arc/mojom/input_method_manager.mojom16
-rw-r--r--chromium/components/arc/mojom/intent_helper.mojom15
-rw-r--r--chromium/components/arc/mojom/keymaster.mojom5
-rw-r--r--chromium/components/arc/mojom/kiosk.mojom4
-rw-r--r--chromium/components/arc/mojom/metrics.mojom4
-rw-r--r--chromium/components/arc/mojom/midis.mojom7
-rw-r--r--chromium/components/arc/mojom/net.mojom26
-rw-r--r--chromium/components/arc/mojom/notifications.mojom4
-rw-r--r--chromium/components/arc/mojom/obb_mounter.mojom4
-rw-r--r--chromium/components/arc/mojom/oemcrypto.mojom6
-rw-r--r--chromium/components/arc/mojom/oemcrypto_daemon.mojom26
-rw-r--r--chromium/components/arc/mojom/pip.mojom2
-rw-r--r--chromium/components/arc/mojom/policy.mojom4
-rw-r--r--chromium/components/arc/mojom/power.mojom4
-rw-r--r--chromium/components/arc/mojom/print_spooler.mojom13
-rw-r--r--chromium/components/arc/mojom/screen_capture.mojom8
-rw-r--r--chromium/components/arc/mojom/timer.mojom2
-rw-r--r--chromium/components/arc/mojom/tts.mojom4
-rw-r--r--chromium/components/arc/mojom/usb_host.mojom2
-rw-r--r--chromium/components/arc/mojom/video.mojom13
-rw-r--r--chromium/components/arc/mojom/video_decode_accelerator.mojom2
-rw-r--r--chromium/components/arc/mojom/video_encode_accelerator.mojom5
-rw-r--r--chromium/components/arc/mojom/voice_interaction_arc_home.mojom5
-rw-r--r--chromium/components/arc/mojom/voice_interaction_framework.mojom5
-rw-r--r--chromium/components/arc/mojom/volume_mounter.mojom2
-rw-r--r--chromium/components/arc/mojom/wake_lock.mojom2
-rw-r--r--chromium/components/arc/mojom/wallpaper.mojom4
-rw-r--r--chromium/components/arc/net/OWNERS3
-rw-r--r--chromium/components/arc/net/arc_net_host_impl.cc524
-rw-r--r--chromium/components/arc/net/arc_net_host_impl.h6
-rw-r--r--chromium/components/arc/power/arc_power_bridge.cc4
-rw-r--r--chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.cc7
-rw-r--r--chromium/components/arc/session/arc_bridge_host_impl.cc237
-rw-r--r--chromium/components/arc/session/arc_bridge_host_impl.h146
-rw-r--r--chromium/components/arc/session/arc_property_util.cc47
-rw-r--r--chromium/components/arc/session/arc_property_util.h9
-rw-r--r--chromium/components/arc/session/arc_property_util_unittest.cc108
-rw-r--r--chromium/components/arc/session/arc_session_impl.cc2
-rw-r--r--chromium/components/arc/session/arc_vm_client_adapter.cc37
-rw-r--r--chromium/components/arc/session/arc_vm_client_adapter_unittest.cc47
-rw-r--r--chromium/components/arc/session/connection_holder.h5
-rw-r--r--chromium/components/arc/session/file_system_status.cc4
-rw-r--r--chromium/components/arc/usb/usb_host_bridge.h1
-rw-r--r--chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc4
-rw-r--r--chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h7
-rw-r--r--chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.cc8
-rw-r--r--chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h16
93 files changed, 1447 insertions, 881 deletions
diff --git a/chromium/components/arc/BUILD.gn b/chromium/components/arc/BUILD.gn
index 2aa5e37f350..bab7b96d2ed 100644
--- a/chromium/components/arc/BUILD.gn
+++ b/chromium/components/arc/BUILD.gn
@@ -34,6 +34,8 @@ static_library("arc") {
"intent_helper/arc_intent_helper_bridge.h",
"intent_helper/arc_intent_helper_observer.h",
"intent_helper/control_camera_app_delegate.h",
+ "intent_helper/custom_tab.cc",
+ "intent_helper/custom_tab.h",
"intent_helper/factory_reset_delegate.h",
"intent_helper/intent_constants.cc",
"intent_helper/intent_constants.h",
@@ -108,7 +110,7 @@ static_library("arc") {
# TODO(crbug.com/853604): After fully migrating the intent picker to query
# directly from App Service, we will deprecated the match functionality
# in intent_filter and this dependency will be removed.
- "//components/services/app_service/public/cpp:intent_util",
+ "//components/services/app_service/public/cpp:intents",
"//components/session_manager/core",
"//components/timers",
"//components/url_formatter",
@@ -231,6 +233,7 @@ static_library("arc_base") {
deps = [
"//ash/public/cpp",
+ "//ash/public/cpp/external_arc",
"//base",
"//chromeos/constants",
"//chromeos/cryptohome",
diff --git a/chromium/components/arc/DEPS b/chromium/components/arc/DEPS
index 06ecd3447d5..3899f4e8900 100644
--- a/chromium/components/arc/DEPS
+++ b/chromium/components/arc/DEPS
@@ -26,6 +26,7 @@ include_rules = [
"+third_party/skia",
"+ui/base",
"+ui/display",
+ "+ui/events",
"+ui/gfx/geometry",
"+ui/gfx/range/range.h",
]
diff --git a/chromium/components/arc/arc_features.cc b/chromium/components/arc/arc_features.cc
index 86fe498c989..8f9fb29823d 100644
--- a/chromium/components/arc/arc_features.cc
+++ b/chromium/components/arc/arc_features.cc
@@ -44,6 +44,11 @@ const base::Feature kEnableDocumentsProviderInFilesAppFeature{
const base::Feature kEnableRegularToChildTransitionFeature{
"ArcEnableRegularToChildTransition", base::FEATURE_ENABLED_BY_DEFAULT};
+// Controls whether secondary accounts are added to ARC++ for child user.
+// This is added temporarily to allow further investigation.
+const base::Feature kEnableSecondaryAccountsForChildExperiment{
+ "ArcEnableSecondaryAccountForChild", base::FEATURE_DISABLED_BY_DEFAULT};
+
// Controls whether we should delegate audio focus requests from ARC to Chrome.
const base::Feature kEnableUnifiedAudioFocusFeature{
"ArcEnableUnifiedAudioFocus", base::FEATURE_ENABLED_BY_DEFAULT};
@@ -56,7 +61,7 @@ const base::Feature kFilePickerExperimentFeature{
// Note, that we keep the original feature name to preserve
// corresponding metrics.
const base::Feature kNativeBridgeToggleFeature{
- "ArcNativeBridgeExperiment", base::FEATURE_ENABLED_BY_DEFAULT};
+ "ArcNativeBridgeExperiment", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls ARC picture-in-picture feature. If this is enabled, then Android
// will control which apps can enter PIP. If this is disabled, then ARC PIP
diff --git a/chromium/components/arc/arc_features.h b/chromium/components/arc/arc_features.h
index 7e1a6daac53..08b58f7fdf0 100644
--- a/chromium/components/arc/arc_features.h
+++ b/chromium/components/arc/arc_features.h
@@ -20,6 +20,7 @@ extern const base::Feature kEnableApplicationZoomFeature;
extern const base::Feature kEnableChildToRegularTransitionFeature;
extern const base::Feature kEnableDocumentsProviderInFilesAppFeature;
extern const base::Feature kEnableRegularToChildTransitionFeature;
+extern const base::Feature kEnableSecondaryAccountsForChildExperiment;
extern const base::Feature kEnableUnifiedAudioFocusFeature;
extern const base::Feature kFilePickerExperimentFeature;
extern const base::Feature kNativeBridgeToggleFeature;
diff --git a/chromium/components/arc/arc_features_parser.cc b/chromium/components/arc/arc_features_parser.cc
index 9dfc871dc0f..75ec90b1ed7 100644
--- a/chromium/components/arc/arc_features_parser.cc
+++ b/chromium/components/arc/arc_features_parser.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
+#include "base/logging.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -30,19 +31,16 @@ constexpr const base::FilePath::CharType kArcFeaturesJsonFile[] =
base::Optional<ArcFeatures> ParseFeaturesJson(base::StringPiece input_json) {
ArcFeatures arc_features;
- int error_code;
- std::string error_msg;
- std::unique_ptr<base::Value> json_value =
- base::JSONReader::ReadAndReturnErrorDeprecated(
- input_json, base::JSON_PARSE_RFC, &error_code, &error_msg);
- if (!json_value || !json_value->is_dict()) {
- LOG(ERROR) << "Error parsing feature JSON: " << error_msg;
+ base::JSONReader::ValueWithError parsed_json =
+ base::JSONReader::ReadAndReturnValueWithError(input_json);
+ if (!parsed_json.value || !parsed_json.value->is_dict()) {
+ LOG(ERROR) << "Error parsing feature JSON: " << parsed_json.error_message;
return base::nullopt;
}
// Parse each item under features.
const base::Value* feature_list =
- json_value->FindKeyOfType("features", base::Value::Type::LIST);
+ parsed_json.value->FindKeyOfType("features", base::Value::Type::LIST);
if (!feature_list) {
LOG(ERROR) << "No feature list in JSON.";
return base::nullopt;
@@ -65,8 +63,9 @@ base::Optional<ArcFeatures> ParseFeaturesJson(base::StringPiece input_json) {
}
// Parse each item under unavailable_features.
- const base::Value* unavailable_feature_list = json_value->FindKeyOfType(
- "unavailable_features", base::Value::Type::LIST);
+ const base::Value* unavailable_feature_list =
+ parsed_json.value->FindKeyOfType("unavailable_features",
+ base::Value::Type::LIST);
if (!unavailable_feature_list) {
LOG(ERROR) << "No unavailable feature list in JSON.";
return base::nullopt;
@@ -85,8 +84,8 @@ base::Optional<ArcFeatures> ParseFeaturesJson(base::StringPiece input_json) {
}
// Parse each item under properties.
- const base::Value* properties =
- json_value->FindKeyOfType("properties", base::Value::Type::DICTIONARY);
+ const base::Value* properties = parsed_json.value->FindKeyOfType(
+ "properties", base::Value::Type::DICTIONARY);
if (!properties) {
LOG(ERROR) << "No properties in JSON.";
return base::nullopt;
@@ -101,7 +100,7 @@ base::Optional<ArcFeatures> ParseFeaturesJson(base::StringPiece input_json) {
}
// Parse the Play Store version
- const base::Value* play_version = json_value->FindKeyOfType(
+ const base::Value* play_version = parsed_json.value->FindKeyOfType(
"play_store_version", base::Value::Type::STRING);
if (!play_version) {
LOG(ERROR) << "No Play Store version in JSON.";
diff --git a/chromium/components/arc/arc_util.cc b/chromium/components/arc/arc_util.cc
index 7b0e268efe2..ddc04468c0e 100644
--- a/chromium/components/arc/arc_util.cc
+++ b/chromium/components/arc/arc_util.cc
@@ -11,6 +11,9 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/feature_list.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/logging.h"
#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "chromeos/constants/chromeos_switches.h"
@@ -303,7 +306,6 @@ bool IsArcPlayAutoInstallDisabled() {
chromeos::switches::kArcDisablePlayAutoInstall);
}
-// static
int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor) {
const auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(chromeos::switches::kArcScale)) {
@@ -333,4 +335,26 @@ int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor) {
kDefaultDensityDpi);
}
+bool GenerateFirstStageFstab(const base::FilePath& combined_property_file_name,
+ const base::FilePath& fstab_path) {
+ DCHECK(IsArcVmEnabled());
+ // The file is exposed to the guest by crosvm via /sys/firmware/devicetree,
+ // which in turn allows the guest's init process to mount /vendor very early,
+ // in its first stage (device) initialization step. crosvm also special-cases
+ // #dt-vendor line and expose |combined_property_file_name| via the device
+ // tree file system too. This also allow the init process to load the expanded
+ // properties very early even before all file systems are mounted.
+ //
+ // The device name for /vendor has to match what arc_vm_client_adapter.cc
+ // configures.
+ constexpr const char kFirstStageFstabTemplate[] =
+ "/dev/block/vdb /vendor squashfs ro,noatime,nosuid,nodev "
+ "wait,check,formattable,reservedsize=128M\n"
+ "#dt-vendor build.prop %s default default\n";
+ return base::WriteFile(
+ fstab_path,
+ base::StringPrintf(kFirstStageFstabTemplate,
+ combined_property_file_name.value().c_str()));
+}
+
} // namespace arc
diff --git a/chromium/components/arc/arc_util.h b/chromium/components/arc/arc_util.h
index 644b63499de..da0fe3d4cd0 100644
--- a/chromium/components/arc/arc_util.h
+++ b/chromium/components/arc/arc_util.h
@@ -18,6 +18,7 @@ class Window;
namespace base {
class CommandLine;
+class FilePath;
} // namespace base
namespace user_manager {
@@ -149,6 +150,12 @@ void SetArcCpuRestriction(CpuRestrictionState cpu_restriction_state);
// factor used on chrome.
int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor);
+// Generates a file called first stage fstab at |fstab_path| which is exported
+// by crosvm to the guest via the device tree so the guest can read certain
+// files in its init's first stage.
+bool GenerateFirstStageFstab(const base::FilePath& combined_property_file_name,
+ const base::FilePath& fstab_path);
+
} // namespace arc
#endif // COMPONENTS_ARC_ARC_UTIL_H_
diff --git a/chromium/components/arc/arc_util_unittest.cc b/chromium/components/arc/arc_util_unittest.cc
index 1dd651d631c..165f40d04b6 100644
--- a/chromium/components/arc/arc_util_unittest.cc
+++ b/chromium/components/arc/arc_util_unittest.cc
@@ -10,6 +10,8 @@
#include "ash/public/cpp/app_types.h"
#include "base/base_switches.h"
#include "base/command_line.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/test/scoped_feature_list.h"
@@ -275,5 +277,32 @@ TEST_F(ArcUtilTest, ScaleFactorToDensity) {
EXPECT_EQ(240, GetLcdDensityForDeviceScaleFactor(2.0));
}
+TEST_F(ArcUtilTest, GenerateFirstStageFstab) {
+ constexpr const char kFakeCombinedBuildPropPath[] = "/path/to/build.prop";
+ constexpr const char kAnotherFakeCombinedBuildPropPath[] =
+ "/foo/bar/baz.prop";
+
+ auto* command_line = base::CommandLine::ForCurrentProcess();
+ command_line->InitFromArgv({"", "--enable-arcvm"});
+
+ std::string content;
+ base::ScopedTempDir dir;
+ ASSERT_TRUE(dir.CreateUniqueTempDir());
+ const base::FilePath fstab(dir.GetPath().Append("fstab"));
+
+ // Generate the fstab and verify the content.
+ EXPECT_TRUE(GenerateFirstStageFstab(
+ base::FilePath(kFakeCombinedBuildPropPath), fstab));
+ EXPECT_TRUE(base::ReadFileToString(fstab, &content));
+ EXPECT_NE(std::string::npos, content.find(kFakeCombinedBuildPropPath));
+
+ // Generate the fstab again with the other prop file and verify the content.
+ EXPECT_TRUE(GenerateFirstStageFstab(
+ base::FilePath(kAnotherFakeCombinedBuildPropPath), fstab));
+ EXPECT_TRUE(base::ReadFileToString(fstab, &content));
+ EXPECT_EQ(std::string::npos, content.find(kFakeCombinedBuildPropPath));
+ EXPECT_NE(std::string::npos, content.find(kAnotherFakeCombinedBuildPropPath));
+}
+
} // namespace
} // namespace arc
diff --git a/chromium/components/arc/camera/arc_camera_bridge.cc b/chromium/components/arc/camera/arc_camera_bridge.cc
index bae4746abb7..59588699993 100644
--- a/chromium/components/arc/camera/arc_camera_bridge.cc
+++ b/chromium/components/arc/camera/arc_camera_bridge.cc
@@ -16,6 +16,7 @@
#include "components/arc/session/arc_bridge_service.h"
#include "crypto/random.h"
#include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
#include "mojo/public/cpp/system/platform_handle.h"
@@ -53,9 +54,10 @@ class ArcCameraBridge::PendingStartCameraServiceResult {
mojo::ScopedMessagePipeHandle pipe,
ArcCameraBridge::StartCameraServiceCallback callback)
: owner_(owner),
- service_(mojom::CameraServicePtrInfo(std::move(pipe), 0u)),
+ service_(
+ mojo::PendingRemote<mojom::CameraService>(std::move(pipe), 0u)),
callback_(std::move(callback)) {
- service_.set_connection_error_handler(
+ service_.set_disconnect_handler(
base::BindOnce(&PendingStartCameraServiceResult::OnError,
weak_ptr_factory_.GetWeakPtr()));
service_.QueryVersion(
@@ -78,13 +80,13 @@ class ArcCameraBridge::PendingStartCameraServiceResult {
// Runs the callback and removes this object from the owner.
void Finish() {
DCHECK(callback_);
- std::move(callback_).Run(std::move(service_));
+ std::move(callback_).Run(service_.Unbind());
// Destructs |this|.
owner_->pending_start_camera_service_results_.erase(this);
}
ArcCameraBridge* const owner_;
- mojom::CameraServicePtr service_;
+ mojo::Remote<mojom::CameraService> service_;
ArcCameraBridge::StartCameraServiceCallback callback_;
base::WeakPtrFactory<PendingStartCameraServiceResult> weak_ptr_factory_{this};
diff --git a/chromium/components/arc/ime/arc_ime_service.cc b/chromium/components/arc/ime/arc_ime_service.cc
index 7913a6baa35..4718428b020 100644
--- a/chromium/components/arc/ime/arc_ime_service.cc
+++ b/chromium/components/arc/ime/arc_ime_service.cc
@@ -7,14 +7,17 @@
#include <utility>
#include "ash/keyboard/ui/keyboard_ui_controller.h"
+#include "base/feature_list.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "chromeos/constants/chromeos_features.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_util.h"
#include "components/arc/ime/arc_ime_bridge_impl.h"
#include "components/exo/wm_helper.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
@@ -45,11 +48,12 @@ double GetDefaultDeviceScaleFactor() {
class ArcWindowDelegateImpl : public ArcImeService::ArcWindowDelegate {
public:
explicit ArcWindowDelegateImpl(ArcImeService* ime_service)
- : ime_service_(ime_service) {}
+ : ime_service_(ime_service) {}
~ArcWindowDelegateImpl() override = default;
bool IsInArcAppWindow(const aura::Window* window) const override {
+ // WMHelper is not craeted in browser_tests.
if (!exo::WMHelper::HasInstance())
return false;
aura::Window* active = exo::WMHelper::GetInstance()->GetActiveWindow();
@@ -71,7 +75,7 @@ class ArcWindowDelegateImpl : public ArcImeService::ArcWindowDelegate {
}
void RegisterFocusObserver() override {
- // WMHelper is not created in tests.
+ // WMHelper is not craeted in browser_tests.
if (!exo::WMHelper::HasInstance())
return;
exo::WMHelper::GetInstance()->AddFocusObserver(ime_service_);
@@ -93,7 +97,7 @@ class ArcWindowDelegateImpl : public ArcImeService::ArcWindowDelegate {
}
bool IsImeBlocked(aura::Window* window) const override {
- // WMHelper is not created in tests.
+ // WMHelper is not craeted in browser_tests.
if (!exo::WMHelper::HasInstance())
return false;
return exo::WMHelper::GetInstance()->IsImeBlocked(window);
@@ -137,8 +141,15 @@ ArcImeService* ArcImeService::GetForBrowserContext(
ArcImeService::ArcImeService(content::BrowserContext* context,
ArcBridgeService* bridge_service)
+ : ArcImeService(context,
+ bridge_service,
+ std::make_unique<ArcWindowDelegateImpl>(this)) {}
+
+ArcImeService::ArcImeService(content::BrowserContext* context,
+ ArcBridgeService* bridge_service,
+ std::unique_ptr<ArcWindowDelegate> delegate)
: ime_bridge_(new ArcImeBridgeImpl(this, bridge_service)),
- arc_window_delegate_(new ArcWindowDelegateImpl(this)),
+ arc_window_delegate_(std::move(delegate)),
ime_type_(ui::TEXT_INPUT_TYPE_NONE),
ime_flags_(ui::TEXT_INPUT_FLAG_NONE),
is_personalized_learning_allowed_(false),
@@ -174,11 +185,6 @@ void ArcImeService::SetImeBridgeForTesting(
ime_bridge_ = std::move(test_ime_bridge);
}
-void ArcImeService::SetArcWindowDelegateForTesting(
- std::unique_ptr<ArcWindowDelegate> delegate) {
- arc_window_delegate_ = std::move(delegate);
-}
-
ui::InputMethod* ArcImeService::GetInputMethod() {
return arc_window_delegate_->GetInputMethodForWindow(focused_arc_window_);
}
@@ -606,6 +612,13 @@ bool ArcImeService::SetCompositionFromExistingText(
return false;
}
+bool ArcImeService::SetAutocorrectRange(const base::string16& autocorrect_text,
+ const gfx::Range& range) {
+ // TODO(https:://crbug.com/1091088): Implement this method.
+ NOTIMPLEMENTED_LOG_ONCE();
+ return false;
+}
+
// static
void ArcImeService::SetOverrideDefaultDeviceScaleFactorForTesting(
base::Optional<double> scale_factor) {
diff --git a/chromium/components/arc/ime/arc_ime_service.h b/chromium/components/arc/ime/arc_ime_service.h
index bc12839d20c..4a48b317eb9 100644
--- a/chromium/components/arc/ime/arc_ime_service.h
+++ b/chromium/components/arc/ime/arc_ime_service.h
@@ -49,10 +49,6 @@ class ArcImeService : public KeyedService,
// or nullptr if the browser |context| is not allowed to use ARC.
static ArcImeService* GetForBrowserContext(content::BrowserContext* context);
- ArcImeService(content::BrowserContext* context,
- ArcBridgeService* bridge_service);
- ~ArcImeService() override;
-
class ArcWindowDelegate {
public:
virtual ~ArcWindowDelegate() = default;
@@ -67,13 +63,14 @@ class ArcImeService : public KeyedService,
virtual bool IsImeBlocked(aura::Window* window) const = 0;
};
+ ArcImeService(content::BrowserContext* context,
+ ArcBridgeService* bridge_service);
+
+ ~ArcImeService() override;
+
// Injects the custom IPC bridge object for testing purpose only.
void SetImeBridgeForTesting(std::unique_ptr<ArcImeBridge> test_ime_bridge);
- // Injects the custom delegate for ARC windows, for testing purpose only.
- void SetArcWindowDelegateForTesting(
- std::unique_ptr<ArcWindowDelegate> delegate);
-
// Overridden from aura::EnvObserver:
void OnWindowInitialized(aura::Window* new_window) override;
@@ -149,6 +146,8 @@ class ArcImeService : public KeyedService,
bool SetCompositionFromExistingText(
const gfx::Range& range,
const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
+ bool SetAutocorrectRange(const base::string16& autocorrect_text,
+ const gfx::Range& range) override;
// Normally, the default device scale factor is used to convert from DPI to
// physical pixels. This method provides a way to override it for testing.
@@ -156,6 +155,13 @@ class ArcImeService : public KeyedService,
base::Optional<double> scale_factor);
private:
+ friend class ArcImeServiceTest;
+
+ // Injects the custom delegate for ARC windows, for testing purpose only.
+ ArcImeService(content::BrowserContext* context,
+ ArcBridgeService* bridge_service,
+ std::unique_ptr<ArcWindowDelegate> delegate);
+
ui::InputMethod* GetInputMethod();
// Detaches from the IME associated with the |old_window|, and attaches to the
diff --git a/chromium/components/arc/ime/arc_ime_service_unittest.cc b/chromium/components/arc/ime/arc_ime_service_unittest.cc
index f38b5efd768..2b0f0ac4ff9 100644
--- a/chromium/components/arc/ime/arc_ime_service_unittest.cc
+++ b/chromium/components/arc/ime/arc_ime_service_unittest.cc
@@ -12,6 +12,8 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "components/arc/mojom/ime.mojom.h"
#include "components/arc/session/arc_bridge_service.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -207,16 +209,17 @@ class ArcImeServiceTest : public testing::Test {
private:
void SetUp() override {
arc_bridge_service_ = std::make_unique<ArcBridgeService>();
- instance_ =
- std::make_unique<ArcImeService>(nullptr, arc_bridge_service_.get());
- fake_arc_ime_bridge_ = new FakeArcImeBridge();
- instance_->SetImeBridgeForTesting(base::WrapUnique(fake_arc_ime_bridge_));
fake_input_method_ = std::make_unique<FakeInputMethod>();
+ auto delegate =
+ std::make_unique<FakeArcWindowDelegate>(fake_input_method_.get());
+ fake_window_delegate_ = delegate.get();
+
+ instance_ = base::WrapUnique(new ArcImeService(
+ nullptr, arc_bridge_service_.get(), std::move(delegate)));
+ fake_arc_ime_bridge_ = new FakeArcImeBridge();
+ instance_->SetImeBridgeForTesting(base::WrapUnique(fake_arc_ime_bridge_));
- fake_window_delegate_ = new FakeArcWindowDelegate(fake_input_method_.get());
- instance_->SetArcWindowDelegateForTesting(
- base::WrapUnique(fake_window_delegate_));
arc_win_ = fake_window_delegate_->CreateFakeArcWindow();
}
@@ -226,6 +229,7 @@ class ArcImeServiceTest : public testing::Test {
fake_window_delegate_ = nullptr;
fake_arc_ime_bridge_ = nullptr;
instance_.reset();
+ fake_input_method_.reset();
arc_bridge_service_.reset();
}
};
diff --git a/chromium/components/arc/intent_helper/DEPS b/chromium/components/arc/intent_helper/DEPS
index 8f0dc0b632f..7f66c60dc3b 100644
--- a/chromium/components/arc/intent_helper/DEPS
+++ b/chromium/components/arc/intent_helper/DEPS
@@ -8,6 +8,8 @@ include_rules = [
"+components/services/app_service/public/cpp",
"+components/url_formatter",
"+services/service_manager/public/cpp/connector.h",
+ "+ui/aura",
"+ui/base",
"+ui/gfx",
+ "+ui/views",
]
diff --git a/chromium/components/arc/intent_helper/activity_icon_loader.cc b/chromium/components/arc/intent_helper/activity_icon_loader.cc
index 5bcebf5a201..bbc02cc8245 100644
--- a/chromium/components/arc/intent_helper/activity_icon_loader.cc
+++ b/chromium/components/arc/intent_helper/activity_icon_loader.cc
@@ -13,6 +13,7 @@
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/task/post_task.h"
+#include "base/task/thread_pool.h"
#include "components/arc/arc_service_manager.h"
#include "components/arc/arc_util.h"
#include "components/arc/session/arc_bridge_service.h"
@@ -252,7 +253,7 @@ void ActivityIconLoader::OnIconsReady(
OnIconsReadyCallback cb,
std::vector<mojom::ActivityIconPtr> icons) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
- base::PostTaskAndReplyWithResult(
+ base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&ResizeAndEncodeIcons, std::move(icons), scale_factor_),
base::BindOnce(&ActivityIconLoader::OnIconsResized,
diff --git a/chromium/components/arc/intent_helper/arc_intent_helper_bridge.cc b/chromium/components/arc/intent_helper/arc_intent_helper_bridge.cc
index 8878c8f8d6b..ba948dc3077 100644
--- a/chromium/components/arc/intent_helper/arc_intent_helper_bridge.cc
+++ b/chromium/components/arc/intent_helper/arc_intent_helper_bridge.cc
@@ -144,7 +144,6 @@ void ArcIntentHelperBridge::OnOpenDownloads() {
// downloads by default, which is what we want. However if it is open it will
// simply be brought to the forgeground without forcibly being navigated to
// downloads, which is probably not ideal.
- // TODO(mash): Support this functionality without ash::Shell access in Chrome.
ash::NewWindowDelegate::GetInstance()->OpenFileManager();
}
diff --git a/chromium/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc b/chromium/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc
index c48c1ff04bf..d1b8a7aa6e1 100644
--- a/chromium/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc
+++ b/chromium/components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc
@@ -24,9 +24,11 @@ IntentFilter GetIntentFilter(const std::string& host,
const std::string& pkg_name) {
std::vector<IntentFilter::AuthorityEntry> authorities;
authorities.emplace_back(host, /*port=*/-1);
- return IntentFilter(pkg_name, std::move(authorities),
+ return IntentFilter(pkg_name, /*actions=*/std::vector<std::string>(),
+ std::move(authorities),
std::vector<IntentFilter::PatternMatcher>(),
- std::vector<std::string>());
+ /*schemes=*/std::vector<std::string>(),
+ /*mime_types=*/std::vector<std::string>());
}
} // namespace
diff --git a/chromium/components/arc/intent_helper/custom_tab.cc b/chromium/components/arc/intent_helper/custom_tab.cc
new file mode 100644
index 00000000000..5af4709668a
--- /dev/null
+++ b/chromium/components/arc/intent_helper/custom_tab.cc
@@ -0,0 +1,160 @@
+// 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.
+
+#include "components/arc/intent_helper/custom_tab.h"
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include "base/threading/sequenced_task_runner_handle.h"
+#include "components/exo/surface.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_targeter.h"
+#include "ui/views/widget/widget.h"
+#include "ui/views/widget/widget_delegate.h"
+
+namespace arc {
+
+namespace {
+
+// Enumerates surfaces under the window.
+void EnumerateSurfaces(aura::Window* window, std::vector<exo::Surface*>* out) {
+ auto* surface = exo::Surface::AsSurface(window);
+ if (surface)
+ out->push_back(surface);
+ for (aura::Window* child : window->children())
+ EnumerateSurfaces(child, out);
+}
+
+} // namespace
+
+CustomTab::CustomTab(aura::Window* arc_app_window,
+ int32_t surface_id,
+ int32_t top_margin)
+ : arc_app_window_(arc_app_window),
+ surface_id_(surface_id),
+ top_margin_(top_margin) {
+ other_windows_observer_.Add(arc_app_window_);
+
+ host_->set_owned_by_client();
+ auto* const widget = views::Widget::GetWidgetForNativeWindow(arc_app_window_);
+ DCHECK(widget);
+ widget->GetContentsView()->AddChildView(host_.get());
+}
+
+CustomTab::~CustomTab() = default;
+
+void CustomTab::Attach(gfx::NativeView view) {
+ DCHECK(view);
+ DCHECK(!GetHostView());
+ host_->Attach(view);
+ aura::Window* const container = host_->GetNativeViewContainer();
+ container->SetEventTargeter(std::make_unique<aura::WindowTargeter>());
+ other_windows_observer_.Add(container);
+ EnsureWindowOrders();
+ UpdateSurfaceIfNecessary();
+}
+
+gfx::NativeView CustomTab::GetHostView() {
+ return host_->native_view();
+}
+
+void CustomTab::OnWindowHierarchyChanged(const HierarchyChangeParams& params) {
+ if ((params.receiver == arc_app_window_) &&
+ exo::Surface::AsSurface(params.target) && params.new_parent)
+ UpdateSurfaceIfNecessary();
+}
+
+void CustomTab::OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds,
+ ui::PropertyChangeReason reason) {
+ if (surface_window_observer_.IsObserving(window) &&
+ old_bounds.size() != new_bounds.size())
+ OnSurfaceBoundsMaybeChanged(window);
+}
+
+void CustomTab::OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) {
+ if (surfaces_observer_.IsObserving(window) && key == exo::kClientSurfaceIdKey)
+ UpdateSurfaceIfNecessary();
+}
+
+void CustomTab::OnWindowStackingChanged(aura::Window* window) {
+ if (window == host_->GetNativeViewContainer() &&
+ !weak_ptr_factory_.HasWeakPtrs()) {
+ // Reordering should happen asynchronously -- some entity (like
+ // views::WindowReorderer) changes the window orders, and then ensures layer
+ // orders later. Changing order here synchronously leads to inconsistent
+ // window/layer ordering and causes weird graphical effects.
+ // TODO(hashimoto): fix the views ordering and remove this handling.
+ base::SequencedTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::BindOnce(&CustomTab::EnsureWindowOrders,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
+}
+
+void CustomTab::OnWindowDestroying(aura::Window* window) {
+ if (surfaces_observer_.IsObserving(window))
+ surfaces_observer_.Remove(window);
+ if (surface_window_observer_.IsObserving(window))
+ surface_window_observer_.Remove(window);
+ if (other_windows_observer_.IsObserving(window))
+ other_windows_observer_.Remove(window);
+}
+
+void CustomTab::OnSurfaceBoundsMaybeChanged(aura::Window* surface_window) {
+ DCHECK(surface_window);
+ gfx::Point origin(0, top_margin_);
+ gfx::Point bottom_right(surface_window->bounds().width(),
+ surface_window->bounds().height());
+ ConvertPointFromWindow(surface_window, &origin);
+ ConvertPointFromWindow(surface_window, &bottom_right);
+ host_->SetBounds(origin.x(), origin.y(), bottom_right.x() - origin.x(),
+ bottom_right.y() - origin.y());
+}
+
+void CustomTab::EnsureWindowOrders() {
+ aura::Window* const container = host_->GetNativeViewContainer();
+ if (container)
+ container->parent()->StackChildAtTop(container);
+}
+
+void CustomTab::ConvertPointFromWindow(aura::Window* window,
+ gfx::Point* point) {
+ views::Widget* const widget = host_->GetWidget();
+ aura::Window::ConvertPointToTarget(window, widget->GetNativeWindow(), point);
+ views::View::ConvertPointFromWidget(widget->GetContentsView(), point);
+}
+
+void CustomTab::UpdateSurfaceIfNecessary() {
+ std::vector<exo::Surface*> surfaces;
+ EnumerateSurfaces(arc_app_window_, &surfaces);
+
+ // Try to find the surface.
+ const auto it = std::find_if(surfaces.cbegin(), surfaces.cend(),
+ [id = surface_id_](const auto* surface) {
+ return surface->GetClientSurfaceId() == id;
+ });
+ if (it == surfaces.cend()) {
+ for (auto* surface : surfaces) {
+ if (!surface->GetClientSurfaceId() &&
+ !surfaces_observer_.IsObserving(surface->window()))
+ surfaces_observer_.Add(surface->window());
+ }
+ } else {
+ surfaces_observer_.RemoveAll();
+
+ auto* const window = (*it)->window();
+ if (!surface_window_observer_.IsObserving(window)) {
+ surface_window_observer_.RemoveAll();
+ surface_window_observer_.Add(window);
+ OnSurfaceBoundsMaybeChanged(window);
+ }
+ }
+}
+
+} // namespace arc
diff --git a/chromium/components/arc/intent_helper/custom_tab.h b/chromium/components/arc/intent_helper/custom_tab.h
new file mode 100644
index 00000000000..01815f2c56c
--- /dev/null
+++ b/chromium/components/arc/intent_helper/custom_tab.h
@@ -0,0 +1,76 @@
+// 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.
+
+#ifndef COMPONENTS_ARC_INTENT_HELPER_CUSTOM_TAB_H_
+#define COMPONENTS_ARC_INTENT_HELPER_CUSTOM_TAB_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/scoped_observer.h"
+#include "components/arc/arc_export.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_observer.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/views/controls/native/native_view_host.h"
+
+namespace arc {
+
+// CustomTab is responsible to embed an ARC++ custom tab.
+class ARC_EXPORT CustomTab : public aura::WindowObserver {
+ public:
+ CustomTab(aura::Window* arc_app_window,
+ int32_t surface_id,
+ int32_t top_margin);
+ CustomTab(const CustomTab&) = delete;
+ CustomTab& operator=(const CustomTab&) = delete;
+ ~CustomTab() override;
+
+ void Attach(gfx::NativeView view);
+
+ // Returns the view against which a view or dialog is positioned and parented
+ // in an CustomTab.
+ gfx::NativeView GetHostView();
+
+ // aura::WindowObserver:
+ void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override;
+ void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds,
+ ui::PropertyChangeReason reason) override;
+ void OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) override;
+ void OnWindowStackingChanged(aura::Window* window) override;
+ void OnWindowDestroying(aura::Window* window) override;
+
+ private:
+ // Updates |host_|'s bounds to deal with changes in the bounds of the
+ // associated |surface_window|.
+ void OnSurfaceBoundsMaybeChanged(aura::Window* surface_window);
+
+ // Ensures the window/layer orders for the NativeViewHost.
+ void EnsureWindowOrders();
+
+ // Converts the point from the given window to this view.
+ void ConvertPointFromWindow(aura::Window* window, gfx::Point* point);
+
+ // Looks for the surface with |surface_id_|, and handles resultant changes.
+ void UpdateSurfaceIfNecessary();
+
+ std::unique_ptr<views::NativeViewHost> host_ =
+ std::make_unique<views::NativeViewHost>();
+ aura::Window* const arc_app_window_;
+ const int32_t surface_id_, top_margin_;
+ ScopedObserver<aura::Window, aura::WindowObserver> surfaces_observer_{this};
+ ScopedObserver<aura::Window, aura::WindowObserver> surface_window_observer_{
+ this};
+ ScopedObserver<aura::Window, aura::WindowObserver> other_windows_observer_{
+ this};
+ base::WeakPtrFactory<CustomTab> weak_ptr_factory_{this};
+};
+
+} // namespace arc
+
+#endif // COMPONENTS_ARC_INTENT_HELPER_CUSTOM_TAB_H_
diff --git a/chromium/components/arc/intent_helper/intent_filter.cc b/chromium/components/arc/intent_helper/intent_filter.cc
index 51d713dbba1..2cb365a24ec 100644
--- a/chromium/components/arc/intent_helper/intent_filter.cc
+++ b/chromium/components/arc/intent_helper/intent_filter.cc
@@ -4,10 +4,12 @@
#include "components/arc/intent_helper/intent_filter.h"
+#include <algorithm>
#include <utility>
#include "base/compiler_specific.h"
#include "base/strings/string_util.h"
+#include "components/arc/intent_helper/intent_constants.h"
#include "components/arc/mojom/intent_helper.mojom.h"
#include "components/services/app_service/public/cpp/intent_util.h"
#include "url/gurl.h"
@@ -19,12 +21,16 @@ IntentFilter::IntentFilter(IntentFilter&& other) = default;
IntentFilter::IntentFilter(
const std::string& package_name,
+ std::vector<std::string> actions,
std::vector<IntentFilter::AuthorityEntry> authorities,
std::vector<IntentFilter::PatternMatcher> paths,
- std::vector<std::string> schemes)
+ std::vector<std::string> schemes,
+ std::vector<std::string> mime_types)
: package_name_(package_name),
+ actions_(std::move(actions)),
authorities_(std::move(authorities)),
- schemes_(std::move(schemes)) {
+ schemes_(std::move(schemes)),
+ mime_types_(std::move(mime_types)) {
// In order to register a path we need to have at least one authority.
if (!authorities_.empty())
paths_ = std::move(paths);
@@ -45,6 +51,15 @@ bool IntentFilter::Match(const GURL& url) const {
return false;
}
+ // Don't return match for filters for sharing.
+ if (std::any_of(actions_.begin(), actions_.end(),
+ [](const std::string action) {
+ return action == kIntentActionSend ||
+ action == kIntentActionSendMultiple;
+ })) {
+ return false;
+ }
+
// Match the authority and the path. If there are no authorities for this
// filter, we can treat this as a match, since we already know this filter
// has a http(s) scheme and it doesn't corresponds to a MIME type.
diff --git a/chromium/components/arc/intent_helper/intent_filter.h b/chromium/components/arc/intent_helper/intent_filter.h
index db457d03827..de205499e0c 100644
--- a/chromium/components/arc/intent_helper/intent_filter.h
+++ b/chromium/components/arc/intent_helper/intent_filter.h
@@ -70,9 +70,11 @@ class IntentFilter {
IntentFilter();
IntentFilter(IntentFilter&& other);
IntentFilter(const std::string& package_name,
+ std::vector<std::string> actions,
std::vector<AuthorityEntry> authorities,
std::vector<PatternMatcher> paths,
- std::vector<std::string> schemes);
+ std::vector<std::string> schemes,
+ std::vector<std::string> mime_types);
~IntentFilter();
IntentFilter& operator=(IntentFilter&& other);
@@ -80,20 +82,24 @@ class IntentFilter {
bool Match(const GURL& url) const;
const std::string& package_name() const { return package_name_; }
+ const std::vector<std::string>& actions() const { return actions_; }
const std::vector<AuthorityEntry>& authorities() const {
return authorities_;
}
const std::vector<PatternMatcher>& paths() const { return paths_; }
const std::vector<std::string>& schemes() const { return schemes_; }
+ const std::vector<std::string>& mime_types() const { return mime_types_; }
private:
bool MatchDataAuthority(const GURL& url) const;
bool HasDataPath(const GURL& url) const;
std::string package_name_;
+ std::vector<std::string> actions_;
std::vector<AuthorityEntry> authorities_;
std::vector<PatternMatcher> paths_;
std::vector<std::string> schemes_;
+ std::vector<std::string> mime_types_;
DISALLOW_COPY_AND_ASSIGN(IntentFilter);
};
diff --git a/chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc
index 16b2b9f0b33..87725074586 100644
--- a/chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc
+++ b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc
@@ -31,8 +31,17 @@ bool StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter>::Read(
if (!data.ReadDataSchemes(&schemes))
return false;
- *out = arc::IntentFilter(package_name, std::move(authorities),
- std::move(paths), std::move(schemes));
+ std::vector<std::string> actions;
+ if (!data.ReadActions(&actions))
+ return false;
+
+ std::vector<std::string> mime_types;
+ if (!data.ReadMimeTypes(&mime_types))
+ return false;
+
+ *out = arc::IntentFilter(package_name, std::move(actions),
+ std::move(authorities), std::move(paths),
+ std::move(schemes), std::move(mime_types));
return true;
}
diff --git a/chromium/components/arc/intent_helper/intent_filter_mojom_traits.h b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.h
index 636efd1d9f1..772f9299db9 100644
--- a/chromium/components/arc/intent_helper/intent_filter_mojom_traits.h
+++ b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.h
@@ -16,9 +16,8 @@ namespace mojo {
template <>
struct StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter> {
- static const base::span<std::string> actions(const arc::IntentFilter& r) {
- // Returns an empty array.
- return base::span<std::string>();
+ static const std::vector<std::string>& actions(const arc::IntentFilter& r) {
+ return r.actions();
}
static const base::span<std::string> categories(const arc::IntentFilter& r) {
// Returns an empty array.
@@ -46,6 +45,11 @@ struct StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter> {
return r.package_name();
}
+ static const std::vector<std::string>& mime_types(
+ const arc::IntentFilter& r) {
+ return r.mime_types();
+ }
+
static bool Read(arc::mojom::IntentFilterDataView data,
arc::IntentFilter* out);
};
diff --git a/chromium/components/arc/intent_helper/intent_filter_unittest.cc b/chromium/components/arc/intent_helper/intent_filter_unittest.cc
index a2158cd26f8..4d65eeee9c3 100644
--- a/chromium/components/arc/intent_helper/intent_filter_unittest.cc
+++ b/chromium/components/arc/intent_helper/intent_filter_unittest.cc
@@ -40,8 +40,11 @@ class IntentFilterBuilder {
}
operator IntentFilter() {
- return IntentFilter(kPackageName, std::move(authorities_),
- std::move(paths_), std::vector<std::string>());
+ return IntentFilter(kPackageName,
+ /*actions=*/std::vector<std::string>(),
+ std::move(authorities_), std::move(paths_),
+ /*schemes=*/std::vector<std::string>(),
+ /*mime_types=*/std::vector<std::string>());
}
private:
diff --git a/chromium/components/arc/midis/arc_midis_bridge.cc b/chromium/components/arc/midis/arc_midis_bridge.cc
index a0edd30b3a4..94f0dc74bcc 100644
--- a/chromium/components/arc/midis/arc_midis_bridge.cc
+++ b/chromium/components/arc/midis/arc_midis_bridge.cc
@@ -57,8 +57,8 @@ ArcMidisBridge::~ArcMidisBridge() {
}
void ArcMidisBridge::OnBootstrapMojoConnection(
- mojom::MidisServerRequest request,
- mojom::MidisClientPtr client_ptr,
+ mojo::PendingReceiver<mojom::MidisServer> receiver,
+ mojo::PendingRemote<mojom::MidisClient> client_remote,
bool result) {
if (!result) {
LOG(ERROR) << "ArcMidisBridge had a failure in D-Bus with the daemon.";
@@ -70,14 +70,15 @@ void ArcMidisBridge::OnBootstrapMojoConnection(
return;
}
DVLOG(1) << "ArcMidisBridge succeeded with Mojo bootstrapping.";
- midis_host_remote_->Connect(std::move(request), std::move(client_ptr));
+ midis_host_remote_->Connect(std::move(receiver), std::move(client_remote));
}
-void ArcMidisBridge::Connect(mojom::MidisServerRequest request,
- mojom::MidisClientPtr client_ptr) {
+void ArcMidisBridge::Connect(
+ mojo::PendingReceiver<mojom::MidisServer> receiver,
+ mojo::PendingRemote<mojom::MidisClient> client_remote) {
if (midis_host_remote_.is_bound()) {
DVLOG(1) << "Re-using bootstrap connection for MidisServer Connect.";
- midis_host_remote_->Connect(std::move(request), std::move(client_ptr));
+ midis_host_remote_->Connect(std::move(receiver), std::move(client_remote));
return;
}
DVLOG(1) << "Bootstrapping the Midis connection via D-Bus.";
@@ -101,8 +102,8 @@ void ArcMidisBridge::Connect(mojom::MidisServerRequest request,
->BootstrapMojoConnection(
channel.TakeRemoteEndpoint().TakePlatformHandle().TakeFD(),
base::BindOnce(&ArcMidisBridge::OnBootstrapMojoConnection,
- weak_factory_.GetWeakPtr(), std::move(request),
- std::move(client_ptr)));
+ weak_factory_.GetWeakPtr(), std::move(receiver),
+ std::move(client_remote)));
}
void ArcMidisBridge::OnMojoConnectionError() {
diff --git a/chromium/components/arc/midis/arc_midis_bridge.h b/chromium/components/arc/midis/arc_midis_bridge.h
index 6bfcf7ba1a0..3b97a95e022 100644
--- a/chromium/components/arc/midis/arc_midis_bridge.h
+++ b/chromium/components/arc/midis/arc_midis_bridge.h
@@ -12,6 +12,8 @@
#include "base/macros.h"
#include "components/arc/mojom/midis.mojom.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace content {
@@ -34,13 +36,14 @@ class ArcMidisBridge : public KeyedService,
~ArcMidisBridge() override;
// Midis Mojo host interface
- void Connect(mojom::MidisServerRequest request,
- mojom::MidisClientPtr client_ptr) override;
+ void Connect(mojo::PendingReceiver<mojom::MidisServer> receiver,
+ mojo::PendingRemote<mojom::MidisClient> client_remote) override;
private:
- void OnBootstrapMojoConnection(mojom::MidisServerRequest request,
- mojom::MidisClientPtr client_ptr,
- bool result);
+ void OnBootstrapMojoConnection(
+ mojo::PendingReceiver<mojom::MidisServer> receiver,
+ mojo::PendingRemote<mojom::MidisClient> client_remote,
+ bool result);
void OnMojoConnectionError();
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
diff --git a/chromium/components/arc/mojom/BUILD.gn b/chromium/components/arc/mojom/BUILD.gn
index 13896b9dc98..ebb973f531e 100644
--- a/chromium/components/arc/mojom/BUILD.gn
+++ b/chromium/components/arc/mojom/BUILD.gn
@@ -41,8 +41,6 @@ if (is_chromeos) {
"midis.mojom",
"net.mojom",
"obb_mounter.mojom",
- "oemcrypto.mojom",
- "oemcrypto_daemon.mojom",
"pip.mojom",
"policy.mojom",
"power.mojom",
@@ -69,7 +67,7 @@ if (is_chromeos) {
":camera_intent",
":media",
":notifications",
- "//components/chromeos_camera/common:camera_app_helper",
+ ":oemcrypto",
"//media/capture/video/chromeos/mojom:cros_camera",
"//mojo/public/mojom/base",
"//printing/mojom",
@@ -112,21 +110,33 @@ if (is_chromeos) {
public_deps = [ "//ui/gfx/geometry/mojom" ]
}
+ mojom("oemcrypto") {
+ sources = [ "oemcrypto.mojom" ]
+ }
+
source_set("mojom_traits") {
- sources = [ "ime_mojom_traits.h" ]
+ sources = [
+ "ime_mojom_traits.cc",
+ "ime_mojom_traits.h",
+ ]
deps = [
":mojom",
"//ui/base/ime:text_input_types",
+ "//ui/events",
]
}
source_set("unit_tests") {
testonly = true
- sources = [ "video_accelerator_mojom_traits_unittest.cc" ]
+ sources = [
+ "ime_mojom_traits_unittest.cc",
+ "video_accelerator_mojom_traits_unittest.cc",
+ ]
deps = [
":mojom",
+ ":mojom_traits",
"//media",
"//mojo/public/cpp/test_support:test_utils",
"//testing/gtest",
diff --git a/chromium/components/arc/mojom/accessibility_helper.mojom b/chromium/components/arc/mojom/accessibility_helper.mojom
index 1092b141686..e8cfb41a789 100644
--- a/chromium/components/arc/mojom/accessibility_helper.mojom
+++ b/chromium/components/arc/mojom/accessibility_helper.mojom
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Next MinVersion: 22
+// Next MinVersion: 23
module arc.mojom;
@@ -47,6 +47,22 @@ enum AccessibilityEventType {
ASSIST_READING_CONTEXT,
};
+// ContentChangeType lists the possible sub types of WINDOW_STATE_CHANGED and
+// WINDOW_CONTENT_CHANGED events on Android ordered as same as developer guide
+// of return value of getContentChangeTypes.
+// https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent?hl=en#getContentChangeTypes()
+[Extensible]
+enum ContentChangeType {
+ CONTENT_DESCRIPTION,
+ STATE_DESCRIPTION,
+ SUBTREE,
+ TEXT,
+ PANE_TITLE,
+ UNDEFINED,
+ PANE_APPEARED,
+ PANE_DISAPPEARED,
+};
+
// Possible actions that can be performed on an AccessibilityNodeInfo.
[Extensible]
enum AccessibilityActionType {
@@ -129,7 +145,8 @@ enum AccessibilityStringProperty {
ROLE_DESCRIPTION, // Chrome only
TOOLTIP,
PANE_TITLE,
- HINT_TEXT
+ HINT_TEXT,
+ STATE_DESCRIPTION
};
// These fields are taken from int instance members of
@@ -355,6 +372,13 @@ enum AccessibilityEventStringProperty {
CONTENT_DESCRIPTION,
};
+// These fields are taken from List<Integer> like instance members of
+// AccessibilityEvent and AccessibilityRecord.
+[Extensible]
+enum AccessibilityEventIntListProperty{
+ CONTENT_CHANGE_TYPES,
+};
+
// AccessibilityEventData is a struct to contain info of
// AccessibilityEvent in Android.
// https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html
@@ -390,6 +414,8 @@ struct AccessibilityEventData {
[MinVersion=21] map<AccessibilityEventIntProperty, int32>? int_properties;
[MinVersion=21]
map<AccessibilityEventStringProperty, string>? string_properties;
+ [MinVersion=23]
+ map<AccessibilityEventIntListProperty, array<int32>>? int_list_properties;
};
// AccessibilityActionData is a struct to contain info of AccessibilityAction in
@@ -472,7 +498,8 @@ interface AccessibilityHelperHost {
// Next method ID: 12
interface AccessibilityHelperInstance {
// Establishes full-duplex communication with the host.
- [MinVersion=9] Init@7(AccessibilityHelperHost host) => ();
+ [MinVersion=9] Init@7(
+ pending_remote<AccessibilityHelperHost> host_remote) => ();
// Set a filter on the event types received.
SetFilter@2(AccessibilityFilterType filter_type);
diff --git a/chromium/components/arc/mojom/app.mojom b/chromium/components/arc/mojom/app.mojom
index 25ff611be6a..ad1fa0ecfd9 100644
--- a/chromium/components/arc/mojom/app.mojom
+++ b/chromium/components/arc/mojom/app.mojom
@@ -87,6 +87,19 @@ enum ShowPackageInfoPage {
MANAGE_LINKS = 1,
};
+// Describes the raw icon png data published by an Android application.
+struct RawIconPngData {
+ // True if the icon is an adaptive icon, or false otherwise.
+ bool is_adaptive_icon;
+ // The raw icon for the non-adaptive icon, or the generated standard icon done
+ // by the ARC side for the adaptive icon.
+ array<uint8>? icon_png_data;
+ // The foreground image for the adaptive icon.
+ array<uint8>? foreground_icon_png_data;
+ // The background image for the adaptive icon.
+ array<uint8>? background_icon_png_data;
+};
+
// Describes a Play Store app discovery result.
struct AppDiscoveryResult {
string? launch_intent_uri;
@@ -364,10 +377,10 @@ interface AppHost {
// Deprecated method IDs: 2, 3, 13
interface AppInstance {
// DEPRECATED: Please use Init@21 instead.
- InitDeprecated@0(AppHost host_ptr);
+ InitDeprecated@0(pending_remote<AppHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=26] Init@21(AppHost host_ptr) => ();
+ [MinVersion=26] Init@21(pending_remote<AppHost> host_remote) => ();
[MinVersion=1] CanHandleResolutionDeprecated@4(
string package_name, string activity, Rect dimension) =>
diff --git a/chromium/components/arc/mojom/appfuse.mojom b/chromium/components/arc/mojom/appfuse.mojom
index ee81f3c788b..b78d30d99e7 100644
--- a/chromium/components/arc/mojom/appfuse.mojom
+++ b/chromium/components/arc/mojom/appfuse.mojom
@@ -23,5 +23,5 @@ interface AppfuseHost {
// Next Method ID: 1
interface AppfuseInstance {
// Establishes full-duplex communication with the host.
- Init@0(AppfuseHost host_ptr) => ();
+ Init@0(pending_remote<AppfuseHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/arc_bridge.mojom b/chromium/components/arc/mojom/arc_bridge.mojom
index 8f6a38fc033..127c81924de 100644
--- a/chromium/components/arc/mojom/arc_bridge.mojom
+++ b/chromium/components/arc/mojom/arc_bridge.mojom
@@ -64,164 +64,198 @@ interface ArcBridgeHost {
// Notifies Chrome that the AccessibilityHelperInstance interface is ready.
[MinVersion=21] OnAccessibilityHelperInstanceReady@127(
- AccessibilityHelperInstance instance_ptr);
+ pending_remote<AccessibilityHelperInstance> instance_remote);
// Notifies Chrome that the AppInstance interface is ready.
- OnAppInstanceReady@100(AppInstance instance_ptr);
+ OnAppInstanceReady@100(pending_remote<AppInstance> instance_remote);
// Notifies Chrome that the AppPermissionsInstance interface is ready.
- [MinVersion=44] OnAppPermissionsInstanceReady@149(AppPermissionsInstance instance_ptr);
+ [MinVersion=44] OnAppPermissionsInstanceReady@149(
+ pending_remote<AppPermissionsInstance> instance_remote);
// Notifies Chrome that the AppfuseInstance interface is ready.
- [MinVersion=40] OnAppfuseInstanceReady@145(AppfuseInstance instance_ptr);
+ [MinVersion=40] OnAppfuseInstanceReady@145(
+ pending_remote<AppfuseInstance> instance_remote);
// Notifies Chrome that the AudioInstance interface is ready.
- [MinVersion=8] OnAudioInstanceReady@115(AudioInstance instance_ptr);
+ [MinVersion=8] OnAudioInstanceReady@115(
+ pending_remote<AudioInstance> instance_remote);
// Notifies Chrome that the AuthInstance interface is ready.
- [MinVersion=1] OnAuthInstanceReady@106(AuthInstance instance_ptr);
+ [MinVersion=1] OnAuthInstanceReady@106(
+ pending_remote<AuthInstance> instance_remote);
// Notifies Chrome that the BackupSettingsInstance interface is ready.
- [MinVersion=33] OnBackupSettingsInstanceReady@138(BackupSettingsInstance instance_ptr);
+ [MinVersion=33] OnBackupSettingsInstanceReady@138(
+ pending_remote<BackupSettingsInstance> instance_remote);
// Notifies Chrome that the BluetoothInstance interface is ready.
- [MinVersion=9] OnBluetoothInstanceReady@113(BluetoothInstance instance_ptr);
+ [MinVersion=9] OnBluetoothInstanceReady@113(
+ pending_remote<BluetoothInstance> instance_remote);
// Notifies Chrome that the BootPhaseMonitorInstance interface is ready.
[MinVersion=19] OnBootPhaseMonitorInstanceReady@125(
- BootPhaseMonitorInstance instance_ptr);
+ pending_remote<BootPhaseMonitorInstance> instance_remote);
// Notifies Chrome that the CameraInstance is ready.
- [MinVersion=46] OnCameraInstanceReady@151(CameraInstance instance_ptr);
+ [MinVersion=46] OnCameraInstanceReady@151(
+ pending_remote<CameraInstance> instance_remote);
// Notifies Chrome that the CastReceiverInstance interface is ready.
[MinVersion=27] OnCastReceiverInstanceReady@132(
- CastReceiverInstance instance_ptr);
+ pending_remote<CastReceiverInstance> instance_remote);
// Notifies Chrome that the CertStoreInstance interface is ready.
[MinVersion=31] OnCertStoreInstanceReady@136(
- CertStoreInstance instance_ptr);
+ pending_remote<CertStoreInstance> instance_remote);
// Notifies Chrome that the ClipboardInstance interface is ready.
- [MinVersion=2] OnClipboardInstanceReady@109(ClipboardInstance instance_ptr);
+ [MinVersion=2] OnClipboardInstanceReady@109(
+ pending_remote<ClipboardInstance> instance_remote);
// Notifies Chrome that the CrashCollectorInstance interface is ready.
[MinVersion=7] OnCrashCollectorInstanceReady@112(
- CrashCollectorInstance instance_ptr);
+ pending_remote<CrashCollectorInstance> instance_remote);
// Notifies Chrome that the DiskQuotaInstance interface is ready.
- [MinVersion=39] OnDiskQuotaInstanceReady@144(DiskQuotaInstance instance_ptr);
+ [MinVersion=39] OnDiskQuotaInstanceReady@144(
+ pending_remote<DiskQuotaInstance> instance_remote);
// Notifies Chrome that the EnterpriseReportingInstance interface is ready.
[MinVersion=15] OnEnterpriseReportingInstanceReady@122(
- EnterpriseReportingInstance instance_ptr);
+ pending_remote<EnterpriseReportingInstance> instance_remote);
// Notifies Chrome that the FileSystemInstance interface is ready.
[MinVersion=13] OnFileSystemInstanceReady@119(
- FileSystemInstance instance_ptr);
+ pending_remote<FileSystemInstance> instance_remote);
// Notifies Chrome that the ImeInstance interface is ready.
- [MinVersion=3] OnImeInstanceReady@110(ImeInstance instance_ptr);
+ [MinVersion=3] OnImeInstanceReady@110(
+ pending_remote<ImeInstance> instance_remote);
// Notifies Chrome that the InputMethodManagerInstance interface is ready.
[MinVersion=38] OnInputMethodManagerInstanceReady@143(
- InputMethodManagerInstance instance_ptr);
+ pending_remote<InputMethodManagerInstance> instance_remote);
// Notifies Chrome that the IntentHelperInstance interface is ready.
[MinVersion=4] OnIntentHelperInstanceReady@111(
- IntentHelperInstance instance_ptr);
+ pending_remote<IntentHelperInstance> instance_remote);
// Notifies Chrome that the KeymasterInstance interface is ready.
- [MinVersion=47] OnKeymasterInstanceReady@152(KeymasterInstance instance_ptr);
+ [MinVersion=47] OnKeymasterInstanceReady@152(
+ pending_remote<KeymasterInstance> instance_remote);
// Notifies Chrome that the KioskInstance interface is ready.
- [MinVersion=20] OnKioskInstanceReady@126(KioskInstance instance_ptr);
+ [MinVersion=20] OnKioskInstanceReady@126(
+ pending_remote<KioskInstance> instance_remote);
// Notifies Chrome that the LockScreenInstance interface is ready.
- [MinVersion=29] OnLockScreenInstanceReady@134(LockScreenInstance instance_ptr);
+ [MinVersion=29] OnLockScreenInstanceReady@134(
+ pending_remote<LockScreenInstance> instance_remote);
// Notifies Chrome that the MediaSessionInstance interface is ready.
- [MinVersion=43] OnMediaSessionInstanceReady@148(MediaSessionInstance instance_ptr);
+ [MinVersion=43] OnMediaSessionInstanceReady@148(
+ pending_remote<MediaSessionInstance> instance_remote);
// Notifies Chrome that the MetricsInstance interface is ready.
- [MinVersion=10] OnMetricsInstanceReady@116(MetricsInstance instance_ptr);
+ [MinVersion=10] OnMetricsInstanceReady@116(
+ pending_remote<MetricsInstance> instance_remote);
// Notifies Chrome that the MidisInstance interface is ready.
- [MinVersion=30] OnMidisInstanceReady@135(MidisInstance instance_ptr);
+ [MinVersion=30] OnMidisInstanceReady@135(
+ pending_remote<MidisInstance> instance_remote);
// Notifies Chrome that the NetInstance interface is ready.
- [MinVersion=5] OnNetInstanceReady@108(NetInstance instance_ptr);
+ [MinVersion=5] OnNetInstanceReady@108(
+ pending_remote<NetInstance> instance_remote);
// Notifies Chrome that the NotificationsInstance interface is ready.
- OnNotificationsInstanceReady@102(NotificationsInstance instance_ptr);
+ OnNotificationsInstanceReady@102(
+ pending_remote<NotificationsInstance> instance_remote);
// Notifies Chrome that the ObbMounter interface is ready.
- [MinVersion=14] OnObbMounterInstanceReady@120(ObbMounterInstance instance_ptr);
+ [MinVersion=14] OnObbMounterInstanceReady@120(
+ pending_remote<ObbMounterInstance> instance_remote);
// Notifies Chrome that the OemCryptoInstance interface is ready.
- [MinVersion=28] OnOemCryptoInstanceReady@133(OemCryptoInstance instance_ptr);
+ [MinVersion=28] OnOemCryptoInstanceReady@133(
+ pending_remote<OemCryptoInstance> instance_remote);
// Notifies Chrome that the PipInstance interface is ready.
- [MinVersion=41] OnPipInstanceReady@146(PipInstance instance_ptr);
+ [MinVersion=41] OnPipInstanceReady@146(
+ pending_remote<PipInstance> instance_remote);
// Notifies Chrome that the PolicyInstance interface is ready.
- [MinVersion=7] OnPolicyInstanceReady@114(PolicyInstance instance_ptr);
+ [MinVersion=7] OnPolicyInstanceReady@114(
+ pending_remote<PolicyInstance> instance_remote);
// Notifies Chrome that the PowerInstance interface is ready.
- OnPowerInstanceReady@103(PowerInstance instance_ptr);
+ OnPowerInstanceReady@103(pending_remote<PowerInstance> instance_remote);
// Notifies Chrome that the PrintSpoolerInstance interface is ready.
[MinVersion=45] OnPrintSpoolerInstanceReady@150(
- PrintSpoolerInstance instance_ptr);
+ pending_remote<PrintSpoolerInstance> instance_remote);
// Notifies Chrome that the ProcessInstance interface is ready.
- OnProcessInstanceReady@104(ProcessInstance instance_ptr);
+ OnProcessInstanceReady@104(pending_remote<ProcessInstance> instance_remote);
// Notifies Chrome that the PropertyInstance interface is ready.
- [MinVersion=42] OnPropertyInstanceReady@147(PropertyInstance instance_ptr);
+ [MinVersion=42] OnPropertyInstanceReady@147(
+ pending_remote<PropertyInstance> instance_remote);
// Notifies Chrome that the RotationLockInstance interface is ready.
- [MinVersion=32] OnRotationLockInstanceReady@137(RotationLockInstance instance_ptr);
+ [MinVersion=32] OnRotationLockInstanceReady@137(
+ pending_remote<RotationLockInstance> instance_remote);
// Notifies Chrome that the ScreenCaptureInstance interface is ready.
- [MinVersion=35] OnScreenCaptureInstanceReady@140(ScreenCaptureInstance instance_ptr);
+ [MinVersion=35] OnScreenCaptureInstanceReady@140(
+ pending_remote<ScreenCaptureInstance> instance_remote);
// Notifies Chrome that the SmartCardManagerInstance interface is ready.
[MinVersion=48] OnSmartCardManagerInstanceReady@153(
- SmartCardManagerInstance instance_ptr);
+ pending_remote<SmartCardManagerInstance> instance_remote);
// Notifies Chrome that the StorageManagerInstance interface is ready.
- [MinVersion=12] OnStorageManagerInstanceReady@118(StorageManagerInstance instance_ptr);
+ [MinVersion=12] OnStorageManagerInstanceReady@118(
+ pending_remote<StorageManagerInstance> instance_remote);
// Notifies Chrome that the TimerInstance interface is ready.
- [MinVersion=36] OnTimerInstanceReady@141(TimerInstance instance_ptr);
+ [MinVersion=36] OnTimerInstanceReady@141(
+ pending_remote<TimerInstance> instance_remote);
// Notifies Chrome that the TracingInstance interface is ready.
- [MinVersion=22] OnTracingInstanceReady@128(TracingInstance instance_ptr);
+ [MinVersion=22] OnTracingInstanceReady@128(
+ pending_remote<TracingInstance> instance_remote);
// Notifies Chrome that the TtsInstance interface is ready.
- [MinVersion=17] OnTtsInstanceReady@123(TtsInstance instance_ptr);
+ [MinVersion=17] OnTtsInstanceReady@123(
+ pending_remote<TtsInstance> instance_remote);
// Notifies Chrome that the UsbHostInstance interface is ready.
- [MinVersion=34] OnUsbHostInstanceReady@139(UsbHostInstance instance_ptr);
+ [MinVersion=34] OnUsbHostInstanceReady@139(
+ pending_remote<UsbHostInstance> instance_remote);
// Notifies Chrome that the VideoInstance interface is ready.
- [MinVersion=6] OnVideoInstanceReady@107(VideoInstance instance_ptr);
+ [MinVersion=6] OnVideoInstanceReady@107(
+ pending_remote<VideoInstance> instance_remote);
// Notifies Chrome that the VoiceInteractionArcHomeInstance is ready.
[MinVersion=24] OnVoiceInteractionArcHomeInstanceReady@130(
- VoiceInteractionArcHomeInstance instance_ptr);
+ pending_remote<VoiceInteractionArcHomeInstance> instance_remote);
// Notifies Chrome that the VoiceInteractionFrameworkInstance is ready.
[MinVersion=23] OnVoiceInteractionFrameworkInstanceReady@129(
- VoiceInteractionFrameworkInstance instance_ptr);
+ pending_remote<VoiceInteractionFrameworkInstance> instance_remote);
// Notifies Chrome that the VolumeMounter interface is ready.
- [MinVersion=25] OnVolumeMounterInstanceReady@131(VolumeMounterInstance instance_ptr);
+ [MinVersion=25] OnVolumeMounterInstanceReady@131(
+ pending_remote<VolumeMounterInstance> instance_remote);
// Notifies Chrome that the WakeLockInstance interface is ready.
- [MinVersion=37] OnWakeLockInstanceReady@142(WakeLockInstance instance_ptr);
+ [MinVersion=37] OnWakeLockInstanceReady@142(
+ pending_remote<WakeLockInstance> instance_remote);
// Notifies Chrome that the WallpaperInstance interface is ready.
- [MinVersion=18] OnWallpaperInstanceReady@124(WallpaperInstance instance_ptr);
+ [MinVersion=18] OnWallpaperInstanceReady@124(
+ pending_remote<WallpaperInstance> instance_remote);
};
diff --git a/chromium/components/arc/mojom/audio.mojom b/chromium/components/arc/mojom/audio.mojom
index eceb20e4cdf..6d90a02569a 100644
--- a/chromium/components/arc/mojom/audio.mojom
+++ b/chromium/components/arc/mojom/audio.mojom
@@ -27,10 +27,10 @@ interface AudioHost {
// Next method ID: 4
interface AudioInstance {
// DEPRECATED: Please use Init@3 instead.
- [MinVersion=1] InitDeprecated@1(AudioHost host);
+ [MinVersion=1] InitDeprecated@1(pending_remote<AudioHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=4] Init@3(AudioHost host) => ();
+ [MinVersion=4] Init@3(pending_remote<AudioHost> host_remote) => ();
// Notify plug states of headphone, microphone, etc. Each switch state is
// represented by the corresponding bit, if the bit is set then the switch
diff --git a/chromium/components/arc/mojom/auth.mojom b/chromium/components/arc/mojom/auth.mojom
index beea834ece7..caa93bdea8f 100644
--- a/chromium/components/arc/mojom/auth.mojom
+++ b/chromium/components/arc/mojom/auth.mojom
@@ -352,10 +352,10 @@ interface AuthHost {
// Next Method ID: 6
interface AuthInstance {
// DEPRECATED: Please use Init@2 instead.
- InitDeprecated@0(AuthHost host_ptr);
+ InitDeprecated@0(pending_remote<AuthHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=12] Init@2(AuthHost host_ptr) => ();
+ [MinVersion=12] Init@2(pending_remote<AuthHost> host_remote) => ();
// Callback from RequestAccountInfo. This cannot be a normal callback since
// the result can sometimes take a few minutes in some cases (Kiosk mode),
diff --git a/chromium/components/arc/mojom/bluetooth.mojom b/chromium/components/arc/mojom/bluetooth.mojom
index 495be3cb939..64e3f6d24f3 100644
--- a/chromium/components/arc/mojom/bluetooth.mojom
+++ b/chromium/components/arc/mojom/bluetooth.mojom
@@ -447,10 +447,10 @@ interface BluetoothHost {
// Deprecated Method ID: 2, 6, 11, 12
interface BluetoothInstance {
// DEPRECATED: Please use Init@18 instead.
- InitDeprecated@0(BluetoothHost host_ptr);
+ InitDeprecated@0(pending_remote<BluetoothHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=7] Init@18(BluetoothHost host_ptr) => ();
+ [MinVersion=7] Init@18(pending_remote<BluetoothHost> host_remote) => ();
OnAdapterProperties@1(BluetoothStatus status,
array<BluetoothProperty> properties);
diff --git a/chromium/components/arc/mojom/boot_phase_monitor.mojom b/chromium/components/arc/mojom/boot_phase_monitor.mojom
index 045270f3e1f..703df7f5dc2 100644
--- a/chromium/components/arc/mojom/boot_phase_monitor.mojom
+++ b/chromium/components/arc/mojom/boot_phase_monitor.mojom
@@ -15,8 +15,8 @@ interface BootPhaseMonitorHost {
// Next method ID: 2
interface BootPhaseMonitorInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(BootPhaseMonitorHost host_ptr);
+ InitDeprecated@0(pending_remote<BootPhaseMonitorHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@1(BootPhaseMonitorHost host_ptr) => ();
+ [MinVersion=1] Init@1(pending_remote<BootPhaseMonitorHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/camera.mojom b/chromium/components/arc/mojom/camera.mojom
index 6437d710c2a..a90eb6524e7 100644
--- a/chromium/components/arc/mojom/camera.mojom
+++ b/chromium/components/arc/mojom/camera.mojom
@@ -96,7 +96,7 @@ interface CameraService {
interface CameraHost {
// Notifies Chrome that CameraService is requested and returns an interface
// pointer bound to a newly created service. Used by camera HAL v1.
- StartCameraService@0() => (CameraService service);
+ StartCameraService@0() => (pending_remote<CameraService> service);
// Registers the camera HAL client. Used by camera HAL v3.
[MinVersion=2] RegisterCameraHalClient@1(
@@ -106,5 +106,5 @@ interface CameraHost {
// Next method ID: 1
interface CameraInstance {
// Establishes full-duplex communication with the host.
- Init@0(CameraHost host_ptr) => ();
+ Init@0(pending_remote<CameraHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/cert_store.mojom b/chromium/components/arc/mojom/cert_store.mojom
index 90f1d8c3ff9..24ec3fb3ed3 100644
--- a/chromium/components/arc/mojom/cert_store.mojom
+++ b/chromium/components/arc/mojom/cert_store.mojom
@@ -111,10 +111,10 @@ interface CertStoreHost {
// Next method ID: 4
interface CertStoreInstance {
// DEPRECATED: Please use Init@3 instead.
- InitDeprecated@0(CertStoreHost host_ptr);
+ InitDeprecated@0(pending_remote<CertStoreHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@3(CertStoreHost host_ptr) => ();
+ [MinVersion=1] Init@3(pending_remote<CertStoreHost> host_remote) => ();
// Informs the key permissions are changed: only listed packages are allowed
// to use exposed certificates.
@@ -134,5 +134,5 @@ interface SmartCardManagerHost {
// Next method ID: 1
interface SmartCardManagerInstance {
// Establishes full-duplex communication with the host.
- Init@0(SmartCardManagerHost host_ptr) => ();
+ Init@0(pending_remote<SmartCardManagerHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/clipboard.mojom b/chromium/components/arc/mojom/clipboard.mojom
index 11ea94683c4..452599c6f0a 100644
--- a/chromium/components/arc/mojom/clipboard.mojom
+++ b/chromium/components/arc/mojom/clipboard.mojom
@@ -53,10 +53,10 @@ interface ClipboardHost {
// Deprecated method IDs: 1
interface ClipboardInstance {
// DEPRECATED: Please use Init@3 instead.
- InitDeprecated@0(ClipboardHost host_ptr);
+ InitDeprecated@0(pending_remote<ClipboardHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=2] Init@3(ClipboardHost host_ptr) => ();
+ [MinVersion=2] Init@3(pending_remote<ClipboardHost> host_remote) => ();
// Tells that the Host clipboard has been updated.
[MinVersion=1] OnHostClipboardUpdated@2();
diff --git a/chromium/components/arc/mojom/crash_collector.mojom b/chromium/components/arc/mojom/crash_collector.mojom
index 70611023476..b25907a42c3 100644
--- a/chromium/components/arc/mojom/crash_collector.mojom
+++ b/chromium/components/arc/mojom/crash_collector.mojom
@@ -24,8 +24,8 @@ interface CrashCollectorHost {
// Next Method ID: 2
interface CrashCollectorInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(CrashCollectorHost host_ptr);
+ InitDeprecated@0(pending_remote<CrashCollectorHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=2] Init@1(CrashCollectorHost host_ptr) => ();
+ [MinVersion=2] Init@1(pending_remote<CrashCollectorHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/disk_quota.mojom b/chromium/components/arc/mojom/disk_quota.mojom
index 006537a6c95..68b4418ee06 100644
--- a/chromium/components/arc/mojom/disk_quota.mojom
+++ b/chromium/components/arc/mojom/disk_quota.mojom
@@ -18,5 +18,6 @@ interface DiskQuotaHost {
// Next Method ID: 1
interface DiskQuotaInstance {
- Init@0(DiskQuotaHost host_ptr) => ();
+ // Establishes full-duplex communication with the host.
+ Init@0(pending_remote<DiskQuotaHost> host_remote) => ();
}; \ No newline at end of file
diff --git a/chromium/components/arc/mojom/enterprise_reporting.mojom b/chromium/components/arc/mojom/enterprise_reporting.mojom
index 3130ee9fc54..a302a5d21bc 100644
--- a/chromium/components/arc/mojom/enterprise_reporting.mojom
+++ b/chromium/components/arc/mojom/enterprise_reporting.mojom
@@ -28,10 +28,11 @@ interface EnterpriseReportingHost {
// Next method ID: 3
interface EnterpriseReportingInstance {
// DEPRECATED: Please use Init@2 instead.
- InitDeprecated@0(EnterpriseReportingHost host_ptr);
+ InitDeprecated@0(pending_remote<EnterpriseReportingHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=2] Init@2(EnterpriseReportingHost host_ptr) => ();
+ [MinVersion=2] Init@2(
+ pending_remote<EnterpriseReportingHost> host_remote) => ();
// Requests that a JSON status blob be generated and passed to the
// host.
diff --git a/chromium/components/arc/mojom/file_system.mojom b/chromium/components/arc/mojom/file_system.mojom
index 4c3176e4a45..7a74c610d13 100644
--- a/chromium/components/arc/mojom/file_system.mojom
+++ b/chromium/components/arc/mojom/file_system.mojom
@@ -382,10 +382,10 @@ interface FileSystemInstance {
(Document? document);
// DEPRECATED: Please use Init@10 instead.
- [MinVersion=3] InitDeprecated@5(FileSystemHost host_ptr);
+ [MinVersion=3] InitDeprecated@5(pending_remote<FileSystemHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=7] Init@10(FileSystemHost host_ptr) => ();
+ [MinVersion=7] Init@10(pending_remote<FileSystemHost> host_remote) => ();
// Asks the ContentResolver to get a FD to read the file specified by the
// URL.
diff --git a/chromium/components/arc/mojom/ime.mojom b/chromium/components/arc/mojom/ime.mojom
index bae292e5e65..f65ee6679e0 100644
--- a/chromium/components/arc/mojom/ime.mojom
+++ b/chromium/components/arc/mojom/ime.mojom
@@ -43,6 +43,19 @@ struct CompositionSegment {
bool emphasized;
};
+// Represents the information of a key event.
+struct KeyEventData {
+ // Whether the event is a press event or a release event.
+ bool pressed;
+ // The key touched in the event represented in |ui::KeyboardCode|.
+ int32 key_code;
+ // The flags for modifiers state.
+ bool is_shift_down;
+ bool is_control_down;
+ bool is_alt_down;
+ bool is_capslock_on;
+};
+
// Next method ID: 6
interface ImeHost {
// Notifies Chrome that the text input focus is changed.
@@ -97,10 +110,10 @@ interface ImeHost {
// Next method ID: 8
interface ImeInstance {
// DEPRECATED: Please use Init@6 instead.
- InitDeprecated@0(ImeHost host_ptr);
+ InitDeprecated@0(pending_remote<ImeHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=6] Init@6(ImeHost host_ptr) => ();
+ [MinVersion=6] Init@6(pending_remote<ImeHost> host_remote) => ();
// Sets composition text and attributes requested by the host IME.
SetCompositionText@1(string text, array<CompositionSegment> segments);
diff --git a/chromium/components/arc/mojom/ime.typemap b/chromium/components/arc/mojom/ime.typemap
index d82e98af726..6d6c89dc7a9 100644
--- a/chromium/components/arc/mojom/ime.typemap
+++ b/chromium/components/arc/mojom/ime.typemap
@@ -1,4 +1,10 @@
mojom = "//components/arc/mojom/ime.mojom"
-public_headers = [ "//ui/base/ime/text_input_type.h" ]
+public_headers = [
+ "//ui/base/ime/text_input_type.h",
+ "//ui/events/event.h",
+]
traits_headers = [ "//components/arc/mojom/ime_mojom_traits.h" ]
-type_mappings = [ "arc.mojom.TextInputType=::ui::TextInputType" ]
+type_mappings = [
+ "arc.mojom.TextInputType=::ui::TextInputType",
+ "arc.mojom.KeyEventData=::std::unique_ptr<::ui::KeyEvent>[move_only]",
+]
diff --git a/chromium/components/arc/mojom/ime_mojom_traits.cc b/chromium/components/arc/mojom/ime_mojom_traits.cc
new file mode 100644
index 00000000000..1687c4635c4
--- /dev/null
+++ b/chromium/components/arc/mojom/ime_mojom_traits.cc
@@ -0,0 +1,42 @@
+// 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 "components/arc/mojom/ime_mojom_traits.h"
+
+#include "ui/events/keycodes/keyboard_code_conversion.h"
+
+namespace mojo {
+using KeyEventUniquePtr = std::unique_ptr<ui::KeyEvent>;
+
+bool StructTraits<arc::mojom::KeyEventDataDataView, KeyEventUniquePtr>::Read(
+ arc::mojom::KeyEventDataDataView data,
+ KeyEventUniquePtr* out) {
+ const ui::EventType type =
+ data.pressed() ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED;
+ // TODO(yhanada): Currently we have no way to know the correct keyboard layout
+ // here, so assuming US layout. Find a way to get the more precise DomCode.
+ const ui::DomCode dom_code = ui::UsLayoutKeyboardCodeToDomCode(
+ static_cast<ui::KeyboardCode>(data.key_code()));
+
+ int flags = 0;
+ if (data.is_shift_down())
+ flags |= ui::EF_SHIFT_DOWN;
+ if (data.is_control_down())
+ flags |= ui::EF_CONTROL_DOWN;
+ if (data.is_alt_down())
+ flags |= ui::EF_ALT_DOWN;
+ if (data.is_capslock_on())
+ flags |= ui::EF_CAPS_LOCK_ON;
+
+ ui::KeyboardCode key_code;
+ ui::DomKey dom_key;
+ if (!DomCodeToUsLayoutDomKey(dom_code, flags, &dom_key, &key_code))
+ return false;
+
+ *out = std::make_unique<ui::KeyEvent>(type, key_code, dom_code, flags,
+ dom_key, base::TimeTicks::Now());
+ return true;
+}
+
+} // namespace mojo
diff --git a/chromium/components/arc/mojom/ime_mojom_traits.h b/chromium/components/arc/mojom/ime_mojom_traits.h
index 5dc61426d55..3941f6161ec 100644
--- a/chromium/components/arc/mojom/ime_mojom_traits.h
+++ b/chromium/components/arc/mojom/ime_mojom_traits.h
@@ -5,8 +5,9 @@
#ifndef COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_
#define COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_
-#include "components/arc/mojom/ime.mojom-shared.h"
+#include "components/arc/mojom/ime.mojom.h"
#include "ui/base/ime/text_input_type.h"
+#include "ui/events/event.h"
namespace mojo {
@@ -107,6 +108,32 @@ struct EnumTraits<arc::mojom::TextInputType, ui::TextInputType> {
}
};
+using KeyEventUniquePtr = std::unique_ptr<ui::KeyEvent>;
+template <>
+struct StructTraits<arc::mojom::KeyEventDataDataView, KeyEventUniquePtr> {
+ static bool pressed(const KeyEventUniquePtr& key_event) {
+ return key_event->type() == ui::ET_KEY_PRESSED;
+ }
+ static int32_t key_code(const KeyEventUniquePtr& key_event) {
+ return key_event->key_code();
+ }
+ static bool is_shift_down(const KeyEventUniquePtr& key_event) {
+ return key_event->IsShiftDown();
+ }
+ static bool is_control_down(const KeyEventUniquePtr& key_event) {
+ return key_event->IsControlDown();
+ }
+ static bool is_alt_down(const KeyEventUniquePtr& key_event) {
+ return key_event->IsAltDown();
+ }
+ static bool is_capslock_on(const KeyEventUniquePtr& key_event) {
+ return key_event->IsCapsLockOn();
+ }
+
+ static bool Read(arc::mojom::KeyEventDataDataView data,
+ KeyEventUniquePtr* out);
+};
+
} // namespace mojo
#endif // COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_
diff --git a/chromium/components/arc/mojom/ime_mojom_traits_unittest.cc b/chromium/components/arc/mojom/ime_mojom_traits_unittest.cc
new file mode 100644
index 00000000000..7dfece3f529
--- /dev/null
+++ b/chromium/components/arc/mojom/ime_mojom_traits_unittest.cc
@@ -0,0 +1,45 @@
+// 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 "components/arc/mojom/ime_mojom_traits.h"
+
+#include "mojo/public/cpp/test_support/test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/events/event.h"
+#include "ui/events/keycodes/dom/dom_code.h"
+
+namespace mojo {
+
+namespace {
+
+void ExpectKeyEventsEqual(const ui::KeyEvent& expected,
+ const ui::KeyEvent& actual) {
+ EXPECT_EQ(expected.type(), actual.type());
+ EXPECT_EQ(expected.key_code(), actual.key_code());
+ EXPECT_EQ(expected.code(), actual.code());
+ EXPECT_EQ(expected.IsShiftDown(), actual.IsShiftDown());
+ EXPECT_EQ(expected.IsAltDown(), actual.IsAltDown());
+ EXPECT_EQ(expected.IsControlDown(), actual.IsControlDown());
+ EXPECT_EQ(expected.IsCapsLockOn(), actual.IsCapsLockOn());
+}
+
+} // namespace
+
+TEST(KeyEventStructTraitsTest, Convert) {
+ const ui::KeyEvent kTestData[] = {
+ {ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::US_A, ui::EF_CONTROL_DOWN},
+ {ui::ET_KEY_PRESSED, ui::VKEY_B, ui::DomCode::US_B, ui::EF_ALT_DOWN},
+ {ui::ET_KEY_RELEASED, ui::VKEY_B, ui::DomCode::US_B, ui::EF_SHIFT_DOWN},
+ {ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::US_A, ui::EF_CAPS_LOCK_ON},
+ };
+ for (size_t idx = 0; idx < base::size(kTestData); ++idx) {
+ auto copy = std::make_unique<ui::KeyEvent>(kTestData[idx]);
+ std::unique_ptr<ui::KeyEvent> output;
+ mojo::test::SerializeAndDeserialize<arc::mojom::KeyEventData>(&copy,
+ &output);
+ ExpectKeyEventsEqual(*copy, *output);
+ }
+}
+
+} // namespace mojo
diff --git a/chromium/components/arc/mojom/input_method_manager.mojom b/chromium/components/arc/mojom/input_method_manager.mojom
index c8e3dcde029..273eac40c5f 100644
--- a/chromium/components/arc/mojom/input_method_manager.mojom
+++ b/chromium/components/arc/mojom/input_method_manager.mojom
@@ -59,20 +59,6 @@ struct TextInputState {
[MinVersion=6] Range? composition_text_range;
};
-// Represents the information of a key event.
-[MinVersion=7]
-struct KeyEventData {
- // Whether the event is a press event or a release event.
- bool pressed;
- // The key touched in the event represented in |ui::KeyboardCode|.
- int32 key_code;
- // The flags for modifiers state.
- bool is_shift_down;
- bool is_control_down;
- bool is_alt_down;
- bool is_capslock_on;
-};
-
// This interface provides methods to control a text field.
// It is generated for each focused text field and passed to Android.
// This interface will be closed when the focus moves to another text field.
@@ -135,7 +121,7 @@ interface InputMethodManagerHost {
// Next method ID: 7
interface InputMethodManagerInstance {
// Establishes full-duplex communication with the host.
- Init@0(InputMethodManagerHost host_ptr) => ();
+ Init@0(pending_remote<InputMethodManagerHost> host_remote) => ();
// Enables/Disables an IME in Android. Calling this method will add/remove
// the specified IME to/from ENABLED_INPUT_METHODS settings.
diff --git a/chromium/components/arc/mojom/intent_helper.mojom b/chromium/components/arc/mojom/intent_helper.mojom
index 3be1655ab7b..c37690fce69 100644
--- a/chromium/components/arc/mojom/intent_helper.mojom
+++ b/chromium/components/arc/mojom/intent_helper.mojom
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Next MinVersion: 37
+// Next MinVersion: 39
module arc.mojom;
@@ -82,6 +82,7 @@ struct IntentFilter {
[MinVersion=10] array<PatternMatcher>? data_paths;
[MinVersion=10] array<PatternMatcher>? deprecated_data_scheme_specific_parts;
[MinVersion=21] string? package_name; // Package which registered the filter.
+ [MinVersion=38] array<string>? mime_types; // Intent filer mime types.
};
// Describes a package that can handle an intent.
@@ -147,7 +148,7 @@ enum ChromePage {
ABOUTBLANK,
ABOUTDOWNLOADS,
ABOUTHISTORY,
- CROSTINIDISKRESIZE,
+ DEPRECATED_CROSTINIDISKRESIZE,
ACCESSIBILITY,
ACCOUNTMANAGER,
ANDROIDAPPSDETAILS,
@@ -314,7 +315,7 @@ interface IntentHelperHost {
};
// Sends intents to ARC on behalf of Chrome.
-// Next method ID: 19
+// Next method ID: 20
interface IntentHelperInstance {
// Sets the given package as a preferred package. The next time an ACTION_VIEW
// intent is sent with a URL that requires disambiguation, instead of opening
@@ -354,10 +355,10 @@ interface IntentHelperInstance {
ActionType action_type);
// DEPRECATED: Please use Init@13 instead.
- InitDeprecated@0(IntentHelperHost host_ptr);
+ InitDeprecated@0(pending_remote<IntentHelperHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=19] Init@13(IntentHelperHost host_ptr) => ();
+ [MinVersion=19] Init@13(pending_remote<IntentHelperHost> host_remote) => ();
// DEPRECATED. Use FileSystemInstance.OpenFileToRead() instead.
[MinVersion=15] OpenFileToReadDeprecated@12(string url) => (handle? fd);
@@ -413,4 +414,8 @@ interface IntentHelperInstance {
CameraIntentAction action,
array<uint8> data)
=> (bool is_success);
+
+ // Request ARC to send the domain verification status update for all packages
+ // to Chrome OS.
+ [MinVersion=37] RequestDomainVerificationStatusUpdate@19();
};
diff --git a/chromium/components/arc/mojom/keymaster.mojom b/chromium/components/arc/mojom/keymaster.mojom
index 24475b72636..6aa80cf3284 100644
--- a/chromium/components/arc/mojom/keymaster.mojom
+++ b/chromium/components/arc/mojom/keymaster.mojom
@@ -12,13 +12,14 @@ module arc.mojom;
// Host is implemented in Chrome. Listens until server and instance come online
// and forwards a server handle to the instance.
interface KeymasterHost {
- GetServer@0() => (KeymasterServer server_ptr);
+ GetServer@0() => (pending_remote<KeymasterServer>? server_remote);
};
// Instance is implemented in ARC. Retrieves a server pointer from the host and
// uses it to fulfill Android Keymaster operations.
interface KeymasterInstance {
- Init@0(KeymasterHost host_ptr) => ();
+ // Establishes full-duplex communication with the host.
+ Init@0(pending_remote<KeymasterHost> host_remote) => ();
};
// Server is implemented in arc-keymasterd in Chrome OS. This interface is the
diff --git a/chromium/components/arc/mojom/kiosk.mojom b/chromium/components/arc/mojom/kiosk.mojom
index 39beb508f79..852991b17a7 100644
--- a/chromium/components/arc/mojom/kiosk.mojom
+++ b/chromium/components/arc/mojom/kiosk.mojom
@@ -23,8 +23,8 @@ interface KioskHost {
// Next method ID: 2
interface KioskInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(KioskHost host_ptr);
+ InitDeprecated@0(pending_remote<KioskHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@1(KioskHost host_ptr) => ();
+ [MinVersion=1] Init@1(pending_remote<KioskHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/metrics.mojom b/chromium/components/arc/mojom/metrics.mojom
index c5befd6601b..b076bb6031e 100644
--- a/chromium/components/arc/mojom/metrics.mojom
+++ b/chromium/components/arc/mojom/metrics.mojom
@@ -108,8 +108,8 @@ interface MetricsHost {
// Next method ID: 2
interface MetricsInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(MetricsHost host_ptr);
+ InitDeprecated@0(pending_remote<MetricsHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=2] Init@1(MetricsHost host_ptr) => ();
+ [MinVersion=2] Init@1(pending_remote<MetricsHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/midis.mojom b/chromium/components/arc/mojom/midis.mojom
index 4a8e1735e20..18d9e40376e 100644
--- a/chromium/components/arc/mojom/midis.mojom
+++ b/chromium/components/arc/mojom/midis.mojom
@@ -66,7 +66,8 @@ interface MidisServer {
// by the client).
// Next Method ID: 1
interface MidisHost {
- Connect@0(MidisServer& server, MidisClient client);
+ Connect@0(
+ pending_receiver<MidisServer> server, pending_remote<MidisClient> client);
};
// MidisInstance is implemented in the ARC MIDI JNI code that
@@ -74,8 +75,8 @@ interface MidisHost {
// Next Method ID: 2
interface MidisInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(MidisHost host_ptr);
+ InitDeprecated@0(pending_remote<MidisHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@1(MidisHost host_ptr) => ();
+ [MinVersion=1] Init@1(pending_remote<MidisHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/net.mojom b/chromium/components/arc/mojom/net.mojom
index 81791af10f1..8faca92ca21 100644
--- a/chromium/components/arc/mojom/net.mojom
+++ b/chromium/components/arc/mojom/net.mojom
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Next MinVersion: 14
+// Next MinVersion: 15
// This file defines the mojo interface between the ARC networking stack and
// Chrome OS. There are three different groups of interactions:
@@ -92,7 +92,8 @@ enum IPAddressType {
IPV6,
};
-// Layer 3 and proxy configuration information for an IP network.
+// Deprecated. Individual fields added to NetworkConfiguration in version 13 of
+// this file should be used instead.
struct IPConfiguration {
// Literal representation of the IP address of the ARC gateway.
@@ -126,7 +127,8 @@ enum SecurityType {
WPA_EAP,
};
-// Tethering state of a |NetworkConfiguration| as a client.
+// Deprecated enum. |is_metered| in NetworkConfiguration should be
+// used instead.
[Extensible]
enum TetheringClientState {
// Tethering state is detected and confirmed.
@@ -189,8 +191,9 @@ struct NetworkConfiguration {
// A string token that uniquely identifies this network service.
string guid;
- // IP configuration for the network service inside ARC.
- array<IPConfiguration>? ip_configs;
+ // Deprecated. Individual fields added to NetworkConfiguration in version 13
+ // of this file should be used instead.
+ array<IPConfiguration>? deprecated_ip_configs;
// Deprecated field unused from ARC P and later.
string? deprecated_mac_address;
@@ -201,9 +204,8 @@ struct NetworkConfiguration {
// Additional WiFi properties for WiFi network services.
WiFi? wifi;
- // Indicates if the physical network is known to have upstream Internet
- // access through tethering on a metered network.
- [MinVersion=8] TetheringClientState tethering_client_state;
+ // Deprecated field. Uses |is_metered| instead.
+ [MinVersion=8] TetheringClientState deprecated_tethering_client_state;
// The name of the network interface on the host.
[MinVersion=10] string? network_interface;
@@ -266,6 +268,10 @@ struct NetworkConfiguration {
// to ARC and associated with the network service. This can be different
// from the name of the real physical interface managed by shill.
[MinVersion=13] string? arc_network_interface;
+
+ // True if the network has been autodetected by the platform as a metered
+ // network or if the user explicitly marked the network as metered in the UI.
+ [MinVersion=14] bool is_metered;
};
// Describes a Wifi network configuration that ARC has requested the host to
@@ -399,10 +405,10 @@ interface NetHost {
// ID 2 is missing as it belonged to deprecated method.
interface NetInstance {
// DEPRECATED: Please use Init@6 instead.
- InitDeprecated@0(NetHost host_ptr);
+ InitDeprecated@0(pending_remote<NetHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=8] Init@6(NetHost host_ptr) => ();
+ [MinVersion=8] Init@6(pending_remote<NetHost> host_remote) => ();
// Notifies the instance of a WiFI AP scan being completed.
[MinVersion=1] ScanCompleted@1();
diff --git a/chromium/components/arc/mojom/notifications.mojom b/chromium/components/arc/mojom/notifications.mojom
index 96cee17676a..db460d4f7c0 100644
--- a/chromium/components/arc/mojom/notifications.mojom
+++ b/chromium/components/arc/mojom/notifications.mojom
@@ -243,10 +243,10 @@ interface NotificationsHost {
// TODO(lhchavez): Migrate all request/response messages to Mojo.
interface NotificationsInstance {
// DEPRECATED: Please use Init@5 instead.
- InitDeprecated@0(NotificationsHost host_ptr);
+ InitDeprecated@0(pending_remote<NotificationsHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=14] Init@5(NotificationsHost host_ptr) => ();
+ [MinVersion=14] Init@5(pending_remote<NotificationsHost> host_remote) => ();
// Sends an event from Chrome notification UI to Android.
// |event| is a type of occured event.
diff --git a/chromium/components/arc/mojom/obb_mounter.mojom b/chromium/components/arc/mojom/obb_mounter.mojom
index d3659753320..403522cba02 100644
--- a/chromium/components/arc/mojom/obb_mounter.mojom
+++ b/chromium/components/arc/mojom/obb_mounter.mojom
@@ -21,8 +21,8 @@ interface ObbMounterHost {
// Next Method ID: 2
interface ObbMounterInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(ObbMounterHost host_ptr);
+ InitDeprecated@0(pending_remote<ObbMounterHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@1(ObbMounterHost host_ptr) => ();
+ [MinVersion=1] Init@1(pending_remote<ObbMounterHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/oemcrypto.mojom b/chromium/components/arc/mojom/oemcrypto.mojom
index 2c4b74737da..c7d050def44 100644
--- a/chromium/components/arc/mojom/oemcrypto.mojom
+++ b/chromium/components/arc/mojom/oemcrypto.mojom
@@ -342,7 +342,7 @@ interface OemCryptoService {
// that runs in Chrome OS.
// Next Method ID: 1
interface OemCryptoHost {
- Connect@0(OemCryptoService& oemcryptor);
+ Connect@0(pending_receiver<OemCryptoService> oemcryptor);
};
// OemCryptoInstance is implemented in the liboemcrypto.so library that runs in
@@ -350,8 +350,8 @@ interface OemCryptoHost {
// Next Method ID: 2
interface OemCryptoInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(OemCryptoHost host_ptr);
+ InitDeprecated@0(pending_remote<OemCryptoHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@1(OemCryptoHost host_ptr) => ();
+ [MinVersion=1] Init@1(pending_remote<OemCryptoHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/oemcrypto_daemon.mojom b/chromium/components/arc/mojom/oemcrypto_daemon.mojom
deleted file mode 100644
index 2988433412c..00000000000
--- a/chromium/components/arc/mojom/oemcrypto_daemon.mojom
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.
-
-// The original version of this file lives in the Chromium repository at:
-// src/components/arc/mojom/oemcrypto_daemon.mojom
-
-// This file defines the mojo interface used between Chrome and the Chrome OS
-// daemon for establishing the connection from Android to the Chrome OS
-// daemon. This is used so Chrome can proxy the OemCryptoService implementation
-// over to the daemon and then also hand the daemon a Mojo connection to the
-// GPU process for dealing with secure buffers.
-
-module arc_oemcrypto.mojom;
-
-import "components/arc/mojom/oemcrypto.mojom";
-import "components/arc/mojom/protected_buffer_manager.mojom";
-
-// OemCryptoHostDaemon is implemented by the OemCrypto daemon running in
-// Chrome OS and has Connect called from the Browser process in Chrome.
-// Next Method ID: 1
-interface OemCryptoHostDaemon {
- Connect@0(
- arc.mojom.OemCryptoService& oemcryptor,
- pending_remote<arc.mojom.ProtectedBufferManager> protected_buffer_manager);
-};
diff --git a/chromium/components/arc/mojom/pip.mojom b/chromium/components/arc/mojom/pip.mojom
index ce620e0f570..8d38010bc40 100644
--- a/chromium/components/arc/mojom/pip.mojom
+++ b/chromium/components/arc/mojom/pip.mojom
@@ -28,7 +28,7 @@ interface PipHost {
// Next Method ID: 3
interface PipInstance {
// Establishes full-duplex communication with the host.
- Init@0(PipHost host_ptr) => ();
+ Init@0(pending_remote<PipHost> host_remote) => ();
// Instruct Android to close the current Android PIP window, if it exists.
// This is used if the user initiates a Chrome side PIP window, since we
diff --git a/chromium/components/arc/mojom/policy.mojom b/chromium/components/arc/mojom/policy.mojom
index 71489020452..820e8a435be 100644
--- a/chromium/components/arc/mojom/policy.mojom
+++ b/chromium/components/arc/mojom/policy.mojom
@@ -98,10 +98,10 @@ interface PolicyHost {
// Next Method ID: 4
interface PolicyInstance {
// DEPRECATED: Please use Init@2 instead.
- InitDeprecated@0(PolicyHost host_ptr);
+ InitDeprecated@0(pending_remote<PolicyHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=2] Init@2(PolicyHost host_ptr) => ();
+ [MinVersion=2] Init@2(pending_remote<PolicyHost> host_remote) => ();
// Indicates some policies have changed
OnPolicyUpdated@1();
diff --git a/chromium/components/arc/mojom/power.mojom b/chromium/components/arc/mojom/power.mojom
index b3304bf856c..ac17a824e8c 100644
--- a/chromium/components/arc/mojom/power.mojom
+++ b/chromium/components/arc/mojom/power.mojom
@@ -36,10 +36,10 @@ interface PowerHost {
// Next method ID: 7
interface PowerInstance {
// DEPRECATED: Please use Init@5 instead.
- InitDeprecated@0(PowerHost host_ptr);
+ InitDeprecated@0(pending_remote<PowerHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=4] Init@5(PowerHost host_ptr) => ();
+ [MinVersion=4] Init@5(pending_remote<PowerHost> host_remote) => ();
// Alerts the instance to a change in interactive state.
[MinVersion=1] SetInteractive@1(bool enabled);
diff --git a/chromium/components/arc/mojom/print_spooler.mojom b/chromium/components/arc/mojom/print_spooler.mojom
index c84183d2970..b0322e7e299 100644
--- a/chromium/components/arc/mojom/print_spooler.mojom
+++ b/chromium/components/arc/mojom/print_spooler.mojom
@@ -42,16 +42,17 @@ interface PrintSpoolerHost {
// The |top_margin| is the height of the space at the top of the window.
// The returned |host| will be null if errors occur while saving the print
// document or locating the Android surface.
- [MinVersion=1] StartPrintInCustomTab@0(handle scoped_handle,
- int32 task_id,
- int32 surface_id,
- int32 top_margin,
- PrintSessionInstance instance)
+ [MinVersion=1] StartPrintInCustomTab@0(
+ handle scoped_handle,
+ int32 task_id,
+ int32 surface_id,
+ int32 top_margin,
+ pending_remote<PrintSessionInstance> instance)
=> (PrintSessionHost? host);
};
// Next method ID: 1
interface PrintSpoolerInstance {
// Establishes full-duplex communication with the host.
- [MinVersion=0] Init@0(PrintSpoolerHost host_ptr) => ();
+ [MinVersion=0] Init@0(pending_remote<PrintSpoolerHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/screen_capture.mojom b/chromium/components/arc/mojom/screen_capture.mojom
index 960012ca016..ca72e9164f1 100644
--- a/chromium/components/arc/mojom/screen_capture.mojom
+++ b/chromium/components/arc/mojom/screen_capture.mojom
@@ -42,9 +42,9 @@ interface ScreenCaptureHost {
// size should have the width/height of the buffers used
// returns null interface in the case the permission was not granted, a valid
// interface pointer otherwise
- OpenSession@1(ScreenCaptureSessionNotifier notifier,
- string package_name, Size size) =>
- (ScreenCaptureSession? session);
+ OpenSession@1(pending_remote<ScreenCaptureSessionNotifier> notifier,
+ string package_name, Size size)
+ => (pending_remote<ScreenCaptureSession>? session);
};
// Implemented by Chrome for handling a screen capture session.
@@ -61,7 +61,7 @@ interface ScreenCaptureSession {
// Implemented by Android.
interface ScreenCaptureInstance {
// Establishes full-duplex communication with the host.
- Init@0(ScreenCaptureHost host_ptr) => ();
+ Init@0(pending_remote<ScreenCaptureHost> host_remote) => ();
};
// Implemented by Android as a callback mechanism.
diff --git a/chromium/components/arc/mojom/timer.mojom b/chromium/components/arc/mojom/timer.mojom
index 4d8760e3096..b79b3f4e521 100644
--- a/chromium/components/arc/mojom/timer.mojom
+++ b/chromium/components/arc/mojom/timer.mojom
@@ -50,5 +50,5 @@ interface TimerHost {
// Next method ID: 1
interface TimerInstance {
// Establishes full-duplex communication with the host.
- Init@0(TimerHost host_ptr) => ();
+ Init@0(pending_remote<TimerHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/tts.mojom b/chromium/components/arc/mojom/tts.mojom
index b013a1b2c21..540ac41f8c0 100644
--- a/chromium/components/arc/mojom/tts.mojom
+++ b/chromium/components/arc/mojom/tts.mojom
@@ -33,10 +33,10 @@ interface TtsHost {
// Next Method ID: 4
interface TtsInstance {
// DEPRECATED: Please use Init@3 instead.
- InitDeprecated@0(TtsHost host_ptr);
+ InitDeprecated@0(pending_remote<TtsHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@3(TtsHost host_ptr) => ();
+ [MinVersion=1] Init@3(pending_remote<TtsHost> host_remote) => ();
// Sends an utterance to Android for synthesis.
Speak@1(TtsUtterance utterance);
diff --git a/chromium/components/arc/mojom/usb_host.mojom b/chromium/components/arc/mojom/usb_host.mojom
index ff41f57cbaa..e31181baf9b 100644
--- a/chromium/components/arc/mojom/usb_host.mojom
+++ b/chromium/components/arc/mojom/usb_host.mojom
@@ -49,7 +49,7 @@ interface UsbHostHost {
// Next method ID: 3
interface UsbHostInstance {
// Establishes full-duplex communication with the host.
- Init@0(UsbHostHost host_ptr) => ();
+ Init@0(pending_remote<UsbHostHost> host_remote) => ();
// Notifies the instance of a new USB device.
// Only packages in |event_receiver_packages| will receive broadcast.
diff --git a/chromium/components/arc/mojom/video.mojom b/chromium/components/arc/mojom/video.mojom
index 22f2558e8c9..f887d6690b0 100644
--- a/chromium/components/arc/mojom/video.mojom
+++ b/chromium/components/arc/mojom/video.mojom
@@ -24,22 +24,25 @@ interface VideoHost {
// Next method ID: 2
interface VideoInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(VideoHost host_ptr);
+ InitDeprecated@0(pending_remote<VideoHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=5] Init@1(VideoHost host_ptr) => ();
+ [MinVersion=5] Init@1(pending_remote<VideoHost> host_remote) => ();
};
// Deprecated method IDs: 0
// Next method ID: 4
interface VideoAcceleratorFactory {
[MinVersion=1]
- CreateEncodeAccelerator@1(VideoEncodeAccelerator& video_encoder);
+ CreateEncodeAccelerator@1(
+ pending_receiver<VideoEncodeAccelerator> video_encoder);
[MinVersion=6]
- CreateDecodeAccelerator@2(VideoDecodeAccelerator& video_decoder);
+ CreateDecodeAccelerator@2(
+ pending_receiver<VideoDecodeAccelerator> video_decoder);
[Minversion=7]
CreateProtectedBufferAllocator@3(
- VideoProtectedBufferAllocator& video_protected_buffer_allocator);
+ pending_receiver<VideoProtectedBufferAllocator>
+ video_protected_buffer_allocator);
};
diff --git a/chromium/components/arc/mojom/video_decode_accelerator.mojom b/chromium/components/arc/mojom/video_decode_accelerator.mojom
index 56bf60dd8c3..d859c7f1eac 100644
--- a/chromium/components/arc/mojom/video_decode_accelerator.mojom
+++ b/chromium/components/arc/mojom/video_decode_accelerator.mojom
@@ -95,7 +95,7 @@ interface VideoDecodeAccelerator {
// The caller needs to wait for the initialization result (returned by
// callback) before calling any other methods.
Initialize@0(VideoDecodeAcceleratorConfig config,
- VideoDecodeClient client) => (Result result);
+ pending_remote<VideoDecodeClient> client) => (Result result);
// Decodes the content in the shared memory of the bitstream buffer. The
// callee needs to map the the shared memory to read the content and is
diff --git a/chromium/components/arc/mojom/video_encode_accelerator.mojom b/chromium/components/arc/mojom/video_encode_accelerator.mojom
index fc493685fcc..40231b20899 100644
--- a/chromium/components/arc/mojom/video_encode_accelerator.mojom
+++ b/chromium/components/arc/mojom/video_encode_accelerator.mojom
@@ -84,7 +84,7 @@ interface VideoEncodeAccelerator {
[MinVersion=4]
Initialize@9(VideoEncodeAcceleratorConfig config,
- VideoEncodeClient client) => (Result result);
+ pending_remote<VideoEncodeClient> client) => (Result result);
// Initializes the video encoder with specific configuration. Called once per
// encoder construction.
@@ -97,7 +97,8 @@ interface VideoEncodeAccelerator {
// invoke any other methods before the callback.
[MinVersion=1]
InitializeDeprecated@7(VideoEncodeAcceleratorConfig config,
- VideoEncodeClient client) => (bool success);
+ pending_remote<VideoEncodeClient> client) =>
+ (bool success);
// Encodes the given frame.
// Parameters:
diff --git a/chromium/components/arc/mojom/voice_interaction_arc_home.mojom b/chromium/components/arc/mojom/voice_interaction_arc_home.mojom
index f91b1be6e4c..ba0e4a57adc 100644
--- a/chromium/components/arc/mojom/voice_interaction_arc_home.mojom
+++ b/chromium/components/arc/mojom/voice_interaction_arc_home.mojom
@@ -63,8 +63,9 @@ interface VoiceInteractionArcHomeHost {
// Next method ID: 2
interface VoiceInteractionArcHomeInstance {
// DEPRECATED: Please use Init@1 instead.
- InitDeprecated@0(VoiceInteractionArcHomeHost host_ptr);
+ InitDeprecated@0(pending_remote<VoiceInteractionArcHomeHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=3] Init@1(VoiceInteractionArcHomeHost host_ptr) => ();
+ [MinVersion=3] Init@1(
+ pending_remote<VoiceInteractionArcHomeHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/voice_interaction_framework.mojom b/chromium/components/arc/mojom/voice_interaction_framework.mojom
index 2873ad90dfa..3b1b055cbb3 100644
--- a/chromium/components/arc/mojom/voice_interaction_framework.mojom
+++ b/chromium/components/arc/mojom/voice_interaction_framework.mojom
@@ -50,10 +50,11 @@ struct VoiceInteractionStatus {
// Deprecated method ID: 4
interface VoiceInteractionFrameworkInstance {
// DEPRECATED: Please use Init@11 instead.
- InitDeprecated@0(VoiceInteractionFrameworkHost host_ptr);
+ InitDeprecated@0(pending_remote<VoiceInteractionFrameworkHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=13] Init@11(VoiceInteractionFrameworkHost host_ptr) => ();
+ [MinVersion=13] Init@11(
+ pending_remote<VoiceInteractionFrameworkHost> host_remote) => ();
// Starts the voice interaction session in container.
// |homescreen_is_active| is true if the session was invoked when homescreen is active.
diff --git a/chromium/components/arc/mojom/volume_mounter.mojom b/chromium/components/arc/mojom/volume_mounter.mojom
index c8059971fa9..d919be789af 100644
--- a/chromium/components/arc/mojom/volume_mounter.mojom
+++ b/chromium/components/arc/mojom/volume_mounter.mojom
@@ -55,7 +55,7 @@ interface VolumeMounterHost {
// Next Method ID: 2
interface VolumeMounterInstance {
// Establishes full-duplex communication with the host.
- [MinVersion=1] Init@0(VolumeMounterHost host_ptr) => ();
+ [MinVersion=1] Init@0(pending_remote<VolumeMounterHost> host_remote) => ();
// Triggers a mount event in Android.
OnMountEvent@1(MountPointInfo mount_point_info);
diff --git a/chromium/components/arc/mojom/wake_lock.mojom b/chromium/components/arc/mojom/wake_lock.mojom
index 44217547422..b1f689189b0 100644
--- a/chromium/components/arc/mojom/wake_lock.mojom
+++ b/chromium/components/arc/mojom/wake_lock.mojom
@@ -25,5 +25,5 @@ interface WakeLockHost {
// Next method ID: 1
interface WakeLockInstance {
// Establishes full-duplex communication with the host.
- Init@0(WakeLockHost host_ptr) => ();
+ Init@0(pending_remote<WakeLockHost> host_remote) => ();
};
diff --git a/chromium/components/arc/mojom/wallpaper.mojom b/chromium/components/arc/mojom/wallpaper.mojom
index 3048e4560a7..cab9703c639 100644
--- a/chromium/components/arc/mojom/wallpaper.mojom
+++ b/chromium/components/arc/mojom/wallpaper.mojom
@@ -24,10 +24,10 @@ interface WallpaperHost {
// Next method ID: 4
interface WallpaperInstance {
// DEPRECATED: Please use Init@3 instead.
- InitDeprecated@0(WallpaperHost host_ptr);
+ InitDeprecated@0(pending_remote<WallpaperHost> host_remote);
// Establishes full-duplex communication with the host.
- [MinVersion=3] Init@3(WallpaperHost host_ptr) => ();
+ [MinVersion=3] Init@3(pending_remote<WallpaperHost> host_remote) => ();
// Notifies ArcWallpaperManagerService that wallpaper is changed.
[MinVersion=1] OnWallpaperChanged@1([MinVersion=2] int32 wallpaper_id);
diff --git a/chromium/components/arc/net/OWNERS b/chromium/components/arc/net/OWNERS
new file mode 100644
index 00000000000..522f9d41ab5
--- /dev/null
+++ b/chromium/components/arc/net/OWNERS
@@ -0,0 +1,3 @@
+hugobenichi@google.com
+
+# COMPONENT: Platform>Apps>ARC
diff --git a/chromium/components/arc/net/arc_net_host_impl.cc b/chromium/components/arc/net/arc_net_host_impl.cc
index 6b5aa63e8f5..be411029899 100644
--- a/chromium/components/arc/net/arc_net_host_impl.cc
+++ b/chromium/components/arc/net/arc_net_host_impl.cc
@@ -13,8 +13,6 @@
#include "base/memory/singleton.h"
#include "base/posix/eintr_wrapper.h"
#include "base/stl_util.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/time/time.h"
#include "chromeos/login/login_state/login_state.h"
#include "chromeos/network/device_state.h"
#include "chromeos/network/managed_network_configuration_handler.h"
@@ -24,7 +22,6 @@
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_type_pattern.h"
-#include "chromeos/network/network_util.h"
#include "chromeos/network/onc/onc_utils.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_prefs.h"
@@ -36,10 +33,6 @@
namespace {
constexpr int kGetNetworksListLimit = 100;
-// Delay in millisecond before asking for a network property update when no IP
-// configuration can be retrieved for a network.
-constexpr base::TimeDelta kNetworkPropertyUpdateDelay =
- base::TimeDelta::FromMilliseconds(5000);
chromeos::NetworkStateHandler* GetStateHandler() {
return chromeos::NetworkHandler::Get()->network_state_handler();
@@ -70,171 +63,25 @@ bool IsDeviceOwner() {
user_manager::UserManager::Get()->GetOwnerAccountId();
}
-std::string GetStringFromONCDictionary(const base::Value* dict,
- const char* key,
- bool required) {
- DCHECK(dict->is_dict());
- const base::Value* string_value =
- dict->FindKeyOfType(key, base::Value::Type::STRING);
- if (!string_value) {
- LOG_IF(ERROR, required) << "Required property " << key << " not found.";
- return std::string();
- }
- std::string result = string_value->GetString();
- LOG_IF(ERROR, required && result.empty())
- << "Required property " << key << " is empty.";
- return result;
-}
-
-arc::mojom::SecurityType TranslateONCWifiSecurityType(
- const base::DictionaryValue* dict) {
- std::string type = GetStringFromONCDictionary(dict, onc::wifi::kSecurity,
- true /* required */);
- if (type == onc::wifi::kWEP_PSK)
+arc::mojom::SecurityType TranslateWiFiSecurity(const std::string& type) {
+ if (type == shill::kSecurityNone)
+ return arc::mojom::SecurityType::NONE;
+ if (type == shill::kSecurityWep)
return arc::mojom::SecurityType::WEP_PSK;
- if (type == onc::wifi::kWEP_8021X)
- return arc::mojom::SecurityType::WEP_8021X;
- if (type == onc::wifi::kWPA_PSK)
+ if (type == shill::kSecurityPsk)
+ return arc::mojom::SecurityType::WPA_PSK;
+ if (type == shill::kSecurityWpa)
return arc::mojom::SecurityType::WPA_PSK;
- if (type == onc::wifi::kWPA_EAP)
+ if (type == shill::kSecurity8021x)
+ return arc::mojom::SecurityType::WPA_EAP;
+ // Robust Security Network does not appear to be defined in Android.
+ // Approximate it with WPA_EAP
+ if (type == shill::kSecurityRsn)
return arc::mojom::SecurityType::WPA_EAP;
+ LOG(WARNING) << "Unknown WiFi security type " << type;
return arc::mojom::SecurityType::NONE;
}
-arc::mojom::TetheringClientState TranslateTetheringState(
- const std::string& tethering_state) {
- if (tethering_state == onc::tethering_state::kTetheringConfirmedState)
- return arc::mojom::TetheringClientState::CONFIRMED;
- else if (tethering_state == onc::tethering_state::kTetheringNotDetectedState)
- return arc::mojom::TetheringClientState::NOT_DETECTED;
- else if (tethering_state == onc::tethering_state::kTetheringSuspectedState)
- return arc::mojom::TetheringClientState::SUSPECTED;
- NOTREACHED() << "Invalid tethering state: " << tethering_state;
- return arc::mojom::TetheringClientState::NOT_DETECTED;
-}
-
-arc::mojom::WiFiPtr TranslateONCWifi(const base::DictionaryValue* dict) {
- arc::mojom::WiFiPtr wifi = arc::mojom::WiFi::New();
-
- // Optional; defaults to 0.
- dict->GetInteger(onc::wifi::kFrequency, &wifi->frequency);
-
- wifi->bssid =
- GetStringFromONCDictionary(dict, onc::wifi::kBSSID, false /* required */);
- wifi->hex_ssid = GetStringFromONCDictionary(dict, onc::wifi::kHexSSID,
- true /* required */);
-
- // Optional; defaults to false.
- dict->GetBoolean(onc::wifi::kHiddenSSID, &wifi->hidden_ssid);
-
- wifi->security = TranslateONCWifiSecurityType(dict);
-
- // Optional; defaults to 0.
- dict->GetInteger(onc::wifi::kSignalStrength, &wifi->signal_strength);
-
- return wifi;
-}
-
-// Extracts WiFi's tethering client state from a dictionary of WiFi properties.
-arc::mojom::TetheringClientState GetWifiTetheringClientState(
- const base::DictionaryValue* dict) {
- std::string tethering_state;
- dict->GetString(onc::wifi::kTetheringState, &tethering_state);
- return TranslateTetheringState(tethering_state);
-}
-
-arc::mojom::IPConfigurationPtr TranslateONCIPConfig(
- const base::Value* ip_dict) {
- DCHECK(ip_dict->is_dict());
-
- arc::mojom::IPConfigurationPtr configuration =
- arc::mojom::IPConfiguration::New();
-
- const base::Value* ip_address = ip_dict->FindKeyOfType(
- onc::ipconfig::kIPAddress, base::Value::Type::STRING);
- if (ip_address && !ip_address->GetString().empty()) {
- configuration->ip_address = ip_address->GetString();
- const base::Value* routing_prefix = ip_dict->FindKeyOfType(
- onc::ipconfig::kRoutingPrefix, base::Value::Type::INTEGER);
- if (routing_prefix)
- configuration->routing_prefix = routing_prefix->GetInt();
- else
- LOG(ERROR) << "Required property RoutingPrefix not found.";
- configuration->gateway = GetStringFromONCDictionary(
- ip_dict, onc::ipconfig::kGateway, true /* required */);
- }
-
- const base::Value* name_servers = ip_dict->FindKeyOfType(
- onc::ipconfig::kNameServers, base::Value::Type::LIST);
- if (name_servers) {
- for (const auto& entry : name_servers->GetList())
- configuration->name_servers.push_back(entry.GetString());
- }
-
- const base::Value* type =
- ip_dict->FindKeyOfType(onc::ipconfig::kType, base::Value::Type::STRING);
- configuration->type = type && type->GetString() == onc::ipconfig::kIPv6
- ? arc::mojom::IPAddressType::IPV6
- : arc::mojom::IPAddressType::IPV4;
-
- configuration->web_proxy_auto_discovery_url = GetStringFromONCDictionary(
- ip_dict, onc::ipconfig::kWebProxyAutoDiscoveryUrl, false /* required */);
-
- return configuration;
-}
-
-// Returns true if the IP configuration is valid enough for ARC. Empty IP
-// config objects can be generated when IPv4 DHCP or IPv6 autoconf has not
-// completed yet.
-bool IsValidIPConfiguration(const arc::mojom::IPConfiguration& ip_config) {
- return !ip_config.ip_address.empty() && !ip_config.gateway.empty();
-}
-
-// Returns an IPConfiguration vector from the IPConfigs ONC property, which may
-// include multiple IP configurations (e.g. IPv4 and IPv6).
-std::vector<arc::mojom::IPConfigurationPtr> IPConfigurationsFromONCIPConfigs(
- const base::Value* dict) {
- const base::Value* ip_config_list =
- dict->FindKey(onc::network_config::kIPConfigs);
- if (!ip_config_list || !ip_config_list->is_list())
- return {};
- std::vector<arc::mojom::IPConfigurationPtr> result;
- for (const auto& entry : ip_config_list->GetList()) {
- arc::mojom::IPConfigurationPtr config = TranslateONCIPConfig(&entry);
- if (config && IsValidIPConfiguration(*config))
- result.push_back(std::move(config));
- }
- return result;
-}
-
-// Returns an IPConfiguration vector from ONC property |property|, which will
-// include a single IP configuration.
-std::vector<arc::mojom::IPConfigurationPtr> IPConfigurationsFromONCProperty(
- const base::Value* dict,
- const char* property_key) {
- const base::Value* ip_dict = dict->FindKey(property_key);
- if (!ip_dict)
- return {};
- arc::mojom::IPConfigurationPtr config = TranslateONCIPConfig(ip_dict);
- if (!config || !IsValidIPConfiguration(*config))
- return {};
- std::vector<arc::mojom::IPConfigurationPtr> result;
- result.push_back(std::move(config));
- return result;
-}
-
-arc::mojom::ConnectionStateType TranslateONCConnectionState(
- const base::DictionaryValue* dict) {
- std::string connection_state = GetStringFromONCDictionary(
- dict, onc::network_config::kConnectionState, false /* required */);
-
- if (connection_state == onc::connection_state::kConnected)
- return arc::mojom::ConnectionStateType::CONNECTED;
- if (connection_state == onc::connection_state::kConnecting)
- return arc::mojom::ConnectionStateType::CONNECTING;
- return arc::mojom::ConnectionStateType::NOT_CONNECTED;
-}
-
// Translates a shill connection state into a mojo ConnectionStateType.
// This is effectively the inverse function of shill.Service::GetStateString
// defined in platform2/shill/service.cc, with in addition some of shill's
@@ -273,54 +120,47 @@ bool IsActiveNetworkState(const chromeos::NetworkState* network) {
state == shill::kStatePortalSuspected;
}
-void TranslateONCNetworkTypeDetails(const base::DictionaryValue* dict,
- arc::mojom::NetworkConfiguration* mojo) {
- std::string type = GetStringFromONCDictionary(
- dict, onc::network_config::kType, true /* required */);
- // This property will be updated as required by the relevant network types
- // below.
- mojo->tethering_client_state = arc::mojom::TetheringClientState::NOT_DETECTED;
- if (type == onc::network_type::kCellular) {
- mojo->type = arc::mojom::NetworkType::CELLULAR;
- } else if (type == onc::network_type::kEthernet) {
- mojo->type = arc::mojom::NetworkType::ETHERNET;
- } else if (type == onc::network_type::kVPN) {
- mojo->type = arc::mojom::NetworkType::VPN;
- } else if (type == onc::network_type::kWiFi) {
- mojo->type = arc::mojom::NetworkType::WIFI;
- const base::DictionaryValue* wifi_dict = nullptr;
- dict->GetDictionary(onc::network_config::kWiFi, &wifi_dict);
- DCHECK(wifi_dict);
- mojo->wifi = TranslateONCWifi(wifi_dict);
- mojo->tethering_client_state = GetWifiTetheringClientState(wifi_dict);
- } else {
- NOTREACHED() << "Unknown network type: " << type;
- }
-}
-
-// Parse a shill IPConfig dictionary and appends the resulting mojo
-// IPConfiguration object to the given |ip_configs| vector.
-void AddIpConfiguration(std::vector<arc::mojom::IPConfigurationPtr>& ip_configs,
+arc::mojom::NetworkType TranslateNetworkType(const std::string& type) {
+ if (type == shill::kTypeWifi)
+ return arc::mojom::NetworkType::WIFI;
+ if (type == shill::kTypeVPN)
+ return arc::mojom::NetworkType::VPN;
+ if (type == shill::kTypeEthernet)
+ return arc::mojom::NetworkType::ETHERNET;
+ if (type == shill::kTypeEthernetEap)
+ return arc::mojom::NetworkType::ETHERNET;
+ if (type == shill::kTypeCellular)
+ return arc::mojom::NetworkType::CELLULAR;
+ NOTREACHED() << "Unknown network type: " << type;
+ return arc::mojom::NetworkType::ETHERNET;
+}
+
+// Parses a shill IPConfig dictionary and adds the relevant fields to
+// the given |network| NetworkConfiguration object.
+void AddIpConfiguration(arc::mojom::NetworkConfiguration* network,
const base::Value* shill_ipconfig) {
if (!shill_ipconfig || !shill_ipconfig->is_dict())
return;
- auto ip_config = arc::mojom::IPConfiguration::New();
- if (const auto* address_property =
- shill_ipconfig->FindStringPath(shill::kAddressProperty))
- ip_config->ip_address = *address_property;
-
- if (const auto* gateway_property =
- shill_ipconfig->FindStringPath(shill::kGatewayProperty))
- ip_config->gateway = *gateway_property;
-
- ip_config->routing_prefix =
+ // Only set the IP address and gateway if both are defined and non empty.
+ const auto* address = shill_ipconfig->FindStringPath(shill::kAddressProperty);
+ const auto* gateway = shill_ipconfig->FindStringPath(shill::kGatewayProperty);
+ const int prefixlen =
shill_ipconfig->FindIntPath(shill::kPrefixlenProperty).value_or(0);
+ if (address && !address->empty() && gateway && !gateway->empty()) {
+ if (prefixlen < 64) {
+ network->host_ipv4_prefix_length = prefixlen;
+ network->host_ipv4_address = *address;
+ network->host_ipv4_gateway = *gateway;
+ } else {
+ network->host_ipv6_prefix_length = prefixlen;
+ network->host_ipv6_global_addresses->push_back(*address);
+ network->host_ipv6_gateway = *gateway;
+ }
+ }
- ip_config->type = (ip_config->routing_prefix < 64)
- ? arc::mojom::IPAddressType::IPV4
- : arc::mojom::IPAddressType::IPV6;
-
+ // If the user has overridden DNS with the "Google nameservers" UI options,
+ // the kStaticIPConfigProperty object will be empty except for DNS addresses.
if (const auto* dns_list =
shill_ipconfig->FindListKey(shill::kNameServersProperty)) {
for (const auto& dns_value : dns_list->GetList()) {
@@ -333,80 +173,80 @@ void AddIpConfiguration(std::vector<arc::mojom::IPConfigurationPtr>& ip_configs,
if (dns == "0.0.0.0")
continue;
- ip_config->name_servers.push_back(dns);
+ network->host_dns_addresses->push_back(dns);
}
}
- if (IsValidIPConfiguration(*ip_config))
- ip_configs.push_back(std::move(ip_config));
-}
-
-// Add shill's Device properties to the given mojo NetworkConfiguration objects.
-// This adds the network interface and current IP configurations.
-void AddDeviceProperties(arc::mojom::NetworkConfiguration* network,
- const std::string& device_path) {
- const auto* device = GetStateHandler()->GetDeviceState(device_path);
- if (!device)
- return;
-
- network->network_interface = device->interface();
-
- std::vector<arc::mojom::IPConfigurationPtr> ip_configs;
- for (const auto& kv : device->ip_configs())
- AddIpConfiguration(ip_configs, kv.second.get());
+ if (const auto* domains =
+ shill_ipconfig->FindKey(shill::kSearchDomainsProperty)) {
+ if (domains->is_list()) {
+ for (const auto& domain : domains->GetList())
+ network->host_search_domains->push_back(domain.GetString());
+ }
+ }
- // If the DeviceState had any IP configuration, always use them and ignore
- // any other IP configuration previously obtained through NetworkState.
- if (!ip_configs.empty())
- network->ip_configs = std::move(ip_configs);
+ const int mtu = shill_ipconfig->FindIntPath(shill::kMtuProperty).value_or(0);
+ if (mtu > 0)
+ network->host_mtu = mtu;
}
-arc::mojom::NetworkConfigurationPtr TranslateONCConfiguration(
+arc::mojom::NetworkConfigurationPtr TranslateNetworkProperties(
const chromeos::NetworkState* network_state,
- const base::Value* shill_dict,
- const base::DictionaryValue* onc_dict) {
+ const base::Value* shill_dict) {
auto mojo = arc::mojom::NetworkConfiguration::New();
-
- mojo->connection_state = TranslateONCConnectionState(onc_dict);
-
- mojo->guid = GetStringFromONCDictionary(onc_dict, onc::network_config::kGUID,
- true /* required */);
-
- // crbug.com/761708 - VPNs do not currently have an IPConfigs array,
- // so in order to fetch the parameters (particularly the DNS server list),
- // fall back to StaticIPConfig or SavedIPConfig.
- // TODO(b/145960788) Remove IP configuration retrieval from ONC properties.
- std::vector<arc::mojom::IPConfigurationPtr> ip_configs =
- IPConfigurationsFromONCIPConfigs(onc_dict);
- if (ip_configs.empty()) {
- ip_configs = IPConfigurationsFromONCProperty(
- onc_dict, onc::network_config::kStaticIPConfig);
+ // Initialize optional array fields to avoid null guards both here and in ARC.
+ mojo->host_ipv6_global_addresses = std::vector<std::string>();
+ mojo->host_search_domains = std::vector<std::string>();
+ mojo->host_dns_addresses = std::vector<std::string>();
+ mojo->connection_state =
+ TranslateConnectionState(network_state->connection_state());
+ mojo->guid = network_state->guid();
+ if (mojo->guid.empty())
+ LOG(ERROR) << "Missing GUID property for network " << network_state->path();
+ mojo->type = TranslateNetworkType(network_state->type());
+ mojo->is_metered =
+ shill_dict &&
+ shill_dict->FindBoolPath(shill::kMeteredProperty).value_or(false);
+
+ // IP configuration data is added from the properties of the underlying shill
+ // Device and shill Service attached to the Device. Device properties are
+ // preferred because Service properties cannot have both IPv4 and IPv6
+ // configurations at the same time for dual stack networks. It is necessary to
+ // fallback on Service properties for networks without a shill Device exposed
+ // over DBus (builtin OpenVPN, builtin L2TP client, Chrome extension VPNs),
+ // particularly to obtain the DNS server list (b/155129178).
+ // A connecting or newly connected network may not immediately have any
+ // usable IP config object if IPv4 dhcp or IPv6 autoconf have not completed
+ // yet. This case is covered by requesting shill properties asynchronously
+ // when chromeos::NetworkStateHandlerObserver::NetworkPropertiesUpdated is
+ // called.
+
+ // Add shill's Device properties to the given mojo NetworkConfiguration
+ // objects. This adds the network interface and current IP configurations.
+ if (const auto* device =
+ GetStateHandler()->GetDeviceState(network_state->device_path())) {
+ mojo->network_interface = device->interface();
+ for (const auto& kv : device->ip_configs())
+ AddIpConfiguration(mojo.get(), kv.second.get());
}
- if (ip_configs.empty()) {
- ip_configs = IPConfigurationsFromONCProperty(
- onc_dict, onc::network_config::kSavedIPConfig);
- }
- // b/155129178 Also use cached shill properties if available.
+
if (shill_dict) {
for (const auto* property :
- {shill::kIPConfigProperty, shill::kStaticIPConfigProperty,
- shill::kSavedIPConfigProperty}) {
- if (!ip_configs.empty())
- break;
-
- AddIpConfiguration(ip_configs, shill_dict->FindKey(property));
+ {shill::kStaticIPConfigProperty, shill::kSavedIPConfigProperty}) {
+ AddIpConfiguration(mojo.get(), shill_dict->FindKey(property));
}
}
- mojo->ip_configs = std::move(ip_configs);
- mojo->guid = GetStringFromONCDictionary(onc_dict, onc::network_config::kGUID,
- true /* required */);
- TranslateONCNetworkTypeDetails(onc_dict, mojo.get());
-
- if (network_state) {
- mojo->connection_state =
- TranslateConnectionState(network_state->connection_state());
- AddDeviceProperties(mojo.get(), network_state->device_path());
+ if (mojo->type == arc::mojom::NetworkType::WIFI) {
+ mojo->wifi = arc::mojom::WiFi::New();
+ mojo->wifi->bssid = network_state->bssid();
+ mojo->wifi->hex_ssid = network_state->GetHexSsid();
+ mojo->wifi->security =
+ TranslateWiFiSecurity(network_state->security_class());
+ mojo->wifi->frequency = network_state->frequency();
+ mojo->wifi->hidden_ssid = shill_dict &&
+ shill_dict->FindBoolPath(shill::kWifiHiddenSsid).value_or(false);
+ mojo->wifi->signal_strength = network_state->signal_strength();
}
return mojo;
@@ -440,25 +280,22 @@ std::vector<arc::mojom::NetworkConfigurationPtr> TranslateNetworkStates(
std::vector<arc::mojom::NetworkConfigurationPtr> networks;
for (const chromeos::NetworkState* state : network_states) {
const std::string& network_path = state->path();
- if (network_path == arc_vpn_path) {
- // Never tell Android about its own VPN.
+ // Never tell Android about its own VPN.
+ if (network_path == arc_vpn_path)
continue;
- }
+
// For tethered networks, the underlying WiFi networks are not part of
// active networks. Replace any such tethered network with its underlying
// backing network, because ARC cannot match its datapath with the tethered
// network configuration.
state = GetShillBackedNetwork(state);
- if (!state) {
+ if (!state)
continue;
- }
const auto it = shill_network_properties.find(network_path);
const auto* shill_dict =
(it != shill_network_properties.end()) ? &it->second : nullptr;
- const auto onc_dict =
- chromeos::network_util::TranslateNetworkStateToONC(state);
- auto network = TranslateONCConfiguration(state, shill_dict, onc_dict.get());
+ auto network = TranslateNetworkProperties(state, shill_dict);
network->is_default_network = state == GetStateHandler()->DefaultNetwork();
network->service_name = network_path;
networks.push_back(std::move(network));
@@ -475,7 +312,6 @@ void ForgetNetworkFailureCallback(
base::OnceCallback<void(arc::mojom::NetworkResult)> callback,
const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data) {
- VLOG(1) << "ForgetNetworkFailureCallback: " << error_name;
std::move(callback).Run(arc::mojom::NetworkResult::FAILURE);
}
@@ -488,7 +324,6 @@ void StartConnectFailureCallback(
base::OnceCallback<void(arc::mojom::NetworkResult)> callback,
const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data) {
- VLOG(1) << "StartConnectFailureCallback: " << error_name;
std::move(callback).Run(arc::mojom::NetworkResult::FAILURE);
}
@@ -501,17 +336,15 @@ void StartDisconnectFailureCallback(
base::OnceCallback<void(arc::mojom::NetworkResult)> callback,
const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data) {
- VLOG(1) << "StartDisconnectFailureCallback: " << error_name;
std::move(callback).Run(arc::mojom::NetworkResult::FAILURE);
}
-void ArcVpnSuccessCallback() {
- DVLOG(1) << "ArcVpnSuccessCallback";
-}
+void ArcVpnSuccessCallback() {}
-void ArcVpnErrorCallback(const std::string& error_name,
+void ArcVpnErrorCallback(const std::string& operation,
+ const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data) {
- LOG(ERROR) << "ArcVpnErrorCallback: " << error_name;
+ LOG(ERROR) << "ArcVpnErrorCallback: " << operation << ": " << error_name;
}
} // namespace
@@ -588,10 +421,9 @@ void ArcNetHostImpl::OnConnectionReady() {
GetShillBackedNetwork(GetStateHandler()->DefaultNetwork());
if (default_network && default_network->type() == shill::kTypeVPN &&
default_network->GetVpnProviderType() == shill::kProviderArcVpn) {
- VLOG(0) << "Disconnecting stale ARC VPN " << default_network->path();
GetNetworkConnectionHandler()->DisconnectNetwork(
default_network->path(), base::Bind(&ArcVpnSuccessCallback),
- base::Bind(&ArcVpnErrorCallback));
+ base::Bind(&ArcVpnErrorCallback, "disconnecting stale ARC VPN"));
}
}
@@ -638,8 +470,6 @@ void ArcNetHostImpl::CreateNetworkSuccessCallback(
base::OnceCallback<void(const std::string&)> callback,
const std::string& service_path,
const std::string& guid) {
- VLOG(1) << "CreateNetworkSuccessCallback";
-
cached_guid_ = guid;
cached_service_path_ = service_path;
@@ -650,13 +480,14 @@ void ArcNetHostImpl::CreateNetworkFailureCallback(
base::OnceCallback<void(const std::string&)> callback,
const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data) {
- VLOG(1) << "CreateNetworkFailureCallback: " << error_name;
+ LOG(ERROR) << "CreateNetworkFailureCallback: " << error_name;
std::move(callback).Run(std::string());
}
void ArcNetHostImpl::CreateNetwork(mojom::WifiConfigurationPtr cfg,
CreateNetworkCallback callback) {
if (!IsDeviceOwner()) {
+ LOG(ERROR) << "Only device owner can create WiFi networks";
std::move(callback).Run(std::string());
return;
}
@@ -665,12 +496,16 @@ void ArcNetHostImpl::CreateNetwork(mojom::WifiConfigurationPtr cfg,
std::unique_ptr<base::DictionaryValue> wifi_dict(new base::DictionaryValue);
if (!cfg->hexssid.has_value() || !cfg->details) {
+ LOG(ERROR)
+ << "Cannot create WiFi network without hex ssid or WiFi properties";
std::move(callback).Run(std::string());
return;
}
+
mojom::ConfiguredNetworkDetailsPtr details =
std::move(cfg->details->get_configured());
if (!details) {
+ LOG(ERROR) << "Cannot create WiFi network without WiFi properties";
std::move(callback).Run(std::string());
return;
}
@@ -707,7 +542,7 @@ void ArcNetHostImpl::CreateNetwork(mojom::WifiConfigurationPtr cfg,
bool ArcNetHostImpl::GetNetworkPathFromGuid(const std::string& guid,
std::string* path) {
- const chromeos::NetworkState* network =
+ const auto* network =
GetShillBackedNetwork(GetStateHandler()->GetNetworkStateFromGuid(guid));
if (network) {
*path = network->path();
@@ -718,18 +553,21 @@ bool ArcNetHostImpl::GetNetworkPathFromGuid(const std::string& guid,
*path = cached_service_path_;
return true;
}
+
return false;
}
void ArcNetHostImpl::ForgetNetwork(const std::string& guid,
ForgetNetworkCallback callback) {
if (!IsDeviceOwner()) {
+ LOG(ERROR) << "Only device owner can remove WiFi networks";
std::move(callback).Run(mojom::NetworkResult::FAILURE);
return;
}
std::string path;
if (!GetNetworkPathFromGuid(guid, &path)) {
+ LOG(ERROR) << "Could not retrieve Service path from GUID " << guid;
std::move(callback).Run(mojom::NetworkResult::FAILURE);
return;
}
@@ -748,6 +586,7 @@ void ArcNetHostImpl::StartConnect(const std::string& guid,
StartConnectCallback callback) {
std::string path;
if (!GetNetworkPathFromGuid(guid, &path)) {
+ LOG(ERROR) << "Could not retrieve Service path from GUID " << guid;
std::move(callback).Run(mojom::NetworkResult::FAILURE);
return;
}
@@ -766,6 +605,7 @@ void ArcNetHostImpl::StartDisconnect(const std::string& guid,
StartDisconnectCallback callback) {
std::string path;
if (!GetNetworkPathFromGuid(guid, &path)) {
+ LOG(ERROR) << "Could not retrieve Service path from GUID " << guid;
std::move(callback).Run(mojom::NetworkResult::FAILURE);
return;
}
@@ -788,17 +628,17 @@ void ArcNetHostImpl::GetWifiEnabledState(GetWifiEnabledStateCallback callback) {
void ArcNetHostImpl::SetWifiEnabledState(bool is_enabled,
SetWifiEnabledStateCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
- chromeos::NetworkStateHandler::TechnologyState state =
- GetStateHandler()->GetTechnologyState(
- chromeos::NetworkTypePattern::WiFi());
+ auto state = GetStateHandler()->GetTechnologyState(
+ chromeos::NetworkTypePattern::WiFi());
// WiFi can't be enabled or disabled in these states.
if ((state == chromeos::NetworkStateHandler::TECHNOLOGY_PROHIBITED) ||
(state == chromeos::NetworkStateHandler::TECHNOLOGY_UNINITIALIZED) ||
(state == chromeos::NetworkStateHandler::TECHNOLOGY_UNAVAILABLE)) {
- VLOG(1) << "SetWifiEnabledState failed due to WiFi state: " << state;
+ LOG(ERROR) << "SetWifiEnabledState failed due to WiFi state: " << state;
std::move(callback).Run(false);
return;
}
+
GetStateHandler()->SetTechnologyEnabled(
chromeos::NetworkTypePattern::WiFi(), is_enabled,
chromeos::network_handler::ErrorCallback());
@@ -836,43 +676,39 @@ std::string ArcNetHostImpl::LookupArcVpnServicePath() {
false /* visible_only */, kGetNetworksListLimit, &state_list);
for (const chromeos::NetworkState* state : state_list) {
- const chromeos::NetworkState* shill_backed_network =
- GetShillBackedNetwork(state);
+ const auto* shill_backed_network = GetShillBackedNetwork(state);
if (!shill_backed_network)
continue;
- if (shill_backed_network->GetVpnProviderType() == shill::kProviderArcVpn) {
+
+ if (shill_backed_network->GetVpnProviderType() == shill::kProviderArcVpn)
return shill_backed_network->path();
- }
}
return std::string();
}
void ArcNetHostImpl::ConnectArcVpn(const std::string& service_path,
const std::string& /* guid */) {
- DVLOG(1) << "ConnectArcVpn " << service_path;
arc_vpn_service_path_ = service_path;
GetNetworkConnectionHandler()->ConnectToNetwork(
service_path, base::Bind(&ArcVpnSuccessCallback),
- base::Bind(&ArcVpnErrorCallback), false /* check_error_state */,
+ base::Bind(&ArcVpnErrorCallback, "connecting ARC VPN"),
+ false /* check_error_state */,
chromeos::ConnectCallbackMode::ON_COMPLETED);
}
std::unique_ptr<base::Value> ArcNetHostImpl::TranslateStringListToValue(
const std::vector<std::string>& string_list) {
- std::unique_ptr<base::Value> result =
- std::make_unique<base::Value>(base::Value::Type::LIST);
- for (const auto& item : string_list) {
+ auto result = std::make_unique<base::Value>(base::Value::Type::LIST);
+ for (const auto& item : string_list)
result->Append(item);
- }
return result;
}
std::unique_ptr<base::DictionaryValue>
ArcNetHostImpl::TranslateVpnConfigurationToOnc(
const mojom::AndroidVpnConfiguration& cfg) {
- std::unique_ptr<base::DictionaryValue> top_dict =
- std::make_unique<base::DictionaryValue>();
+ auto top_dict = std::make_unique<base::DictionaryValue>();
// Name, Type
top_dict->SetKey(
@@ -930,31 +766,26 @@ ArcNetHostImpl::TranslateVpnConfigurationToOnc(
void ArcNetHostImpl::AndroidVpnConnected(
mojom::AndroidVpnConfigurationPtr cfg) {
- std::unique_ptr<base::DictionaryValue> properties =
- TranslateVpnConfigurationToOnc(*cfg);
+ auto properties = TranslateVpnConfigurationToOnc(*cfg);
std::string service_path = LookupArcVpnServicePath();
if (!service_path.empty()) {
- VLOG(1) << "AndroidVpnConnected: reusing " << service_path;
GetManagedConfigurationHandler()->SetProperties(
service_path, *properties,
base::Bind(&ArcNetHostImpl::ConnectArcVpn, weak_factory_.GetWeakPtr(),
service_path, std::string()),
- base::Bind(&ArcVpnErrorCallback));
+ base::Bind(&ArcVpnErrorCallback,
+ "reconnecting ARC VPN " + service_path));
return;
}
- VLOG(1) << "AndroidVpnConnected: creating new ARC VPN";
std::string user_id_hash = chromeos::LoginState::Get()->primary_user_hash();
GetManagedConfigurationHandler()->CreateConfiguration(
user_id_hash, *properties,
base::Bind(&ArcNetHostImpl::ConnectArcVpn, weak_factory_.GetWeakPtr()),
- base::Bind(&ArcVpnErrorCallback));
+ base::Bind(&ArcVpnErrorCallback, "connecting new ARC VPN"));
}
void ArcNetHostImpl::AndroidVpnStateChanged(mojom::ConnectionStateType state) {
- VLOG(1) << "AndroidVpnStateChanged: state=" << state
- << " service=" << arc_vpn_service_path_;
-
if (state != arc::mojom::ConnectionStateType::NOT_CONNECTED ||
arc_vpn_service_path_.empty()) {
return;
@@ -968,7 +799,7 @@ void ArcNetHostImpl::AndroidVpnStateChanged(mojom::ConnectionStateType state) {
GetNetworkConnectionHandler()->DisconnectNetwork(
service_path, base::Bind(&ArcVpnSuccessCallback),
- base::Bind(&ArcVpnErrorCallback));
+ base::Bind(&ArcVpnErrorCallback, "disconnecting ARC VPN"));
}
void ArcNetHostImpl::SetAlwaysOnVpn(const std::string& vpn_package,
@@ -984,10 +815,9 @@ void ArcNetHostImpl::DisconnectArcVpn() {
auto* net_instance = ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service_->net(),
DisconnectAndroidVpn);
- if (!net_instance) {
- LOG(ERROR) << "User requested VPN disconnection but API is unavailable";
+ if (!net_instance)
return;
- }
+
net_instance->DisconnectAndroidVpn();
}
@@ -999,27 +829,23 @@ void ArcNetHostImpl::DisconnectRequested(const std::string& service_path) {
// This code path is taken when a user clicks the blue Disconnect button
// in Chrome OS. Chrome is about to send the Disconnect call to shill,
// so update our local state and tell Android to disconnect the VPN.
- VLOG(1) << "DisconnectRequested " << service_path;
DisconnectArcVpn();
}
void ArcNetHostImpl::NetworkConnectionStateChanged(
const chromeos::NetworkState* network) {
- const chromeos::NetworkState* shill_backed_network =
- GetShillBackedNetwork(network);
+ const auto* shill_backed_network = GetShillBackedNetwork(network);
if (!shill_backed_network)
return;
if (arc_vpn_service_path_ != shill_backed_network->path() ||
- shill_backed_network->IsConnectingOrConnected()) {
+ shill_backed_network->IsConnectingOrConnected())
return;
- }
// This code path is taken when shill disconnects the Android VPN
// service. This can happen if a user tries to connect to a Chrome OS
// VPN, and shill's VPNProvider::DisconnectAll() forcibly disconnects
// all other VPN services to avoid a conflict.
- VLOG(1) << "NetworkConnectionStateChanged " << shill_backed_network->path();
DisconnectArcVpn();
}
@@ -1064,43 +890,8 @@ void ArcNetHostImpl::UpdateActiveNetworks() {
if (!net_instance)
return;
- const auto active_networks = GetActiveNetworks();
- auto network_configurations = TranslateNetworkStates(
- arc_vpn_service_path_, active_networks, shill_network_properties_);
-
- // A newly connected network may not immediately have any usable IP config
- // object if IPv4 dhcp or IPv6 autoconf have not completed yet. Schedule
- // with a few seconds delay a forced property update for that service to
- // ensure the IP configuration is sent to ARC. Ensure that at most one such
- // request is scheduled for a given service.
- for (const auto& network : network_configurations) {
- if (!network->ip_configs->empty())
- continue;
-
- if (!network->service_name)
- continue;
-
- const std::string& path = network->service_name.value();
- if (pending_service_property_requests_.insert(path).second) {
- LOG(WARNING) << "No IP configuration for " << path;
- // TODO(hugobenichi): add exponential backoff for the case when IP
- // configuration stays unavailable.
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE,
- base::BindOnce(&ArcNetHostImpl::RequestUpdateForNetwork,
- weak_factory_.GetWeakPtr(), path),
- kNetworkPropertyUpdateDelay);
- }
- }
-
- net_instance->ActiveNetworksChanged(std::move(network_configurations));
-}
-
-void ArcNetHostImpl::RequestUpdateForNetwork(const std::string& service_path) {
- // TODO(hugobenichi): skip the request if the IP configuration for this
- // service has been received since then and ARC has been notified about it.
- pending_service_property_requests_.erase(service_path);
- GetStateHandler()->RequestUpdateForNetwork(service_path);
+ net_instance->ActiveNetworksChanged(TranslateNetworkStates(
+ arc_vpn_service_path_, GetActiveNetworks(), shill_network_properties_));
}
void ArcNetHostImpl::NetworkListChanged() {
@@ -1109,7 +900,14 @@ void ArcNetHostImpl::NetworkListChanged() {
return !IsActiveNetworkState(
GetStateHandler()->GetNetworkState(entry.first));
});
- for (const auto* network : GetActiveNetworks())
+ const auto active_networks = GetActiveNetworks();
+ // If there is no active networks, send an explicit ActiveNetworksChanged
+ // event to ARC and skip updating Shill properties.
+ if (active_networks.empty()) {
+ UpdateActiveNetworks();
+ return;
+ }
+ for (const auto* network : active_networks)
NetworkPropertiesUpdated(network);
}
diff --git a/chromium/components/arc/net/arc_net_host_impl.h b/chromium/components/arc/net/arc_net_host_impl.h
index 1dcde71376c..5a072af14b5 100644
--- a/chromium/components/arc/net/arc_net_host_impl.h
+++ b/chromium/components/arc/net/arc_net_host_impl.h
@@ -8,7 +8,6 @@
#include <stdint.h>
#include <map>
#include <memory>
-#include <set>
#include <string>
#include <vector>
@@ -150,8 +149,6 @@ class ArcNetHostImpl : public KeyedService,
const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data);
- // Request properties of the Service corresponding to |service_path|.
- void RequestUpdateForNetwork(const std::string& service_path);
// Callback for chromeos::NetworkHandler::GetShillProperties
void ReceiveShillProperties(const std::string& service_path,
const base::DictionaryValue& shill_properties);
@@ -161,9 +158,6 @@ class ArcNetHostImpl : public KeyedService,
// True if the chrome::NetworkStateHandler is currently being observed for
// state changes.
bool observing_network_state_ = false;
- // Contains all service paths for which a property update request is
- // currently scheduled.
- std::set<std::string> pending_service_property_requests_;
// Cached shill properties for all active networks, keyed by Service path.
std::map<std::string, base::Value> shill_network_properties_;
diff --git a/chromium/components/arc/power/arc_power_bridge.cc b/chromium/components/arc/power/arc_power_bridge.cc
index 89d3c85c16a..0ab1ebed483 100644
--- a/chromium/components/arc/power/arc_power_bridge.cc
+++ b/chromium/components/arc/power/arc_power_bridge.cc
@@ -151,7 +151,7 @@ void ArcPowerBridge::FlushWakeLocksForTesting() {
}
void ArcPowerBridge::OnConnectionReady() {
- // TODO(mash): Support this functionality without ash::Shell access in Chrome.
+ // ash::Shell may not exist in tests.
if (ash::Shell::HasInstance())
ash::Shell::Get()->display_configurator()->AddObserver(this);
chromeos::PowerManagerClient::Get()->AddObserver(this);
@@ -161,7 +161,7 @@ void ArcPowerBridge::OnConnectionReady() {
}
void ArcPowerBridge::OnConnectionClosed() {
- // TODO(mash): Support this functionality without ash::Shell access in Chrome.
+ // ash::Shell may not exist in tests.
if (ash::Shell::HasInstance())
ash::Shell::Get()->display_configurator()->RemoveObserver(this);
chromeos::PowerManagerClient::Get()->RemoveObserver(this);
diff --git a/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.cc b/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.cc
index e3b073b1f82..9a7cc716baf 100644
--- a/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.cc
+++ b/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.cc
@@ -47,7 +47,7 @@ ArcRotationLockBridge::ArcRotationLockBridge(content::BrowserContext* context,
ArcBridgeService* bridge_service)
: arc_bridge_service_(bridge_service) {
arc_bridge_service_->rotation_lock()->AddObserver(this);
- // TODO(mash): Support this functionality without ash::Shell access in Chrome.
+ // ash::Shell may not exist in tests.
if (ash::Shell::HasInstance()) {
ash::Shell::Get()->screen_orientation_controller()->AddObserver(this);
ash::Shell::Get()->tablet_mode_controller()->AddObserver(this);
@@ -56,8 +56,7 @@ ArcRotationLockBridge::ArcRotationLockBridge(content::BrowserContext* context,
ArcRotationLockBridge::~ArcRotationLockBridge() {
arc_bridge_service_->rotation_lock()->RemoveObserver(this);
- // TODO(mus): mus needs proper shutdown process.
- // TODO(mash): Support this functionality without ash::Shell access in Chrome.
+ // ash::Shell may not exist in tests.
if (ash::Shell::HasInstance()) {
ash::Shell::Get()->screen_orientation_controller()->RemoveObserver(this);
ash::Shell::Get()->tablet_mode_controller()->RemoveObserver(this);
@@ -77,7 +76,7 @@ void ArcRotationLockBridge::OnTabletPhysicalStateChanged() {
}
void ArcRotationLockBridge::SendRotationLockState() {
- // TODO(mash): Support this functionality without ash::Shell access in Chrome.
+ // ash::Shell may not exist in tests.
if (!ash::Shell::HasInstance())
return;
diff --git a/chromium/components/arc/session/arc_bridge_host_impl.cc b/chromium/components/arc/session/arc_bridge_host_impl.cc
index f6ee475621d..4bd630b65f2 100644
--- a/chromium/components/arc/session/arc_bridge_host_impl.cc
+++ b/chromium/components/arc/session/arc_bridge_host_impl.cc
@@ -7,7 +7,8 @@
#include <algorithm>
#include <utility>
-#include "ash/public/cpp/arc_notifications_host_initializer.h"
+#include "ash/public/cpp/external_arc/message_center/arc_notification_manager.h"
+#include "ash/public/cpp/message_center/arc_notifications_host_initializer.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "components/arc/mojom/accessibility_helper.mojom.h"
@@ -80,268 +81,296 @@ ArcBridgeHostImpl::~ArcBridgeHostImpl() {
}
void ArcBridgeHostImpl::OnAccessibilityHelperInstanceReady(
- mojom::AccessibilityHelperInstancePtr accessibility_helper_ptr) {
+ mojo::PendingRemote<mojom::AccessibilityHelperInstance>
+ accessibility_helper_remote) {
OnInstanceReady(arc_bridge_service_->accessibility_helper(),
- std::move(accessibility_helper_ptr));
+ std::move(accessibility_helper_remote));
}
-void ArcBridgeHostImpl::OnAppInstanceReady(mojom::AppInstancePtr app_ptr) {
- OnInstanceReady(arc_bridge_service_->app(), std::move(app_ptr));
+void ArcBridgeHostImpl::OnAppInstanceReady(
+ mojo::PendingRemote<mojom::AppInstance> app_remote) {
+ OnInstanceReady(arc_bridge_service_->app(), std::move(app_remote));
}
void ArcBridgeHostImpl::OnAppPermissionsInstanceReady(
- mojom::AppPermissionsInstancePtr app_permissions_ptr) {
+ mojo::PendingRemote<mojom::AppPermissionsInstance> app_permissions_remote) {
OnInstanceReady(arc_bridge_service_->app_permissions(),
- std::move(app_permissions_ptr));
+ std::move(app_permissions_remote));
}
void ArcBridgeHostImpl::OnAppfuseInstanceReady(
- mojom::AppfuseInstancePtr appfuse_ptr) {
- OnInstanceReady(arc_bridge_service_->appfuse(), std::move(appfuse_ptr));
+ mojo::PendingRemote<mojom::AppfuseInstance> appfuse_remote) {
+ OnInstanceReady(arc_bridge_service_->appfuse(), std::move(appfuse_remote));
}
void ArcBridgeHostImpl::OnAudioInstanceReady(
- mojom::AudioInstancePtr audio_ptr) {
- OnInstanceReady(arc_bridge_service_->audio(), std::move(audio_ptr));
+ mojo::PendingRemote<mojom::AudioInstance> audio_remote) {
+ OnInstanceReady(arc_bridge_service_->audio(), std::move(audio_remote));
}
-void ArcBridgeHostImpl::OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) {
- OnInstanceReady(arc_bridge_service_->auth(), std::move(auth_ptr));
+void ArcBridgeHostImpl::OnAuthInstanceReady(
+ mojo::PendingRemote<mojom::AuthInstance> auth_remote) {
+ OnInstanceReady(arc_bridge_service_->auth(), std::move(auth_remote));
}
void ArcBridgeHostImpl::OnBackupSettingsInstanceReady(
- mojom::BackupSettingsInstancePtr backup_settings_ptr) {
+ mojo::PendingRemote<mojom::BackupSettingsInstance> backup_settings_remote) {
OnInstanceReady(arc_bridge_service_->backup_settings(),
- std::move(backup_settings_ptr));
+ std::move(backup_settings_remote));
}
void ArcBridgeHostImpl::OnBluetoothInstanceReady(
- mojom::BluetoothInstancePtr bluetooth_ptr) {
- OnInstanceReady(arc_bridge_service_->bluetooth(), std::move(bluetooth_ptr));
+ mojo::PendingRemote<mojom::BluetoothInstance> bluetooth_remote) {
+ OnInstanceReady(arc_bridge_service_->bluetooth(),
+ std::move(bluetooth_remote));
}
void ArcBridgeHostImpl::OnBootPhaseMonitorInstanceReady(
- mojom::BootPhaseMonitorInstancePtr boot_phase_monitor_ptr) {
+ mojo::PendingRemote<mojom::BootPhaseMonitorInstance>
+ boot_phase_monitor_remote) {
OnInstanceReady(arc_bridge_service_->boot_phase_monitor(),
- std::move(boot_phase_monitor_ptr));
+ std::move(boot_phase_monitor_remote));
}
void ArcBridgeHostImpl::OnCameraInstanceReady(
- mojom::CameraInstancePtr camera_ptr) {
- OnInstanceReady(arc_bridge_service_->camera(), std::move(camera_ptr));
+ mojo::PendingRemote<mojom::CameraInstance> camera_remote) {
+ OnInstanceReady(arc_bridge_service_->camera(), std::move(camera_remote));
}
void ArcBridgeHostImpl::OnCastReceiverInstanceReady(
- mojom::CastReceiverInstancePtr cast_receiver_ptr) {
+ mojo::PendingRemote<mojom::CastReceiverInstance> cast_receiver_remote) {
OnInstanceReady(arc_bridge_service_->cast_receiver(),
- std::move(cast_receiver_ptr));
+ std::move(cast_receiver_remote));
}
void ArcBridgeHostImpl::OnCertStoreInstanceReady(
- mojom::CertStoreInstancePtr instance_ptr) {
- OnInstanceReady(arc_bridge_service_->cert_store(), std::move(instance_ptr));
+ mojo::PendingRemote<mojom::CertStoreInstance> instance_remote) {
+ OnInstanceReady(arc_bridge_service_->cert_store(),
+ std::move(instance_remote));
}
void ArcBridgeHostImpl::OnClipboardInstanceReady(
- mojom::ClipboardInstancePtr clipboard_ptr) {
- OnInstanceReady(arc_bridge_service_->clipboard(), std::move(clipboard_ptr));
+ mojo::PendingRemote<mojom::ClipboardInstance> clipboard_remote) {
+ OnInstanceReady(arc_bridge_service_->clipboard(),
+ std::move(clipboard_remote));
}
void ArcBridgeHostImpl::OnCrashCollectorInstanceReady(
- mojom::CrashCollectorInstancePtr crash_collector_ptr) {
+ mojo::PendingRemote<mojom::CrashCollectorInstance> crash_collector_remote) {
OnInstanceReady(arc_bridge_service_->crash_collector(),
- std::move(crash_collector_ptr));
+ std::move(crash_collector_remote));
}
void ArcBridgeHostImpl::OnDiskQuotaInstanceReady(
- mojom::DiskQuotaInstancePtr disk_quota_ptr) {
- OnInstanceReady(arc_bridge_service_->disk_quota(), std::move(disk_quota_ptr));
+ mojo::PendingRemote<mojom::DiskQuotaInstance> disk_quota_remote) {
+ OnInstanceReady(arc_bridge_service_->disk_quota(),
+ std::move(disk_quota_remote));
}
void ArcBridgeHostImpl::OnEnterpriseReportingInstanceReady(
- mojom::EnterpriseReportingInstancePtr enterprise_reporting_ptr) {
+ mojo::PendingRemote<mojom::EnterpriseReportingInstance>
+ enterprise_reporting_remote) {
OnInstanceReady(arc_bridge_service_->enterprise_reporting(),
- std::move(enterprise_reporting_ptr));
+ std::move(enterprise_reporting_remote));
}
void ArcBridgeHostImpl::OnFileSystemInstanceReady(
- mojom::FileSystemInstancePtr file_system_ptr) {
+ mojo::PendingRemote<mojom::FileSystemInstance> file_system_remote) {
OnInstanceReady(arc_bridge_service_->file_system(),
- std::move(file_system_ptr));
+ std::move(file_system_remote));
}
-void ArcBridgeHostImpl::OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) {
- OnInstanceReady(arc_bridge_service_->ime(), std::move(ime_ptr));
+void ArcBridgeHostImpl::OnImeInstanceReady(
+ mojo::PendingRemote<mojom::ImeInstance> ime_remote) {
+ OnInstanceReady(arc_bridge_service_->ime(), std::move(ime_remote));
}
void ArcBridgeHostImpl::OnInputMethodManagerInstanceReady(
- mojom::InputMethodManagerInstancePtr input_method_manager_ptr) {
+ mojo::PendingRemote<mojom::InputMethodManagerInstance>
+ input_method_manager_remote) {
OnInstanceReady(arc_bridge_service_->input_method_manager(),
- std::move(input_method_manager_ptr));
+ std::move(input_method_manager_remote));
}
void ArcBridgeHostImpl::OnIntentHelperInstanceReady(
- mojom::IntentHelperInstancePtr intent_helper_ptr) {
+ mojo::PendingRemote<mojom::IntentHelperInstance> intent_helper_remote) {
OnInstanceReady(arc_bridge_service_->intent_helper(),
- std::move(intent_helper_ptr));
+ std::move(intent_helper_remote));
}
void ArcBridgeHostImpl::OnKeymasterInstanceReady(
- mojom::KeymasterInstancePtr keymaster_ptr) {
- OnInstanceReady(arc_bridge_service_->keymaster(), std::move(keymaster_ptr));
+ mojo::PendingRemote<mojom::KeymasterInstance> keymaster_remote) {
+ OnInstanceReady(arc_bridge_service_->keymaster(),
+ std::move(keymaster_remote));
}
void ArcBridgeHostImpl::OnKioskInstanceReady(
- mojom::KioskInstancePtr kiosk_ptr) {
- OnInstanceReady(arc_bridge_service_->kiosk(), std::move(kiosk_ptr));
+ mojo::PendingRemote<mojom::KioskInstance> kiosk_remote) {
+ OnInstanceReady(arc_bridge_service_->kiosk(), std::move(kiosk_remote));
}
void ArcBridgeHostImpl::OnLockScreenInstanceReady(
- mojom::LockScreenInstancePtr lock_screen_ptr) {
+ mojo::PendingRemote<mojom::LockScreenInstance> lock_screen_remote) {
OnInstanceReady(arc_bridge_service_->lock_screen(),
- std::move(lock_screen_ptr));
+ std::move(lock_screen_remote));
}
void ArcBridgeHostImpl::OnMediaSessionInstanceReady(
- mojom::MediaSessionInstancePtr media_session_ptr) {
+ mojo::PendingRemote<mojom::MediaSessionInstance> media_session_remote) {
OnInstanceReady(arc_bridge_service_->media_session(),
- std::move(media_session_ptr));
+ std::move(media_session_remote));
}
void ArcBridgeHostImpl::OnMetricsInstanceReady(
- mojom::MetricsInstancePtr metrics_ptr) {
- OnInstanceReady(arc_bridge_service_->metrics(), std::move(metrics_ptr));
+ mojo::PendingRemote<mojom::MetricsInstance> metrics_remote) {
+ OnInstanceReady(arc_bridge_service_->metrics(), std::move(metrics_remote));
}
void ArcBridgeHostImpl::OnMidisInstanceReady(
- mojom::MidisInstancePtr midis_ptr) {
- OnInstanceReady(arc_bridge_service_->midis(), std::move(midis_ptr));
+ mojo::PendingRemote<mojom::MidisInstance> midis_remote) {
+ OnInstanceReady(arc_bridge_service_->midis(), std::move(midis_remote));
}
-void ArcBridgeHostImpl::OnNetInstanceReady(mojom::NetInstancePtr net_ptr) {
- OnInstanceReady(arc_bridge_service_->net(), std::move(net_ptr));
+void ArcBridgeHostImpl::OnNetInstanceReady(
+ mojo::PendingRemote<mojom::NetInstance> net_remote) {
+ OnInstanceReady(arc_bridge_service_->net(), std::move(net_remote));
}
void ArcBridgeHostImpl::OnNotificationsInstanceReady(
- mojom::NotificationsInstancePtr notifications_ptr) {
- // Forward notification instance to ash.
- ash::ArcNotificationsHostInitializer::Get()->SetArcNotificationsInstance(
- notifications_ptr.PassInterface());
+ mojo::PendingRemote<mojom::NotificationsInstance> notifications_remote) {
+ auto* host_initializer = ash::ArcNotificationsHostInitializer::Get();
+ auto* manager = host_initializer->GetArcNotificationManagerInstance();
+ if (manager) {
+ static_cast<ash::ArcNotificationManager*>(manager)->SetInstance(
+ std::move(notifications_remote));
+ return;
+ }
+ // Forward notification instance to ash by injecting ArcNotificationManager.
+ auto new_manager = std::make_unique<ash::ArcNotificationManager>();
+ new_manager->SetInstance(std::move(notifications_remote));
+ ash::ArcNotificationsHostInitializer::Get()
+ ->SetArcNotificationManagerInstance(std::move(new_manager));
}
void ArcBridgeHostImpl::OnObbMounterInstanceReady(
- mojom::ObbMounterInstancePtr obb_mounter_ptr) {
+ mojo::PendingRemote<mojom::ObbMounterInstance> obb_mounter_remote) {
OnInstanceReady(arc_bridge_service_->obb_mounter(),
- std::move(obb_mounter_ptr));
+ std::move(obb_mounter_remote));
}
void ArcBridgeHostImpl::OnOemCryptoInstanceReady(
- mojom::OemCryptoInstancePtr oemcrypto_ptr) {
- OnInstanceReady(arc_bridge_service_->oemcrypto(), std::move(oemcrypto_ptr));
+ mojo::PendingRemote<mojom::OemCryptoInstance> oemcrypto_remote) {
+ OnInstanceReady(arc_bridge_service_->oemcrypto(),
+ std::move(oemcrypto_remote));
}
-void ArcBridgeHostImpl::OnPipInstanceReady(mojom::PipInstancePtr pip_ptr) {
- OnInstanceReady(arc_bridge_service_->pip(), std::move(pip_ptr));
+void ArcBridgeHostImpl::OnPipInstanceReady(
+ mojo::PendingRemote<mojom::PipInstance> pip_remote) {
+ OnInstanceReady(arc_bridge_service_->pip(), std::move(pip_remote));
}
void ArcBridgeHostImpl::OnPolicyInstanceReady(
- mojom::PolicyInstancePtr policy_ptr) {
- OnInstanceReady(arc_bridge_service_->policy(), std::move(policy_ptr));
+ mojo::PendingRemote<mojom::PolicyInstance> policy_remote) {
+ OnInstanceReady(arc_bridge_service_->policy(), std::move(policy_remote));
}
void ArcBridgeHostImpl::OnPowerInstanceReady(
- mojom::PowerInstancePtr power_ptr) {
- OnInstanceReady(arc_bridge_service_->power(), std::move(power_ptr));
+ mojo::PendingRemote<mojom::PowerInstance> power_remote) {
+ OnInstanceReady(arc_bridge_service_->power(), std::move(power_remote));
}
void ArcBridgeHostImpl::OnPrintSpoolerInstanceReady(
- mojom::PrintSpoolerInstancePtr print_spooler_ptr) {
+ mojo::PendingRemote<mojom::PrintSpoolerInstance> print_spooler_remote) {
OnInstanceReady(arc_bridge_service_->print_spooler(),
- std::move(print_spooler_ptr));
+ std::move(print_spooler_remote));
}
void ArcBridgeHostImpl::OnProcessInstanceReady(
- mojom::ProcessInstancePtr process_ptr) {
- OnInstanceReady(arc_bridge_service_->process(), std::move(process_ptr));
+ mojo::PendingRemote<mojom::ProcessInstance> process_remote) {
+ OnInstanceReady(arc_bridge_service_->process(), std::move(process_remote));
}
void ArcBridgeHostImpl::OnPropertyInstanceReady(
- mojom::PropertyInstancePtr property_ptr) {
- OnInstanceReady(arc_bridge_service_->property(), std::move(property_ptr));
+ mojo::PendingRemote<mojom::PropertyInstance> property_remote) {
+ OnInstanceReady(arc_bridge_service_->property(), std::move(property_remote));
}
void ArcBridgeHostImpl::OnRotationLockInstanceReady(
- mojom::RotationLockInstancePtr rotation_lock_ptr) {
+ mojo::PendingRemote<mojom::RotationLockInstance> rotation_lock_remote) {
OnInstanceReady(arc_bridge_service_->rotation_lock(),
- std::move(rotation_lock_ptr));
+ std::move(rotation_lock_remote));
}
void ArcBridgeHostImpl::OnScreenCaptureInstanceReady(
- mojom::ScreenCaptureInstancePtr screen_capture_ptr) {
+ mojo::PendingRemote<mojom::ScreenCaptureInstance> screen_capture_remote) {
OnInstanceReady(arc_bridge_service_->screen_capture(),
- std::move(screen_capture_ptr));
+ std::move(screen_capture_remote));
}
void ArcBridgeHostImpl::OnSmartCardManagerInstanceReady(
- mojom::SmartCardManagerInstancePtr smart_card_manager_ptr) {
+ mojo::PendingRemote<mojom::SmartCardManagerInstance>
+ smart_card_manager_remote) {
OnInstanceReady(arc_bridge_service_->smart_card_manager(),
- std::move(smart_card_manager_ptr));
+ std::move(smart_card_manager_remote));
}
void ArcBridgeHostImpl::OnStorageManagerInstanceReady(
- mojom::StorageManagerInstancePtr storage_manager_ptr) {
+ mojo::PendingRemote<mojom::StorageManagerInstance> storage_manager_remote) {
OnInstanceReady(arc_bridge_service_->storage_manager(),
- std::move(storage_manager_ptr));
+ std::move(storage_manager_remote));
}
void ArcBridgeHostImpl::OnTimerInstanceReady(
- mojom::TimerInstancePtr timer_ptr) {
- OnInstanceReady(arc_bridge_service_->timer(), std::move(timer_ptr));
+ mojo::PendingRemote<mojom::TimerInstance> timer_remote) {
+ OnInstanceReady(arc_bridge_service_->timer(), std::move(timer_remote));
}
void ArcBridgeHostImpl::OnTracingInstanceReady(
- mojom::TracingInstancePtr tracing_ptr) {
- OnInstanceReady(arc_bridge_service_->tracing(), std::move(tracing_ptr));
+ mojo::PendingRemote<mojom::TracingInstance> tracing_remote) {
+ OnInstanceReady(arc_bridge_service_->tracing(), std::move(tracing_remote));
}
-void ArcBridgeHostImpl::OnTtsInstanceReady(mojom::TtsInstancePtr tts_ptr) {
- OnInstanceReady(arc_bridge_service_->tts(), std::move(tts_ptr));
+void ArcBridgeHostImpl::OnTtsInstanceReady(
+ mojo::PendingRemote<mojom::TtsInstance> tts_remote) {
+ OnInstanceReady(arc_bridge_service_->tts(), std::move(tts_remote));
}
void ArcBridgeHostImpl::OnUsbHostInstanceReady(
- mojom::UsbHostInstancePtr usb_host_ptr) {
- OnInstanceReady(arc_bridge_service_->usb_host(), std::move(usb_host_ptr));
+ mojo::PendingRemote<mojom::UsbHostInstance> usb_host_remote) {
+ OnInstanceReady(arc_bridge_service_->usb_host(), std::move(usb_host_remote));
}
void ArcBridgeHostImpl::OnVideoInstanceReady(
- mojom::VideoInstancePtr video_ptr) {
- OnInstanceReady(arc_bridge_service_->video(), std::move(video_ptr));
+ mojo::PendingRemote<mojom::VideoInstance> video_remote) {
+ OnInstanceReady(arc_bridge_service_->video(), std::move(video_remote));
}
void ArcBridgeHostImpl::OnVoiceInteractionArcHomeInstanceReady(
- mojom::VoiceInteractionArcHomeInstancePtr home_ptr) {
+ mojo::PendingRemote<mojom::VoiceInteractionArcHomeInstance> home_remote) {
NOTREACHED();
}
void ArcBridgeHostImpl::OnVoiceInteractionFrameworkInstanceReady(
- mojom::VoiceInteractionFrameworkInstancePtr framework_ptr) {
+ mojo::PendingRemote<mojom::VoiceInteractionFrameworkInstance>
+ framework_remote) {
NOTREACHED();
}
void ArcBridgeHostImpl::OnVolumeMounterInstanceReady(
- mojom::VolumeMounterInstancePtr volume_mounter_ptr) {
+ mojo::PendingRemote<mojom::VolumeMounterInstance> volume_mounter_remote) {
OnInstanceReady(arc_bridge_service_->volume_mounter(),
- std::move(volume_mounter_ptr));
+ std::move(volume_mounter_remote));
}
void ArcBridgeHostImpl::OnWakeLockInstanceReady(
- mojom::WakeLockInstancePtr wakelock_ptr) {
- OnInstanceReady(arc_bridge_service_->wake_lock(), std::move(wakelock_ptr));
+ mojo::PendingRemote<mojom::WakeLockInstance> wakelock_remote) {
+ OnInstanceReady(arc_bridge_service_->wake_lock(), std::move(wakelock_remote));
}
void ArcBridgeHostImpl::OnWallpaperInstanceReady(
- mojom::WallpaperInstancePtr wallpaper_ptr) {
- OnInstanceReady(arc_bridge_service_->wallpaper(), std::move(wallpaper_ptr));
+ mojo::PendingRemote<mojom::WallpaperInstance> wallpaper_remote) {
+ OnInstanceReady(arc_bridge_service_->wallpaper(),
+ std::move(wallpaper_remote));
}
void ArcBridgeHostImpl::OnClosed() {
@@ -360,16 +389,16 @@ void ArcBridgeHostImpl::OnClosed() {
template <typename InstanceType, typename HostType>
void ArcBridgeHostImpl::OnInstanceReady(
ConnectionHolder<InstanceType, HostType>* holder,
- mojo::InterfacePtr<InstanceType> ptr) {
+ mojo::PendingRemote<InstanceType> remote) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(receiver_.is_bound());
- DCHECK(ptr.is_bound());
+ DCHECK(remote.is_valid());
// Track |channel|'s lifetime via |mojo_channels_| so that it will be
// closed on ArcBridgeHost/Instance closing or the ArcBridgeHostImpl's
// destruction.
auto* channel =
- new MojoChannel<InstanceType, HostType>(holder, ptr.PassInterface());
+ new MojoChannel<InstanceType, HostType>(holder, std::move(remote));
mojo_channels_.emplace_back(channel);
// Since |channel| is managed by |mojo_channels_|, its lifetime is shorter
diff --git a/chromium/components/arc/session/arc_bridge_host_impl.h b/chromium/components/arc/session/arc_bridge_host_impl.h
index 4e4020846b5..8f9b1fa796d 100644
--- a/chromium/components/arc/session/arc_bridge_host_impl.h
+++ b/chromium/components/arc/session/arc_bridge_host_impl.h
@@ -40,86 +40,124 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost {
// ArcBridgeHost overrides.
void OnAccessibilityHelperInstanceReady(
- mojom::AccessibilityHelperInstancePtr accessibility_helper_ptr) override;
- void OnAppInstanceReady(mojom::AppInstancePtr app_ptr) override;
+ mojo::PendingRemote<mojom::AccessibilityHelperInstance>
+ accessibility_helper_remote) override;
+ void OnAppInstanceReady(
+ mojo::PendingRemote<mojom::AppInstance> app_ptr) override;
void OnAppPermissionsInstanceReady(
- mojom::AppPermissionsInstancePtr app_permissions_ptr) override;
- void OnAppfuseInstanceReady(mojom::AppfuseInstancePtr appfuse_ptr) override;
- void OnAudioInstanceReady(mojom::AudioInstancePtr audio_ptr) override;
- void OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) override;
+ mojo::PendingRemote<mojom::AppPermissionsInstance> app_permissions_remote)
+ override;
+ void OnAppfuseInstanceReady(
+ mojo::PendingRemote<mojom::AppfuseInstance> appfuse_remote) override;
+ void OnAudioInstanceReady(
+ mojo::PendingRemote<mojom::AudioInstance> audio_remote) override;
+ void OnAuthInstanceReady(
+ mojo::PendingRemote<mojom::AuthInstance> auth_remote) override;
void OnBackupSettingsInstanceReady(
- mojom::BackupSettingsInstancePtr backup_settings_ptr) override;
+ mojo::PendingRemote<mojom::BackupSettingsInstance> backup_settings_remote)
+ override;
void OnBluetoothInstanceReady(
- mojom::BluetoothInstancePtr bluetooth_ptr) override;
+ mojo::PendingRemote<mojom::BluetoothInstance> bluetooth_remote) override;
void OnBootPhaseMonitorInstanceReady(
- mojom::BootPhaseMonitorInstancePtr boot_phase_monitor_ptr) override;
- void OnCameraInstanceReady(mojom::CameraInstancePtr camera_ptr) override;
+ mojo::PendingRemote<mojom::BootPhaseMonitorInstance>
+ boot_phase_monitor_remote) override;
+ void OnCameraInstanceReady(
+ mojo::PendingRemote<mojom::CameraInstance> camera_remote) override;
void OnCastReceiverInstanceReady(
- mojom::CastReceiverInstancePtr cast_receiver_ptr) override;
+ mojo::PendingRemote<mojom::CastReceiverInstance> cast_receiver_remote)
+ override;
void OnCertStoreInstanceReady(
- mojom::CertStoreInstancePtr instance_ptr) override;
+ mojo::PendingRemote<mojom::CertStoreInstance> instance_remote) override;
void OnClipboardInstanceReady(
- mojom::ClipboardInstancePtr clipboard_ptr) override;
+ mojo::PendingRemote<mojom::ClipboardInstance> clipboard_remote) override;
void OnCrashCollectorInstanceReady(
- mojom::CrashCollectorInstancePtr crash_collector_ptr) override;
+ mojo::PendingRemote<mojom::CrashCollectorInstance> crash_collector_remote)
+ override;
void OnDiskQuotaInstanceReady(
- mojom::DiskQuotaInstancePtr disk_quota_ptr) override;
+ mojo::PendingRemote<mojom::DiskQuotaInstance> disk_quota_remote) override;
void OnEnterpriseReportingInstanceReady(
- mojom::EnterpriseReportingInstancePtr enterprise_reporting_ptr) override;
- void OnFileSystemInstanceReady(
- mojom::FileSystemInstancePtr file_system_ptr) override;
- void OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) override;
+ mojo::PendingRemote<mojom::EnterpriseReportingInstance>
+ enterprise_reporting_remote) override;
+ void OnFileSystemInstanceReady(mojo::PendingRemote<mojom::FileSystemInstance>
+ file_system_remote) override;
+ void OnImeInstanceReady(
+ mojo::PendingRemote<mojom::ImeInstance> ime_remote) override;
void OnInputMethodManagerInstanceReady(
- mojom::InputMethodManagerInstancePtr input_method_manager_ptr) override;
+ mojo::PendingRemote<mojom::InputMethodManagerInstance>
+ input_method_manager_remote) override;
void OnIntentHelperInstanceReady(
- mojom::IntentHelperInstancePtr intent_helper_ptr) override;
+ mojo::PendingRemote<mojom::IntentHelperInstance> intent_helper_remote)
+ override;
void OnKeymasterInstanceReady(
- mojom::KeymasterInstancePtr keymaster_ptr) override;
- void OnKioskInstanceReady(mojom::KioskInstancePtr kiosk_ptr) override;
- void OnLockScreenInstanceReady(
- mojom::LockScreenInstancePtr lock_screen_ptr) override;
+ mojo::PendingRemote<mojom::KeymasterInstance> keymaster_remote) override;
+ void OnKioskInstanceReady(
+ mojo::PendingRemote<mojom::KioskInstance> kiosk_remote) override;
+ void OnLockScreenInstanceReady(mojo::PendingRemote<mojom::LockScreenInstance>
+ lock_screen_remote) override;
void OnMediaSessionInstanceReady(
- mojom::MediaSessionInstancePtr media_session_ptr) override;
- void OnMetricsInstanceReady(mojom::MetricsInstancePtr metrics_ptr) override;
- void OnMidisInstanceReady(mojom::MidisInstancePtr midis_ptr) override;
- void OnNetInstanceReady(mojom::NetInstancePtr net_ptr) override;
+ mojo::PendingRemote<mojom::MediaSessionInstance> media_session_remote)
+ override;
+ void OnMetricsInstanceReady(
+ mojo::PendingRemote<mojom::MetricsInstance> metrics_remote) override;
+ void OnMidisInstanceReady(
+ mojo::PendingRemote<mojom::MidisInstance> midis_remote) override;
+ void OnNetInstanceReady(
+ mojo::PendingRemote<mojom::NetInstance> net_remote) override;
void OnNotificationsInstanceReady(
- mojom::NotificationsInstancePtr notifications_ptr) override;
- void OnObbMounterInstanceReady(
- mojom::ObbMounterInstancePtr obb_mounter_ptr) override;
+ mojo::PendingRemote<mojom::NotificationsInstance> notifications_remote)
+ override;
+ void OnObbMounterInstanceReady(mojo::PendingRemote<mojom::ObbMounterInstance>
+ obb_mounter_remote) override;
void OnOemCryptoInstanceReady(
- mojom::OemCryptoInstancePtr oemcrypto_ptr) override;
- void OnPipInstanceReady(mojom::PipInstancePtr policy_ptr) override;
- void OnPolicyInstanceReady(mojom::PolicyInstancePtr policy_ptr) override;
- void OnPowerInstanceReady(mojom::PowerInstancePtr power_ptr) override;
+ mojo::PendingRemote<mojom::OemCryptoInstance> oemcrypto_remote) override;
+ void OnPipInstanceReady(
+ mojo::PendingRemote<mojom::PipInstance> policy_remote) override;
+ void OnPolicyInstanceReady(
+ mojo::PendingRemote<mojom::PolicyInstance> policy_remote) override;
+ void OnPowerInstanceReady(
+ mojo::PendingRemote<mojom::PowerInstance> power_remote) override;
void OnPrintSpoolerInstanceReady(
- mojom::PrintSpoolerInstancePtr print_spooler_ptr) override;
- void OnProcessInstanceReady(mojom::ProcessInstancePtr process_ptr) override;
+ mojo::PendingRemote<mojom::PrintSpoolerInstance> print_spooler_remote)
+ override;
+ void OnProcessInstanceReady(
+ mojo::PendingRemote<mojom::ProcessInstance> process_remote) override;
void OnPropertyInstanceReady(
- mojom::PropertyInstancePtr property_ptr) override;
+ mojo::PendingRemote<mojom::PropertyInstance> property_remote) override;
void OnRotationLockInstanceReady(
- mojom::RotationLockInstancePtr rotation_lock_ptr) override;
+ mojo::PendingRemote<mojom::RotationLockInstance> rotation_lock_remote)
+ override;
void OnScreenCaptureInstanceReady(
- mojom::ScreenCaptureInstancePtr screen_capture_ptr) override;
+ mojo::PendingRemote<mojom::ScreenCaptureInstance> screen_capture_remote)
+ override;
void OnSmartCardManagerInstanceReady(
- mojom::SmartCardManagerInstancePtr smart_card_manager_ptr) override;
+ mojo::PendingRemote<mojom::SmartCardManagerInstance>
+ smart_card_manager_remote) override;
void OnStorageManagerInstanceReady(
- mojom::StorageManagerInstancePtr storage_manager_ptr) override;
- void OnTimerInstanceReady(mojom::TimerInstancePtr timer_ptr) override;
- void OnTracingInstanceReady(mojom::TracingInstancePtr trace_ptr) override;
- void OnTtsInstanceReady(mojom::TtsInstancePtr tts_ptr) override;
- void OnUsbHostInstanceReady(mojom::UsbHostInstancePtr usb_host_ptr) override;
- void OnVideoInstanceReady(mojom::VideoInstancePtr video_ptr) override;
+ mojo::PendingRemote<mojom::StorageManagerInstance> storage_manager_remote)
+ override;
+ void OnTimerInstanceReady(
+ mojo::PendingRemote<mojom::TimerInstance> timer_remote) override;
+ void OnTracingInstanceReady(
+ mojo::PendingRemote<mojom::TracingInstance> trace_remote) override;
+ void OnTtsInstanceReady(
+ mojo::PendingRemote<mojom::TtsInstance> tts_remote) override;
+ void OnUsbHostInstanceReady(
+ mojo::PendingRemote<mojom::UsbHostInstance> usb_host_remote) override;
+ void OnVideoInstanceReady(
+ mojo::PendingRemote<mojom::VideoInstance> video_remote) override;
void OnVoiceInteractionArcHomeInstanceReady(
- mojom::VoiceInteractionArcHomeInstancePtr home_ptr) override;
+ mojo::PendingRemote<mojom::VoiceInteractionArcHomeInstance> home_remote)
+ override;
void OnVoiceInteractionFrameworkInstanceReady(
- mojom::VoiceInteractionFrameworkInstancePtr framework_ptr) override;
+ mojo::PendingRemote<mojom::VoiceInteractionFrameworkInstance>
+ framework_remote) override;
void OnVolumeMounterInstanceReady(
- mojom::VolumeMounterInstancePtr volume_mounter_ptr) override;
+ mojo::PendingRemote<mojom::VolumeMounterInstance> volume_mounter_remote)
+ override;
void OnWakeLockInstanceReady(
- mojom::WakeLockInstancePtr wake_lock_ptr) override;
+ mojo::PendingRemote<mojom::WakeLockInstance> wake_lock_remote) override;
void OnWallpaperInstanceReady(
- mojom::WallpaperInstancePtr wallpaper_ptr) override;
+ mojo::PendingRemote<mojom::WallpaperInstance> wallpaper_remote) override;
private:
// Called when the bridge channel is closed. This typically only happens when
@@ -130,7 +168,7 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost {
// |T| is a ARC Mojo Instance type.
template <typename InstanceType, typename HostType>
void OnInstanceReady(ConnectionHolder<InstanceType, HostType>* holder,
- mojo::InterfacePtr<InstanceType> ptr);
+ mojo::PendingRemote<InstanceType> remote);
// Called if one of the established channels is closed.
void OnChannelClosed(MojoChannelBase* channel);
diff --git a/chromium/components/arc/session/arc_property_util.cc b/chromium/components/arc/session/arc_property_util.cc
index 9b6498c51fe..0a4ca1a4c66 100644
--- a/chromium/components/arc/session/arc_property_util.cc
+++ b/chromium/components/arc/session/arc_property_util.cc
@@ -216,7 +216,8 @@ bool ExpandPropertyContents(const std::string& content,
bool ExpandPropertyFile(const base::FilePath& input,
const base::FilePath& output,
- CrosConfig* config) {
+ CrosConfig* config,
+ bool append) {
std::string content;
std::string expanded;
if (!base::ReadFileToString(input, &content)) {
@@ -225,10 +226,17 @@ bool ExpandPropertyFile(const base::FilePath& input,
}
if (!ExpandPropertyContents(content, config, &expanded))
return false;
- if (base::WriteFile(output, expanded.data(), expanded.size()) !=
- static_cast<int>(expanded.size())) {
- PLOG(ERROR) << "Failed to write to " << output;
- return false;
+ if (append && base::PathExists(output)) {
+ if (!base::AppendToFile(output, expanded.data(), expanded.size())) {
+ PLOG(ERROR) << "Failed to append to " << output;
+ return false;
+ }
+ } else {
+ if (base::WriteFile(output, expanded.data(), expanded.size()) !=
+ static_cast<int>(expanded.size())) {
+ PLOG(ERROR) << "Failed to write to " << output;
+ return false;
+ }
}
return true;
}
@@ -287,22 +295,35 @@ bool TruncateAndroidPropertyForTesting(const std::string& line,
bool ExpandPropertyFileForTesting(const base::FilePath& input,
const base::FilePath& output,
CrosConfig* config) {
- return ExpandPropertyFile(input, output, config);
+ return ExpandPropertyFile(input, output, config, /*append=*/false);
}
bool ExpandPropertyFiles(const base::FilePath& source_path,
- const base::FilePath& dest_path) {
+ const base::FilePath& dest_path,
+ bool single_file) {
CrosConfig config;
- for (const char* file : {"default.prop", "build.prop", "vendor_build.prop"}) {
- if (!ExpandPropertyFile(source_path.Append(file), dest_path.Append(file),
- &config)) {
+ if (single_file)
+ base::DeleteFile(dest_path, /*recursive=*/false);
+
+ // default.prop may not exist. Silently skip it if not found.
+ for (const auto& pair : {std::pair<const char*, bool>{"default.prop", true},
+ {"build.prop", false},
+ {"vendor_build.prop", false}}) {
+ const char* file = pair.first;
+ const bool is_optional = pair.second;
+
+ if (is_optional && !base::PathExists(source_path.Append(file)))
+ continue;
+
+ if (!ExpandPropertyFile(source_path.Append(file),
+ single_file ? dest_path : dest_path.Append(file),
+ &config,
+ /*append=*/single_file)) {
LOG(ERROR) << "Failed to expand " << source_path.Append(file);
return false;
}
}
- // Use the same permissions as stock Android for /vendor/build.prop.
- return base::SetPosixFilePermissions(dest_path.Append("vendor_build.prop"),
- 0600);
+ return true;
}
} // namespace arc
diff --git a/chromium/components/arc/session/arc_property_util.h b/chromium/components/arc/session/arc_property_util.h
index ce780cfc787..4748e563f94 100644
--- a/chromium/components/arc/session/arc_property_util.h
+++ b/chromium/components/arc/session/arc_property_util.h
@@ -57,10 +57,13 @@ bool ExpandPropertyFileForTesting(const base::FilePath& input,
const base::FilePath& output,
CrosConfig* config);
-// Calls ExpandPropertyFile for {build,default}.prop files in |source_path|.
-// Expanded files are written in |dest_path|. Returns true on success.
+// Calls ExpandPropertyFile for {build,default,vendor_build}.prop files in
+// |source_path|. Expanded files are written in |dest_path|. Returns true on
+// success. When |single_file| is true, only one file (|dest_path| itself) is
+// written. All expanded properties are included in the single file.
bool ExpandPropertyFiles(const base::FilePath& source_path,
- const base::FilePath& dest_path);
+ const base::FilePath& dest_path,
+ bool single_file);
} // namespace arc
diff --git a/chromium/components/arc/session/arc_property_util_unittest.cc b/chromium/components/arc/session/arc_property_util_unittest.cc
index 29e8a5e0e13..1583bc1a5da 100644
--- a/chromium/components/arc/session/arc_property_util_unittest.cc
+++ b/chromium/components/arc/session/arc_property_util_unittest.cc
@@ -10,6 +10,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/strings/stringprintf.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/arc/test/fake_cros_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -286,36 +287,37 @@ TEST_F(ArcPropertyUtilTest, ExpandPropertyFile_CannotWrite) {
path, base::FilePath("/nonexistent2"), config()));
}
-TEST_F(ArcPropertyUtilTest, ExpandPropertyFiles_NoSource) {
+TEST_F(ArcPropertyUtilTest, ExpandPropertyFiles) {
// Both source and dest are not found.
EXPECT_FALSE(ExpandPropertyFiles(base::FilePath("/nonexistent1"),
- base::FilePath("/nonexistent2")));
+ base::FilePath("/nonexistent2"),
+ /*single_file=*/false));
// Both source and dest exist, but the source directory is empty.
base::FilePath source_dir;
ASSERT_TRUE(base::CreateTemporaryDirInDir(GetTempDir(), "test", &source_dir));
base::FilePath dest_dir;
ASSERT_TRUE(base::CreateTemporaryDirInDir(GetTempDir(), "test", &dest_dir));
- EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_dir));
+ EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_dir, false));
// Add default.prop to the source, but not build.prop.
base::FilePath default_prop = source_dir.Append("default.prop");
constexpr const char kDefaultProp[] = "ro.foo=bar\n";
base::WriteFile(default_prop, kDefaultProp, strlen(kDefaultProp));
- EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_dir));
+ EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_dir, false));
// Add build.prop too. The call should not succeed still.
base::FilePath build_prop = source_dir.Append("build.prop");
constexpr const char kBuildProp[] = "ro.baz=boo\n";
base::WriteFile(build_prop, kBuildProp, strlen(kBuildProp));
- EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_dir));
+ EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_dir, false));
// Add vendor_build.prop too. Then the call should succeed.
base::FilePath vendor_build_prop = source_dir.Append("vendor_build.prop");
constexpr const char kVendorBuildProp[] = "ro.a=b\n";
base::WriteFile(vendor_build_prop, kVendorBuildProp,
strlen(kVendorBuildProp));
- EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_dir));
+ EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_dir, false));
// Verify all dest files are there.
EXPECT_TRUE(base::PathExists(dest_dir.Append("default.prop")));
@@ -334,8 +336,100 @@ TEST_F(ArcPropertyUtilTest, ExpandPropertyFiles_NoSource) {
base::ReadFileToString(dest_dir.Append("vendor_build.prop"), &content));
EXPECT_EQ(std::string(kVendorBuildProp) + "\n", content);
+ // Expand it again, verify the previous result is cleared.
+ EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_dir, false));
+ EXPECT_TRUE(
+ base::ReadFileToString(dest_dir.Append("default.prop"), &content));
+ EXPECT_EQ(std::string(kDefaultProp) + "\n", content);
+
+ // If default.prop does not exist in the source path, it should still process
+ // the other files, while also ensuring that default.prop is removed from the
+ // destination path.
+ base::DeleteFile(dest_dir.Append("default.prop"), /*recursive=*/false);
+
+ EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_dir, false));
+
+ EXPECT_TRUE(base::ReadFileToString(dest_dir.Append("build.prop"), &content));
+ EXPECT_EQ(std::string(kBuildProp) + "\n", content);
+ EXPECT_TRUE(
+ base::ReadFileToString(dest_dir.Append("vendor_build.prop"), &content));
+ EXPECT_EQ(std::string(kVendorBuildProp) + "\n", content);
+
+ // Finally, test the case where source is valid but the dest is not.
+ EXPECT_FALSE(
+ ExpandPropertyFiles(source_dir, base::FilePath("/nonexistent"), false));
+}
+
+// Do the same as the previous test, but with |single_file| == true.
+TEST_F(ArcPropertyUtilTest, ExpandPropertyFiles_SingleFile) {
+ // Both source and dest are not found.
+ EXPECT_FALSE(ExpandPropertyFiles(base::FilePath("/nonexistent1"),
+ base::FilePath("/nonexistent2"),
+ /*single_file=*/true));
+
+ // Both source and dest exist, but the source directory is empty.
+ base::FilePath source_dir;
+ ASSERT_TRUE(base::CreateTemporaryDirInDir(GetTempDir(), "test", &source_dir));
+ base::FilePath dest_prop_file;
+ ASSERT_TRUE(
+ base::CreateTemporaryDirInDir(GetTempDir(), "test", &dest_prop_file));
+ dest_prop_file = dest_prop_file.Append("combined.prop");
+ EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_prop_file, true));
+
+ // Add default.prop to the source, but not build.prop.
+ base::FilePath default_prop = source_dir.Append("default.prop");
+ constexpr const char kDefaultProp[] = "ro.foo=bar\n";
+ base::WriteFile(default_prop, kDefaultProp, strlen(kDefaultProp));
+ EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_prop_file, true));
+
+ // Add build.prop too. The call should not succeed still.
+ base::FilePath build_prop = source_dir.Append("build.prop");
+ constexpr const char kBuildProp[] = "ro.baz=boo\n";
+ base::WriteFile(build_prop, kBuildProp, strlen(kBuildProp));
+ EXPECT_FALSE(ExpandPropertyFiles(source_dir, dest_prop_file, true));
+
+ // Add vendor_build.prop too. Then the call should succeed.
+ base::FilePath vendor_build_prop = source_dir.Append("vendor_build.prop");
+ constexpr const char kVendorBuildProp[] = "ro.a=b\n";
+ base::WriteFile(vendor_build_prop, kVendorBuildProp,
+ strlen(kVendorBuildProp));
+ EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_prop_file, true));
+
+ // Verify only one dest file exists.
+ EXPECT_FALSE(
+ base::PathExists(dest_prop_file.DirName().Append("default.prop")));
+ EXPECT_FALSE(base::PathExists(dest_prop_file.DirName().Append("build.prop")));
+ EXPECT_FALSE(
+ base::PathExists(dest_prop_file.DirName().Append("vendor_build.prop")));
+ EXPECT_TRUE(base::PathExists(dest_prop_file));
+
+ // Verify the content.
+ // Note: ExpandPropertyFileForTesting() adds a trailing LF.
+ std::string content;
+ EXPECT_TRUE(base::ReadFileToString(dest_prop_file, &content));
+ EXPECT_EQ(base::StringPrintf("%s\n%s\n%s\n", kDefaultProp, kBuildProp,
+ kVendorBuildProp),
+ content);
+
+ // Expand it again, verify the previous result is cleared.
+ EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_prop_file, true));
+ EXPECT_TRUE(base::ReadFileToString(dest_prop_file, &content));
+ EXPECT_EQ(base::StringPrintf("%s\n%s\n%s\n", kDefaultProp, kBuildProp,
+ kVendorBuildProp),
+ content);
+
+ // If default.prop does not exist in the source path, it should still process
+ // the other files.
+ base::DeleteFile(source_dir.Append("default.prop"),
+ /*recursive=*/false);
+ EXPECT_TRUE(ExpandPropertyFiles(source_dir, dest_prop_file, true));
+ EXPECT_TRUE(base::ReadFileToString(dest_prop_file, &content));
+ EXPECT_EQ(base::StringPrintf("%s\n%s\n", kBuildProp, kVendorBuildProp),
+ content);
+
// Finally, test the case where source is valid but the dest is not.
- EXPECT_FALSE(ExpandPropertyFiles(source_dir, base::FilePath("/nonexistent")));
+ EXPECT_FALSE(
+ ExpandPropertyFiles(source_dir, base::FilePath("/nonexistent"), true));
}
} // namespace
diff --git a/chromium/components/arc/session/arc_session_impl.cc b/chromium/components/arc/session/arc_session_impl.cc
index 3657d1c29a6..cecccda4961 100644
--- a/chromium/components/arc/session/arc_session_impl.cc
+++ b/chromium/components/arc/session/arc_session_impl.cc
@@ -375,7 +375,7 @@ void ArcSessionImpl::DoStartMiniInstance(size_t num_cores_disabled) {
base::FeatureList::IsEnabled(arc::kNativeBridgeToggleFeature);
params.arc_file_picker_experiment =
base::FeatureList::IsEnabled(arc::kFilePickerExperimentFeature);
- // Enable Custom Tabs only on Dev and Cannary, and only when Mash is enabled.
+ // Enable Custom Tabs only on Dev and Canary.
const bool is_custom_tab_enabled =
base::FeatureList::IsEnabled(arc::kCustomTabsExperimentFeature) &&
delegate_->GetChannel() != version_info::Channel::STABLE &&
diff --git a/chromium/components/arc/session/arc_vm_client_adapter.cc b/chromium/components/arc/session/arc_vm_client_adapter.cc
index aed435c112f..c9ffbb891b0 100644
--- a/chromium/components/arc/session/arc_vm_client_adapter.cc
+++ b/chromium/components/arc/session/arc_vm_client_adapter.cc
@@ -114,11 +114,12 @@ std::string MonotonicTimestamp() {
ArcBinaryTranslationType IdentifyBinaryTranslationType(
const StartParams& start_params) {
const auto* command_line = base::CommandLine::ForCurrentProcess();
- bool is_houdini_available =
+ const bool is_houdini_available =
command_line->HasSwitch(chromeos::switches::kEnableHoudini) ||
command_line->HasSwitch(chromeos::switches::kEnableHoudini64);
- bool is_ndk_translation_available =
- command_line->HasSwitch(chromeos::switches::kEnableNdkTranslation);
+ const bool is_ndk_translation_available =
+ command_line->HasSwitch(chromeos::switches::kEnableNdkTranslation) ||
+ command_line->HasSwitch(chromeos::switches::kEnableNdkTranslation64);
if (!is_houdini_available && !is_ndk_translation_available)
return ArcBinaryTranslationType::NONE;
@@ -219,14 +220,6 @@ vm_tools::concierge::StartArcVmRequest CreateStartArcVmRequest(
}
request.add_params("init=/init");
- // TIP: When you want to see all dmesg logs from the Android system processes
- // such as init, uncomment the following line. By default, the guest kernel
- // rate-limits the logging and you might not be able to see all LOGs from
- // them. The logs could be silently dropped. This is useful when modifying
- // init.bertha.rc, for example.
- //
- // request.add_params("printk.devkmsg=on");
-
for (auto& entry : kernel_cmdline)
request.add_params(std::move(entry));
@@ -234,27 +227,21 @@ vm_tools::concierge::StartArcVmRequest CreateStartArcVmRequest(
vm->set_kernel(file_system_status.guest_kernel_path().value());
- // Add / as /dev/vda.
+ // Add rootfs as /dev/vda.
vm->set_rootfs(file_system_status.system_image_path().value());
request.set_rootfs_writable(file_system_status.is_host_rootfs_writable() &&
file_system_status.is_system_image_ext_format());
- // Add /vendor as /dev/vdb.
+ // Add /vendor as /dev/block/vdb. The device name has to be consistent with
+ // the one in GenerateFirstStageFstab() in ../arc_util.cc.
vm_tools::concierge::DiskImage* disk_image = request.add_disks();
disk_image->set_path(file_system_status.vendor_image_path().value());
disk_image->set_image_type(vm_tools::concierge::DISK_IMAGE_AUTO);
disk_image->set_writable(false);
disk_image->set_do_mount(true);
- // Add /vendor as /dev/vdc.
- // TODO(yusukes): Remove /dev/vdc once Android side stops using it.
- disk_image = request.add_disks();
- disk_image->set_path(file_system_status.vendor_image_path().value());
- disk_image->set_image_type(vm_tools::concierge::DISK_IMAGE_AUTO);
- disk_image->set_writable(false);
- disk_image->set_do_mount(true);
-
- // Add /run/imageloader/.../android_demo_apps.squash as /dev/vdd if needed.
+ // Add /run/imageloader/.../android_demo_apps.squash as /dev/block/vdc if
+ // needed.
// TODO(b/144542975): Do this on upgrade instead.
if (!demo_session_apps_path.empty()) {
disk_image = request.add_disks();
@@ -482,7 +469,7 @@ class ArcVmClientAdapter : public ArcClientAdapter,
OnArcInstanceStopped();
}
- void ConciergeServiceRestarted() override {}
+ void ConciergeServiceStarted() override {}
private:
void OnArcBugReportBackedUp(bool result) {
@@ -537,8 +524,6 @@ class ArcVmClientAdapter : public ArcClientAdapter,
VLOG(1) << "OnArcVmServerProxyJobStopped: job "
<< (result ? "stopped" : "not running?");
- should_notify_observers_ = true;
-
// Make sure to stop arc-keymasterd if it's already started. Always move
// |callback| as is and ignore |result|.
chromeos::UpstartClient::Get()->StopJob(
@@ -616,6 +601,8 @@ class ArcVmClientAdapter : public ArcClientAdapter,
return;
}
std::move(callback).Run(true);
+ // StartMiniArc() successful. Update the member variable here.
+ should_notify_observers_ = true;
}
void OnConciergeStarted(UpgradeParams params,
diff --git a/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc b/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc
index 2328423e97b..067862033b5 100644
--- a/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc
+++ b/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc
@@ -58,7 +58,7 @@ constexpr int64_t kCid = 123;
StartParams GetPopulatedStartParams() {
StartParams params;
- params.native_bridge_experiment = true;
+ params.native_bridge_experiment = false;
params.lcd_density = 240;
params.arc_file_picker_experiment = true;
params.play_store_auto_update =
@@ -483,6 +483,10 @@ TEST_F(ArcVmClientAdapterTest, StartMiniArc) {
StartMiniArc();
// Confirm that no VM is started. ARCVM doesn't support mini ARC yet.
EXPECT_FALSE(GetTestConciergeClient()->start_arc_vm_called());
+
+ // TODO(wvk): Once mini VM is supported, call StopArcInstance() and
+ // SendVmStoppedSignal() here, then verify arc_instance_stopped_called()
+ // becomes true. See StopArcInstance test for more details.
}
// Tests that StartMiniArc() still succeeds even when Upstart fails to stop
@@ -494,6 +498,10 @@ TEST_F(ArcVmClientAdapterTest, StartMiniArc_StopArcVmServerProxyJobFail) {
StartMiniArc();
// Confirm that no VM is started. ARCVM doesn't support mini ARC yet.
EXPECT_FALSE(GetTestConciergeClient()->start_arc_vm_called());
+
+ // TODO(wvk): Once mini VM is supported, call StopArcInstance() here,
+ // then verify arc_instance_stopped_called() never becomes true. Same
+ // for other StartMiniArc_...Fail tests.
}
// Tests that StartMiniArc() fails if Upstart fails to start arc-keymasterd.
@@ -517,7 +525,7 @@ TEST_F(ArcVmClientAdapterTest, StartMiniArc_StopArcKeymasterJobFail) {
}
// Tests that StartMiniArc() fails when Upstart fails to start the job.
-TEST_F(ArcVmClientAdapterTest, StartMiniArc_Fail) {
+TEST_F(ArcVmClientAdapterTest, StartMiniArc_StartArcVmPerBoardFeaturesJobFail) {
// Inject failure to FakeUpstartClient.
InjectUpstartStartJobFailure(kArcVmPerBoardFeaturesJobName);
@@ -1011,11 +1019,11 @@ TEST_F(ArcVmClientAdapterTest, VmStartedSignal) {
run_loop()->RunUntilIdle();
}
-// Tests that ConciergeServiceRestarted() doesn't crash.
-TEST_F(ArcVmClientAdapterTest, TestConciergeServiceRestarted) {
+// Tests that ConciergeServiceStarted() doesn't crash.
+TEST_F(ArcVmClientAdapterTest, TestConciergeServiceStarted) {
StartMiniArc();
for (auto& observer : GetTestConciergeClient()->observer_list())
- observer.ConciergeServiceRestarted();
+ observer.ConciergeServiceStarted();
}
// Tests that the kernel parameter does not include "rw" by default.
@@ -1090,8 +1098,8 @@ TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNone) {
"androidboot.native_bridge=0"));
}
-// Tests that the binary translation type is set to Houdini when only Houdini
-// library is enabled by USE flags.
+// Tests that the binary translation type is set to Houdini when only 32-bit
+// Houdini library is enabled by USE flags.
TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeHoudini) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--enable-houdini"});
@@ -1104,8 +1112,8 @@ TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeHoudini) {
"androidboot.native_bridge=libhoudini.so"));
}
-// Tests that the binary translation type is set to Houdini when only Houdini
-// 64-bit library is enabled by USE flags.
+// Tests that the binary translation type is set to Houdini when only 64-bit
+// Houdini library is enabled by USE flags.
TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeHoudini64) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--enable-houdini64"});
@@ -1119,7 +1127,7 @@ TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeHoudini64) {
}
// Tests that the binary translation type is set to NDK translation when only
-// NDK translation library is enabled by USE flags.
+// 32-bit NDK translation library is enabled by USE flags.
TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNdkTranslation) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--enable-ndk-translation"});
@@ -1132,13 +1140,28 @@ TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNdkTranslation) {
"androidboot.native_bridge=libndk_translation.so"));
}
+// Tests that the binary translation type is set to NDK translation when only
+// 64-bit NDK translation library is enabled by USE flags.
+TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNdkTranslation64) {
+ base::CommandLine::ForCurrentProcess()->InitFromArgv(
+ {"", "--enable-ndk-translation64"});
+ StartParams start_params(GetPopulatedStartParams());
+ SetValidUserInfo();
+ StartMiniArcWithParams(true, std::move(start_params));
+ UpgradeArc(true);
+ EXPECT_TRUE(
+ base::Contains(GetTestConciergeClient()->start_arc_vm_request().params(),
+ "androidboot.native_bridge=libndk_translation.so"));
+}
+
// Tests that the binary translation type is set to NDK translation when both
// Houdini and NDK translation libraries are enabled by USE flags, and the
-// parameter start_params.native_bridge_experiment is set.
+// parameter start_params.native_bridge_experiment is set to true.
TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNativeBridgeExperiment) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--enable-houdini", "--enable-ndk-translation"});
StartParams start_params(GetPopulatedStartParams());
+ start_params.native_bridge_experiment = true;
SetValidUserInfo();
StartMiniArcWithParams(true, std::move(start_params));
UpgradeArc(true);
@@ -1149,7 +1172,7 @@ TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNativeBridgeExperiment) {
// Tests that the binary translation type is set to Houdini when both Houdini
// and NDK translation libraries are enabled by USE flags, and the parameter
-// start_params.native_bridge_experiment is not set.
+// start_params.native_bridge_experiment is set to false.
TEST_F(ArcVmClientAdapterTest, BintaryTranslationTypeNoNativeBridgeExperiment) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(
{"", "--enable-houdini", "--enable-ndk-translation"});
diff --git a/chromium/components/arc/session/connection_holder.h b/chromium/components/arc/session/connection_holder.h
index 0d35f5ff224..6dcfb061f3f 100644
--- a/chromium/components/arc/session/connection_holder.h
+++ b/chromium/components/arc/session/connection_holder.h
@@ -11,6 +11,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
@@ -133,8 +134,8 @@ class ConnectionHolderImpl {
// When both the instance and host are ready, start connection.
// TODO(crbug.com/750563): Fix the race issue.
auto receiver = std::make_unique<mojo::Receiver<HostType>>(host_);
- mojo::InterfacePtr<HostType> host_proxy;
- receiver->Bind(mojo::MakeRequest(&host_proxy));
+ mojo::PendingRemote<HostType> host_proxy;
+ receiver->Bind(host_proxy.InitWithNewPipeAndPassReceiver());
instance_->Init(
std::move(host_proxy),
base::BindOnce(&ConnectionHolderImpl::OnConnectionReady,
diff --git a/chromium/components/arc/session/file_system_status.cc b/chromium/components/arc/session/file_system_status.cc
index 3d0eb8f00f4..d4cccb9fcba 100644
--- a/chromium/components/arc/session/file_system_status.cc
+++ b/chromium/components/arc/session/file_system_status.cc
@@ -22,7 +22,7 @@ namespace {
constexpr const char kArcVmConfigJsonPath[] = "/usr/share/arcvm/config.json";
constexpr const char kBuiltinPath[] = "/opt/google/vms/android";
-constexpr const char kFstab[] = "fstab";
+constexpr const char kFstabPath[] = "/run/arcvm/host_generated/fstab";
constexpr const char kKernel[] = "vmlinux";
constexpr const char kRootFs[] = "system.raw.img";
constexpr const char kVendorImage[] = "vendor.raw.img";
@@ -41,7 +41,7 @@ FileSystemStatus::FileSystemStatus()
system_image_path_(base::FilePath(kBuiltinPath).Append(kRootFs)),
vendor_image_path_(base::FilePath(kBuiltinPath).Append(kVendorImage)),
guest_kernel_path_(base::FilePath(kBuiltinPath).Append(kKernel)),
- fstab_path_(base::FilePath(kBuiltinPath).Append(kFstab)),
+ fstab_path_(kFstabPath),
is_system_image_ext_format_(IsSystemImageExtFormat(system_image_path_)) {}
// static
diff --git a/chromium/components/arc/usb/usb_host_bridge.h b/chromium/components/arc/usb/usb_host_bridge.h
index 8082b97470e..f292a593a8c 100644
--- a/chromium/components/arc/usb/usb_host_bridge.h
+++ b/chromium/components/arc/usb/usb_host_bridge.h
@@ -108,7 +108,6 @@ class ArcUsbHostBridge : public KeyedService,
SEQUENCE_CHECKER(sequence_);
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
- mojom::UsbHostHostPtr usb_host_ptr_;
// Connection to the DeviceService for usb manager.
mojo::Remote<device::mojom::UsbDeviceManager> usb_manager_;
diff --git a/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc b/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc
index 9b4a79d431c..b38784c8f60 100644
--- a/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc
+++ b/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc
@@ -282,13 +282,13 @@ void GpuArcVideoDecodeAccelerator::ExecuteRequest(
void GpuArcVideoDecodeAccelerator::Initialize(
mojom::VideoDecodeAcceleratorConfigPtr config,
- mojom::VideoDecodeClientPtr client,
+ mojo::PendingRemote<mojom::VideoDecodeClient> client,
InitializeCallback callback) {
VLOGF(2) << "profile = " << config->profile
<< ", secure_mode = " << config->secure_mode;
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
CHECK(!client_);
- client_ = std::move(client);
+ client_.Bind(std::move(client));
auto result = InitializeTask(std::move(config));
diff --git a/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h b/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h
index 5de76657dd5..f3d2afa9e48 100644
--- a/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h
+++ b/chromium/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h
@@ -16,6 +16,8 @@
#include "components/arc/mojom/video_decode_accelerator.mojom.h"
#include "gpu/config/gpu_preferences.h"
#include "media/video/video_decode_accelerator.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
namespace arc {
@@ -61,7 +63,7 @@ class GpuArcVideoDecodeAccelerator
// mojom::VideoDecodeAccelerator implementation.
void Initialize(mojom::VideoDecodeAcceleratorConfigPtr config,
- mojom::VideoDecodeClientPtr client,
+ mojo::PendingRemote<mojom::VideoDecodeClient> client,
InitializeCallback callback) override;
void Decode(mojom::BitstreamBufferPtr bitstream_buffer) override;
void AssignPictureBuffers(uint32_t count) override;
@@ -72,7 +74,6 @@ class GpuArcVideoDecodeAccelerator
void ReusePictureBuffer(int32_t picture_buffer_id) override;
void Flush(FlushCallback callback) override;
void Reset(ResetCallback callback) override;
-
private:
using PendingCallback =
base::OnceCallback<void(mojom::VideoDecodeAccelerator::Result)>;
@@ -140,7 +141,7 @@ class GpuArcVideoDecodeAccelerator
gpu::GpuPreferences gpu_preferences_;
std::unique_ptr<media::VideoDecodeAccelerator> vda_;
- mojom::VideoDecodeClientPtr client_;
+ mojo::Remote<mojom::VideoDecodeClient> client_;
gfx::Size coded_size_;
gfx::Size pending_coded_size_;
diff --git a/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.cc b/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.cc
index 48b07c1ad4c..4db437aeeff 100644
--- a/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.cc
+++ b/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.cc
@@ -114,7 +114,7 @@ void GpuArcVideoEncodeAccelerator::GetSupportedProfiles(
void GpuArcVideoEncodeAccelerator::Initialize(
const media::VideoEncodeAccelerator::Config& config,
- VideoEncodeClientPtr client,
+ mojo::PendingRemote<mojom::VideoEncodeClient> client,
InitializeCallback callback) {
auto result = InitializeTask(config, std::move(client));
std::move(callback).Run(result);
@@ -122,7 +122,7 @@ void GpuArcVideoEncodeAccelerator::Initialize(
void GpuArcVideoEncodeAccelerator::InitializeDeprecated(
const media::VideoEncodeAccelerator::Config& config,
- VideoEncodeClientPtr client,
+ mojo::PendingRemote<mojom::VideoEncodeClient> client,
InitializeDeprecatedCallback callback) {
auto result = InitializeTask(config, std::move(client));
std::move(callback).Run(result ==
@@ -132,7 +132,7 @@ void GpuArcVideoEncodeAccelerator::InitializeDeprecated(
mojom::VideoEncodeAccelerator::Result
GpuArcVideoEncodeAccelerator::InitializeTask(
const media::VideoEncodeAccelerator::Config& config,
- VideoEncodeClientPtr client) {
+ mojo::PendingRemote<mojom::VideoEncodeClient> client) {
DVLOGF(2) << config.AsHumanReadableString();
if (!config.storage_type.has_value()) {
DLOG(ERROR) << "storage type must be specified";
@@ -147,7 +147,7 @@ GpuArcVideoEncodeAccelerator::InitializeTask(
DLOG(ERROR) << "Failed to create a VideoEncodeAccelerator.";
return mojom::VideoEncodeAccelerator::Result::kPlatformFailureError;
}
- client_ = std::move(client);
+ client_.Bind(std::move(client));
return mojom::VideoEncodeAccelerator::Result::kSuccess;
}
diff --git a/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h b/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h
index 63508c124a8..8531b7ee13d 100644
--- a/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h
+++ b/chromium/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h
@@ -16,6 +16,8 @@
#include "gpu/config/gpu_preferences.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/video/video_encode_accelerator.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
namespace arc {
@@ -33,7 +35,6 @@ class GpuArcVideoEncodeAccelerator
using VideoPixelFormat = media::VideoPixelFormat;
using VideoCodecProfile = media::VideoCodecProfile;
using Error = media::VideoEncodeAccelerator::Error;
- using VideoEncodeClientPtr = ::arc::mojom::VideoEncodeClientPtr;
// VideoEncodeAccelerator::Client implementation.
void RequireBitstreamBuffers(unsigned int input_count,
@@ -48,14 +49,15 @@ class GpuArcVideoEncodeAccelerator
void GetSupportedProfiles(GetSupportedProfilesCallback callback) override;
void Initialize(const media::VideoEncodeAccelerator::Config& config,
- VideoEncodeClientPtr client,
+ mojo::PendingRemote<mojom::VideoEncodeClient> client,
InitializeCallback callback) override;
- void InitializeDeprecated(const media::VideoEncodeAccelerator::Config& config,
- VideoEncodeClientPtr client,
- InitializeDeprecatedCallback callback) override;
+ void InitializeDeprecated(
+ const media::VideoEncodeAccelerator::Config& config,
+ mojo::PendingRemote<mojom::VideoEncodeClient> client,
+ InitializeDeprecatedCallback callback) override;
mojom::VideoEncodeAccelerator::Result InitializeTask(
const media::VideoEncodeAccelerator::Config& config,
- VideoEncodeClientPtr client);
+ mojo::PendingRemote<mojom::VideoEncodeClient> client);
void Encode(media::VideoPixelFormat format,
mojo::ScopedHandle fd,
@@ -86,7 +88,7 @@ class GpuArcVideoEncodeAccelerator
gpu::GpuPreferences gpu_preferences_;
std::unique_ptr<media::VideoEncodeAccelerator> accelerator_;
- ::arc::mojom::VideoEncodeClientPtr client_;
+ mojo::Remote<::arc::mojom::VideoEncodeClient> client_;
gfx::Size coded_size_;
gfx::Size visible_size_;
VideoPixelFormat input_pixel_format_;