diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-20 13:40:20 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-22 12:41:23 +0000 |
commit | 7961cea6d1041e3e454dae6a1da660b453efd238 (patch) | |
tree | c0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/components/arc | |
parent | b7034d0803538058e5c9d904ef03cf5eab34f6ef (diff) | |
download | qtwebengine-chromium-7961cea6d1041e3e454dae6a1da660b453efd238.tar.gz |
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/arc')
209 files changed, 1429 insertions, 2093 deletions
diff --git a/chromium/components/arc/BUILD.gn b/chromium/components/arc/BUILD.gn index b8b2b203908..63568d5672b 100644 --- a/chromium/components/arc/BUILD.gn +++ b/chromium/components/arc/BUILD.gn @@ -102,7 +102,8 @@ static_library("arc") { "//chromeos/network", "//components/account_id", "//components/exo", - "//components/google/core/browser", + "//components/google/core/common", + "//components/guest_os", "//components/onc", "//components/prefs", "//components/session_manager/core", @@ -143,6 +144,7 @@ static_library("prefs") { deps = [ ":arc_base_enums", + "//components/guest_os:prefs", "//components/prefs", ] } @@ -174,6 +176,7 @@ static_library("arc_base_utils") { "//ash/public/cpp", "//base", "//chromeos/constants", + "//chromeos/dbus:dbus", "//chromeos/dbus/session_manager", "//components/exo", "//ui/aura", @@ -237,7 +240,7 @@ static_library("arc_base") { ":arc_base_utils", ":connection_holder", ":prefs", - "//components/arc/common", + "//components/arc/mojom", "//dbus", ] } @@ -267,7 +270,7 @@ static_library("notification_test_support") { public_deps = [ ":connection_holder", - "//components/arc/common:notifications", + "//components/arc/mojom:notifications", ] } @@ -335,7 +338,7 @@ source_set("unit_tests") { sources = [ "arc_features_parser_unittest.cc", "arc_util_unittest.cc", - "bluetooth/bluetooth_struct_traits_unittest.cc", + "bluetooth/bluetooth_mojom_traits_unittest.cc", "bluetooth/bluetooth_type_converters_unittest.cc", "clipboard/arc_clipboard_bridge_unittest.cc", "ime/arc_ime_service_unittest.cc", @@ -352,7 +355,6 @@ source_set("unit_tests") { "session/arc_data_remover_unittest.cc", "session/arc_session_impl_unittest.cc", "session/arc_session_runner_unittest.cc", - "session/arc_vm_client_adapter_unittest.cc", "timer/arc_timer_bridge_unittest.cc", "wake_lock/arc_wake_lock_bridge_unittest.cc", ] diff --git a/chromium/components/arc/DEPS b/chromium/components/arc/DEPS index 2f1503f0451..955ca638cc5 100644 --- a/chromium/components/arc/DEPS +++ b/chromium/components/arc/DEPS @@ -3,6 +3,7 @@ include_rules = [ "+chromeos/constants", "+chromeos/cryptohome", "+chromeos/dbus", + "+components/guest_os", "+components/account_id", "+components/exo", "+components/keyed_service", @@ -38,6 +39,6 @@ specific_include_rules = { "+ui/aura", ], ".*_unittest.cc": [ - "+content/public/test/test_browser_thread_bundle.h" + "+content/public/test/browser_task_environment.h" ], } diff --git a/chromium/components/arc/OWNERS b/chromium/components/arc/OWNERS index ab4ebe9c76a..d2b9a649ec6 100644 --- a/chromium/components/arc/OWNERS +++ b/chromium/components/arc/OWNERS @@ -2,3 +2,5 @@ hidehiko@chromium.org yusukes@chromium.org # backup reviewer elijahtaylor@chromium.org + +# COMPONENT: Platform>Apps>ARC diff --git a/chromium/components/arc/app_permissions/arc_app_permissions_bridge.h b/chromium/components/arc/app_permissions/arc_app_permissions_bridge.h index c83e4b90051..7c3ba6fc33c 100644 --- a/chromium/components/arc/app_permissions/arc_app_permissions_bridge.h +++ b/chromium/components/arc/app_permissions/arc_app_permissions_bridge.h @@ -6,7 +6,7 @@ #define COMPONENTS_ARC_APP_PERMISSIONS_ARC_APP_PERMISSIONS_BRIDGE_H_ #include "base/macros.h" -#include "components/arc/common/app_permissions.mojom.h" +#include "components/arc/mojom/app_permissions.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/appfuse/arc_appfuse_bridge.h b/chromium/components/arc/appfuse/arc_appfuse_bridge.h index 615f01b2ceb..963f38e18a1 100644 --- a/chromium/components/arc/appfuse/arc_appfuse_bridge.h +++ b/chromium/components/arc/appfuse/arc_appfuse_bridge.h @@ -8,7 +8,7 @@ #include <stdint.h> #include "base/macros.h" -#include "components/arc/common/appfuse.mojom.h" +#include "components/arc/mojom/appfuse.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/arc_features.cc b/chromium/components/arc/arc_features.cc index e3293d027f6..e5502898ddc 100644 --- a/chromium/components/arc/arc_features.cc +++ b/chromium/components/arc/arc_features.cc @@ -6,10 +6,6 @@ namespace arc { -// Controls whether ARC is available for CHILD accounts. -const base::Feature kAvailableForChildAccountFeature{ - "ArcAvailableForChildAccount", base::FEATURE_ENABLED_BY_DEFAULT}; - // Controls whether ARC++ app runtime performance statistics collection is // enabled. const base::Feature kAppRuntimePerormanceStatistics{ @@ -52,14 +48,17 @@ const base::Feature kEnableUnifiedAudioFocusFeature{ const base::Feature kFilePickerExperimentFeature{ "ArcFilePickerExperiment", base::FEATURE_ENABLED_BY_DEFAULT}; -// Controls experimental ARC graphic buffers visualization tools. -const base::Feature kGraphicBuffersVisualizationTool{ - "ArcGraphicBuffersVisualizationTool", base::FEATURE_DISABLED_BY_DEFAULT}; +// Toggles between native bridge implementations for ARC. +// Note, that we keep the original feature name to preserve +// corresponding metrics. +const base::Feature kNativeBridgeToggleFeature{ + "ArcNativeBridgeExperiment", base::FEATURE_ENABLED_BY_DEFAULT}; -// Controls experimental native bridge feature for ARC. -const base::Feature kNativeBridgeExperimentFeature { - "ArcNativeBridgeExperiment", base::FEATURE_ENABLED_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 +// will be disabled. +const base::Feature kPictureInPictureFeature{"ArcPictureInPicture", + base::FEATURE_ENABLED_BY_DEFAULT}; // Controls experimental print spooler feature for ARC. const base::Feature kPrintSpoolerExperimentFeature{ @@ -80,7 +79,7 @@ const base::Feature kUsbHostFeature{"ArcUsbHost", // When enabled, chrome://settings and Files.app will ask if the user wants // to expose USB storage devices to ARC. const base::Feature kUsbStorageUIFeature{"ArcUsbStorageUI", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Controls ARC VPN integration. // When enabled, Chrome traffic will be routed through VPNs connected in diff --git a/chromium/components/arc/arc_features.h b/chromium/components/arc/arc_features.h index ea3a79876a4..6cbf9eb7d49 100644 --- a/chromium/components/arc/arc_features.h +++ b/chromium/components/arc/arc_features.h @@ -12,7 +12,6 @@ namespace arc { // Please keep alphabetized. -extern const base::Feature kAvailableForChildAccountFeature; extern const base::Feature kAppRuntimePerormanceStatistics; extern const base::Feature kBootCompletedBroadcastFeature; extern const base::Feature kCleanArcDataOnRegularToChildTransitionFeature; @@ -22,8 +21,8 @@ extern const base::Feature kEnableDocumentsProviderInFilesAppFeature; extern const base::Feature kEnableRegularToChildTransitionFeature; extern const base::Feature kEnableUnifiedAudioFocusFeature; extern const base::Feature kFilePickerExperimentFeature; -extern const base::Feature kGraphicBuffersVisualizationTool; -extern const base::Feature kNativeBridgeExperimentFeature; +extern const base::Feature kNativeBridgeToggleFeature; +extern const base::Feature kPictureInPictureFeature; extern const base::Feature kPrintSpoolerExperimentFeature; extern const base::Feature kSmartTextSelectionFeature; extern const base::Feature kUsbHostFeature; diff --git a/chromium/components/arc/arc_features_parser.cc b/chromium/components/arc/arc_features_parser.cc index 8c031c1f3d6..1235e2d3ae3 100644 --- a/chromium/components/arc/arc_features_parser.cc +++ b/chromium/components/arc/arc_features_parser.cc @@ -141,8 +141,9 @@ ArcFeatures& ArcFeatures::operator=(ArcFeatures&& other) = default; void ArcFeaturesParser::GetArcFeatures( base::OnceCallback<void(base::Optional<ArcFeatures>)> callback) { - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, + base::PostTaskAndReplyWithResult( + FROM_HERE, + {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT}, base::BindOnce(&ReadOnFileThread, base::FilePath(kArcFeaturesJsonFile)), std::move(callback)); } diff --git a/chromium/components/arc/arc_prefs.cc b/chromium/components/arc/arc_prefs.cc index 9b2b91b93f2..8065710be4c 100644 --- a/chromium/components/arc/arc_prefs.cc +++ b/chromium/components/arc/arc_prefs.cc @@ -7,6 +7,7 @@ #include <string> +#include "components/guest_os/guest_os_prefs.h" #include "components/prefs/pref_registry_simple.h" namespace arc { @@ -40,8 +41,14 @@ const char kArcDataRemoveRequested[] = "arc.data.remove_requested"; // SetArcPlayStoreEnabledForProfile()) in chrome/browser/chromeos/arc/arc_util. const char kArcEnabled[] = "arc.enabled"; // A preference to control if ARC can access removable media on the host side. +// TODO(fukino): Remove this pref once "Play Store applications can't access +// this device" toast in Files app becomes aware of kArcVisibleExternalStorages. +// crbug.com/998512. const char kArcHasAccessToRemovableMedia[] = "arc.has_access_to_removable_media"; +// A preference to keep list of external storages which are visible to Android +// apps. (i.e. can be read/written by Android apps.) +const char kArcVisibleExternalStorages[] = "arc.visible_external_storages"; // A preference that indicates that initial settings need to be applied. Initial // settings are applied only once per new OptIn once mojo settings instance is // ready. Each OptOut resets this preference. Note, its sense is close to @@ -99,38 +106,9 @@ const char kArcCompatibleFilesystemChosen[] = // Integer pref indicating the ecryptfs to ext4 migration strategy. One of // options: forbidden = 0, migrate = 1, wipe = 2 or minimal migrate = 4. const char kEcryptfsMigrationStrategy[] = "ecryptfs_migration_strategy"; -// A preference that persists total engagement time across sessions, which is -// accumulated and sent to UMA once a day. -const char kEngagementTimeTotal[] = "arc.metrics.engagement_time.total"; -// A preference that persists foreground engagement time across sessions, which -// is accumulated and sent to UMA once a day. -const char kEngagementTimeForeground[] = - "arc.metrics.engagement_time.foreground"; -// A preference that persists background engagement time across sessions, which -// is accumulated and sent to UMA once a day. -const char kEngagementTimeBackground[] = - "arc.metrics.engagement_time.background"; -// A preference that saves the OS version when engagement time was last -// recorded. Old results will be discarded if a version change is detected. -const char kEngagementTimeOsVersion[] = - "arc.metrics.engagement_time.os_version"; -// A preference that saves the day ID (number of days since origin of Time) when -// engagement time was last recorded. Accumulated results are sent to UMA if day -// ID has changed. -const char kEngagementTimeDayId[] = "arc.metrics.engagement_time.day_id"; -// A preference that indicates the user has allowed voice interaction services -// to access the "context" (text and graphic content that is currently on -// screen). This preference can be overridden by the -// VoiceInteractionContextEnabled administrator policy. -const char kVoiceInteractionContextEnabled[] = - "settings.voice_interaction.context.enabled"; -// A preference that indicates the user has enabled voice interaction services. -const char kVoiceInteractionEnabled[] = "settings.voice_interaction.enabled"; -// A preference that indicates the user has allowed voice interaction services -// to use hotword listening. This preference can be overridden by the -// VoiceInteractionHotwordEnabled administrator policy. -const char kVoiceInteractionHotwordEnabled[] = - "settings.voice_interaction.hotword.enabled"; +// Preferences for storing engagement time data, as per +// GuestOsEngagementMetrics. +const char kEngagementPrefsPrefix[] = "arc.metrics"; // ======== LOCAL STATE PREFS ======== @@ -166,6 +144,9 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { kArcSupervisionTransition, static_cast<int>(ArcSupervisionTransition::NO_TRANSITION)); + guest_os::prefs::RegisterEngagementProfilePrefs(registry, + kEngagementPrefsPrefix); + // Sorted in lexicographical order. registry->RegisterBooleanPref(kAlwaysOnVpnLockdown, false); registry->RegisterStringPref(kAlwaysOnVpnPackage, std::string()); @@ -182,14 +163,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(kArcSkippedReportingNotice, false); registry->RegisterBooleanPref(kArcTermsAccepted, false); registry->RegisterBooleanPref(kArcTermsShownInOobe, false); - registry->RegisterTimeDeltaPref(kEngagementTimeBackground, base::TimeDelta()); - registry->RegisterIntegerPref(kEngagementTimeDayId, 0); - registry->RegisterTimeDeltaPref(kEngagementTimeForeground, base::TimeDelta()); - registry->RegisterStringPref(kEngagementTimeOsVersion, ""); - registry->RegisterTimeDeltaPref(kEngagementTimeTotal, base::TimeDelta()); - registry->RegisterBooleanPref(kVoiceInteractionContextEnabled, false); - registry->RegisterBooleanPref(kVoiceInteractionEnabled, false); - registry->RegisterBooleanPref(kVoiceInteractionHotwordEnabled, false); + registry->RegisterListPref(kArcVisibleExternalStorages); } } // namespace prefs diff --git a/chromium/components/arc/arc_prefs.h b/chromium/components/arc/arc_prefs.h index 671128c6bba..d4d00f56366 100644 --- a/chromium/components/arc/arc_prefs.h +++ b/chromium/components/arc/arc_prefs.h @@ -39,16 +39,9 @@ ARC_EXPORT extern const char kArcSkippedReportingNotice[]; ARC_EXPORT extern const char kArcSupervisionTransition[]; ARC_EXPORT extern const char kArcTermsAccepted[]; ARC_EXPORT extern const char kArcTermsShownInOobe[]; +ARC_EXPORT extern const char kArcVisibleExternalStorages[]; ARC_EXPORT extern const char kEcryptfsMigrationStrategy[]; -ARC_EXPORT extern const char kEngagementTimeBackground[]; -ARC_EXPORT extern const char kEngagementTimeDayId[]; -ARC_EXPORT extern const char kEngagementTimeForeground[]; -ARC_EXPORT extern const char kEngagementTimeOsVersion[]; -ARC_EXPORT extern const char kEngagementTimeTotal[]; -// TODO(b/110211045): Move Assistant related prefs to ash. -ARC_EXPORT extern const char kVoiceInteractionContextEnabled[]; -ARC_EXPORT extern const char kVoiceInteractionEnabled[]; -ARC_EXPORT extern const char kVoiceInteractionHotwordEnabled[]; +ARC_EXPORT extern const char kEngagementPrefsPrefix[]; // Local state prefs in lexicographical order. ARC_EXPORT extern const char kStabilityMetrics[]; diff --git a/chromium/components/arc/arc_util.cc b/chromium/components/arc/arc_util.cc index d5084ad4a0e..245e442e6cc 100644 --- a/chromium/components/arc/arc_util.cc +++ b/chromium/components/arc/arc_util.cc @@ -11,7 +11,10 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/feature_list.h" +#include "base/optional.h" #include "chromeos/constants/chromeos_switches.h" +#include "chromeos/dbus/concierge_client.h" +#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/session_manager/session_manager_client.h" #include "components/arc/arc_features.h" #include "components/exo/shell_surface_util.h" @@ -48,6 +51,46 @@ void SetArcCpuRestrictionCallback( LOG(ERROR) << "Failed to " << message << " ARC"; } +void OnSetArcVmCpuRestriction( + base::Optional<vm_tools::concierge::SetVmCpuRestrictionResponse> response) { + if (!response) { + LOG(ERROR) << "Failed to call SetVmCpuRestriction"; + return; + } + if (!response->success()) + LOG(ERROR) << "SetVmCpuRestriction for ARCVM failed"; +} + +void SetArcVmCpuRestriction(bool do_restrict) { + auto* client = chromeos::DBusThreadManager::Get()->GetConciergeClient(); + if (!client) { + LOG(WARNING) << "ConciergeClient is not available"; + return; + } + + vm_tools::concierge::SetVmCpuRestrictionRequest request; + request.set_cpu_cgroup(vm_tools::concierge::CPU_CGROUP_ARCVM); + request.set_cpu_restriction_state( + do_restrict ? vm_tools::concierge::CPU_RESTRICTION_BACKGROUND + : vm_tools::concierge::CPU_RESTRICTION_FOREGROUND); + + client->SetVmCpuRestriction(request, + base::BindOnce(&OnSetArcVmCpuRestriction)); +} + +void SetArcContainerCpuRestriction(bool do_restrict) { + if (!chromeos::SessionManagerClient::Get()) { + LOG(WARNING) << "SessionManagerClient is not available"; + return; + } + + const login_manager::ContainerCpuRestrictionState state = + do_restrict ? login_manager::CONTAINER_CPU_RESTRICTION_BACKGROUND + : login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND; + chromeos::SessionManagerClient::Get()->SetArcCpuRestriction( + state, base::BindOnce(SetArcCpuRestrictionCallback, state)); +} + } // namespace bool IsArcAvailable() { @@ -77,16 +120,6 @@ bool IsArcVmEnabled() { chromeos::switches::kEnableArcVm); } -void EnableArcVmForTesting() { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - chromeos::switches::kEnableArcVm); -} - -void DisableArcVmForTesting() { - base::CommandLine::ForCurrentProcess()->RemoveSwitch( - chromeos::switches::kEnableArcVm); -} - bool ShouldArcAlwaysStart() { const auto* command_line = base::CommandLine::ForCurrentProcess(); if (!command_line->HasSwitch(chromeos::switches::kArcStartMode)) @@ -167,12 +200,6 @@ bool IsArcAllowedForUser(const user_manager::User* user) { return false; } - if (user->GetType() == user_manager::USER_TYPE_CHILD && - !base::FeatureList::IsEnabled(arc::kAvailableForChildAccountFeature)) { - VLOG(1) << "ARC usage by Child users is prohibited"; - return false; - } - return true; } @@ -205,21 +232,16 @@ int GetTaskIdFromWindowAppId(const std::string& app_id) { } void SetArcCpuRestriction(bool do_restrict) { - if (!chromeos::SessionManagerClient::Get()) { - LOG(WARNING) << "SessionManagerClient is not available"; - return; - } - // Ignore any calls to restrict the ARC container if the specified command // line flag is set. if (chromeos::switches::IsArcCpuRestrictionDisabled() && do_restrict) return; - const login_manager::ContainerCpuRestrictionState state = - do_restrict ? login_manager::CONTAINER_CPU_RESTRICTION_BACKGROUND - : login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND; - chromeos::SessionManagerClient::Get()->SetArcCpuRestriction( - state, base::BindOnce(SetArcCpuRestrictionCallback, state)); + if (IsArcVmEnabled()) { + SetArcVmCpuRestriction(do_restrict); + } else { + SetArcContainerCpuRestriction(do_restrict); + } } bool IsArcForceCacheAppIcon() { @@ -249,13 +271,15 @@ bool IsArcPlayAutoInstallDisabled() { // static int32_t GetLcdDensityForDeviceScaleFactor(float device_scale_factor) { - // Keep this consistent with wayland_client.cpp on Android side. - // TODO(oshima): Consider sending this through wayland. + // TODO(b/131884992): Remove the logic to update default lcd density once + // per-display-density is supported. constexpr float kEpsilon = 0.001; if (std::abs(device_scale_factor - 2.25f) < kEpsilon) return 280; if (std::abs(device_scale_factor - 1.6f) < kEpsilon) return 213; // TVDPI + if (std::abs(device_scale_factor - 2.5f) < kEpsilon) + return 320; // XHDPI constexpr float kChromeScaleToAndroidScaleRatio = 0.75f; constexpr int32_t kDefaultDensityDpi = 160; diff --git a/chromium/components/arc/arc_util.h b/chromium/components/arc/arc_util.h index f6b7b929cf1..7660757d220 100644 --- a/chromium/components/arc/arc_util.h +++ b/chromium/components/arc/arc_util.h @@ -43,11 +43,6 @@ bool IsArcAvailable(); // Returns true if ARC VM is enabled. bool IsArcVmEnabled(); -// These two methods used for testing only add and remove the arcvm flag so that -// IsArcVmEnabled() returns the corresponding result. -void EnableArcVmForTesting(); -void DisableArcVmForTesting(); - // Returns true if ARC should always start within the primary user session // (opted in user or not), and other supported mode such as guest and Kiosk // mode. diff --git a/chromium/components/arc/arc_util_unittest.cc b/chromium/components/arc/arc_util_unittest.cc index fd75726b1ac..db092c67fd4 100644 --- a/chromium/components/arc/arc_util_unittest.cc +++ b/chromium/components/arc/arc_util_unittest.cc @@ -231,18 +231,6 @@ TEST_F(ArcUtilTest, IsArcAllowedForUser) { EXPECT_TRUE(IsArcAllowedForUser(ephemeral_user)); } -TEST_F(ArcUtilTest, IsArcAllowedForChildUserWithExperiment) { - auto* command_line = base::CommandLine::ForCurrentProcess(); - command_line->InitFromArgv( - {"", "--enable-features=ArcAvailableForChildAccount"}); - base::test::ScopedFeatureList feature_list; - feature_list.InitFromCommandLine( - command_line->GetSwitchValueASCII(switches::kEnableFeatures), - command_line->GetSwitchValueASCII(switches::kDisableFeatures)); - const FakeUser user(user_manager::USER_TYPE_CHILD); - EXPECT_TRUE(IsArcAllowedForUser(&user)); -} - TEST_F(ArcUtilTest, ArcStartModeDefault) { auto* command_line = base::CommandLine::ForCurrentProcess(); command_line->InitFromArgv({"", "--arc-availability=installed"}); @@ -266,6 +254,7 @@ TEST_F(ArcUtilTest, ScaleFactorToDensity) { EXPECT_EQ(213, GetLcdDensityForDeviceScaleFactor(1.6f)); EXPECT_EQ(240, GetLcdDensityForDeviceScaleFactor(2.0f)); EXPECT_EQ(280, GetLcdDensityForDeviceScaleFactor(2.25f)); + EXPECT_EQ(320, GetLcdDensityForDeviceScaleFactor(2.5f)); // Bad scale factors shouldn't blow up. EXPECT_EQ(160, GetLcdDensityForDeviceScaleFactor(0.5f)); diff --git a/chromium/components/arc/audio/arc_audio_bridge.h b/chromium/components/arc/audio/arc_audio_bridge.h index 347b91cf023..7ef4c147b42 100644 --- a/chromium/components/arc/audio/arc_audio_bridge.h +++ b/chromium/components/arc/audio/arc_audio_bridge.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "chromeos/audio/cras_audio_handler.h" -#include "components/arc/common/audio.mojom.h" +#include "components/arc/mojom/audio.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" diff --git a/chromium/components/arc/bitmap/OWNERS b/chromium/components/arc/bitmap/OWNERS index ef5cf841917..012a33c0b1c 100644 --- a/chromium/components/arc/bitmap/OWNERS +++ b/chromium/components/arc/bitmap/OWNERS @@ -1,3 +1,3 @@ -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/bitmap/bitmap_struct_traits.cc b/chromium/components/arc/bitmap/bitmap_mojom_traits.cc index 868734b4c27..9abd471de49 100644 --- a/chromium/components/arc/bitmap/bitmap_struct_traits.cc +++ b/chromium/components/arc/bitmap/bitmap_mojom_traits.cc @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/bitmap/bitmap_struct_traits.h" +#include "components/arc/bitmap/bitmap_mojom_traits.h" namespace mojo { -bool StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap>:: - Read(arc::mojom::ArcBitmapDataView data, SkBitmap* out) { +bool StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap>::Read( + arc::mojom::ArcBitmapDataView data, + SkBitmap* out) { mojo::ArrayDataView<uint8_t> pixel_data; data.GetPixelDataDataView(&pixel_data); SkImageInfo info = SkImageInfo::Make( - data.width(), data.height(), - kRGBA_8888_SkColorType, kPremul_SkAlphaType); + data.width(), data.height(), kRGBA_8888_SkColorType, kPremul_SkAlphaType); if (info.computeByteSize(info.minRowBytes()) > pixel_data.size()) { // Insufficient buffer size. return false; @@ -22,9 +22,8 @@ bool StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap>:: // Create the SkBitmap object which wraps the arc bitmap pixels. This // doesn't copy and |data| and |bitmap| share the buffer. SkBitmap bitmap; - if (!bitmap.installPixels(info, - const_cast<uint8_t*>(pixel_data.data()), - info.minRowBytes())) { + if (!bitmap.installPixels(info, const_cast<uint8_t*>(pixel_data.data()), + info.minRowBytes())) { // Error in installing pixels. return false; } diff --git a/chromium/components/arc/bitmap/bitmap_struct_traits.h b/chromium/components/arc/bitmap/bitmap_mojom_traits.h index d750ce813b6..a39b987785f 100644 --- a/chromium/components/arc/bitmap/bitmap_struct_traits.h +++ b/chromium/components/arc/bitmap/bitmap_mojom_traits.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_BITMAP_BITMAP_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_BITMAP_BITMAP_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ #include "base/containers/span.h" -#include "components/arc/common/bitmap.mojom.h" +#include "components/arc/mojom/bitmap.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" namespace mojo { @@ -28,4 +28,4 @@ struct StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap> { } // namespace mojo -#endif // COMPONENTS_ARC_BITMAP_BITMAP_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_BITMAP_BITMAP_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/bluetooth/OWNERS b/chromium/components/arc/bluetooth/OWNERS index 40f6a3e842b..28b1b58bb21 100644 --- a/chromium/components/arc/bluetooth/OWNERS +++ b/chromium/components/arc/bluetooth/OWNERS @@ -1,7 +1,7 @@ per-file *_type_converter*.*=set noparent per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS -per-file *_type_converter*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_type_converter*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/bluetooth/bluetooth_struct_traits.cc b/chromium/components/arc/bluetooth/bluetooth_mojom_traits.cc index e10d42f9fb3..9272ce6b909 100644 --- a/chromium/components/arc/bluetooth/bluetooth_struct_traits.cc +++ b/chromium/components/arc/bluetooth/bluetooth_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/bluetooth/bluetooth_struct_traits.h" +#include "components/arc/bluetooth/bluetooth_mojom_traits.h" #include <initializer_list> #include <map> @@ -124,9 +124,9 @@ StructTraits<arc::mojom::BluetoothUUIDDataView, device::BluetoothUUID>::uuid( // static bool StructTraits<arc::mojom::BluetoothUUIDDataView, - device::BluetoothUUID>::Read( - arc::mojom::BluetoothUUIDDataView data, - device::BluetoothUUID* output) { + device::BluetoothUUID>::Read(arc::mojom::BluetoothUUIDDataView + data, + device::BluetoothUUID* output) { std::vector<uint8_t> address_bytes; if (!data.ReadUuid(&address_bytes)) return false; diff --git a/chromium/components/arc/bluetooth/bluetooth_struct_traits.h b/chromium/components/arc/bluetooth/bluetooth_mojom_traits.h index 5ae85d1cfc6..c696fc8a632 100644 --- a/chromium/components/arc/bluetooth/bluetooth_struct_traits.h +++ b/chromium/components/arc/bluetooth/bluetooth_mojom_traits.h @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_MOJOM_TRAITS_H_ #include <memory> #include <vector> -#include "components/arc/common/bluetooth.mojom.h" +#include "components/arc/mojom/bluetooth.mojom.h" #include "device/bluetooth/bluetooth_advertisement.h" #include "device/bluetooth/bluetooth_common.h" #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" @@ -17,8 +17,7 @@ namespace mojo { template <> -struct EnumTraits<arc::mojom::BluetoothDeviceType, - device::BluetoothTransport> { +struct EnumTraits<arc::mojom::BluetoothDeviceType, device::BluetoothTransport> { static arc::mojom::BluetoothDeviceType ToMojom( device::BluetoothTransport type) { switch (type) { @@ -134,4 +133,4 @@ struct StructTraits<arc::mojom::BluetoothAdvertisementDataView, } // namespace mojo -#endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_BLUETOOTH_BLUETOOTH_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/bluetooth/bluetooth_struct_traits_unittest.cc b/chromium/components/arc/bluetooth/bluetooth_mojom_traits_unittest.cc index b6ddaae7125..fa371a2c8d6 100644 --- a/chromium/components/arc/bluetooth/bluetooth_struct_traits_unittest.cc +++ b/chromium/components/arc/bluetooth/bluetooth_mojom_traits_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/bluetooth/bluetooth_struct_traits.h" +#include "components/arc/bluetooth/bluetooth_mojom_traits.h" #include <string> #include <utility> diff --git a/chromium/components/arc/bluetooth/bluetooth_type_converters.h b/chromium/components/arc/bluetooth/bluetooth_type_converters.h index 67a43e7436e..c410f2d7b5d 100644 --- a/chromium/components/arc/bluetooth/bluetooth_type_converters.h +++ b/chromium/components/arc/bluetooth/bluetooth_type_converters.h @@ -10,7 +10,7 @@ #include <string> #include <utility> -#include "components/arc/common/bluetooth.mojom.h" +#include "components/arc/mojom/bluetooth.mojom.h" #include "device/bluetooth/bluetooth_gatt_service.h" #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h" diff --git a/chromium/components/arc/camera/arc_camera_bridge.h b/chromium/components/arc/camera/arc_camera_bridge.h index 43ab1c311fd..e327a711e32 100644 --- a/chromium/components/arc/camera/arc_camera_bridge.h +++ b/chromium/components/arc/camera/arc_camera_bridge.h @@ -9,7 +9,7 @@ #include <memory> #include "base/macros.h" -#include "components/arc/common/camera.mojom.h" +#include "components/arc/mojom/camera.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/clipboard/arc_clipboard_bridge.cc b/chromium/components/arc/clipboard/arc_clipboard_bridge.cc index fa49041af96..c4c677f46a9 100644 --- a/chromium/components/arc/clipboard/arc_clipboard_bridge.cc +++ b/chromium/components/arc/clipboard/arc_clipboard_bridge.cc @@ -48,7 +48,7 @@ mojom::ClipRepresentationPtr CreateHTML(const ui::Clipboard* clipboard) { std::string url; uint32_t fragment_start, fragment_end; - clipboard->ReadHTML(ui::ClipboardType::kCopyPaste, &markup16, &url, + clipboard->ReadHTML(ui::ClipboardBuffer::kCopyPaste, &markup16, &url, &fragment_start, &fragment_end); std::string text(base::UTF16ToUTF8( @@ -73,7 +73,7 @@ mojom::ClipRepresentationPtr CreatePlainText(const ui::Clipboard* clipboard) { // present, only use Bookmark. clipboard->ReadBookmark(&title, &text); if (text.size() == 0) - clipboard->ReadAsciiText(ui::ClipboardType::kCopyPaste, &text); + clipboard->ReadAsciiText(ui::ClipboardBuffer::kCopyPaste, &text); return mojom::ClipRepresentation::New(mime_type, mojom::ClipValue::NewText(text)); @@ -84,7 +84,7 @@ mojom::ClipDataPtr GetClipData(const ui::Clipboard* clipboard) { std::vector<base::string16> mime_types; bool contains_files; - clipboard->ReadAvailableTypes(ui::ClipboardType::kCopyPaste, &mime_types, + clipboard->ReadAvailableTypes(ui::ClipboardBuffer::kCopyPaste, &mime_types, &contains_files); mojom::ClipDataPtr clip_data(mojom::ClipData::New()); @@ -172,7 +172,7 @@ void ArcClipboardBridge::SetClipContent(mojom::ClipDataPtr clip_data) { // Order is important. AutoReset should outlive ScopedClipboardWriter. base::AutoReset<bool> auto_reset(&event_originated_at_instance_, true); - ui::ScopedClipboardWriter writer(ui::ClipboardType::kCopyPaste); + ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); for (const auto& repr : clip_data->representations) { const std::string& mime_type(repr->mime_type); diff --git a/chromium/components/arc/clipboard/arc_clipboard_bridge.h b/chromium/components/arc/clipboard/arc_clipboard_bridge.h index 0e26b276c40..1056ad5a080 100644 --- a/chromium/components/arc/clipboard/arc_clipboard_bridge.h +++ b/chromium/components/arc/clipboard/arc_clipboard_bridge.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/clipboard.mojom.h" +#include "components/arc/mojom/clipboard.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "ui/base/clipboard/clipboard_observer.h" diff --git a/chromium/components/arc/clipboard/arc_clipboard_bridge_unittest.cc b/chromium/components/arc/clipboard/arc_clipboard_bridge_unittest.cc index 838de85ee7b..b2e541ea8d4 100644 --- a/chromium/components/arc/clipboard/arc_clipboard_bridge_unittest.cc +++ b/chromium/components/arc/clipboard/arc_clipboard_bridge_unittest.cc @@ -10,11 +10,11 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/mock_callback.h" -#include "components/arc/common/clipboard.mojom.h" +#include "components/arc/mojom/clipboard.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "components/arc/test/connection_holder_util.h" #include "components/arc/test/fake_clipboard_instance.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard_constants.h" @@ -74,7 +74,7 @@ class ArcClipboardBridgeTest : public testing::Test { } protected: - content::TestBrowserThreadBundle thread_bundle_; + content::BrowserTaskEnvironment task_environment_; std::unique_ptr<ArcBridgeService> arc_bridge_service_; std::unique_ptr<ArcClipboardBridge> clipboard_bridge_; std::unique_ptr<FakeClipboardInstance> clipboard_instance_; @@ -84,7 +84,7 @@ class ArcClipboardBridgeTest : public testing::Test { TEST_F(ArcClipboardBridgeTest, GetClipContent_PlainText) { { - ui::ScopedClipboardWriter writer(ui::ClipboardType::kCopyPaste); + ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); writer.WriteText(base::UTF8ToUTF16(kSampleText)); } @@ -100,7 +100,7 @@ TEST_F(ArcClipboardBridgeTest, GetClipContent_PlainText) { TEST_F(ArcClipboardBridgeTest, GetClipContent_Html) { { - ui::ScopedClipboardWriter writer(ui::ClipboardType::kCopyPaste); + ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); writer.WriteHTML(base::UTF8ToUTF16(kSampleHtml), std::string()); } @@ -121,13 +121,13 @@ TEST_F(ArcClipboardBridgeTest, SetClipContent_PlainText) { std::vector<base::string16> mime_types; bool contains_files; - GetClipboard()->ReadAvailableTypes(ui::ClipboardType::kCopyPaste, &mime_types, - &contains_files); + GetClipboard()->ReadAvailableTypes(ui::ClipboardBuffer::kCopyPaste, + &mime_types, &contains_files); ASSERT_EQ(1u, mime_types.size()); EXPECT_EQ(ui::kMimeTypeText, base::UTF16ToUTF8(mime_types[0])); base::string16 result; - GetClipboard()->ReadText(ui::ClipboardType::kCopyPaste, &result); + GetClipboard()->ReadText(ui::ClipboardBuffer::kCopyPaste, &result); EXPECT_EQ(kSampleText, base::UTF16ToUTF8(result)); } @@ -138,15 +138,15 @@ TEST_F(ArcClipboardBridgeTest, SetClipContent_Html) { std::vector<base::string16> mime_types; bool contains_files; - GetClipboard()->ReadAvailableTypes(ui::ClipboardType::kCopyPaste, &mime_types, - &contains_files); + GetClipboard()->ReadAvailableTypes(ui::ClipboardBuffer::kCopyPaste, + &mime_types, &contains_files); ASSERT_EQ(1u, mime_types.size()); EXPECT_EQ(ui::kMimeTypeHTML, base::UTF16ToUTF8(mime_types[0])); base::string16 markup16; std::string url; uint32_t fragment_start, fragment_end; - GetClipboard()->ReadHTML(ui::ClipboardType::kCopyPaste, &markup16, &url, + GetClipboard()->ReadHTML(ui::ClipboardBuffer::kCopyPaste, &markup16, &url, &fragment_start, &fragment_end); base::string16 result = markup16.substr(fragment_start, fragment_end - fragment_start); diff --git a/chromium/components/arc/common/app.typemap b/chromium/components/arc/common/app.typemap deleted file mode 100644 index a6f3cfbf317..00000000000 --- a/chromium/components/arc/common/app.typemap +++ /dev/null @@ -1,5 +0,0 @@ -mojom = "//components/arc/common/app.mojom" -public_headers = [ "//components/arc/app/arc_playstore_search_request_state.h" ] -traits_headers = [ "//components/arc/common/app_struct_traits.h" ] -type_mappings = - [ "arc.mojom.AppDiscoveryRequestState=arc::ArcPlayStoreSearchRequestState" ] diff --git a/chromium/components/arc/common/bitmap.typemap b/chromium/components/arc/common/bitmap.typemap deleted file mode 100644 index 73529dc3611..00000000000 --- a/chromium/components/arc/common/bitmap.typemap +++ /dev/null @@ -1,13 +0,0 @@ -mojom = "//components/arc/common/bitmap.mojom" -public_headers = [ "//third_party/skia/include/core/SkBitmap.h" ] -traits_headers = [ "//components/arc/bitmap/bitmap_struct_traits.h" ] -sources = [ - "//components/arc/bitmap/bitmap_struct_traits.cc", -] -deps = [ - "//skia", -] -public_deps = [ - "//skia", -] -type_mappings = [ "arc.mojom.ArcBitmap=SkBitmap" ] diff --git a/chromium/components/arc/common/bluetooth.typemap b/chromium/components/arc/common/bluetooth.typemap deleted file mode 100644 index d620cccabe9..00000000000 --- a/chromium/components/arc/common/bluetooth.typemap +++ /dev/null @@ -1,21 +0,0 @@ -mojom = "//components/arc/common/bluetooth.mojom" -public_headers = [ - "//device/bluetooth/bluetooth_advertisement.h", - "//device/bluetooth/bluetooth_common.h", - "//device/bluetooth/public/cpp/bluetooth_uuid.h", - "//device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h", -] -traits_headers = [ "//components/arc/bluetooth/bluetooth_struct_traits.h" ] -sources = [ - "//components/arc/bluetooth/bluetooth_struct_traits.cc", -] -deps = [ - "//device/bluetooth", - "//device/bluetooth/public/cpp", -] -type_mappings = [ - "arc.mojom.BluetoothDeviceType=device::BluetoothTransport", - "arc.mojom.BluetoothSdpAttributeType=bluez::BluetoothServiceAttributeValueBlueZ::Type", - "arc.mojom.BluetoothUUID=device::BluetoothUUID", - "arc.mojom.BluetoothAdvertisement=std::unique_ptr<device::BluetoothAdvertisement::Data>[move_only]", -] diff --git a/chromium/components/arc/common/ime.typemap b/chromium/components/arc/common/ime.typemap deleted file mode 100644 index ba967cf09fe..00000000000 --- a/chromium/components/arc/common/ime.typemap +++ /dev/null @@ -1,4 +0,0 @@ -mojom = "//components/arc/common/ime.mojom" -public_headers = [ "//ui/base/ime/text_input_type.h" ] -traits_headers = [ "//components/arc/common/ime_struct_traits.h" ] -type_mappings = [ "arc.mojom.TextInputType=ui::TextInputType" ] diff --git a/chromium/components/arc/common/print.typemap b/chromium/components/arc/common/print.typemap deleted file mode 100644 index c8bb9251091..00000000000 --- a/chromium/components/arc/common/print.typemap +++ /dev/null @@ -1,19 +0,0 @@ -mojom = "//components/arc/common/print.mojom" -public_headers = [ - "//printing/backend/print_backend.h", - "//printing/page_range.h", - "//ui/gfx/geometry/size.h", -] -traits_headers = [ "//chrome/browser/chromeos/arc/print/print_struct_traits.h" ] -sources = [ - "//chrome/browser/chromeos/arc/print/print_struct_traits.cc", -] -deps = [] -public_deps = [ - "//printing:printing", -] -type_mappings = [ - "arc.mojom.PrintPageRange=printing::PageRange", - "arc.mojom.PrintResolution=gfx::Size", - "arc.mojom.PrinterCapabilities=printing::PrinterSemanticCapsAndDefaults", -] diff --git a/chromium/components/arc/common/print_spooler.mojom b/chromium/components/arc/common/print_spooler.mojom deleted file mode 100644 index 81c415b78e7..00000000000 --- a/chromium/components/arc/common/print_spooler.mojom +++ /dev/null @@ -1,18 +0,0 @@ -// 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. -// -// Next MinVersion: 1 - -module arc.mojom; - -// Next method ID: 0 -interface PrintSpoolerHost { - // TODO(jschettler): Add methods to open and close print preview -}; - -// Next method ID: 1 -interface PrintSpoolerInstance { - // Establishes full-duplex communication with the host. - [MinVersion=0] Init@0(PrintSpoolerHost host_ptr) => (); -};
\ No newline at end of file diff --git a/chromium/components/arc/common/timer.typemap b/chromium/components/arc/common/timer.typemap deleted file mode 100644 index df7d6f3401c..00000000000 --- a/chromium/components/arc/common/timer.typemap +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2018 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. - -mojom = "//components/arc/common/timer.mojom" -traits_headers = [ "//components/arc/timer/arc_timer_struct_traits.h" ] -sources = [ - "//components/arc/timer/arc_timer_struct_traits.cc", -] -type_mappings = [ "arc.mojom.ClockId=clockid_t" ] diff --git a/chromium/components/arc/common/typemaps.gni b/chromium/components/arc/common/typemaps.gni deleted file mode 100644 index 7756be687e1..00000000000 --- a/chromium/components/arc/common/typemaps.gni +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2016 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. - -typemaps = [ - "//components/arc/common/app.typemap", - "//components/arc/common/bitmap.typemap", - "//components/arc/common/bluetooth.typemap", - "//components/arc/common/file_system.typemap", - "//components/arc/common/gfx.typemap", - "//components/arc/common/ime.typemap", - "//components/arc/common/intent_helper.typemap", - "//components/arc/common/print.typemap", - "//components/arc/common/timer.typemap", - "//components/arc/common/video_common.typemap", - "//components/arc/common/video_encode_accelerator.typemap", - "//components/arc/common/volume_mounter.typemap", -] diff --git a/chromium/components/arc/common/video_encode_accelerator.typemap b/chromium/components/arc/common/video_encode_accelerator.typemap deleted file mode 100644 index 5210cc6379d..00000000000 --- a/chromium/components/arc/common/video_encode_accelerator.typemap +++ /dev/null @@ -1,24 +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. - -mojom = "//components/arc/common/video_encode_accelerator.mojom" -public_headers = [ "//media/video/video_encode_accelerator.h" ] -public_deps = [ - "//base", - "//media/gpu", -] -traits_headers = - [ "//components/arc/common/video_encode_accelerator_struct_traits.h" ] -sources = [ - "//components/arc/common/video_encode_accelerator_struct_traits.cc", -] -deps = [ - "//base", -] -type_mappings = [ - "arc.mojom.VideoFrameStorageType=media::VideoEncodeAccelerator::Config::StorageType", - "arc.mojom.VideoEncodeAccelerator.Error=media::VideoEncodeAccelerator::Error", - "arc.mojom.VideoEncodeProfile=media::VideoEncodeAccelerator::SupportedProfile", - "arc.mojom.VideoEncodeAcceleratorConfig=media::VideoEncodeAccelerator::Config", -] diff --git a/chromium/components/arc/crash_collector/arc_crash_collector_bridge.cc b/chromium/components/arc/crash_collector/arc_crash_collector_bridge.cc index a265482e39b..8cc5dbcb344 100644 --- a/chromium/components/arc/crash_collector/arc_crash_collector_bridge.cc +++ b/chromium/components/arc/crash_collector/arc_crash_collector_bridge.cc @@ -91,8 +91,8 @@ ArcCrashCollectorBridge::~ArcCrashCollectorBridge() { void ArcCrashCollectorBridge::DumpCrash(const std::string& type, mojo::ScopedHandle pipe) { - base::PostTaskWithTraits( - FROM_HERE, {base::WithBaseSyncPrimitives()}, + base::PostTask( + FROM_HERE, {base::ThreadPool(), base::WithBaseSyncPrimitives()}, base::BindOnce(&RunCrashReporter, type, device_, board_, cpu_abi_, mojo::UnwrapPlatformHandle(std::move(pipe)).TakeFD())); } diff --git a/chromium/components/arc/crash_collector/arc_crash_collector_bridge.h b/chromium/components/arc/crash_collector/arc_crash_collector_bridge.h index 9da78baf6e7..af1814d4a19 100644 --- a/chromium/components/arc/crash_collector/arc_crash_collector_bridge.h +++ b/chromium/components/arc/crash_collector/arc_crash_collector_bridge.h @@ -8,7 +8,7 @@ #include <string> #include "base/macros.h" -#include "components/arc/common/crash_collector.mojom.h" +#include "components/arc/mojom/crash_collector.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/disk_quota/arc_disk_quota_bridge.h b/chromium/components/arc/disk_quota/arc_disk_quota_bridge.h index 3b8c73f0055..1ceca5687c1 100644 --- a/chromium/components/arc/disk_quota/arc_disk_quota_bridge.h +++ b/chromium/components/arc/disk_quota/arc_disk_quota_bridge.h @@ -6,7 +6,7 @@ #define COMPONENTS_ARC_DISK_QUOTA_ARC_DISK_QUOTA_BRIDGE_H_ #include "base/macros.h" -#include "components/arc/common/disk_quota.mojom.h" +#include "components/arc/mojom/disk_quota.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/file_system/OWNERS b/chromium/components/arc/file_system/OWNERS index ef5cf841917..012a33c0b1c 100644 --- a/chromium/components/arc/file_system/OWNERS +++ b/chromium/components/arc/file_system/OWNERS @@ -1,3 +1,3 @@ -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/file_system/file_system_struct_traits.cc b/chromium/components/arc/file_system/file_system_mojom_traits.cc index df97e6bb621..9af0c129a1e 100644 --- a/chromium/components/arc/file_system/file_system_struct_traits.cc +++ b/chromium/components/arc/file_system/file_system_mojom_traits.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/file_system/file_system_struct_traits.h" +#include "components/arc/file_system/file_system_mojom_traits.h" #include "base/logging.h" -#include "components/arc/common/file_system.mojom.h" +#include "components/arc/mojom/file_system.mojom.h" namespace mojo { diff --git a/chromium/components/arc/file_system/file_system_struct_traits.h b/chromium/components/arc/file_system/file_system_mojom_traits.h index eae87efd1f4..d69f407ed1e 100644 --- a/chromium/components/arc/file_system/file_system_struct_traits.h +++ b/chromium/components/arc/file_system/file_system_mojom_traits.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ -#include "components/arc/common/file_system.mojom.h" +#include "components/arc/mojom/file_system.mojom.h" #include "storage/browser/fileapi/watcher_manager.h" namespace mojo { @@ -20,4 +20,4 @@ struct EnumTraits<arc::mojom::ChangeType, storage::WatcherManager::ChangeType> { } // namespace mojo -#endif // COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/ime/arc_ime_bridge_impl.h b/chromium/components/arc/ime/arc_ime_bridge_impl.h index eb68bd47220..f5ac479fb35 100644 --- a/chromium/components/arc/ime/arc_ime_bridge_impl.h +++ b/chromium/components/arc/ime/arc_ime_bridge_impl.h @@ -9,8 +9,8 @@ #include "base/macros.h" #include "base/strings/string16.h" -#include "components/arc/common/ime.mojom.h" #include "components/arc/ime/arc_ime_bridge.h" +#include "components/arc/mojom/ime.mojom.h" #include "ui/base/ime/text_input_type.h" #include "ui/gfx/geometry/rect.h" diff --git a/chromium/components/arc/ime/arc_ime_service.cc b/chromium/components/arc/ime/arc_ime_service.cc index 5b4a0c02da5..5db6d525c89 100644 --- a/chromium/components/arc/ime/arc_ime_service.cc +++ b/chromium/components/arc/ime/arc_ime_service.cc @@ -252,6 +252,13 @@ void ArcImeService::OnWindowPropertyChanged(aura::Window* window, } } +void ArcImeService::OnWindowRemoved(aura::Window* removed_window) { + // |this| can lose the IME focus because |focused_arc_window_| may have + // children other than ExoSurface e.g. WebContentsViewAura for CustomTabs. + // Restore the IME focus when such a window is removed. + ReattachInputMethod(nullptr, focused_arc_window_); +} + //////////////////////////////////////////////////////////////////////////////// // Overridden from exo::WMHelper::FocusChangeObserver: diff --git a/chromium/components/arc/ime/arc_ime_service.h b/chromium/components/arc/ime/arc_ime_service.h index c8f20c8c8fe..9b68a96f7e1 100644 --- a/chromium/components/arc/ime/arc_ime_service.h +++ b/chromium/components/arc/ime/arc_ime_service.h @@ -84,6 +84,7 @@ class ArcImeService : public KeyedService, void OnWindowPropertyChanged(aura::Window* window, const void* key, intptr_t old) override; + void OnWindowRemoved(aura::Window* removed_window) override; // Overridden from aura::client::FocusChangeObserver: void OnWindowFocused(aura::Window* gained_focus, diff --git a/chromium/components/arc/ime/arc_ime_service_unittest.cc b/chromium/components/arc/ime/arc_ime_service_unittest.cc index 0fa67211789..ee62ec60690 100644 --- a/chromium/components/arc/ime/arc_ime_service_unittest.cc +++ b/chromium/components/arc/ime/arc_ime_service_unittest.cc @@ -11,7 +11,7 @@ #include "ash/keyboard/ui/keyboard_ui_controller.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" -#include "components/arc/common/ime.mojom.h" +#include "components/arc/mojom/ime.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/test/test_window_delegate.h" diff --git a/chromium/components/arc/intent_helper/OWNERS b/chromium/components/arc/intent_helper/OWNERS index 99a8310c6ae..d2e1c3575fe 100644 --- a/chromium/components/arc/intent_helper/OWNERS +++ b/chromium/components/arc/intent_helper/OWNERS @@ -1,5 +1,6 @@ djacobo@chromium.org -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS +# COMPONENT: Platform>Apps>Foundation diff --git a/chromium/components/arc/intent_helper/activity_icon_loader.cc b/chromium/components/arc/intent_helper/activity_icon_loader.cc index 970e1b39849..5bcebf5a201 100644 --- a/chromium/components/arc/intent_helper/activity_icon_loader.cc +++ b/chromium/components/arc/intent_helper/activity_icon_loader.cc @@ -165,7 +165,7 @@ bool ActivityIconLoader::ActivityName::operator<( } ActivityIconLoader::ActivityIconLoader() - : scale_factor_(GetSupportedScaleFactor()), weak_ptr_factory_(this) {} + : scale_factor_(GetSupportedScaleFactor()) {} ActivityIconLoader::~ActivityIconLoader() = default; diff --git a/chromium/components/arc/intent_helper/activity_icon_loader.h b/chromium/components/arc/intent_helper/activity_icon_loader.h index 3b07589fd21..835eae82c5e 100644 --- a/chromium/components/arc/intent_helper/activity_icon_loader.h +++ b/chromium/components/arc/intent_helper/activity_icon_loader.h @@ -15,7 +15,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/intent_helper.mojom.h" +#include "components/arc/mojom/intent_helper.mojom.h" #include "ui/base/layout.h" #include "ui/gfx/image/image.h" #include "url/gurl.h" @@ -112,7 +112,7 @@ class ActivityIconLoader { THREAD_CHECKER(thread_checker_); // This must come last to make sure weak pointers are invalidated first. - base::WeakPtrFactory<ActivityIconLoader> weak_ptr_factory_; + base::WeakPtrFactory<ActivityIconLoader> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ActivityIconLoader); }; diff --git a/chromium/components/arc/intent_helper/arc_intent_helper_bridge.h b/chromium/components/arc/intent_helper/arc_intent_helper_bridge.h index 94d7f97a2c9..e1be685f248 100644 --- a/chromium/components/arc/intent_helper/arc_intent_helper_bridge.h +++ b/chromium/components/arc/intent_helper/arc_intent_helper_bridge.h @@ -14,9 +14,9 @@ #include "base/macros.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/intent_helper/activity_icon_loader.h" #include "components/arc/intent_helper/arc_intent_helper_observer.h" +#include "components/arc/mojom/intent_helper.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "url/gurl.h" 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 18edc662742..072e957ff9b 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 @@ -8,8 +8,8 @@ #include <utility> #include "base/memory/ptr_util.h" -#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/intent_helper/open_url_delegate.h" +#include "components/arc/mojom/intent_helper.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chromium/components/arc/intent_helper/factory_reset_delegate.h b/chromium/components/arc/intent_helper/factory_reset_delegate.h index edddbe34db6..0ac61513aa2 100644 --- a/chromium/components/arc/intent_helper/factory_reset_delegate.h +++ b/chromium/components/arc/intent_helper/factory_reset_delegate.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_ARC_INTENT_HELPER_FACTORY_RESET_DELEGATE_H_ #define COMPONENTS_ARC_INTENT_HELPER_FACTORY_RESET_DELEGATE_H_ -#include "components/arc/common/intent_helper.mojom.h" +#include "components/arc/mojom/intent_helper.mojom.h" namespace arc { diff --git a/chromium/components/arc/intent_helper/intent_filter.cc b/chromium/components/arc/intent_helper/intent_filter.cc index d82b8ba260f..bb4720a0932 100644 --- a/chromium/components/arc/intent_helper/intent_filter.cc +++ b/chromium/components/arc/intent_helper/intent_filter.cc @@ -8,7 +8,7 @@ #include "base/compiler_specific.h" #include "base/strings/string_util.h" -#include "components/arc/common/intent_helper.mojom.h" +#include "components/arc/mojom/intent_helper.mojom.h" #include "url/gurl.h" namespace arc { diff --git a/chromium/components/arc/intent_helper/intent_filter_struct_traits.cc b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc index 1a33f43a5eb..0ae02e7fd69 100644 --- a/chromium/components/arc/intent_helper/intent_filter_struct_traits.cc +++ b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/intent_helper/intent_filter_struct_traits.h" +#include "components/arc/intent_helper/intent_filter_mojom_traits.h" #include <string> #include <utility> @@ -12,9 +12,9 @@ namespace mojo { -bool StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter>:: - Read(arc::mojom::IntentFilterDataView data, - arc::IntentFilter* out) { +bool StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter>::Read( + arc::mojom::IntentFilterDataView data, + arc::IntentFilter* out) { std::vector<arc::IntentFilter::AuthorityEntry> authorities; if (!data.ReadDataAuthorities(&authorities)) return false; @@ -33,7 +33,7 @@ bool StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter>:: } bool StructTraits<arc::mojom::AuthorityEntryDataView, - arc::IntentFilter::AuthorityEntry>:: + arc::IntentFilter::AuthorityEntry>:: Read(arc::mojom::AuthorityEntryDataView data, arc::IntentFilter::AuthorityEntry* out) { std::string host; @@ -45,9 +45,9 @@ bool StructTraits<arc::mojom::AuthorityEntryDataView, } bool StructTraits<arc::mojom::PatternMatcherDataView, - arc::IntentFilter::PatternMatcher>:: - Read(arc::mojom::PatternMatcherDataView data, - arc::IntentFilter::PatternMatcher* out) { + arc::IntentFilter::PatternMatcher>:: + Read(arc::mojom::PatternMatcherDataView data, + arc::IntentFilter::PatternMatcher* out) { std::string pattern; if (!data.ReadPattern(&pattern)) return false; diff --git a/chromium/components/arc/intent_helper/intent_filter_struct_traits.h b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.h index 421001dad36..7ef52ca347f 100644 --- a/chromium/components/arc/intent_helper/intent_filter_struct_traits.h +++ b/chromium/components/arc/intent_helper/intent_filter_mojom_traits.h @@ -2,15 +2,15 @@ // 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_INTENT_FILTER_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ #include <string> #include <vector> #include "base/containers/span.h" -#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/intent_helper/intent_filter.h" +#include "components/arc/mojom/intent_helper.mojom.h" namespace mojo { @@ -83,4 +83,4 @@ struct StructTraits<arc::mojom::PatternMatcherDataView, } // namespace mojo -#endif // COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_INTENT_HELPER_INTENT_FILTER_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/intent_helper/intent_filter_unittest.cc b/chromium/components/arc/intent_helper/intent_filter_unittest.cc index 73a9d3fe934..0bcc241b0e4 100644 --- a/chromium/components/arc/intent_helper/intent_filter_unittest.cc +++ b/chromium/components/arc/intent_helper/intent_filter_unittest.cc @@ -9,8 +9,8 @@ #include "base/bind.h" #include "base/memory/ref_counted.h" -#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/intent_helper/intent_filter.h" +#include "components/arc/mojom/intent_helper.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" diff --git a/chromium/components/arc/intent_helper/link_handler_model.h b/chromium/components/arc/intent_helper/link_handler_model.h index 3cf7bf32c95..5c7cc9e87c9 100644 --- a/chromium/components/arc/intent_helper/link_handler_model.h +++ b/chromium/components/arc/intent_helper/link_handler_model.h @@ -11,8 +11,8 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/strings/string16.h" -#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" +#include "components/arc/mojom/intent_helper.mojom.h" #include "url/gurl.h" namespace content { diff --git a/chromium/components/arc/intent_helper/open_url_delegate.h b/chromium/components/arc/intent_helper/open_url_delegate.h index 602b62def4c..b4bc58796fe 100644 --- a/chromium/components/arc/intent_helper/open_url_delegate.h +++ b/chromium/components/arc/intent_helper/open_url_delegate.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_ARC_INTENT_HELPER_OPEN_URL_DELEGATE_H_ #define COMPONENTS_ARC_INTENT_HELPER_OPEN_URL_DELEGATE_H_ -#include "components/arc/common/intent_helper.mojom.h" +#include "components/arc/mojom/intent_helper.mojom.h" class GURL; diff --git a/chromium/components/arc/keymaster/arc_keymaster_bridge.h b/chromium/components/arc/keymaster/arc_keymaster_bridge.h index 32833e3f8d7..a5ed47eb5b7 100644 --- a/chromium/components/arc/keymaster/arc_keymaster_bridge.h +++ b/chromium/components/arc/keymaster/arc_keymaster_bridge.h @@ -7,7 +7,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "components/arc/common/keymaster.mojom.h" +#include "components/arc/mojom/keymaster.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/lock_screen/arc_lock_screen_bridge.h b/chromium/components/arc/lock_screen/arc_lock_screen_bridge.h index 4274763f8ee..9d1c7757412 100644 --- a/chromium/components/arc/lock_screen/arc_lock_screen_bridge.h +++ b/chromium/components/arc/lock_screen/arc_lock_screen_bridge.h @@ -7,7 +7,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/lock_screen.mojom.h" +#include "components/arc/mojom/lock_screen.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "components/session_manager/core/session_manager_observer.h" diff --git a/chromium/components/arc/media_session/arc_media_session_bridge.cc b/chromium/components/arc/media_session/arc_media_session_bridge.cc index e5c0dbdf0ba..a532ce0ce42 100644 --- a/chromium/components/arc/media_session/arc_media_session_bridge.cc +++ b/chromium/components/arc/media_session/arc_media_session_bridge.cc @@ -91,7 +91,8 @@ void ArcMediaSessionBridge::SetupAudioFocus() { content::GetSystemConnector()->BindInterface( media_session::mojom::kServiceName, &audio_focus_ptr); - audio_focus_ptr->SetSourceName(kAudioFocusSourceName); + audio_focus_ptr->SetSource(base::UnguessableToken::Create(), + kAudioFocusSourceName); DVLOG(2) << "ArcMediaSessionBridge will enable audio focus"; ms_instance->EnableAudioFocus(std::move(audio_focus_ptr)); diff --git a/chromium/components/arc/media_session/arc_media_session_bridge.h b/chromium/components/arc/media_session/arc_media_session_bridge.h index 9d81768a41d..8cb89bed047 100644 --- a/chromium/components/arc/media_session/arc_media_session_bridge.h +++ b/chromium/components/arc/media_session/arc_media_session_bridge.h @@ -8,7 +8,7 @@ #include <string> #include "base/macros.h" -#include "components/arc/common/media_session.mojom.h" +#include "components/arc/mojom/media_session.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" diff --git a/chromium/components/arc/metrics/arc_metrics_service.cc b/chromium/components/arc/metrics/arc_metrics_service.cc index cfc8161d338..3d1b52a331a 100644 --- a/chromium/components/arc/metrics/arc_metrics_service.cc +++ b/chromium/components/arc/metrics/arc_metrics_service.cc @@ -13,9 +13,6 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" -#include "base/system/sys_info.h" -#include "base/time/default_clock.h" -#include "base/time/default_tick_clock.h" #include "chromeos/dbus/power_manager/idle.pb.h" #include "chromeos/dbus/session_manager/session_manager_client.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h" @@ -26,7 +23,6 @@ #include "components/arc/session/arc_bridge_service.h" #include "components/exo/wm_helper.h" #include "components/prefs/pref_service.h" -#include "components/session_manager/core/session_manager.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "ui/events/ozone/gamepad/gamepad_provider_ozone.h" @@ -35,6 +31,8 @@ namespace arc { namespace { +constexpr char kUmaPrefix[] = "Arc"; + constexpr base::TimeDelta kUmaMinTime = base::TimeDelta::FromMilliseconds(1); constexpr base::TimeDelta kUmaMaxTime = base::TimeDelta::FromSeconds(60); constexpr int kUmaNumBuckets = 50; @@ -45,11 +43,6 @@ constexpr char kArcProcessNamePrefix[] = "org.chromium.arc."; constexpr char kGmsProcessNamePrefix[] = "com.google.android.gms"; constexpr char kBootProgressEnableScreen[] = "boot_progress_enable_screen"; -constexpr base::TimeDelta kUpdateEngagementTimePeriod = - base::TimeDelta::FromMinutes(1); -constexpr base::TimeDelta kSaveEngagementTimeToPrefsPeriod = - base::TimeDelta::FromMinutes(30); - std::string BootTypeToString(mojom::BootType boot_type) { switch (boot_type) { case mojom::BootType::UNKNOWN: @@ -65,40 +58,6 @@ std::string BootTypeToString(mojom::BootType boot_type) { return ""; } -inline int GetDayId(const base::Clock* clock) { - return clock->Now().LocalMidnight().since_origin().InDays(); -} - -class ArcWindowDelegateImpl : public ArcMetricsService::ArcWindowDelegate { - public: - explicit ArcWindowDelegateImpl(ArcMetricsService* service) - : service_(service) {} - - ~ArcWindowDelegateImpl() override = default; - - bool IsArcAppWindow(const aura::Window* window) const override { - return arc::IsArcAppWindow(window); - } - - void RegisterActivationChangeObserver() override { - // If WMHelper doesn't exist, do nothing. This occurs in tests. - if (exo::WMHelper::HasInstance()) - exo::WMHelper::GetInstance()->AddActivationObserver(service_); - } - - void UnregisterActivationChangeObserver() override { - // If WMHelper is already destroyed, do nothing. - // TODO(crbug.com/748380): Fix shutdown order. - if (exo::WMHelper::HasInstance()) - exo::WMHelper::GetInstance()->RemoveActivationObserver(service_); - } - - private: - ArcMetricsService* const service_; // Owned by ArcMetricsService - - DISALLOW_COPY_AND_ASSIGN(ArcWindowDelegateImpl); -}; - // Singleton factory for ArcMetricsService. class ArcMetricsServiceFactory : public internal::ArcBrowserContextKeyedServiceFactoryBase< @@ -140,61 +99,34 @@ BrowserContextKeyedServiceFactory* ArcMetricsService::GetFactory() { ArcMetricsService::ArcMetricsService(content::BrowserContext* context, ArcBridgeService* bridge_service) : arc_bridge_service_(bridge_service), - arc_window_delegate_(std::make_unique<ArcWindowDelegateImpl>(this)), - process_observer_(this), - pref_service_(user_prefs::UserPrefs::Get(context)), - clock_(base::DefaultClock::GetInstance()), - tick_clock_(base::DefaultTickClock::GetInstance()), - last_update_ticks_(tick_clock_->NowTicks()), - weak_ptr_factory_(this) { + guest_os_engagement_metrics_(user_prefs::UserPrefs::Get(context), + base::BindRepeating(arc::IsArcAppWindow), + prefs::kEngagementPrefsPrefix, + kUmaPrefix), + process_observer_(this) { arc_bridge_service_->metrics()->SetHost(this); arc_bridge_service_->process()->AddObserver(&process_observer_); - arc_window_delegate_->RegisterActivationChangeObserver(); - session_manager::SessionManager::Get()->AddObserver(this); - chromeos::PowerManagerClient::Get()->AddObserver(this); + // If WMHelper doesn't exist, do nothing. This occurs in tests. + if (exo::WMHelper::HasInstance()) + exo::WMHelper::GetInstance()->AddActivationObserver(this); ui::GamepadProviderOzone::GetInstance()->AddGamepadObserver(this); - DCHECK(pref_service_); - RestoreEngagementTimeFromPrefs(); - update_engagement_time_timer_.Start(FROM_HERE, kUpdateEngagementTimePeriod, - this, - &ArcMetricsService::UpdateEngagementTime); - save_engagement_time_to_prefs_timer_.Start( - FROM_HERE, kSaveEngagementTimeToPrefsPeriod, this, - &ArcMetricsService::SaveEngagementTimeToPrefs); - StabilityMetricsManager::Get()->SetArcNativeBridgeType( NativeBridgeType::UNKNOWN); } ArcMetricsService::~ArcMetricsService() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - save_engagement_time_to_prefs_timer_.Stop(); - update_engagement_time_timer_.Stop(); - UpdateEngagementTime(); - SaveEngagementTimeToPrefs(); ui::GamepadProviderOzone::GetInstance()->RemoveGamepadObserver(this); - chromeos::PowerManagerClient::Get()->RemoveObserver(this); - session_manager::SessionManager::Get()->RemoveObserver(this); - arc_window_delegate_->UnregisterActivationChangeObserver(); + // If WMHelper is already destroyed, do nothing. + // TODO(crbug.com/748380): Fix shutdown order. + if (exo::WMHelper::HasInstance()) + exo::WMHelper::GetInstance()->RemoveActivationObserver(this); arc_bridge_service_->process()->RemoveObserver(&process_observer_); arc_bridge_service_->metrics()->SetHost(nullptr); } -void ArcMetricsService::SetArcWindowDelegateForTesting( - std::unique_ptr<ArcWindowDelegate> delegate) { - arc_window_delegate_ = std::move(delegate); -} - -void ArcMetricsService::SetClockForTesting(base::Clock* clock) { - clock_ = clock; -} - -void ArcMetricsService::SetTickClockForTesting(base::TickClock* tick_clock) { - tick_clock_ = tick_clock; -} - void ArcMetricsService::OnProcessConnectionReady() { VLOG(2) << "Start updating process list."; request_process_list_timer_.Start(FROM_HERE, kRequestProcessListPeriod, this, @@ -326,8 +258,7 @@ void ArcMetricsService::OnWindowActivated( wm::ActivationChangeObserver::ActivationReason reason, aura::Window* gained_active, aura::Window* lost_active) { - UpdateEngagementTime(); - was_arc_window_active_ = arc_window_delegate_->IsArcAppWindow(gained_active); + was_arc_window_active_ = arc::IsArcAppWindow(gained_active); if (!was_arc_window_active_) { gamepad_interaction_recorded_ = false; return; @@ -337,19 +268,6 @@ void ArcMetricsService::OnWindowActivated( UserInteractionType::APP_CONTENT_WINDOW_INTERACTION); } -void ArcMetricsService::OnSessionStateChanged() { - UpdateEngagementTime(); - was_session_active_ = - session_manager::SessionManager::Get()->session_state() == - session_manager::SessionState::ACTIVE; -} - -void ArcMetricsService::ScreenIdleStateChanged( - const power_manager::ScreenIdleState& proto) { - UpdateEngagementTime(); - was_screen_dimmed_ = proto.dimmed(); -} - void ArcMetricsService::OnGamepadEvent(const ui::GamepadEvent& event) { if (!was_arc_window_active_) return; @@ -364,125 +282,18 @@ void ArcMetricsService::OnTaskCreated(int32_t task_id, const std::string& package_name, const std::string& activity, const std::string& intent) { - UpdateEngagementTime(); task_ids_.push_back(task_id); + guest_os_engagement_metrics_.SetBackgroundActive(true); } void ArcMetricsService::OnTaskDestroyed(int32_t task_id) { - UpdateEngagementTime(); auto it = std::find(task_ids_.begin(), task_ids_.end(), task_id); if (it == task_ids_.end()) { LOG(WARNING) << "unknown task_id, background time might be undermeasured"; return; } task_ids_.erase(it); -} - -void ArcMetricsService::RestoreEngagementTimeFromPrefs() { - // Restore accumulated results only if they were recorded on the same OS - // version. - if (pref_service_->GetString(prefs::kEngagementTimeOsVersion) == - base::SysInfo::OperatingSystemVersion()) { - day_id_ = pref_service_->GetInteger(prefs::kEngagementTimeDayId); - engagement_time_total_ = - pref_service_->GetTimeDelta(prefs::kEngagementTimeTotal); - engagement_time_foreground_ = - pref_service_->GetTimeDelta(prefs::kEngagementTimeForeground); - engagement_time_background_ = - pref_service_->GetTimeDelta(prefs::kEngagementTimeBackground); - } else { - ResetEngagementTimePrefs(); - } - - RecordEngagementTimeToUmaIfNeeded(); -} - -void ArcMetricsService::SaveEngagementTimeToPrefs() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(pref_service_); - - pref_service_->SetString(prefs::kEngagementTimeOsVersion, - base::SysInfo::OperatingSystemVersion()); - pref_service_->SetInteger(prefs::kEngagementTimeDayId, day_id_); - pref_service_->SetTimeDelta(prefs::kEngagementTimeTotal, - engagement_time_total_); - pref_service_->SetTimeDelta(prefs::kEngagementTimeForeground, - engagement_time_foreground_); - pref_service_->SetTimeDelta(prefs::kEngagementTimeBackground, - engagement_time_background_); -} - -void ArcMetricsService::UpdateEngagementTime() { - VLOG(2) << "last state: dimmed=" << was_screen_dimmed_ - << " active=" << was_session_active_ - << " focus=" << was_arc_window_active_ - << " #tasks=" << task_ids_.size(); - - base::TimeTicks now = tick_clock_->NowTicks(); - base::TimeDelta elapsed = now - last_update_ticks_; - - if (ShouldAccumulateEngagementTotalTime()) { - VLOG(2) << "accumulate to total time " << elapsed; - engagement_time_total_ += elapsed; - if (ShouldAccumulateEngagementForegroundTime()) { - VLOG(2) << "accumulate to foreground time " << elapsed; - engagement_time_foreground_ += elapsed; - } else if (ShouldAccumulateEngagementBackgroundTime()) { - VLOG(2) << "accumulate to background time " << elapsed; - engagement_time_background_ += elapsed; - } - } - - last_update_ticks_ = now; - RecordEngagementTimeToUmaIfNeeded(); -} - -void ArcMetricsService::RecordEngagementTimeToUmaIfNeeded() { - if (!ShouldRecordEngagementTimeToUma()) - return; - VLOG(2) << "day changed, recording engagement time to UMA"; - UMA_HISTOGRAM_CUSTOM_TIMES( - "Arc.EngagementTime.Total", engagement_time_total_, - base::TimeDelta::FromSeconds(1), - base::TimeDelta::FromDays(1) + kUpdateEngagementTimePeriod, 50); - UMA_HISTOGRAM_CUSTOM_TIMES( - "Arc.EngagementTime.ArcTotal", - engagement_time_foreground_ + engagement_time_background_, - base::TimeDelta::FromSeconds(1), - base::TimeDelta::FromDays(1) + kUpdateEngagementTimePeriod, 50); - UMA_HISTOGRAM_CUSTOM_TIMES( - "Arc.EngagementTime.Foreground", engagement_time_foreground_, - base::TimeDelta::FromSeconds(1), - base::TimeDelta::FromDays(1) + kUpdateEngagementTimePeriod, 50); - UMA_HISTOGRAM_CUSTOM_TIMES( - "Arc.EngagementTime.Background", engagement_time_background_, - base::TimeDelta::FromSeconds(1), - base::TimeDelta::FromDays(1) + kUpdateEngagementTimePeriod, 50); - ResetEngagementTimePrefs(); -} - -void ArcMetricsService::ResetEngagementTimePrefs() { - day_id_ = GetDayId(clock_); - engagement_time_total_ = base::TimeDelta(); - engagement_time_foreground_ = base::TimeDelta(); - engagement_time_background_ = base::TimeDelta(); - SaveEngagementTimeToPrefs(); -} - -bool ArcMetricsService::ShouldAccumulateEngagementTotalTime() const { - return was_session_active_ && !was_screen_dimmed_; -} - -bool ArcMetricsService::ShouldAccumulateEngagementForegroundTime() const { - return was_arc_window_active_; -} - -bool ArcMetricsService::ShouldAccumulateEngagementBackgroundTime() const { - return task_ids_.size() > 0; -} - -bool ArcMetricsService::ShouldRecordEngagementTimeToUma() const { - return day_id_ != GetDayId(clock_); + guest_os_engagement_metrics_.SetBackgroundActive(!task_ids_.empty()); } ArcMetricsService::ProcessObserver::ProcessObserver( diff --git a/chromium/components/arc/metrics/arc_metrics_service.h b/chromium/components/arc/metrics/arc_metrics_service.h index ba3a11f768b..fefddb6c18b 100644 --- a/chromium/components/arc/metrics/arc_metrics_service.h +++ b/chromium/components/arc/metrics/arc_metrics_service.h @@ -15,27 +15,20 @@ #include "base/threading/thread_checker.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "chromeos/dbus/power/power_manager_client.h" -#include "components/arc/common/metrics.mojom.h" -#include "components/arc/common/process.mojom.h" +#include "components/arc/mojom/metrics.mojom.h" +#include "components/arc/mojom/process.mojom.h" #include "components/arc/session/connection_observer.h" +#include "components/guest_os/guest_os_engagement_metrics.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/session_manager/core/session_manager_observer.h" #include "ui/events/ozone/gamepad/gamepad_observer.h" #include "ui/wm/public/activation_change_observer.h" class BrowserContextKeyedServiceFactory; -class PrefService; namespace aura { class Window; } // namespace aura -namespace base { -class Clock; -class TickClock; -} // namespace base - namespace content { class BrowserContext; } // namespace content @@ -47,32 +40,9 @@ class ArcBridgeService; // Collects information from other ArcServices and send UMA metrics. class ArcMetricsService : public KeyedService, public wm::ActivationChangeObserver, - public session_manager::SessionManagerObserver, - public chromeos::PowerManagerClient::Observer, public mojom::MetricsHost, public ui::GamepadObserver { public: - // Delegate for handling window focus observation that is used to track ARC - // app usage metrics. - class ArcWindowDelegate { - public: - virtual ~ArcWindowDelegate() = default; - // Returns whether |window| is an ARC window. - virtual bool IsArcAppWindow(const aura::Window* window) const = 0; - virtual void RegisterActivationChangeObserver() = 0; - virtual void UnregisterActivationChangeObserver() = 0; - }; - - // Sets the fake ArcWindowDelegate for testing. - void SetArcWindowDelegateForTesting( - std::unique_ptr<ArcWindowDelegate> delegate); - - // Sets Clock for testing. - void SetClockForTesting(base::Clock* clock); - - // Sets TickClock for testing. - void SetTickClockForTesting(base::TickClock* tick_clock); - // Returns singleton instance for the given BrowserContext, // or nullptr if the browser |context| is not allowed to use ARC. static ArcMetricsService* GetForBrowserContext( @@ -102,13 +72,6 @@ class ArcMetricsService : public KeyedService, aura::Window* gained_active, aura::Window* lost_active) override; - // session_manager::SessionManagerObserver overrides. - void OnSessionStateChanged() override; - - // chromeos::PowerManagerClient::Observer overrides. - void ScreenIdleStateChanged( - const power_manager::ScreenIdleState& proto) override; - // ui::GamepadObserver overrides. void OnGamepadEvent(const ui::GamepadEvent& event) override; @@ -145,63 +108,24 @@ class ArcMetricsService : public KeyedService, mojom::BootType boot_type, base::Optional<base::TimeTicks> arc_start_time); - // Restores accumulated ARC++ engagement time in previous sessions from - // profile preferences. - void RestoreEngagementTimeFromPrefs(); - - // Called periodically to save accumulated results to profile preferences. - void SaveEngagementTimeToPrefs(); - - // Called whenever engagement state is changed. Time spent in last state is - // accumulated to corresponding metrics. - void UpdateEngagementTime(); - - // Records accumulated engagement time metrics to UMA if necessary (i.e. day - // has changed). - void RecordEngagementTimeToUmaIfNeeded(); - - // Resets accumulated engagement times to zero, and updates both OS version - // and day ID. - void ResetEngagementTimePrefs(); - - bool ShouldAccumulateEngagementTotalTime() const; - bool ShouldAccumulateEngagementForegroundTime() const; - bool ShouldAccumulateEngagementBackgroundTime() const; - bool ShouldRecordEngagementTimeToUma() const; - THREAD_CHECKER(thread_checker_); ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. - std::unique_ptr<ArcWindowDelegate> arc_window_delegate_; + + // Helper class for tracking engagement metrics. + guest_os::GuestOsEngagementMetrics guest_os_engagement_metrics_; ProcessObserver process_observer_; base::RepeatingTimer request_process_list_timer_; - PrefService* const pref_service_; - const base::Clock* clock_; - const base::TickClock* tick_clock_; - base::RepeatingTimer update_engagement_time_timer_; - base::RepeatingTimer save_engagement_time_to_prefs_timer_; - base::TimeTicks last_update_ticks_; - - // States for determining which engagement metrics should we accumulate to. - bool was_session_active_ = false; - bool was_screen_dimmed_ = false; bool was_arc_window_active_ = false; std::vector<int32_t> task_ids_; - // Accumulated results and associated state which are saved to profile - // preferences at fixed interval. - int day_id_ = 0; - base::TimeDelta engagement_time_total_; - base::TimeDelta engagement_time_foreground_; - base::TimeDelta engagement_time_background_; - bool gamepad_interaction_recorded_ = false; // Always keep this the last member of this class to make sure it's the // first thing to be destructed. - base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_; + base::WeakPtrFactory<ArcMetricsService> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcMetricsService); }; diff --git a/chromium/components/arc/metrics/arc_metrics_service_unittest.cc b/chromium/components/arc/metrics/arc_metrics_service_unittest.cc index dd91dfb8ce4..c48b29206e1 100644 --- a/chromium/components/arc/metrics/arc_metrics_service_unittest.cc +++ b/chromium/components/arc/metrics/arc_metrics_service_unittest.cc @@ -6,19 +6,12 @@ #include <algorithm> #include <array> -#include <memory> -#include <string> #include <utility> #include "ash/public/cpp/app_types.h" #include "base/metrics/histogram_samples.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" -#include "base/time/clock.h" -#include "base/time/tick_clock.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/power/fake_power_manager_client.h" -#include "chromeos/dbus/power_manager/idle.pb.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h" #include "components/arc/arc_prefs.h" #include "components/arc/arc_service_manager.h" @@ -27,133 +20,15 @@ #include "components/arc/test/test_browser_context.h" #include "components/prefs/testing_pref_service.h" #include "components/session_manager/core/session_manager.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" namespace arc { namespace { -// Fake ArcWindowDelegate to help test recording UMA on focus changes, -// not depending on the full setup of Exo and Ash. -class FakeArcWindowDelegate : public ArcMetricsService::ArcWindowDelegate { - public: - FakeArcWindowDelegate() = default; - ~FakeArcWindowDelegate() override = default; - - bool IsArcAppWindow(const aura::Window* window) const override { - return focused_window_id_ == arc_window_id_; - } - - void RegisterActivationChangeObserver() override {} - void UnregisterActivationChangeObserver() override {} - - std::unique_ptr<aura::Window> CreateFakeArcWindow() { - const int id = next_id_++; - arc_window_id_ = id; - std::unique_ptr<aura::Window> window( - base::WrapUnique(aura::test::CreateTestWindowWithDelegate( - &dummy_delegate_, id, gfx::Rect(), nullptr))); - window->SetProperty(aura::client::kAppType, - static_cast<int>(ash::AppType::ARC_APP)); - return window; - } - - std::unique_ptr<aura::Window> CreateFakeNonArcWindow() { - const int id = next_id_++; - return base::WrapUnique(aura::test::CreateTestWindowWithDelegate( - &dummy_delegate_, id, gfx::Rect(), nullptr)); - } - - void FocusWindow(const aura::Window* window) { - focused_window_id_ = window->id(); - } - - private: - aura::test::TestWindowDelegate dummy_delegate_; - int next_id_ = 0; - int arc_window_id_ = 0; - int focused_window_id_ = 0; - - DISALLOW_COPY_AND_ASSIGN(FakeArcWindowDelegate); -}; - -// Fake base::Clock to simulate wall clock time changes, which ArcMetricsService -// uses to determine if cumulative metrics should be recorded to UMA. -class FakeClock : public base::Clock { - public: - FakeClock() : now_(base::Time::Now()) {} - - ~FakeClock() override = default; - - base::Time Now() const override { return now_; } - - void TimeElapsed(base::TimeDelta delta) { now_ += delta; } - - private: - base::Time now_; - - DISALLOW_COPY_AND_ASSIGN(FakeClock); -}; - -// Fake base::TickClock to simulate time changes which are being recorded by -// metrics. -class FakeTickClock : public base::TickClock { - public: - FakeTickClock() = default; - ~FakeTickClock() override = default; - - base::TimeTicks NowTicks() const override { return now_ticks_; } - - void TimeElapsed(base::TimeDelta delta) { now_ticks_ += delta; } - - private: - base::TimeTicks now_ticks_; - - DISALLOW_COPY_AND_ASSIGN(FakeTickClock); -}; - -// Helper class that initializes and shuts down dbus clients for testing. -class DBusThreadManagerLifetimeHelper { - public: - DBusThreadManagerLifetimeHelper() { - chromeos::PowerManagerClient::InitializeFake(); - chromeos::SessionManagerClient::InitializeFakeInMemory(); - } - - ~DBusThreadManagerLifetimeHelper() { - chromeos::SessionManagerClient::Shutdown(); - chromeos::PowerManagerClient::Shutdown(); - } -}; - -// Helper class that ensures lifetime of StabilityMetricsManager for testing. -class ScopedStabilityMetricsManager { - public: - ScopedStabilityMetricsManager() { - prefs::RegisterLocalStatePrefs(local_state_.registry()); - StabilityMetricsManager::Initialize(&local_state_); - } - - ~ScopedStabilityMetricsManager() { StabilityMetricsManager::Shutdown(); } - - private: - TestingPrefServiceSimple local_state_; - - DISALLOW_COPY_AND_ASSIGN(ScopedStabilityMetricsManager); -}; - -// Initializes dependencies before creating ArcMetricsService instance. -ArcMetricsService* CreateArcMetricsService(TestBrowserContext* context) { - // Register preferences for ARC++ engagement time metrics. - prefs::RegisterProfilePrefs(context->pref_registry()); - - return ArcMetricsService::GetForBrowserContextForTesting(context); -} - // The event names the container sends to Chrome. constexpr std::array<const char*, 11> kBootEvents{ "boot_progress_start", @@ -170,24 +45,33 @@ constexpr std::array<const char*, 11> kBootEvents{ class ArcMetricsServiceTest : public testing::Test { protected: - ArcMetricsServiceTest() - : arc_service_manager_(std::make_unique<ArcServiceManager>()), - context_(std::make_unique<TestBrowserContext>()), - service_(CreateArcMetricsService(context_.get())) { + ArcMetricsServiceTest() { + prefs::RegisterLocalStatePrefs(local_state_.registry()); + StabilityMetricsManager::Initialize(&local_state_); + chromeos::PowerManagerClient::InitializeFake(); + chromeos::SessionManagerClient::InitializeFakeInMemory(); chromeos::FakeSessionManagerClient::Get()->set_arc_available(true); - auto fake_arc_window_delegate = std::make_unique<FakeArcWindowDelegate>(); - fake_arc_window_delegate_ = fake_arc_window_delegate.get(); - service_->SetArcWindowDelegateForTesting( - std::move(fake_arc_window_delegate)); - fake_arc_window_ = fake_arc_window_delegate_->CreateFakeArcWindow(); - fake_non_arc_window_ = fake_arc_window_delegate_->CreateFakeNonArcWindow(); + arc_service_manager_ = std::make_unique<ArcServiceManager>(); + context_ = std::make_unique<TestBrowserContext>(); + prefs::RegisterProfilePrefs(context_->pref_registry()); + service_ = + ArcMetricsService::GetForBrowserContextForTesting(context_.get()); - service_->SetClockForTesting(&fake_clock_); - service_->SetTickClockForTesting(&fake_tick_clock_); + CreateFakeWindows(); } - ~ArcMetricsServiceTest() override {} + ~ArcMetricsServiceTest() override { + fake_non_arc_window_.reset(); + fake_arc_window_.reset(); + + context_.reset(); + arc_service_manager_.reset(); + + chromeos::SessionManagerClient::Shutdown(); + chromeos::PowerManagerClient::Shutdown(); + StabilityMetricsManager::Shutdown(); + } ArcMetricsService* service() { return service_; } @@ -210,53 +94,29 @@ class ArcMetricsServiceTest : public testing::Test { return events; } - void SetSessionState(session_manager::SessionState state) { - session_manager_.SetSessionState(state); - } - - void SetScreenDimmed(bool is_screen_dimmed) { - power_manager::ScreenIdleState screen_idle_state; - screen_idle_state.set_dimmed(is_screen_dimmed); - GetPowerManagerClient()->SendScreenIdleStateChanged(screen_idle_state); - } - - void TriggerRecordEngagementTimeToUma() { - // Trigger UMA record by changing to next day. - fake_clock_.TimeElapsed(base::TimeDelta::FromDays(1)); - service_->OnSessionStateChanged(); - } - - FakeArcWindowDelegate* fake_arc_window_delegate() { - return fake_arc_window_delegate_; - } aura::Window* fake_arc_window() { return fake_arc_window_.get(); } aura::Window* fake_non_arc_window() { return fake_non_arc_window_.get(); } - FakeTickClock* fake_tick_clock() { return &fake_tick_clock_; } - private: - chromeos::FakePowerManagerClient* GetPowerManagerClient() { - return static_cast<chromeos::FakePowerManagerClient*>( - chromeos::PowerManagerClient::Get()); + void CreateFakeWindows() { + fake_arc_window_.reset(aura::test::CreateTestWindowWithId( + /*id=*/0, nullptr)); + fake_arc_window_->SetProperty(aura::client::kAppType, + static_cast<int>(ash::AppType::ARC_APP)); + fake_non_arc_window_.reset(aura::test::CreateTestWindowWithId( + /*id=*/1, nullptr)); } - content::TestBrowserThreadBundle thread_bundle_; - std::unique_ptr<ArcServiceManager> arc_service_manager_; - - // DBusThreadManager, SessionManager and StabilityMetricsManager should - // outlive TestBrowserContext which destructs ArcMetricsService in dtor. - DBusThreadManagerLifetimeHelper dbus_thread_manager_lifetime_helper_; + content::BrowserTaskEnvironment task_environment_; + TestingPrefServiceSimple local_state_; session_manager::SessionManager session_manager_; - ScopedStabilityMetricsManager scoped_stability_metrics_manager_; + + std::unique_ptr<ArcServiceManager> arc_service_manager_; std::unique_ptr<TestBrowserContext> context_; + ArcMetricsService* service_; std::unique_ptr<aura::Window> fake_arc_window_; std::unique_ptr<aura::Window> fake_non_arc_window_; - FakeArcWindowDelegate* fake_arc_window_delegate_; // Owned by |service_| - FakeClock fake_clock_; - FakeTickClock fake_tick_clock_; - - ArcMetricsService* const service_; DISALLOW_COPY_AND_ASSIGN(ArcMetricsServiceTest); }; @@ -398,7 +258,6 @@ TEST_F(ArcMetricsServiceTest, ReportNativeBridge) { TEST_F(ArcMetricsServiceTest, RecordArcWindowFocusAction) { base::HistogramTester tester; - fake_arc_window_delegate()->FocusWindow(fake_arc_window()); service()->OnWindowActivated( wm::ActivationChangeObserver::ActivationReason::INPUT_EVENT, @@ -413,7 +272,6 @@ TEST_F(ArcMetricsServiceTest, RecordNothingNonArcWindowFocusAction) { base::HistogramTester tester; // Focus an ARC window once so that the histogram is created. - fake_arc_window_delegate()->FocusWindow(fake_arc_window()); service()->OnWindowActivated( wm::ActivationChangeObserver::ActivationReason::INPUT_EVENT, fake_arc_window(), nullptr); @@ -422,7 +280,6 @@ TEST_F(ArcMetricsServiceTest, RecordNothingNonArcWindowFocusAction) { static_cast<int>(UserInteractionType::APP_CONTENT_WINDOW_INTERACTION), 1); // Focusing a non-ARC window should not increase the bucket count. - fake_arc_window_delegate()->FocusWindow(fake_non_arc_window()); service()->OnWindowActivated( wm::ActivationChangeObserver::ActivationReason::INPUT_EVENT, fake_non_arc_window(), nullptr); @@ -432,150 +289,5 @@ TEST_F(ArcMetricsServiceTest, RecordNothingNonArcWindowFocusAction) { static_cast<int>(UserInteractionType::APP_CONTENT_WINDOW_INTERACTION), 1); } -TEST_F(ArcMetricsServiceTest, RecordEngagementTimeSessionLocked) { - base::HistogramTester tester; - - // Make session inactive for 1 sec. Nothing should be recorded. - SetSessionState(session_manager::SessionState::LOCKED); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(0), 1); -} - -TEST_F(ArcMetricsServiceTest, RecordEngagementTimeSessionActive) { - base::HistogramTester tester; - - // Make session active for 1 sec. Should be recorded as total time. - SetSessionState(session_manager::SessionState::ACTIVE); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(0), 1); -} - -TEST_F(ArcMetricsServiceTest, RecordEngagementTimeScreenDimmed) { - base::HistogramTester tester; - SetSessionState(session_manager::SessionState::ACTIVE); - - // Dim screen off for 1 sec. Nothing should be recorded. - SetScreenDimmed(true); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(0), 1); -} - -TEST_F(ArcMetricsServiceTest, RecordEngagementTimeArcWindowFocused) { - base::HistogramTester tester; - SetSessionState(session_manager::SessionState::ACTIVE); - - // Focus an ARC++ window for 1 sec. Should be recorded as total time and - // foreground time. - fake_arc_window_delegate()->FocusWindow(fake_arc_window()); - service()->OnWindowActivated( - wm::ActivationChangeObserver::ActivationReason::INPUT_EVENT, - fake_arc_window(), nullptr); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(0), 1); -} - -TEST_F(ArcMetricsServiceTest, RecordEngagementTimeNonArcWindowFocused) { - base::HistogramTester tester; - SetSessionState(session_manager::SessionState::ACTIVE); - - // Focus an non-ARC++ window for 1 sec. Should be recorded as total time. - fake_arc_window_delegate()->FocusWindow(fake_non_arc_window()); - service()->OnWindowActivated( - wm::ActivationChangeObserver::ActivationReason::INPUT_EVENT, - fake_arc_window(), nullptr); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(0), 1); -} - -TEST_F(ArcMetricsServiceTest, RecordEngagementTimeAppInBackground) { - base::HistogramTester tester; - SetSessionState(session_manager::SessionState::ACTIVE); - - // Open an ARC++ app in the background and wait for 1 sec. Should be recorded - // as total time and background time. - service()->OnTaskCreated(1, "", "", ""); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(0), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(1), 1); -} - -TEST_F(ArcMetricsServiceTest, - RecordEngagementTimeAppInBackgroundAndArcWindowFocused) { - base::HistogramTester tester; - SetSessionState(session_manager::SessionState::ACTIVE); - - // With an ARC++ app in the background, focus an ARC++ window for 1 sec. - // Should be recorded as total time and foreground time. - service()->OnTaskCreated(1, "", "", ""); - fake_arc_window_delegate()->FocusWindow(fake_arc_window()); - service()->OnWindowActivated( - wm::ActivationChangeObserver::ActivationReason::INPUT_EVENT, - fake_arc_window(), nullptr); - fake_tick_clock()->TimeElapsed(base::TimeDelta::FromSeconds(1)); - - TriggerRecordEngagementTimeToUma(); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Total", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.ArcTotal", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Foreground", - base::TimeDelta::FromSeconds(1), 1); - tester.ExpectTimeBucketCount("Arc.EngagementTime.Background", - base::TimeDelta::FromSeconds(0), 1); -} - } // namespace } // namespace arc diff --git a/chromium/components/arc/midis/arc_midis_bridge.cc b/chromium/components/arc/midis/arc_midis_bridge.cc index 69bdfd2d69c..4972701ee82 100644 --- a/chromium/components/arc/midis/arc_midis_bridge.cc +++ b/chromium/components/arc/midis/arc_midis_bridge.cc @@ -47,7 +47,7 @@ ArcMidisBridge* ArcMidisBridge::GetForBrowserContext( ArcMidisBridge::ArcMidisBridge(content::BrowserContext* context, ArcBridgeService* bridge_service) - : arc_bridge_service_(bridge_service), weak_factory_(this) { + : arc_bridge_service_(bridge_service) { arc_bridge_service_->midis()->SetHost(this); } diff --git a/chromium/components/arc/midis/arc_midis_bridge.h b/chromium/components/arc/midis/arc_midis_bridge.h index 9874336d508..2e49a60239e 100644 --- a/chromium/components/arc/midis/arc_midis_bridge.h +++ b/chromium/components/arc/midis/arc_midis_bridge.h @@ -10,7 +10,7 @@ #include <vector> #include "base/macros.h" -#include "components/arc/common/midis.mojom.h" +#include "components/arc/mojom/midis.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { @@ -46,7 +46,7 @@ class ArcMidisBridge : public KeyedService, mojom::MidisHostPtr midis_host_ptr_; // WeakPtrFactory to use for callbacks. - base::WeakPtrFactory<ArcMidisBridge> weak_factory_; + base::WeakPtrFactory<ArcMidisBridge> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcMidisBridge); }; diff --git a/chromium/components/arc/common/ARC_SECURITY_OWNERS b/chromium/components/arc/mojom/ARC_SECURITY_OWNERS index 84c8d11c9e8..84c8d11c9e8 100644 --- a/chromium/components/arc/common/ARC_SECURITY_OWNERS +++ b/chromium/components/arc/mojom/ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/common/BUILD.gn b/chromium/components/arc/mojom/BUILD.gn index c8064bb814c..9b89c58a421 100644 --- a/chromium/components/arc/common/BUILD.gn +++ b/chromium/components/arc/mojom/BUILD.gn @@ -9,7 +9,7 @@ import("//mojo/public/tools/bindings/mojom.gni") # inclusion is done through read_file(), which does not respect the global # defines for GN, so it itself cannot use the "is_chromeos" variable. if (is_chromeos) { - mojom("common") { + mojom("mojom") { sources = [ "accessibility_helper.mojom", "app.mojom", @@ -47,6 +47,7 @@ if (is_chromeos) { "policy.mojom", "power.mojom", "print.mojom", + "print_common.mojom", "print_spooler.mojom", "process.mojom", "property.mojom", @@ -68,13 +69,13 @@ if (is_chromeos) { public_deps = [ ":media", ":notifications", - "//media/capture/video/chromeos/mojo:cros_camera", + "//media/capture/video/chromeos/mojom:cros_camera", "//mojo/public/mojom/base", "//services/device/public/mojom:usb", "//services/media_session/public/mojom", "//services/resource_coordinator/public/mojom", "//ui/accessibility/mojom", - "//ui/gfx/geometry/mojo", + "//ui/gfx/geometry/mojom", "//url/mojom:url_mojom_gurl", ] } @@ -91,7 +92,7 @@ if (is_chromeos) { } # Media related mojo interfaces. These are used by - # //services/viz/public/interfaces. We have this separate mojom target to + # //services/viz/public/mojom. We have this separate mojom target to # avoid pulling in unnecessary interfaces. mojom("media") { sources = [ @@ -105,17 +106,17 @@ if (is_chromeos) { ] public_deps = [ - "//ui/gfx/geometry/mojo", + "//ui/gfx/geometry/mojom", ] } - source_set("struct_traits") { + source_set("mojom_traits") { sources = [ - "ime_struct_traits.h", + "ime_mojom_traits.h", ] deps = [ - ":common", + ":mojom", "//ui/base/ime:text_input_types", ] } @@ -123,11 +124,11 @@ if (is_chromeos) { source_set("unit_tests") { testonly = true sources = [ - "video_accelerator_struct_traits_unittest.cc", + "video_accelerator_mojom_traits_unittest.cc", ] deps = [ - ":common", + ":mojom", "//media", "//mojo/public/cpp/test_support:test_utils", "//testing/gtest", diff --git a/chromium/components/arc/common/OWNERS b/chromium/components/arc/mojom/OWNERS index 539b2efbb79..33e669b224a 100644 --- a/chromium/components/arc/common/OWNERS +++ b/chromium/components/arc/mojom/OWNERS @@ -6,6 +6,6 @@ per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS per-file *.typemap=file:ARC_SECURITY_OWNERS -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file:ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file:ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/common/accessibility_helper.mojom b/chromium/components/arc/mojom/accessibility_helper.mojom index 9aecc7657dc..f03ae13bda2 100644 --- a/chromium/components/arc/common/accessibility_helper.mojom +++ b/chromium/components/arc/mojom/accessibility_helper.mojom @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Next MinVersion: 16 +// Next MinVersion: 17 module arc.mojom; -import "components/arc/common/gfx.mojom"; +import "components/arc/mojom/gfx.mojom"; // For future maintainers, each of the below enums were hand picked // from their equivalents in the Android source. Keep them in the @@ -376,6 +376,36 @@ struct AccessibilityActionData { [MinVersion=13] int32 end_index; }; +// The type of shadow used for Chrome captions. +// https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle +[Extensible] +enum CaptionTextShadowType { + // Edge type value specifying no character edges. + NONE = 0, + + // Edge type value specifying uniformly outlined character edges. + UNIFORM = 1, + + // Edge type value specifying drop-shadowed character edges. + DROP_SHADOW = 2, + + // Edge type value specifying raised bevel character edges. + RAISED = 3, + + // Edge type value specifying depressed bevel character edges. + DEPRESSED = 4, +}; + +// Encapsulates settings to stylize captions. +// https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html +struct CaptionStyle { + string user_locale; + string text_size; + string text_color; + string background_color; + CaptionTextShadowType text_shadow_type; +}; + // Interface for Android communicating to Chrome. // Deprecated method IDs: 0 // Next method ID: 3 @@ -392,7 +422,7 @@ interface AccessibilityHelperHost { // Interface for communicating to Android. // Deprecated method IDs: 0, 1, 3, 5 -// Next method ID: 10 +// Next method ID: 11 interface AccessibilityHelperInstance { // Establishes full-duplex communication with the host. [MinVersion=9] Init@7(AccessibilityHelperHost host) => (); @@ -416,4 +446,7 @@ interface AccessibilityHelperInstance { // Returns Rect specifying location, or null if textLocation is not available. [MinVersion=13] RefreshWithExtraData@9(AccessibilityActionData refresh_data) => (Rect? text_location); + + // Requests the service to set the caption style. + [MinVersion=16] SetCaptionStyle@10(CaptionStyle style); }; diff --git a/chromium/components/arc/common/app.mojom b/chromium/components/arc/mojom/app.mojom index 8513efbc592..ba6af7956bd 100644 --- a/chromium/components/arc/common/app.mojom +++ b/chromium/components/arc/mojom/app.mojom @@ -6,9 +6,9 @@ module arc.mojom; -import "components/arc/common/app_permissions.mojom"; -import "components/arc/common/gfx.mojom"; -import "components/arc/common/scale_factor.mojom"; +import "components/arc/mojom/app_permissions.mojom"; +import "components/arc/mojom/gfx.mojom"; +import "components/arc/mojom/scale_factor.mojom"; import "ui/accessibility/mojom/ax_assistant_structure.mojom"; // Describes installation result. diff --git a/chromium/components/arc/mojom/app.typemap b/chromium/components/arc/mojom/app.typemap new file mode 100644 index 00000000000..c3e3ed9bde3 --- /dev/null +++ b/chromium/components/arc/mojom/app.typemap @@ -0,0 +1,6 @@ +mojom = "//components/arc/mojom/app.mojom" +public_headers = [ "//components/arc/app/arc_playstore_search_request_state.h" ] +traits_headers = [ "//components/arc/mojom/app_mojom_traits.h" ] +type_mappings = [ + "arc.mojom.AppDiscoveryRequestState=::arc::ArcPlayStoreSearchRequestState", +] diff --git a/chromium/components/arc/common/app_struct_traits.h b/chromium/components/arc/mojom/app_mojom_traits.h index 43e587de8fe..cfa23d089f5 100644 --- a/chromium/components/arc/common/app_struct_traits.h +++ b/chromium/components/arc/mojom/app_mojom_traits.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ #include "components/arc/app/arc_playstore_search_request_state.h" -#include "components/arc/common/app.mojom-shared.h" +#include "components/arc/mojom/app.mojom-shared.h" namespace mojo { @@ -122,4 +122,4 @@ struct EnumTraits<arc::mojom::AppDiscoveryRequestState, } // namespace mojo -#endif // COMPONENTS_ARC_COMMON_APP_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_MOJOM_APP_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/common/app_permissions.mojom b/chromium/components/arc/mojom/app_permissions.mojom index 0454b7411a1..0454b7411a1 100644 --- a/chromium/components/arc/common/app_permissions.mojom +++ b/chromium/components/arc/mojom/app_permissions.mojom diff --git a/chromium/components/arc/common/appfuse.mojom b/chromium/components/arc/mojom/appfuse.mojom index ee81f3c788b..ee81f3c788b 100644 --- a/chromium/components/arc/common/appfuse.mojom +++ b/chromium/components/arc/mojom/appfuse.mojom diff --git a/chromium/components/arc/common/arc_bridge.mojom b/chromium/components/arc/mojom/arc_bridge.mojom index 491cdc2da05..c0a6a2d068a 100644 --- a/chromium/components/arc/common/arc_bridge.mojom +++ b/chromium/components/arc/mojom/arc_bridge.mojom @@ -4,56 +4,56 @@ module arc.mojom; -import "components/arc/common/accessibility_helper.mojom"; -import "components/arc/common/app.mojom"; -import "components/arc/common/app_permissions.mojom"; -import "components/arc/common/appfuse.mojom"; -import "components/arc/common/audio.mojom"; -import "components/arc/common/auth.mojom"; -import "components/arc/common/backup_settings.mojom"; -import "components/arc/common/bluetooth.mojom"; -import "components/arc/common/boot_phase_monitor.mojom"; -import "components/arc/common/camera.mojom"; -import "components/arc/common/cast_receiver.mojom"; -import "components/arc/common/cert_store.mojom"; -import "components/arc/common/clipboard.mojom"; -import "components/arc/common/crash_collector.mojom"; -import "components/arc/common/disk_quota.mojom"; -import "components/arc/common/enterprise_reporting.mojom"; -import "components/arc/common/file_system.mojom"; -import "components/arc/common/ime.mojom"; -import "components/arc/common/input_method_manager.mojom"; -import "components/arc/common/intent_helper.mojom"; -import "components/arc/common/keymaster.mojom"; -import "components/arc/common/kiosk.mojom"; -import "components/arc/common/lock_screen.mojom"; -import "components/arc/common/media_session.mojom"; -import "components/arc/common/metrics.mojom"; -import "components/arc/common/midis.mojom"; -import "components/arc/common/net.mojom"; -import "components/arc/common/notifications.mojom"; -import "components/arc/common/obb_mounter.mojom"; -import "components/arc/common/oemcrypto.mojom"; -import "components/arc/common/pip.mojom"; -import "components/arc/common/policy.mojom"; -import "components/arc/common/power.mojom"; -import "components/arc/common/print.mojom"; -import "components/arc/common/print_spooler.mojom"; -import "components/arc/common/process.mojom"; -import "components/arc/common/property.mojom"; -import "components/arc/common/rotation_lock.mojom"; -import "components/arc/common/screen_capture.mojom"; -import "components/arc/common/storage_manager.mojom"; -import "components/arc/common/timer.mojom"; -import "components/arc/common/tracing.mojom"; -import "components/arc/common/tts.mojom"; -import "components/arc/common/usb_host.mojom"; -import "components/arc/common/video.mojom"; -import "components/arc/common/voice_interaction_arc_home.mojom"; -import "components/arc/common/voice_interaction_framework.mojom"; -import "components/arc/common/volume_mounter.mojom"; -import "components/arc/common/wake_lock.mojom"; -import "components/arc/common/wallpaper.mojom"; +import "components/arc/mojom/accessibility_helper.mojom"; +import "components/arc/mojom/app.mojom"; +import "components/arc/mojom/app_permissions.mojom"; +import "components/arc/mojom/appfuse.mojom"; +import "components/arc/mojom/audio.mojom"; +import "components/arc/mojom/auth.mojom"; +import "components/arc/mojom/backup_settings.mojom"; +import "components/arc/mojom/bluetooth.mojom"; +import "components/arc/mojom/boot_phase_monitor.mojom"; +import "components/arc/mojom/camera.mojom"; +import "components/arc/mojom/cast_receiver.mojom"; +import "components/arc/mojom/cert_store.mojom"; +import "components/arc/mojom/clipboard.mojom"; +import "components/arc/mojom/crash_collector.mojom"; +import "components/arc/mojom/disk_quota.mojom"; +import "components/arc/mojom/enterprise_reporting.mojom"; +import "components/arc/mojom/file_system.mojom"; +import "components/arc/mojom/ime.mojom"; +import "components/arc/mojom/input_method_manager.mojom"; +import "components/arc/mojom/intent_helper.mojom"; +import "components/arc/mojom/keymaster.mojom"; +import "components/arc/mojom/kiosk.mojom"; +import "components/arc/mojom/lock_screen.mojom"; +import "components/arc/mojom/media_session.mojom"; +import "components/arc/mojom/metrics.mojom"; +import "components/arc/mojom/midis.mojom"; +import "components/arc/mojom/net.mojom"; +import "components/arc/mojom/notifications.mojom"; +import "components/arc/mojom/obb_mounter.mojom"; +import "components/arc/mojom/oemcrypto.mojom"; +import "components/arc/mojom/pip.mojom"; +import "components/arc/mojom/policy.mojom"; +import "components/arc/mojom/power.mojom"; +import "components/arc/mojom/print.mojom"; +import "components/arc/mojom/print_spooler.mojom"; +import "components/arc/mojom/process.mojom"; +import "components/arc/mojom/property.mojom"; +import "components/arc/mojom/rotation_lock.mojom"; +import "components/arc/mojom/screen_capture.mojom"; +import "components/arc/mojom/storage_manager.mojom"; +import "components/arc/mojom/timer.mojom"; +import "components/arc/mojom/tracing.mojom"; +import "components/arc/mojom/tts.mojom"; +import "components/arc/mojom/usb_host.mojom"; +import "components/arc/mojom/video.mojom"; +import "components/arc/mojom/voice_interaction_arc_home.mojom"; +import "components/arc/mojom/voice_interaction_framework.mojom"; +import "components/arc/mojom/volume_mounter.mojom"; +import "components/arc/mojom/wake_lock.mojom"; +import "components/arc/mojom/wallpaper.mojom"; // Next MinVersion: 48 // Deprecated method IDs: 101, 105 diff --git a/chromium/components/arc/common/arc_gfx_struct_traits.cc b/chromium/components/arc/mojom/arc_gfx_mojom_traits.cc index 20858df1123..c56397edbee 100644 --- a/chromium/components/arc/common/arc_gfx_struct_traits.cc +++ b/chromium/components/arc/mojom/arc_gfx_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/common/arc_gfx_struct_traits.h" +#include "components/arc/mojom/arc_gfx_mojom_traits.h" namespace mojo { diff --git a/chromium/components/arc/common/arc_gfx_struct_traits.h b/chromium/components/arc/mojom/arc_gfx_mojom_traits.h index 02c4edf9023..82d420911f2 100644 --- a/chromium/components/arc/common/arc_gfx_struct_traits.h +++ b/chromium/components/arc/mojom/arc_gfx_mojom_traits.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_COMMON_ARC_GFX_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_COMMON_ARC_GFX_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_MOJOM_ARC_GFX_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_MOJOM_ARC_GFX_MOJOM_TRAITS_H_ -#include "components/arc/common/gfx.mojom.h" +#include "components/arc/mojom/gfx.mojom.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/range/range.h" @@ -31,4 +31,4 @@ struct StructTraits<arc::mojom::RangeDataView, gfx::Range> { } // namespace mojo -#endif // COMPONENTS_ARC_COMMON_ARC_GFX_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_MOJOM_ARC_GFX_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/common/audio.mojom b/chromium/components/arc/mojom/audio.mojom index eceb20e4cdf..eceb20e4cdf 100644 --- a/chromium/components/arc/common/audio.mojom +++ b/chromium/components/arc/mojom/audio.mojom diff --git a/chromium/components/arc/common/auth.mojom b/chromium/components/arc/mojom/auth.mojom index f723c1e85ba..837231cc354 100644 --- a/chromium/components/arc/common/auth.mojom +++ b/chromium/components/arc/mojom/auth.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: 21 +// Next MinVersion: 23 module arc.mojom; @@ -102,6 +102,45 @@ enum AccountCheckStatus { // corresponding UMA callsite in Chrome arc::UpdateAuthAccountCheckStatus. }; +[Extensible] +enum MainAccountResolutionStatus { + // No hash code was set for the main account. System contains no account of + // required type. + [MinVersion=22] NO_HASH_CODE_NO_ACCOUNT = 0, + + // No hash code was set for the main account. System contains only single + // account of required type. + [MinVersion=22] NO_HASH_CODE_SINGLE_ACCOUNT = 1, + + // No hash code was set for the main account. System contains multiple + // accounts of required type. + [MinVersion=22] NO_HASH_CODE_MULTIPLE_ACCOUNTS = 2, + + // Hash code was set but no account currently available. + [MinVersion=22] HASH_CODE_NO_ACCOUNT = 3, + + // Hash code was set but it does not match single account of required type. + [MinVersion=22] HASH_CODE_DO_NOT_MATCH_SINGLE_ACCOUNT = 4, + + // Hash code was set but it does not match multiple accounts of required + // type. + [MinVersion=22] HASH_CODE_DO_NOT_MATCH_MULTIPLE_ACCOUNTS = 5, + + // Hash code was set and it matches single account of required type. + [MinVersion=22] HASH_CODE_MATCH_SINGLE_ACCOUNT = 6, + + // Hash code was set and it matches one of multiple accounts of required + // type. + [MinVersion=22] HASH_CODE_MATCH_MULTIPLE_ACCOUNTS = 7, + + // Hash code collides with multiple accounts of required type. + [MinVersion=22] HASH_CODE_COLLIDE_FOR_MULTIPLE_ACCOUNTS = 8, + + // NOTE: If you add any entries to this enum, you must also update the + // corresponding UMA ArcAuthMainAccountResolutionStatus at + // tools/metrics/histograms/enums.xml. +}; + // These values describe the result of ARC attempting to change supervision // state after an account type change. [Extensible] @@ -296,7 +335,7 @@ interface AuthHost { [MinVersion=20] HandleUpdateCredentialsRequest@17(string account_name); }; -// Next Method ID: 5 +// Next Method ID: 6 interface AuthInstance { // DEPRECATED: Please use Init@2 instead. InitDeprecated@0(AuthHost host_ptr); @@ -325,4 +364,8 @@ interface AuthInstance { // Gets the list of Google accounts in ARC. Called during the one-time // migration of accounts from ARC to Chrome OS Account Manager. [MinVersion=19] GetGoogleAccounts@4() => (array<ArcAccountInfo> accounts); + + // Gets resolution status of main account for statistics reporting. + [MinVersion=22] GetMainAccountResolutionStatus@5() + => (MainAccountResolutionStatus status); }; diff --git a/chromium/components/arc/common/backup_settings.mojom b/chromium/components/arc/mojom/backup_settings.mojom index 4ebb2ce2e09..4ebb2ce2e09 100644 --- a/chromium/components/arc/common/backup_settings.mojom +++ b/chromium/components/arc/mojom/backup_settings.mojom diff --git a/chromium/components/arc/common/bitmap.mojom b/chromium/components/arc/mojom/bitmap.mojom index 02d96647b6c..02d96647b6c 100644 --- a/chromium/components/arc/common/bitmap.mojom +++ b/chromium/components/arc/mojom/bitmap.mojom diff --git a/chromium/components/arc/mojom/bitmap.typemap b/chromium/components/arc/mojom/bitmap.typemap new file mode 100644 index 00000000000..31574898894 --- /dev/null +++ b/chromium/components/arc/mojom/bitmap.typemap @@ -0,0 +1,13 @@ +mojom = "//components/arc/mojom/bitmap.mojom" +public_headers = [ "//third_party/skia/include/core/SkBitmap.h" ] +traits_headers = [ "//components/arc/bitmap/bitmap_mojom_traits.h" ] +sources = [ + "//components/arc/bitmap/bitmap_mojom_traits.cc", +] +deps = [ + "//skia", +] +public_deps = [ + "//skia", +] +type_mappings = [ "arc.mojom.ArcBitmap=::SkBitmap" ] diff --git a/chromium/components/arc/common/bluetooth.mojom b/chromium/components/arc/mojom/bluetooth.mojom index 67720f4e604..67720f4e604 100644 --- a/chromium/components/arc/common/bluetooth.mojom +++ b/chromium/components/arc/mojom/bluetooth.mojom diff --git a/chromium/components/arc/mojom/bluetooth.typemap b/chromium/components/arc/mojom/bluetooth.typemap new file mode 100644 index 00000000000..47715225355 --- /dev/null +++ b/chromium/components/arc/mojom/bluetooth.typemap @@ -0,0 +1,21 @@ +mojom = "//components/arc/mojom/bluetooth.mojom" +public_headers = [ + "//device/bluetooth/bluetooth_advertisement.h", + "//device/bluetooth/bluetooth_common.h", + "//device/bluetooth/public/cpp/bluetooth_uuid.h", + "//device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h", +] +traits_headers = [ "//components/arc/bluetooth/bluetooth_mojom_traits.h" ] +sources = [ + "//components/arc/bluetooth/bluetooth_mojom_traits.cc", +] +deps = [ + "//device/bluetooth", + "//device/bluetooth/public/cpp", +] +type_mappings = [ + "arc.mojom.BluetoothDeviceType=::device::BluetoothTransport", + "arc.mojom.BluetoothSdpAttributeType=::bluez::BluetoothServiceAttributeValueBlueZ::Type", + "arc.mojom.BluetoothUUID=::device::BluetoothUUID", + "arc.mojom.BluetoothAdvertisement=::std::unique_ptr<::device::BluetoothAdvertisement::Data>[move_only]", +] diff --git a/chromium/components/arc/common/boot_phase_monitor.mojom b/chromium/components/arc/mojom/boot_phase_monitor.mojom index 045270f3e1f..045270f3e1f 100644 --- a/chromium/components/arc/common/boot_phase_monitor.mojom +++ b/chromium/components/arc/mojom/boot_phase_monitor.mojom diff --git a/chromium/components/arc/common/camera.mojom b/chromium/components/arc/mojom/camera.mojom index 424bf5b659d..04106e6cec1 100644 --- a/chromium/components/arc/common/camera.mojom +++ b/chromium/components/arc/mojom/camera.mojom @@ -6,7 +6,7 @@ module arc.mojom; -import "media/capture/video/chromeos/mojo/cros_camera_service.mojom"; +import "media/capture/video/chromeos/mojom/cros_camera_service.mojom"; struct CameraDeviceInfo { string device_path@0; diff --git a/chromium/components/arc/common/cast_receiver.mojom b/chromium/components/arc/mojom/cast_receiver.mojom index 3801a1fcb2a..3801a1fcb2a 100644 --- a/chromium/components/arc/common/cast_receiver.mojom +++ b/chromium/components/arc/mojom/cast_receiver.mojom diff --git a/chromium/components/arc/common/cert_store.mojom b/chromium/components/arc/mojom/cert_store.mojom index eabf6b13731..eabf6b13731 100644 --- a/chromium/components/arc/common/cert_store.mojom +++ b/chromium/components/arc/mojom/cert_store.mojom diff --git a/chromium/components/arc/common/clipboard.mojom b/chromium/components/arc/mojom/clipboard.mojom index 11ea94683c4..11ea94683c4 100644 --- a/chromium/components/arc/common/clipboard.mojom +++ b/chromium/components/arc/mojom/clipboard.mojom diff --git a/chromium/components/arc/common/crash_collector.mojom b/chromium/components/arc/mojom/crash_collector.mojom index fb827b89f3f..fb827b89f3f 100644 --- a/chromium/components/arc/common/crash_collector.mojom +++ b/chromium/components/arc/mojom/crash_collector.mojom diff --git a/chromium/components/arc/common/disk_quota.mojom b/chromium/components/arc/mojom/disk_quota.mojom index 006537a6c95..006537a6c95 100644 --- a/chromium/components/arc/common/disk_quota.mojom +++ b/chromium/components/arc/mojom/disk_quota.mojom diff --git a/chromium/components/arc/common/enterprise_reporting.mojom b/chromium/components/arc/mojom/enterprise_reporting.mojom index 3130ee9fc54..3130ee9fc54 100644 --- a/chromium/components/arc/common/enterprise_reporting.mojom +++ b/chromium/components/arc/mojom/enterprise_reporting.mojom diff --git a/chromium/components/arc/common/file_system.mojom b/chromium/components/arc/mojom/file_system.mojom index 8b237704b72..16f0b9a12cf 100644 --- a/chromium/components/arc/common/file_system.mojom +++ b/chromium/components/arc/mojom/file_system.mojom @@ -6,8 +6,8 @@ module arc.mojom; -import "components/arc/common/bitmap.mojom"; -import "components/arc/common/intent_common.mojom"; +import "components/arc/mojom/bitmap.mojom"; +import "components/arc/mojom/intent_common.mojom"; import "url/mojom/url.mojom"; // Represents a document in Android DocumentsProvider. diff --git a/chromium/components/arc/common/file_system.typemap b/chromium/components/arc/mojom/file_system.typemap index e21e8490f6a..8ea6051a9cf 100644 --- a/chromium/components/arc/common/file_system.typemap +++ b/chromium/components/arc/mojom/file_system.typemap @@ -2,13 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//components/arc/common/file_system.mojom" +mojom = "//components/arc/mojom/file_system.mojom" public_headers = [ "//storage/browser/fileapi/watcher_manager.h" ] public_deps = [ "//storage/browser", ] -traits_headers = [ "//components/arc/file_system/file_system_struct_traits.h" ] +traits_headers = [ "//components/arc/file_system/file_system_mojom_traits.h" ] sources = [ - "//components/arc/file_system/file_system_struct_traits.cc", + "//components/arc/file_system/file_system_mojom_traits.cc", ] -type_mappings = [ "arc.mojom.ChangeType=storage::WatcherManager::ChangeType" ] +type_mappings = [ "arc.mojom.ChangeType=::storage::WatcherManager::ChangeType" ] diff --git a/chromium/components/arc/common/gfx.mojom b/chromium/components/arc/mojom/gfx.mojom index aaf58a27b7e..aaf58a27b7e 100644 --- a/chromium/components/arc/common/gfx.mojom +++ b/chromium/components/arc/mojom/gfx.mojom diff --git a/chromium/components/arc/common/gfx.typemap b/chromium/components/arc/mojom/gfx.typemap index be462bc0ab5..48ba64aabfe 100644 --- a/chromium/components/arc/common/gfx.typemap +++ b/chromium/components/arc/mojom/gfx.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//components/arc/common/gfx.mojom" +mojom = "//components/arc/mojom/gfx.mojom" public_headers = [ "//ui/gfx/geometry/rect.h", @@ -13,10 +13,10 @@ deps = [ "//ui/gfx", ] -traits_headers = [ "//components/arc/common/arc_gfx_struct_traits.h" ] +traits_headers = [ "//components/arc/mojom/arc_gfx_mojom_traits.h" ] sources = [ - "//components/arc/common/arc_gfx_struct_traits.cc", + "//components/arc/mojom/arc_gfx_mojom_traits.cc", ] type_mappings = [ diff --git a/chromium/components/arc/common/ime.mojom b/chromium/components/arc/mojom/ime.mojom index 3e103302e6c..14b38312b8e 100644 --- a/chromium/components/arc/common/ime.mojom +++ b/chromium/components/arc/mojom/ime.mojom @@ -6,7 +6,7 @@ module arc.mojom; -import "components/arc/common/gfx.mojom"; +import "components/arc/mojom/gfx.mojom"; // Represents the type of text input field currently focused. [Extensible] diff --git a/chromium/components/arc/mojom/ime.typemap b/chromium/components/arc/mojom/ime.typemap new file mode 100644 index 00000000000..d82e98af726 --- /dev/null +++ b/chromium/components/arc/mojom/ime.typemap @@ -0,0 +1,4 @@ +mojom = "//components/arc/mojom/ime.mojom" +public_headers = [ "//ui/base/ime/text_input_type.h" ] +traits_headers = [ "//components/arc/mojom/ime_mojom_traits.h" ] +type_mappings = [ "arc.mojom.TextInputType=::ui::TextInputType" ] diff --git a/chromium/components/arc/common/ime_struct_traits.h b/chromium/components/arc/mojom/ime_mojom_traits.h index c366cff17ef..c79568373b8 100644 --- a/chromium/components/arc/common/ime_struct_traits.h +++ b/chromium/components/arc/mojom/ime_mojom_traits.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_COMMON_IME_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_COMMON_IME_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ -#include "components/arc/common/ime.mojom-shared.h" +#include "components/arc/mojom/ime.mojom-shared.h" #include "ui/base/ime/text_input_type.h" namespace mojo { @@ -107,4 +107,4 @@ struct EnumTraits<arc::mojom::TextInputType, ui::TextInputType> { } // namespace mojo -#endif // COMPONENTS_ARC_COMMON_IME_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_MOJOM_IME_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/common/input_method_manager.mojom b/chromium/components/arc/mojom/input_method_manager.mojom index c5c0b930d2b..c8e3dcde029 100644 --- a/chromium/components/arc/common/input_method_manager.mojom +++ b/chromium/components/arc/mojom/input_method_manager.mojom @@ -7,8 +7,8 @@ module arc.mojom; import "mojo/public/mojom/base/string16.mojom"; -import "components/arc/common/gfx.mojom"; -import "components/arc/common/ime.mojom"; +import "components/arc/mojom/gfx.mojom"; +import "components/arc/mojom/ime.mojom"; // Represents the information of an Android IME. struct ImeInfo { diff --git a/chromium/components/arc/common/intent_common.mojom b/chromium/components/arc/mojom/intent_common.mojom index d18b11e08a0..d18b11e08a0 100644 --- a/chromium/components/arc/common/intent_common.mojom +++ b/chromium/components/arc/mojom/intent_common.mojom diff --git a/chromium/components/arc/common/intent_helper.mojom b/chromium/components/arc/mojom/intent_helper.mojom index ab63854fe9f..acf15f732b6 100644 --- a/chromium/components/arc/common/intent_helper.mojom +++ b/chromium/components/arc/mojom/intent_helper.mojom @@ -6,9 +6,9 @@ module arc.mojom; -import "components/arc/common/bitmap.mojom"; -import "components/arc/common/intent_common.mojom"; -import "components/arc/common/scale_factor.mojom"; +import "components/arc/mojom/bitmap.mojom"; +import "components/arc/mojom/intent_common.mojom"; +import "components/arc/mojom/scale_factor.mojom"; [Extensible] enum PatternType { diff --git a/chromium/components/arc/common/intent_helper.typemap b/chromium/components/arc/mojom/intent_helper.typemap index 5b1a17ceb56..3a774f359d8 100644 --- a/chromium/components/arc/common/intent_helper.typemap +++ b/chromium/components/arc/mojom/intent_helper.typemap @@ -2,12 +2,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//components/arc/common/intent_helper.mojom" +mojom = "//components/arc/mojom/intent_helper.mojom" public_headers = [ "//components/arc/intent_helper/intent_filter.h" ] traits_headers = - [ "//components/arc/intent_helper/intent_filter_struct_traits.h" ] + [ "//components/arc/intent_helper/intent_filter_mojom_traits.h" ] sources = [ - "//components/arc/intent_helper/intent_filter_struct_traits.cc", + "//components/arc/intent_helper/intent_filter_mojom_traits.cc", ] type_mappings = [ "arc.mojom.IntentFilter=::arc::IntentFilter[move_only]", diff --git a/chromium/components/arc/common/keymaster.mojom b/chromium/components/arc/mojom/keymaster.mojom index 24475b72636..24475b72636 100644 --- a/chromium/components/arc/common/keymaster.mojom +++ b/chromium/components/arc/mojom/keymaster.mojom diff --git a/chromium/components/arc/common/kiosk.mojom b/chromium/components/arc/mojom/kiosk.mojom index 39beb508f79..39beb508f79 100644 --- a/chromium/components/arc/common/kiosk.mojom +++ b/chromium/components/arc/mojom/kiosk.mojom diff --git a/chromium/components/arc/common/lock_screen.mojom b/chromium/components/arc/mojom/lock_screen.mojom index a19bc32dbbd..a19bc32dbbd 100644 --- a/chromium/components/arc/common/lock_screen.mojom +++ b/chromium/components/arc/mojom/lock_screen.mojom diff --git a/chromium/components/arc/common/media_session.mojom b/chromium/components/arc/mojom/media_session.mojom index f8e2c936c5f..f8e2c936c5f 100644 --- a/chromium/components/arc/common/media_session.mojom +++ b/chromium/components/arc/mojom/media_session.mojom diff --git a/chromium/components/arc/common/metrics.mojom b/chromium/components/arc/mojom/metrics.mojom index 8a603cde00c..8a603cde00c 100644 --- a/chromium/components/arc/common/metrics.mojom +++ b/chromium/components/arc/mojom/metrics.mojom diff --git a/chromium/components/arc/common/midis.mojom b/chromium/components/arc/mojom/midis.mojom index 4a8e1735e20..4a8e1735e20 100644 --- a/chromium/components/arc/common/midis.mojom +++ b/chromium/components/arc/mojom/midis.mojom diff --git a/chromium/components/arc/common/net.mojom b/chromium/components/arc/mojom/net.mojom index 731445ab940..731445ab940 100644 --- a/chromium/components/arc/common/net.mojom +++ b/chromium/components/arc/mojom/net.mojom diff --git a/chromium/components/arc/common/notifications.mojom b/chromium/components/arc/mojom/notifications.mojom index 85f6ee81564..a208c0b47a1 100644 --- a/chromium/components/arc/common/notifications.mojom +++ b/chromium/components/arc/mojom/notifications.mojom @@ -6,8 +6,8 @@ module arc.mojom; -import "components/arc/common/bitmap.mojom"; -import "components/arc/common/gfx.mojom"; +import "components/arc/mojom/bitmap.mojom"; +import "components/arc/mojom/gfx.mojom"; // These values must be matched with the NOTIFICATION_EVENT_* constants in // com.android.server.ArcNotificationListenerService. diff --git a/chromium/components/arc/common/obb_mounter.mojom b/chromium/components/arc/mojom/obb_mounter.mojom index d3659753320..d3659753320 100644 --- a/chromium/components/arc/common/obb_mounter.mojom +++ b/chromium/components/arc/mojom/obb_mounter.mojom diff --git a/chromium/components/arc/common/oemcrypto.mojom b/chromium/components/arc/mojom/oemcrypto.mojom index 21db429814d..2c4b74737da 100644 --- a/chromium/components/arc/common/oemcrypto.mojom +++ b/chromium/components/arc/mojom/oemcrypto.mojom @@ -5,7 +5,7 @@ // Next MinVersion: 3 // The original version of this file lives in the Chromium repository at: -// src/components/arc/common/oemcrypto.mojom +// src/components/arc/mojom/oemcrypto.mojom // This file defines the mojo interface between Android, Chrome and the // Chrome OS daemon for the Widevine L1 OEMCrypto implementation used in ARC++. diff --git a/chromium/components/arc/common/oemcrypto_daemon.mojom b/chromium/components/arc/mojom/oemcrypto_daemon.mojom index 887c175228e..a7128c91449 100644 --- a/chromium/components/arc/common/oemcrypto_daemon.mojom +++ b/chromium/components/arc/mojom/oemcrypto_daemon.mojom @@ -3,7 +3,7 @@ // found in the LICENSE file. // The original version of this file lives in the Chromium repository at: -// src/components/arc/common/oemcrypto_daemon.mojom +// 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 @@ -13,8 +13,8 @@ module arc_oemcrypto.mojom; -import "components/arc/common/oemcrypto.mojom"; -import "components/arc/common/protected_buffer_manager.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. diff --git a/chromium/components/arc/common/pip.mojom b/chromium/components/arc/mojom/pip.mojom index ce620e0f570..ce620e0f570 100644 --- a/chromium/components/arc/common/pip.mojom +++ b/chromium/components/arc/mojom/pip.mojom diff --git a/chromium/components/arc/common/policy.mojom b/chromium/components/arc/mojom/policy.mojom index 71489020452..71489020452 100644 --- a/chromium/components/arc/common/policy.mojom +++ b/chromium/components/arc/mojom/policy.mojom diff --git a/chromium/components/arc/common/power.mojom b/chromium/components/arc/mojom/power.mojom index b3304bf856c..b3304bf856c 100644 --- a/chromium/components/arc/common/power.mojom +++ b/chromium/components/arc/mojom/power.mojom diff --git a/chromium/components/arc/common/print.mojom b/chromium/components/arc/mojom/print.mojom index f74d468ca4c..c7eb2e736a7 100644 --- a/chromium/components/arc/common/print.mojom +++ b/chromium/components/arc/mojom/print.mojom @@ -6,123 +6,7 @@ module arc.mojom; -// android.print.PageRange -struct PrintPageRange { - // First page inclusive. - int32 start; - // Last page inclusive. - int32 end; -}; - -// android.print.PrintAttributes.MediaSize -struct PrintMediaSize { - // Id unique among media sizes. - string id; - // Localized label. - string label; - int32 width_mils; - int32 height_mils; -}; - -// android.print.PrintAttributes.Resolution -struct PrintResolution { - // Id unique among resolutions. - string id; - // Localized label. - string label; - int32 horizontal_dpi; - int32 vertical_dpi; -}; - -// android.print.PrintAttributes.Margins -struct PrintMargins { - int32 left_mils; - int32 top_mils; - int32 right_mils; - int32 bottom_mils; -}; - -// android.print.PrintAttributes.COLOR_MODE_* -[Extensible] -enum PrintColorMode { - MONOCHROME = 1, - COLOR = 2, -}; - -// android.print.PrintAttributes.DUPLEX_MODE_* -[Extensible] -enum PrintDuplexMode { - NONE = 1, - LONG_EDGE = 2, - SHORT_EDGE = 4, -}; - -// android.print.PrintDocumentInfo.CONTENT_TYPE_* -[Extensible] -enum PrintContentType { - UNKNOWN = -1, - DOCUMENT = 0, - PHOTO = 1, -}; - -// android.print.PrintAttributes -struct PrintAttributes { - PrintMediaSize? media_size; - PrintResolution? resolution; - PrintMargins? min_margins; - PrintColorMode color_mode; - PrintDuplexMode duplex_mode; -}; - -struct PrintJobRequest { - // android.printservice.PrintJob fields: - array<int8> id; - string label; - string? printer_id; - int64 creation_time; - int32 copies; - array<PrintPageRange> pages; - PrintAttributes attributes; - // android.print.PrintDocumentInfo fields: - string document_name; - int32 document_page_count; - PrintContentType content_type; - int64 data_size; - // android.printservice.PrintDocument fields: - handle? data; -}; - -// android.print.PrinterInfo.STATUS_* -[Extensible] -enum PrinterStatus { - IDLE = 1, - BUSY = 2, - UNAVAILABLE = 3, -}; - -// android.print.PrinterCapabilitiesInfo -struct PrinterCapabilities { - array<PrintMediaSize> media_sizes; - array<PrintResolution> resolutions; - PrintMargins min_margins; - PrintColorMode color_modes; - PrintDuplexMode duplex_modes; - PrintAttributes defaults; -}; - -// android.print.PrinterInfo -struct PrinterInfo { - // Id unique among printers. - string id; - // Localized name. - string name; - PrinterStatus status; - // Localized description. - string? description; - // Intent for provider-specific settings. - string? info_intent; - PrinterCapabilities? capabilities; -}; +import "components/arc/mojom/print_common.mojom"; // android.printservice.PrinterDiscoverySession implementation. // This is called by container when printing is requested and printer discovery diff --git a/chromium/components/arc/mojom/print.typemap b/chromium/components/arc/mojom/print.typemap new file mode 100644 index 00000000000..231f12f8593 --- /dev/null +++ b/chromium/components/arc/mojom/print.typemap @@ -0,0 +1,19 @@ +mojom = "//components/arc/mojom/print_common.mojom" +public_headers = [ + "//printing/backend/print_backend.h", + "//printing/page_range.h", + "//ui/gfx/geometry/size.h", +] +traits_headers = [ "//chrome/browser/chromeos/arc/print/print_mojom_traits.h" ] +sources = [ + "//chrome/browser/chromeos/arc/print/print_mojom_traits.cc", +] +deps = [] +public_deps = [ + "//printing:printing", +] +type_mappings = [ + "arc.mojom.PrintPageRange=::printing::PageRange", + "arc.mojom.PrintResolution=::gfx::Size", + "arc.mojom.PrinterCapabilities=::printing::PrinterSemanticCapsAndDefaults", +] diff --git a/chromium/components/arc/mojom/print_common.mojom b/chromium/components/arc/mojom/print_common.mojom new file mode 100644 index 00000000000..006181d8d2b --- /dev/null +++ b/chromium/components/arc/mojom/print_common.mojom @@ -0,0 +1,123 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module arc.mojom; + +// android.print.PageRange +struct PrintPageRange { + // First page inclusive. + int32 start; + // Last page inclusive. + int32 end; +}; + +// android.print.PrintAttributes.MediaSize +struct PrintMediaSize { + // Id unique among media sizes. + string id; + // Localized label. + string label; + int32 width_mils; + int32 height_mils; +}; + +// android.print.PrintAttributes.Resolution +struct PrintResolution { + // Id unique among resolutions. + string id; + // Localized label. + string label; + int32 horizontal_dpi; + int32 vertical_dpi; +}; + +// android.print.PrintAttributes.Margins +struct PrintMargins { + int32 left_mils; + int32 top_mils; + int32 right_mils; + int32 bottom_mils; +}; + +// android.print.PrintAttributes.COLOR_MODE_* +[Extensible] +enum PrintColorMode { + MONOCHROME = 1, + COLOR = 2, +}; + +// android.print.PrintAttributes.DUPLEX_MODE_* +[Extensible] +enum PrintDuplexMode { + NONE = 1, + LONG_EDGE = 2, + SHORT_EDGE = 4, +}; + +// android.print.PrintDocumentInfo.CONTENT_TYPE_* +[Extensible] +enum PrintContentType { + UNKNOWN = -1, + DOCUMENT = 0, + PHOTO = 1, +}; + +// android.print.PrintAttributes +struct PrintAttributes { + PrintMediaSize? media_size; + PrintResolution? resolution; + PrintMargins? min_margins; + PrintColorMode color_mode; + PrintDuplexMode duplex_mode; +}; + +struct PrintJobRequest { + // android.printservice.PrintJob fields: + array<int8> id; + string label; + string? printer_id; + int64 creation_time; + int32 copies; + array<PrintPageRange> pages; + PrintAttributes attributes; + // android.print.PrintDocumentInfo fields: + string document_name; + int32 document_page_count; + PrintContentType content_type; + int64 data_size; + // android.printservice.PrintDocument fields: + handle? data; +}; + +// android.print.PrinterInfo.STATUS_* +[Extensible] +enum PrinterStatus { + IDLE = 1, + BUSY = 2, + UNAVAILABLE = 3, +}; + +// android.print.PrinterCapabilitiesInfo +struct PrinterCapabilities { + array<PrintMediaSize> media_sizes; + array<PrintResolution> resolutions; + PrintMargins min_margins; + PrintColorMode color_modes; + PrintDuplexMode duplex_modes; + PrintAttributes defaults; +}; + +// android.print.PrinterInfo +struct PrinterInfo { + // Id unique among printers. + string id; + // Localized name. + string name; + PrinterStatus status; + // Localized description. + string? description; + // Intent for provider-specific settings. + string? info_intent; + PrinterCapabilities? capabilities; +}; diff --git a/chromium/components/arc/mojom/print_spooler.mojom b/chromium/components/arc/mojom/print_spooler.mojom new file mode 100644 index 00000000000..978be91e01e --- /dev/null +++ b/chromium/components/arc/mojom/print_spooler.mojom @@ -0,0 +1,52 @@ +// 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. +// +// Next MinVersion: 3 + +module arc.mojom; + +import "components/arc/mojom/print_common.mojom"; + +// Represents the Chrome side of a print session. Used by ARC to send +// print-related messages to Chrome and interact with the ARC Custom Tab used +// for printing. +// Closing the interface will close the ARC Custom Tab. +// Next method ID: 0 +interface PrintSessionHost { +}; + +// Represents the ARC side of a print session. Used by Chrome to send +// print-related messages to ARC and request rendered print documents. +// Next method ID: 1 +interface PrintSessionInstance { + // Called when Chrome print preview is closed. + [MinVersion=2] OnPrintPreviewClosed@0(); + + // TODO(jschettler): Add method to render a print document. +}; + +// Used by ARC to create a new print session. A print session is used to print a +// document from ARC using Chrome print preview. +// Next method ID: 1 +interface PrintSpoolerHost { + // Opens the file owned by |scoped_handle| in Chrome print preview in an ARC + // Custom Tab. + // The |task_id| and |surface_id| specify the Android task and the surface on + // which the ARC Custom Tab should be shown. + // 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) + => (PrintSessionHost? host); +}; + +// Next method ID: 1 +interface PrintSpoolerInstance { + // Establishes full-duplex communication with the host. + [MinVersion=0] Init@0(PrintSpoolerHost host_ptr) => (); +}; diff --git a/chromium/components/arc/common/process.mojom b/chromium/components/arc/mojom/process.mojom index 1dd08326bad..76b68ac375c 100644 --- a/chromium/components/arc/common/process.mojom +++ b/chromium/components/arc/mojom/process.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: 8 +// Next MinVersion: 9 module arc.mojom; @@ -109,7 +109,19 @@ struct RunningAppProcessInfo { int64 last_activity_time; }; -// Next Method ID: 8 +// Describes the memory usage of an ARC process. +struct ArcMemoryDump { + // PID (within ARC's PID namespace) of the process. + uint32 pid; + + // Resident Set Size (RSS) in kilobytes + uint32 resident_set_kb = 0; + + // Private footprint (RSS + swap usage) in kilobytes + uint32 private_footprint_kb = 0; +}; + +// Next Method ID: 10 interface ProcessInstance { // Requests ARC instance to kill a process. [MinVersion=1] @@ -120,11 +132,22 @@ interface ProcessInstance { // Requests memory usage dumps for all ARC application processes. [MinVersion=7] - RequestApplicationProcessMemoryInfo@6() - => (memory_instrumentation.mojom.GlobalMemoryDump dump); + RequestApplicationProcessMemoryInfoDeprecated@6() + => (memory_instrumentation.mojom.GlobalMemoryDump dump); // Requests memory usage dumps for all ARC system processes. [MinVersion=7] - RequestSystemProcessMemoryInfo@7(array<uint32> nspids) - => (memory_instrumentation.mojom.GlobalMemoryDump dump); + RequestSystemProcessMemoryInfoDeprecated@7(array<uint32> nspids) + => (memory_instrumentation.mojom.GlobalMemoryDump dump); + + // Requests memory usage dumps for all ARC application processes. + [MinVersion=8] + RequestApplicationProcessMemoryInfo@8() + => (array<ArcMemoryDump> process_dumps); + + // Requests memory usage dumps for all ARC system processes. + [MinVersion=8] + RequestSystemProcessMemoryInfo@9(array<uint32> nspids) + => (array<ArcMemoryDump> process_dumps); + }; diff --git a/chromium/components/arc/common/property.mojom b/chromium/components/arc/mojom/property.mojom index 8e1ca2e874f..8e1ca2e874f 100644 --- a/chromium/components/arc/common/property.mojom +++ b/chromium/components/arc/mojom/property.mojom diff --git a/chromium/components/arc/common/protected_buffer_manager.mojom b/chromium/components/arc/mojom/protected_buffer_manager.mojom index 298f6d3bbf2..633bab84235 100644 --- a/chromium/components/arc/common/protected_buffer_manager.mojom +++ b/chromium/components/arc/mojom/protected_buffer_manager.mojom @@ -3,7 +3,7 @@ // found in the LICENSE file. // The original version of this file lives in the Chromium repository at: -// src/components/arc/common/protected_buffer_manager.mojom +// src/components/arc/mojom/protected_buffer_manager.mojom module arc.mojom; diff --git a/chromium/components/arc/common/rotation_lock.mojom b/chromium/components/arc/mojom/rotation_lock.mojom index 9bfeb524a52..9bfeb524a52 100644 --- a/chromium/components/arc/common/rotation_lock.mojom +++ b/chromium/components/arc/mojom/rotation_lock.mojom diff --git a/chromium/components/arc/common/scale_factor.mojom b/chromium/components/arc/mojom/scale_factor.mojom index df38c5c035b..df38c5c035b 100644 --- a/chromium/components/arc/common/scale_factor.mojom +++ b/chromium/components/arc/mojom/scale_factor.mojom diff --git a/chromium/components/arc/common/screen_capture.mojom b/chromium/components/arc/mojom/screen_capture.mojom index 8a3bc852adf..960012ca016 100644 --- a/chromium/components/arc/common/screen_capture.mojom +++ b/chromium/components/arc/mojom/screen_capture.mojom @@ -8,14 +8,14 @@ // permissions to capture the entire desktop and then also perform that capture. // The original version of this file lives in the Chromium repository at: -// src/components/arc/common/screen_capture.mojom +// src/components/arc/mojom/screen_capture.mojom // Next MinVersion: 2 module arc.mojom; // For gfx::Size. -import "components/arc/common/video_common.mojom"; +import "components/arc/mojom/video_common.mojom"; // Implemented by Chrome in order to allow requesting of permissions to perform // desktop capture as well as creating a session for it. diff --git a/chromium/components/arc/common/storage_manager.mojom b/chromium/components/arc/mojom/storage_manager.mojom index 2e4295dd240..2e4295dd240 100644 --- a/chromium/components/arc/common/storage_manager.mojom +++ b/chromium/components/arc/mojom/storage_manager.mojom diff --git a/chromium/components/arc/common/timer.mojom b/chromium/components/arc/mojom/timer.mojom index 4d8760e3096..4d8760e3096 100644 --- a/chromium/components/arc/common/timer.mojom +++ b/chromium/components/arc/mojom/timer.mojom diff --git a/chromium/components/arc/mojom/timer.typemap b/chromium/components/arc/mojom/timer.typemap new file mode 100644 index 00000000000..2226601b3fe --- /dev/null +++ b/chromium/components/arc/mojom/timer.typemap @@ -0,0 +1,10 @@ +# Copyright 2018 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. + +mojom = "//components/arc/mojom/timer.mojom" +traits_headers = [ "//components/arc/timer/arc_timer_mojom_traits.h" ] +sources = [ + "//components/arc/timer/arc_timer_mojom_traits.cc", +] +type_mappings = [ "arc.mojom.ClockId=::clockid_t" ] diff --git a/chromium/components/arc/common/tracing.mojom b/chromium/components/arc/mojom/tracing.mojom index aa1f5a2f3bc..aa1f5a2f3bc 100644 --- a/chromium/components/arc/common/tracing.mojom +++ b/chromium/components/arc/mojom/tracing.mojom diff --git a/chromium/components/arc/common/tts.mojom b/chromium/components/arc/mojom/tts.mojom index b013a1b2c21..b013a1b2c21 100644 --- a/chromium/components/arc/common/tts.mojom +++ b/chromium/components/arc/mojom/tts.mojom diff --git a/chromium/components/arc/mojom/typemaps.gni b/chromium/components/arc/mojom/typemaps.gni new file mode 100644 index 00000000000..6b295325ab4 --- /dev/null +++ b/chromium/components/arc/mojom/typemaps.gni @@ -0,0 +1,18 @@ +# Copyright 2016 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. + +typemaps = [ + "//components/arc/mojom/app.typemap", + "//components/arc/mojom/bitmap.typemap", + "//components/arc/mojom/bluetooth.typemap", + "//components/arc/mojom/file_system.typemap", + "//components/arc/mojom/gfx.typemap", + "//components/arc/mojom/ime.typemap", + "//components/arc/mojom/intent_helper.typemap", + "//components/arc/mojom/print.typemap", + "//components/arc/mojom/timer.typemap", + "//components/arc/mojom/video_common.typemap", + "//components/arc/mojom/video_encode_accelerator.typemap", + "//components/arc/mojom/volume_mounter.typemap", +] diff --git a/chromium/components/arc/common/usb_host.mojom b/chromium/components/arc/mojom/usb_host.mojom index ff41f57cbaa..ff41f57cbaa 100644 --- a/chromium/components/arc/common/usb_host.mojom +++ b/chromium/components/arc/mojom/usb_host.mojom diff --git a/chromium/components/arc/common/video.mojom b/chromium/components/arc/mojom/video.mojom index acc40a454c2..22f2558e8c9 100644 --- a/chromium/components/arc/common/video.mojom +++ b/chromium/components/arc/mojom/video.mojom @@ -6,9 +6,9 @@ module arc.mojom; -import "components/arc/common/video_decode_accelerator.mojom"; -import "components/arc/common/video_encode_accelerator.mojom"; -import "components/arc/common/video_protected_buffer_allocator.mojom"; +import "components/arc/mojom/video_decode_accelerator.mojom"; +import "components/arc/mojom/video_encode_accelerator.mojom"; +import "components/arc/mojom/video_protected_buffer_allocator.mojom"; // Deprecated method IDs: 0 // Next method ID: 2 diff --git a/chromium/components/arc/common/video_accelerator_struct_traits.cc b/chromium/components/arc/mojom/video_accelerator_mojom_traits.cc index 4116b28ca39..cd270013b47 100644 --- a/chromium/components/arc/common/video_accelerator_struct_traits.cc +++ b/chromium/components/arc/mojom/video_accelerator_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/common/video_accelerator_struct_traits.h" +#include "components/arc/mojom/video_accelerator_mojom_traits.h" namespace mojo { diff --git a/chromium/components/arc/common/video_accelerator_struct_traits.h b/chromium/components/arc/mojom/video_accelerator_mojom_traits.h index f9c959f8863..9ac646001ef 100644 --- a/chromium/components/arc/common/video_accelerator_struct_traits.h +++ b/chromium/components/arc/mojom/video_accelerator_mojom_traits.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_COMMON_VIDEO_ACCELERATOR_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_COMMON_VIDEO_ACCELERATOR_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_MOJOM_VIDEO_ACCELERATOR_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_MOJOM_VIDEO_ACCELERATOR_MOJOM_TRAITS_H_ #include <memory> -#include "components/arc/common/video_common.mojom.h" +#include "components/arc/mojom/video_common.mojom.h" #include "components/arc/video_accelerator/video_frame_plane.h" #include "media/base/decode_status.h" #include "media/base/video_codecs.h" @@ -147,4 +147,4 @@ struct EnumTraits<arc::mojom::DecodeStatus, media::DecodeStatus> { } // namespace mojo -#endif // COMPONENTS_ARC_COMMON_VIDEO_ACCELERATOR_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_MOJOM_VIDEO_ACCELERATOR_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/common/video_accelerator_struct_traits_unittest.cc b/chromium/components/arc/mojom/video_accelerator_mojom_traits_unittest.cc index 6d2e655bbda..76c21ca2a95 100644 --- a/chromium/components/arc/common/video_accelerator_struct_traits_unittest.cc +++ b/chromium/components/arc/mojom/video_accelerator_mojom_traits_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/common/video_accelerator_struct_traits.h" +#include "components/arc/mojom/video_accelerator_mojom_traits.h" #include <vector> -#include "components/arc/common/video_common.mojom.h" +#include "components/arc/mojom/video_common.mojom.h" #include "media/base/video_frame_layout.h" #include "media/base/video_types.h" #include "mojo/public/cpp/test_support/test_utils.h" diff --git a/chromium/components/arc/common/video_common.mojom b/chromium/components/arc/mojom/video_common.mojom index 3ead5042db6..3ead5042db6 100644 --- a/chromium/components/arc/common/video_common.mojom +++ b/chromium/components/arc/mojom/video_common.mojom diff --git a/chromium/components/arc/common/video_common.typemap b/chromium/components/arc/mojom/video_common.typemap index 9eb47ee6195..61488691c93 100644 --- a/chromium/components/arc/common/video_common.typemap +++ b/chromium/components/arc/mojom/video_common.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//components/arc/common/video_common.mojom" +mojom = "//components/arc/mojom/video_common.mojom" public_headers = [ "//components/arc/video_accelerator/video_frame_plane.h", "//media/base/decode_status.h", @@ -16,11 +16,11 @@ public_deps = [ "//media", ] -traits_headers = [ "//components/arc/common/video_accelerator_struct_traits.h" ] +traits_headers = [ "//components/arc/mojom/video_accelerator_mojom_traits.h" ] sources = [ - "//components/arc/common/video_accelerator_struct_traits.cc", - "//components/arc/common/video_accelerator_struct_traits.h", + "//components/arc/mojom/video_accelerator_mojom_traits.cc", + "//components/arc/mojom/video_accelerator_mojom_traits.h", ] deps = [ diff --git a/chromium/components/arc/common/video_decode_accelerator.mojom b/chromium/components/arc/mojom/video_decode_accelerator.mojom index 625b62a0d19..56bf60dd8c3 100644 --- a/chromium/components/arc/common/video_decode_accelerator.mojom +++ b/chromium/components/arc/mojom/video_decode_accelerator.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: 5 +// Next MinVersion: 4 // This file defines the mojo interface between Android and Chromium for video // decoding. Any Mojo callee that returns a value does so by callback. @@ -17,8 +17,8 @@ module arc.mojom; -import "components/arc/common/gfx.mojom"; -import "components/arc/common/video_common.mojom"; +import "components/arc/mojom/gfx.mojom"; +import "components/arc/mojom/video_common.mojom"; // Information of the bitstream buffer. struct BitstreamBuffer { @@ -78,7 +78,7 @@ struct VideoDecodeAcceleratorConfig { // the dummy buffer. // // Deprecated method IDs: 3, 7, 8 -// Next method ID: 11 +// Next method ID: 10 interface VideoDecodeAccelerator { [Extensible] enum Result { @@ -104,13 +104,7 @@ interface VideoDecodeAccelerator { // Sets the number of output picture buffers. // This releases any buffers in use/imported previously. - AssignPictureBuffersDeprecated@2(uint32 count); - - // Sets the number of output picture buffers. |size| is the frame size - // adjusted by Android. - // This releases any buffers in use/imported previously. - [MinVersion=4] - AssignPictureBuffers@10(uint32 count, Size size); + AssignPictureBuffers@2(uint32 count); // Imports a buffer to be used by the accelerator with specified // |picture_buffer_id|. diff --git a/chromium/components/arc/common/video_encode_accelerator.mojom b/chromium/components/arc/mojom/video_encode_accelerator.mojom index b4c9f417340..0bf30f7de9d 100644 --- a/chromium/components/arc/common/video_encode_accelerator.mojom +++ b/chromium/components/arc/mojom/video_encode_accelerator.mojom @@ -7,7 +7,7 @@ module arc.mojom; -import "components/arc/common/video_common.mojom"; +import "components/arc/mojom/video_common.mojom"; // Next MinVersion: 4 diff --git a/chromium/components/arc/mojom/video_encode_accelerator.typemap b/chromium/components/arc/mojom/video_encode_accelerator.typemap new file mode 100644 index 00000000000..89e99e89487 --- /dev/null +++ b/chromium/components/arc/mojom/video_encode_accelerator.typemap @@ -0,0 +1,24 @@ +# 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. + +mojom = "//components/arc/mojom/video_encode_accelerator.mojom" +public_headers = [ "//media/video/video_encode_accelerator.h" ] +public_deps = [ + "//base", + "//media/gpu", +] +traits_headers = + [ "//components/arc/mojom/video_encode_accelerator_mojom_traits.h" ] +sources = [ + "//components/arc/mojom/video_encode_accelerator_mojom_traits.cc", +] +deps = [ + "//base", +] +type_mappings = [ + "arc.mojom.VideoFrameStorageType=::media::VideoEncodeAccelerator::Config::StorageType", + "arc.mojom.VideoEncodeAccelerator.Error=::media::VideoEncodeAccelerator::Error", + "arc.mojom.VideoEncodeProfile=::media::VideoEncodeAccelerator::SupportedProfile", + "arc.mojom.VideoEncodeAcceleratorConfig=::media::VideoEncodeAccelerator::Config", +] diff --git a/chromium/components/arc/common/video_encode_accelerator_struct_traits.cc b/chromium/components/arc/mojom/video_encode_accelerator_mojom_traits.cc index 72bcd884f3d..e38ad164c0e 100644 --- a/chromium/components/arc/common/video_encode_accelerator_struct_traits.cc +++ b/chromium/components/arc/mojom/video_encode_accelerator_mojom_traits.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/common/video_encode_accelerator_struct_traits.h" +#include "components/arc/mojom/video_encode_accelerator_mojom_traits.h" #include "base/optional.h" -#include "components/arc/common/video_accelerator_struct_traits.h" +#include "components/arc/mojom/video_accelerator_mojom_traits.h" namespace mojo { diff --git a/chromium/components/arc/common/video_encode_accelerator_struct_traits.h b/chromium/components/arc/mojom/video_encode_accelerator_mojom_traits.h index aa3078c0a7b..3b2f742646b 100644 --- a/chromium/components/arc/common/video_encode_accelerator_struct_traits.h +++ b/chromium/components/arc/mojom/video_encode_accelerator_mojom_traits.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_COMMON_VIDEO_ENCODE_ACCELERATOR_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_COMMON_VIDEO_ENCODE_ACCELERATOR_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_MOJOM_VIDEO_ENCODE_ACCELERATOR_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_MOJOM_VIDEO_ENCODE_ACCELERATOR_MOJOM_TRAITS_H_ -#include "components/arc/common/video_encode_accelerator.mojom.h" +#include "components/arc/mojom/video_encode_accelerator.mojom.h" #include "media/video/video_encode_accelerator.h" namespace mojo { @@ -128,4 +128,4 @@ struct StructTraits<arc::mojom::VideoEncodeAcceleratorConfigDataView, } // namespace mojo -#endif // COMPONENTS_ARC_COMMON_VIDEO_ENCODE_ACCELERATOR_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_MOJOM_VIDEO_ENCODE_ACCELERATOR_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/common/video_protected_buffer_allocator.mojom b/chromium/components/arc/mojom/video_protected_buffer_allocator.mojom index c133cafecc4..dbb9eda3ef3 100644 --- a/chromium/components/arc/common/video_protected_buffer_allocator.mojom +++ b/chromium/components/arc/mojom/video_protected_buffer_allocator.mojom @@ -6,7 +6,7 @@ module arc.mojom; -import "components/arc/common/video_common.mojom"; +import "components/arc/mojom/video_common.mojom"; // Next method ID: 3 interface VideoProtectedBufferAllocator { diff --git a/chromium/components/arc/common/voice_interaction_arc_home.mojom b/chromium/components/arc/mojom/voice_interaction_arc_home.mojom index 10d5d57b7c7..f91b1be6e4c 100644 --- a/chromium/components/arc/common/voice_interaction_arc_home.mojom +++ b/chromium/components/arc/mojom/voice_interaction_arc_home.mojom @@ -6,7 +6,7 @@ module arc.mojom; -import "components/arc/common/gfx.mojom"; +import "components/arc/mojom/gfx.mojom"; import "mojo/public/mojom/base/string16.mojom"; // Represents view structure to be passed to ARC. The view diff --git a/chromium/components/arc/common/voice_interaction_framework.mojom b/chromium/components/arc/mojom/voice_interaction_framework.mojom index 56bcc58d948..2873ad90dfa 100644 --- a/chromium/components/arc/common/voice_interaction_framework.mojom +++ b/chromium/components/arc/mojom/voice_interaction_framework.mojom @@ -6,10 +6,10 @@ module arc.mojom; -import "components/arc/common/gfx.mojom"; +import "components/arc/mojom/gfx.mojom"; // There is another copy of the VoiceInteractionState definition in -// //ash/public/interfaces/voice_interaction_controller.mojom +// //ash/public/mojom/voice_interaction_controller.mojom // Please also update the other one if you change it. // The duplicate definition is because we do not use extensible widely // (crbug.com/731893). diff --git a/chromium/components/arc/common/volume_mounter.mojom b/chromium/components/arc/mojom/volume_mounter.mojom index 27401b9a59b..c8059971fa9 100644 --- a/chromium/components/arc/common/volume_mounter.mojom +++ b/chromium/components/arc/mojom/volume_mounter.mojom @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Next MinVersion: 3 + module arc.mojom; [Extensible] @@ -36,6 +38,10 @@ struct MountPointInfo { // The device type that contains this mount point. If unknown, the event // should be ignored. DeviceType device_type; + // Whether the mounted volume should be visible to Android apps. + // This is a user-controlled setting, which is accessible in "External + // storage preferences" screen in device settings. + [MinVersion=2] bool visible; }; // Next Method ID: 1 diff --git a/chromium/components/arc/common/volume_mounter.typemap b/chromium/components/arc/mojom/volume_mounter.typemap index 4a025cf050b..34424125d29 100644 --- a/chromium/components/arc/common/volume_mounter.typemap +++ b/chromium/components/arc/mojom/volume_mounter.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//components/arc/common/volume_mounter.mojom" +mojom = "//components/arc/mojom/volume_mounter.mojom" public_headers = [ "//chromeos/chromeos_export.h", "//chromeos/dbus/cros_disks_client.h", @@ -10,11 +10,11 @@ public_headers = [ "//chromeos/disks/disk_mount_manager.h", ] traits_headers = - [ "//components/arc/volume_mounter/volume_mounter_struct_traits.h" ] + [ "//components/arc/volume_mounter/volume_mounter_mojom_traits.h" ] sources = [ - "//components/arc/volume_mounter/volume_mounter_struct_traits.cc", + "//components/arc/volume_mounter/volume_mounter_mojom_traits.cc", ] type_mappings = [ - "arc.mojom.DeviceType=chromeos::DeviceType", - "arc.mojom.MountEvent=chromeos::disks::DiskMountManager::MountEvent", + "arc.mojom.DeviceType=::chromeos::DeviceType", + "arc.mojom.MountEvent=::chromeos::disks::DiskMountManager::MountEvent", ] diff --git a/chromium/components/arc/common/wake_lock.mojom b/chromium/components/arc/mojom/wake_lock.mojom index 44217547422..44217547422 100644 --- a/chromium/components/arc/common/wake_lock.mojom +++ b/chromium/components/arc/mojom/wake_lock.mojom diff --git a/chromium/components/arc/common/wallpaper.mojom b/chromium/components/arc/mojom/wallpaper.mojom index 3048e4560a7..3048e4560a7 100644 --- a/chromium/components/arc/common/wallpaper.mojom +++ b/chromium/components/arc/mojom/wallpaper.mojom diff --git a/chromium/components/arc/net/always_on_vpn_manager_unittest.cc b/chromium/components/arc/net/always_on_vpn_manager_unittest.cc index d18bf1c1b65..d4ff7dcaa3d 100644 --- a/chromium/components/arc/net/always_on_vpn_manager_unittest.cc +++ b/chromium/components/arc/net/always_on_vpn_manager_unittest.cc @@ -14,7 +14,7 @@ #include "chromeos/network/network_handler.h" #include "components/arc/arc_prefs.h" #include "components/prefs/testing_pref_service.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -80,7 +80,7 @@ class AlwaysOnVpnManagerTest : public testing::Test { TestingPrefServiceSimple* pref_service() { return &pref_service_; } private: - content::TestBrowserThreadBundle thread_bundle_; + content::BrowserTaskEnvironment task_environment_; TestingPrefServiceSimple pref_service_; DISALLOW_COPY_AND_ASSIGN(AlwaysOnVpnManagerTest); diff --git a/chromium/components/arc/net/arc_net_host_impl.cc b/chromium/components/arc/net/arc_net_host_impl.cc index 0ea0f510843..83ff44b4c13 100644 --- a/chromium/components/arc/net/arc_net_host_impl.cc +++ b/chromium/components/arc/net/arc_net_host_impl.cc @@ -230,7 +230,7 @@ arc::mojom::ConnectionStateType TranslateConnectionState( state == shill::kStateConfiguration) return arc::mojom::ConnectionStateType::CONNECTING; if ((state == shill::kStateIdle) || (state == shill::kStateFailure) || - (state == "")) + (state == shill::kStateDisconnect) || (state == "")) return arc::mojom::ConnectionStateType::NOT_CONNECTED; if (chromeos::NetworkState::StateIsPortalled(state)) return arc::mojom::ConnectionStateType::PORTAL; @@ -239,7 +239,7 @@ arc::mojom::ConnectionStateType TranslateConnectionState( // The remaining cases defined in shill dbus-constants are legacy values from // Flimflam and are not expected to be encountered. These are: kStateCarrier, - // kStateActivationFailure, kStateDisconnect, and kStateOffline. + // kStateActivationFailure, and kStateOffline. NOTREACHED() << "Unknown connection state: " << state; return arc::mojom::ConnectionStateType::NOT_CONNECTED; } @@ -458,7 +458,7 @@ ArcNetHostImpl* ArcNetHostImpl::GetForBrowserContextForTesting( ArcNetHostImpl::ArcNetHostImpl(content::BrowserContext* context, ArcBridgeService* bridge_service) - : arc_bridge_service_(bridge_service), weak_factory_(this) { + : arc_bridge_service_(bridge_service) { arc_bridge_service_->net()->SetHost(this); arc_bridge_service_->net()->AddObserver(this); } diff --git a/chromium/components/arc/net/arc_net_host_impl.h b/chromium/components/arc/net/arc_net_host_impl.h index fca8d74ba01..79d19676d33 100644 --- a/chromium/components/arc/net/arc_net_host_impl.h +++ b/chromium/components/arc/net/arc_net_host_impl.h @@ -18,7 +18,7 @@ #include "base/values.h" #include "chromeos/network/network_connection_observer.h" #include "chromeos/network/network_state_handler_observer.h" -#include "components/arc/common/net.mojom.h" +#include "components/arc/mojom/net.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" @@ -165,7 +165,7 @@ class ArcNetHostImpl : public KeyedService, PrefService* pref_service_ = nullptr; THREAD_CHECKER(thread_checker_); - base::WeakPtrFactory<ArcNetHostImpl> weak_factory_; + base::WeakPtrFactory<ArcNetHostImpl> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl); }; diff --git a/chromium/components/arc/net/arc_net_host_impl_unittest.cc b/chromium/components/arc/net/arc_net_host_impl_unittest.cc index 2dab5b4168a..d43dbad1dda 100644 --- a/chromium/components/arc/net/arc_net_host_impl_unittest.cc +++ b/chromium/components/arc/net/arc_net_host_impl_unittest.cc @@ -11,7 +11,7 @@ #include "components/arc/arc_service_manager.h" #include "components/arc/test/test_browser_context.h" #include "components/prefs/testing_pref_service.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/browser_task_environment.h" #include "testing/gtest/include/gtest/gtest.h" namespace arc { @@ -34,7 +34,7 @@ class ArcNetHostImplTest : public testing::Test { TestingPrefServiceSimple* pref_service() { return &pref_service_; } private: - content::TestBrowserThreadBundle thread_bundle_; + content::BrowserTaskEnvironment task_environment_; std::unique_ptr<ArcServiceManager> arc_service_manager_; TestingPrefServiceSimple pref_service_; std::unique_ptr<TestBrowserContext> context_; diff --git a/chromium/components/arc/obb_mounter/arc_obb_mounter_bridge.h b/chromium/components/arc/obb_mounter/arc_obb_mounter_bridge.h index 8756ab62ebf..707ea27a979 100644 --- a/chromium/components/arc/obb_mounter/arc_obb_mounter_bridge.h +++ b/chromium/components/arc/obb_mounter/arc_obb_mounter_bridge.h @@ -8,7 +8,7 @@ #include <string> #include "base/macros.h" -#include "components/arc/common/obb_mounter.mojom.h" +#include "components/arc/mojom/obb_mounter.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/power/arc_power_bridge.cc b/chromium/components/arc/power/arc_power_bridge.cc index 4985b11674d..7603476c237 100644 --- a/chromium/components/arc/power/arc_power_bridge.cc +++ b/chromium/components/arc/power/arc_power_bridge.cc @@ -19,6 +19,7 @@ #include "components/arc/arc_service_manager.h" #include "components/arc/session/arc_bridge_service.h" #include "content/public/browser/system_connector.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/device/public/mojom/constants.mojom.h" #include "services/device/public/mojom/wake_lock.mojom.h" #include "services/device/public/mojom/wake_lock_provider.mojom.h" @@ -73,12 +74,12 @@ class ArcPowerBridge::WakeLockRequestor { // Initialize |wake_lock_| if this is the first time we're using it. if (!wake_lock_) { - device::mojom::WakeLockProviderPtr provider; - connector_->BindInterface(device::mojom::kServiceName, - mojo::MakeRequest(&provider)); + mojo::Remote<device::mojom::WakeLockProvider> provider; + connector_->Connect(device::mojom::kServiceName, + provider.BindNewPipeAndPassReceiver()); provider->GetWakeLockWithoutContext( type_, device::mojom::WakeLockReason::kOther, "ARC", - mojo::MakeRequest(&wake_lock_)); + wake_lock_.BindNewPipeAndPassReceiver()); } wake_lock_->RequestWakeLock(); @@ -114,7 +115,7 @@ class ArcPowerBridge::WakeLockRequestor { int num_android_requests_ = 0; // Lazily initialized in response to first request. - device::mojom::WakeLockPtr wake_lock_; + mojo::Remote<device::mojom::WakeLock> wake_lock_; DISALLOW_COPY_AND_ASSIGN(WakeLockRequestor); }; @@ -127,7 +128,7 @@ ArcPowerBridge* ArcPowerBridge::GetForBrowserContext( ArcPowerBridge::ArcPowerBridge(content::BrowserContext* context, ArcBridgeService* bridge_service) - : arc_bridge_service_(bridge_service), weak_ptr_factory_(this) { + : arc_bridge_service_(bridge_service) { arc_bridge_service_->power()->SetHost(this); arc_bridge_service_->power()->AddObserver(this); } diff --git a/chromium/components/arc/power/arc_power_bridge.h b/chromium/components/arc/power/arc_power_bridge.h index 94fc7dbc527..3533089adea 100644 --- a/chromium/components/arc/power/arc_power_bridge.h +++ b/chromium/components/arc/power/arc_power_bridge.h @@ -12,7 +12,7 @@ #include "base/optional.h" #include "base/timer/timer.h" #include "chromeos/dbus/power/power_manager_client.h" -#include "components/arc/common/power.mojom.h" +#include "components/arc/mojom/power.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "services/device/public/mojom/wake_lock.mojom.h" @@ -105,7 +105,7 @@ class ArcPowerBridge : public KeyedService, // about brightness changes. base::OneShotTimer notify_brightness_timer_; - base::WeakPtrFactory<ArcPowerBridge> weak_ptr_factory_; + base::WeakPtrFactory<ArcPowerBridge> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcPowerBridge); }; diff --git a/chromium/components/arc/power/arc_power_bridge_unittest.cc b/chromium/components/arc/power/arc_power_bridge_unittest.cc index 427ea5747fb..0bef551b69a 100644 --- a/chromium/components/arc/power/arc_power_bridge_unittest.cc +++ b/chromium/components/arc/power/arc_power_bridge_unittest.cc @@ -7,11 +7,11 @@ #include <utility> #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" #include "chromeos/dbus/power_manager/suspend.pb.h" -#include "components/arc/common/power.mojom.h" +#include "components/arc/mojom/power.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "components/arc/test/connection_holder_util.h" #include "components/arc/test/fake_power_instance.h" @@ -103,7 +103,7 @@ class ArcPowerBridgeTest : public testing::Test { return chromeos::FakePowerManagerClient::Get(); } - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; diff --git a/chromium/components/arc/print_spooler/OWNERS b/chromium/components/arc/print_spooler/OWNERS new file mode 100644 index 00000000000..060b5bfc5ef --- /dev/null +++ b/chromium/components/arc/print_spooler/OWNERS @@ -0,0 +1,2 @@ +bmgordon@chromium.org +jschettler@chromium.org diff --git a/chromium/components/arc/property/arc_property_bridge.h b/chromium/components/arc/property/arc_property_bridge.h index 27d37fd0266..f116134972a 100644 --- a/chromium/components/arc/property/arc_property_bridge.h +++ b/chromium/components/arc/property/arc_property_bridge.h @@ -14,7 +14,7 @@ #include "base/optional.h" #include "base/strings/string_piece.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/property.mojom.h" +#include "components/arc/mojom/property.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" diff --git a/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.h b/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.h index 7f2acfadd53..034cad3c741 100644 --- a/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.h +++ b/chromium/components/arc/rotation_lock/arc_rotation_lock_bridge.h @@ -9,7 +9,7 @@ #include "ash/public/cpp/tablet_mode_observer.h" #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/rotation_lock.mojom.h" +#include "components/arc/mojom/rotation_lock.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" diff --git a/chromium/components/arc/session/arc_bridge_host_impl.cc b/chromium/components/arc/session/arc_bridge_host_impl.cc index 45584862d06..1dd5de99370 100644 --- a/chromium/components/arc/session/arc_bridge_host_impl.cc +++ b/chromium/components/arc/session/arc_bridge_host_impl.cc @@ -10,56 +10,56 @@ #include "ash/public/cpp/arc_notifications_host_initializer.h" #include "base/bind.h" #include "base/bind_helpers.h" -#include "components/arc/common/accessibility_helper.mojom.h" -#include "components/arc/common/app.mojom.h" -#include "components/arc/common/app_permissions.mojom.h" -#include "components/arc/common/appfuse.mojom.h" -#include "components/arc/common/audio.mojom.h" -#include "components/arc/common/auth.mojom.h" -#include "components/arc/common/backup_settings.mojom.h" -#include "components/arc/common/bluetooth.mojom.h" -#include "components/arc/common/boot_phase_monitor.mojom.h" -#include "components/arc/common/camera.mojom.h" -#include "components/arc/common/cast_receiver.mojom.h" -#include "components/arc/common/cert_store.mojom.h" -#include "components/arc/common/clipboard.mojom.h" -#include "components/arc/common/crash_collector.mojom.h" -#include "components/arc/common/disk_quota.mojom.h" -#include "components/arc/common/enterprise_reporting.mojom.h" -#include "components/arc/common/file_system.mojom.h" -#include "components/arc/common/ime.mojom.h" -#include "components/arc/common/input_method_manager.mojom.h" -#include "components/arc/common/intent_helper.mojom.h" -#include "components/arc/common/keymaster.mojom.h" -#include "components/arc/common/kiosk.mojom.h" -#include "components/arc/common/lock_screen.mojom.h" -#include "components/arc/common/media_session.mojom.h" -#include "components/arc/common/metrics.mojom.h" -#include "components/arc/common/midis.mojom.h" -#include "components/arc/common/net.mojom.h" -#include "components/arc/common/notifications.mojom.h" -#include "components/arc/common/obb_mounter.mojom.h" -#include "components/arc/common/oemcrypto.mojom.h" -#include "components/arc/common/pip.mojom.h" -#include "components/arc/common/policy.mojom.h" -#include "components/arc/common/power.mojom.h" -#include "components/arc/common/print.mojom.h" -#include "components/arc/common/print_spooler.mojom.h" -#include "components/arc/common/process.mojom.h" -#include "components/arc/common/property.mojom.h" -#include "components/arc/common/rotation_lock.mojom.h" -#include "components/arc/common/screen_capture.mojom.h" -#include "components/arc/common/storage_manager.mojom.h" -#include "components/arc/common/timer.mojom.h" -#include "components/arc/common/tracing.mojom.h" -#include "components/arc/common/tts.mojom.h" -#include "components/arc/common/usb_host.mojom.h" -#include "components/arc/common/video.mojom.h" -#include "components/arc/common/voice_interaction_arc_home.mojom.h" -#include "components/arc/common/voice_interaction_framework.mojom.h" -#include "components/arc/common/volume_mounter.mojom.h" -#include "components/arc/common/wake_lock.mojom.h" -#include "components/arc/common/wallpaper.mojom.h" +#include "components/arc/mojom/accessibility_helper.mojom.h" +#include "components/arc/mojom/app.mojom.h" +#include "components/arc/mojom/app_permissions.mojom.h" +#include "components/arc/mojom/appfuse.mojom.h" +#include "components/arc/mojom/audio.mojom.h" +#include "components/arc/mojom/auth.mojom.h" +#include "components/arc/mojom/backup_settings.mojom.h" +#include "components/arc/mojom/bluetooth.mojom.h" +#include "components/arc/mojom/boot_phase_monitor.mojom.h" +#include "components/arc/mojom/camera.mojom.h" +#include "components/arc/mojom/cast_receiver.mojom.h" +#include "components/arc/mojom/cert_store.mojom.h" +#include "components/arc/mojom/clipboard.mojom.h" +#include "components/arc/mojom/crash_collector.mojom.h" +#include "components/arc/mojom/disk_quota.mojom.h" +#include "components/arc/mojom/enterprise_reporting.mojom.h" +#include "components/arc/mojom/file_system.mojom.h" +#include "components/arc/mojom/ime.mojom.h" +#include "components/arc/mojom/input_method_manager.mojom.h" +#include "components/arc/mojom/intent_helper.mojom.h" +#include "components/arc/mojom/keymaster.mojom.h" +#include "components/arc/mojom/kiosk.mojom.h" +#include "components/arc/mojom/lock_screen.mojom.h" +#include "components/arc/mojom/media_session.mojom.h" +#include "components/arc/mojom/metrics.mojom.h" +#include "components/arc/mojom/midis.mojom.h" +#include "components/arc/mojom/net.mojom.h" +#include "components/arc/mojom/notifications.mojom.h" +#include "components/arc/mojom/obb_mounter.mojom.h" +#include "components/arc/mojom/oemcrypto.mojom.h" +#include "components/arc/mojom/pip.mojom.h" +#include "components/arc/mojom/policy.mojom.h" +#include "components/arc/mojom/power.mojom.h" +#include "components/arc/mojom/print.mojom.h" +#include "components/arc/mojom/print_spooler.mojom.h" +#include "components/arc/mojom/process.mojom.h" +#include "components/arc/mojom/property.mojom.h" +#include "components/arc/mojom/rotation_lock.mojom.h" +#include "components/arc/mojom/screen_capture.mojom.h" +#include "components/arc/mojom/storage_manager.mojom.h" +#include "components/arc/mojom/timer.mojom.h" +#include "components/arc/mojom/tracing.mojom.h" +#include "components/arc/mojom/tts.mojom.h" +#include "components/arc/mojom/usb_host.mojom.h" +#include "components/arc/mojom/video.mojom.h" +#include "components/arc/mojom/voice_interaction_arc_home.mojom.h" +#include "components/arc/mojom/voice_interaction_framework.mojom.h" +#include "components/arc/mojom/volume_mounter.mojom.h" +#include "components/arc/mojom/wake_lock.mojom.h" +#include "components/arc/mojom/wallpaper.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "components/arc/session/mojo_channel.h" #include "content/public/browser/system_connector.h" diff --git a/chromium/components/arc/session/arc_bridge_host_impl.h b/chromium/components/arc/session/arc_bridge_host_impl.h index 0f5868dd50e..901fb37f36e 100644 --- a/chromium/components/arc/session/arc_bridge_host_impl.h +++ b/chromium/components/arc/session/arc_bridge_host_impl.h @@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/arc_bridge.mojom.h" +#include "components/arc/mojom/arc_bridge.mojom.h" #include "components/arc/session/connection_holder.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/interface_ptr.h" diff --git a/chromium/components/arc/session/arc_bridge_service.cc b/chromium/components/arc/session/arc_bridge_service.cc index 485b0fea947..f7bd98c969c 100644 --- a/chromium/components/arc/session/arc_bridge_service.cc +++ b/chromium/components/arc/session/arc_bridge_service.cc @@ -5,56 +5,56 @@ #include "components/arc/session/arc_bridge_service.h" // These header is necessary for instantiation of ConnectionHolder. -#include "components/arc/common/accessibility_helper.mojom.h" -#include "components/arc/common/app.mojom.h" -#include "components/arc/common/app_permissions.mojom.h" -#include "components/arc/common/appfuse.mojom.h" -#include "components/arc/common/arc_bridge.mojom.h" -#include "components/arc/common/audio.mojom.h" -#include "components/arc/common/auth.mojom.h" -#include "components/arc/common/backup_settings.mojom.h" -#include "components/arc/common/bluetooth.mojom.h" -#include "components/arc/common/boot_phase_monitor.mojom.h" -#include "components/arc/common/camera.mojom.h" -#include "components/arc/common/cast_receiver.mojom.h" -#include "components/arc/common/cert_store.mojom.h" -#include "components/arc/common/clipboard.mojom.h" -#include "components/arc/common/crash_collector.mojom.h" -#include "components/arc/common/disk_quota.mojom.h" -#include "components/arc/common/enterprise_reporting.mojom.h" -#include "components/arc/common/file_system.mojom.h" -#include "components/arc/common/ime.mojom.h" -#include "components/arc/common/input_method_manager.mojom.h" -#include "components/arc/common/intent_helper.mojom.h" -#include "components/arc/common/keymaster.mojom.h" -#include "components/arc/common/kiosk.mojom.h" -#include "components/arc/common/lock_screen.mojom.h" -#include "components/arc/common/media_session.mojom.h" -#include "components/arc/common/metrics.mojom.h" -#include "components/arc/common/midis.mojom.h" -#include "components/arc/common/net.mojom.h" -#include "components/arc/common/obb_mounter.mojom.h" -#include "components/arc/common/oemcrypto.mojom.h" -#include "components/arc/common/pip.mojom.h" -#include "components/arc/common/policy.mojom.h" -#include "components/arc/common/power.mojom.h" -#include "components/arc/common/print.mojom.h" -#include "components/arc/common/print_spooler.mojom.h" -#include "components/arc/common/process.mojom.h" -#include "components/arc/common/property.mojom.h" -#include "components/arc/common/rotation_lock.mojom.h" -#include "components/arc/common/screen_capture.mojom.h" -#include "components/arc/common/storage_manager.mojom.h" -#include "components/arc/common/timer.mojom.h" -#include "components/arc/common/tracing.mojom.h" -#include "components/arc/common/tts.mojom.h" -#include "components/arc/common/usb_host.mojom.h" -#include "components/arc/common/video.mojom.h" -#include "components/arc/common/voice_interaction_arc_home.mojom.h" -#include "components/arc/common/voice_interaction_framework.mojom.h" -#include "components/arc/common/volume_mounter.mojom.h" -#include "components/arc/common/wake_lock.mojom.h" -#include "components/arc/common/wallpaper.mojom.h" +#include "components/arc/mojom/accessibility_helper.mojom.h" +#include "components/arc/mojom/app.mojom.h" +#include "components/arc/mojom/app_permissions.mojom.h" +#include "components/arc/mojom/appfuse.mojom.h" +#include "components/arc/mojom/arc_bridge.mojom.h" +#include "components/arc/mojom/audio.mojom.h" +#include "components/arc/mojom/auth.mojom.h" +#include "components/arc/mojom/backup_settings.mojom.h" +#include "components/arc/mojom/bluetooth.mojom.h" +#include "components/arc/mojom/boot_phase_monitor.mojom.h" +#include "components/arc/mojom/camera.mojom.h" +#include "components/arc/mojom/cast_receiver.mojom.h" +#include "components/arc/mojom/cert_store.mojom.h" +#include "components/arc/mojom/clipboard.mojom.h" +#include "components/arc/mojom/crash_collector.mojom.h" +#include "components/arc/mojom/disk_quota.mojom.h" +#include "components/arc/mojom/enterprise_reporting.mojom.h" +#include "components/arc/mojom/file_system.mojom.h" +#include "components/arc/mojom/ime.mojom.h" +#include "components/arc/mojom/input_method_manager.mojom.h" +#include "components/arc/mojom/intent_helper.mojom.h" +#include "components/arc/mojom/keymaster.mojom.h" +#include "components/arc/mojom/kiosk.mojom.h" +#include "components/arc/mojom/lock_screen.mojom.h" +#include "components/arc/mojom/media_session.mojom.h" +#include "components/arc/mojom/metrics.mojom.h" +#include "components/arc/mojom/midis.mojom.h" +#include "components/arc/mojom/net.mojom.h" +#include "components/arc/mojom/obb_mounter.mojom.h" +#include "components/arc/mojom/oemcrypto.mojom.h" +#include "components/arc/mojom/pip.mojom.h" +#include "components/arc/mojom/policy.mojom.h" +#include "components/arc/mojom/power.mojom.h" +#include "components/arc/mojom/print.mojom.h" +#include "components/arc/mojom/print_spooler.mojom.h" +#include "components/arc/mojom/process.mojom.h" +#include "components/arc/mojom/property.mojom.h" +#include "components/arc/mojom/rotation_lock.mojom.h" +#include "components/arc/mojom/screen_capture.mojom.h" +#include "components/arc/mojom/storage_manager.mojom.h" +#include "components/arc/mojom/timer.mojom.h" +#include "components/arc/mojom/tracing.mojom.h" +#include "components/arc/mojom/tts.mojom.h" +#include "components/arc/mojom/usb_host.mojom.h" +#include "components/arc/mojom/video.mojom.h" +#include "components/arc/mojom/voice_interaction_arc_home.mojom.h" +#include "components/arc/mojom/voice_interaction_framework.mojom.h" +#include "components/arc/mojom/volume_mounter.mojom.h" +#include "components/arc/mojom/wake_lock.mojom.h" +#include "components/arc/mojom/wallpaper.mojom.h" namespace arc { diff --git a/chromium/components/arc/session/arc_bridge_service.h b/chromium/components/arc/session/arc_bridge_service.h index d3f0f3b4f59..cc0f132ab2f 100644 --- a/chromium/components/arc/session/arc_bridge_service.h +++ b/chromium/components/arc/session/arc_bridge_service.h @@ -12,8 +12,8 @@ namespace arc { namespace mojom { -// Instead of including components/arc/common/arc_bridge.mojom.h, list all the -// instance classes here for faster build. +// Instead of including components/arc/mojom/arc_bridge.mojom.h, list all +// the instance classes here for faster build. class AccessibilityHelperHost; class AccessibilityHelperInstance; class AppHost; diff --git a/chromium/components/arc/session/arc_data_remover.cc b/chromium/components/arc/session/arc_data_remover.cc index c6e99114718..89d76725943 100644 --- a/chromium/components/arc/session/arc_data_remover.cc +++ b/chromium/components/arc/session/arc_data_remover.cc @@ -30,7 +30,7 @@ constexpr char kArcRemoveDataUpstartJob[] = "arc_2dremove_2ddata"; ArcDataRemover::ArcDataRemover(PrefService* prefs, const cryptohome::Identification& cryptohome_id) - : cryptohome_id_(cryptohome_id), weak_factory_(this) { + : cryptohome_id_(cryptohome_id) { pref_.Init(prefs::kArcDataRemoveRequested, prefs); } diff --git a/chromium/components/arc/session/arc_data_remover.h b/chromium/components/arc/session/arc_data_remover.h index ba4bc456d9b..187e6137ede 100644 --- a/chromium/components/arc/session/arc_data_remover.h +++ b/chromium/components/arc/session/arc_data_remover.h @@ -65,7 +65,7 @@ class ArcDataRemover { // TODO(yusukes): Remove the member variable. std::string user_id_hash_; - base::WeakPtrFactory<ArcDataRemover> weak_factory_; + base::WeakPtrFactory<ArcDataRemover> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcDataRemover); }; diff --git a/chromium/components/arc/session/arc_data_remover_unittest.cc b/chromium/components/arc/session/arc_data_remover_unittest.cc index 75c4d6caffd..51f8851e409 100644 --- a/chromium/components/arc/session/arc_data_remover_unittest.cc +++ b/chromium/components/arc/session/arc_data_remover_unittest.cc @@ -11,7 +11,7 @@ #include "base/bind.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -72,7 +72,7 @@ class ArcDataRemoverTest : public testing::Test { private: TestingPrefServiceSimple prefs_; const cryptohome::Identification cryptohome_id_{EmptyAccountId()}; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; std::unique_ptr<TestUpstartClient> test_upstart_client_; DISALLOW_COPY_AND_ASSIGN(ArcDataRemoverTest); diff --git a/chromium/components/arc/session/arc_session_impl.cc b/chromium/components/arc/session/arc_session_impl.cc index 04efc71f7db..0a45db110aa 100644 --- a/chromium/components/arc/session/arc_session_impl.cc +++ b/chromium/components/arc/session/arc_session_impl.cc @@ -145,7 +145,7 @@ class ArcSessionDelegateImpl : public ArcSessionImpl::Delegate { const version_info::Channel channel_; // WeakPtrFactory to use callbacks. - base::WeakPtrFactory<ArcSessionDelegateImpl> weak_factory_; + base::WeakPtrFactory<ArcSessionDelegateImpl> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcSessionDelegateImpl); }; @@ -156,12 +156,11 @@ ArcSessionDelegateImpl::ArcSessionDelegateImpl( version_info::Channel channel) : arc_bridge_service_(arc_bridge_service), default_scale_factor_retriever_(retriever), - channel_(channel), - weak_factory_(this) {} + channel_(channel) {} void ArcSessionDelegateImpl::CreateSocket(CreateSocketCallback callback) { - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, + base::PostTaskAndReplyWithResult( + FROM_HERE, {base::ThreadPool(), base::MayBlock()}, base::BindOnce(&ArcSessionDelegateImpl::CreateSocketInternal), std::move(callback)); } @@ -181,8 +180,8 @@ base::ScopedFD ArcSessionDelegateImpl::ConnectMojo( // For production, |socket_fd| passed from session_manager is either a valid // socket or a valid file descriptor (/dev/null). For testing, |socket_fd| // might be invalid. - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, + base::PostTaskAndReplyWithResult( + FROM_HERE, {base::ThreadPool(), base::MayBlock()}, base::BindOnce(&ArcSessionDelegateImpl::ConnectMojoInternal, std::move(socket_fd), std::move(cancel_fd)), base::BindOnce(&ArcSessionDelegateImpl::OnMojoConnected, @@ -201,8 +200,8 @@ void ArcSessionDelegateImpl::GetLcdDensity(GetLcdDensityCallback callback) { void ArcSessionDelegateImpl::GetFreeDiskSpace( GetFreeDiskSpaceCallback callback) { - PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, + PostTaskAndReplyWithResult( + FROM_HERE, {base::ThreadPool(), base::MayBlock()}, base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, base::FilePath("/home")), std::move(callback)); @@ -337,9 +336,7 @@ std::unique_ptr<ArcSessionImpl::Delegate> ArcSessionImpl::CreateDelegate( } ArcSessionImpl::ArcSessionImpl(std::unique_ptr<Delegate> delegate) - : delegate_(std::move(delegate)), - client_(ArcClientAdapter::Create()), - weak_factory_(this) { + : delegate_(std::move(delegate)), client_(ArcClientAdapter::Create()) { DCHECK(client_); client_->AddObserver(this); } @@ -368,7 +365,7 @@ void ArcSessionImpl::OnLcdDensity(int32_t lcd_density) { state_ = State::STARTING_MINI_INSTANCE; StartArcMiniContainerRequest request; request.set_native_bridge_experiment( - base::FeatureList::IsEnabled(arc::kNativeBridgeExperimentFeature)); + base::FeatureList::IsEnabled(arc::kNativeBridgeToggleFeature)); request.set_arc_file_picker_experiment( base::FeatureList::IsEnabled(arc::kFilePickerExperimentFeature)); // Enable Custom Tabs only on Dev and Cannary, and only when Mash is enabled. diff --git a/chromium/components/arc/session/arc_session_impl.h b/chromium/components/arc/session/arc_session_impl.h index 9742edf246e..14c7078ac8c 100644 --- a/chromium/components/arc/session/arc_session_impl.h +++ b/chromium/components/arc/session/arc_session_impl.h @@ -256,7 +256,7 @@ class ArcSessionImpl : public ArcSession, public ArcClientAdapter::Observer { std::unique_ptr<mojom::ArcBridgeHost> arc_bridge_host_; // WeakPtrFactory to use callbacks. - base::WeakPtrFactory<ArcSessionImpl> weak_factory_; + base::WeakPtrFactory<ArcSessionImpl> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcSessionImpl); }; diff --git a/chromium/components/arc/session/arc_session_impl_unittest.cc b/chromium/components/arc/session/arc_session_impl_unittest.cc index 83f7951c037..130bb566429 100644 --- a/chromium/components/arc/session/arc_session_impl_unittest.cc +++ b/chromium/components/arc/session/arc_session_impl_unittest.cc @@ -13,7 +13,7 @@ #include "base/command_line.h" #include "base/location.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/constants/chromeos_switches.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h" @@ -224,7 +224,7 @@ class ArcSessionImplTest : public testing::Test { } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; user_manager::ScopedUserManager scoped_user_manager_{ std::make_unique<user_manager::FakeUserManager>()}; diff --git a/chromium/components/arc/session/arc_session_runner.cc b/chromium/components/arc/session/arc_session_runner.cc index fe656884a18..b02c6586f4e 100644 --- a/chromium/components/arc/session/arc_session_runner.cc +++ b/chromium/components/arc/session/arc_session_runner.cc @@ -120,8 +120,7 @@ bool IsRequestAllowed(const base::Optional<ArcInstanceMode>& current_mode, ArcSessionRunner::ArcSessionRunner(const ArcSessionFactory& factory) : restart_delay_(kDefaultRestartDelay), restart_after_crash_count_(0), - factory_(factory), - weak_ptr_factory_(this) {} + factory_(factory) {} ArcSessionRunner::~ArcSessionRunner() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); diff --git a/chromium/components/arc/session/arc_session_runner.h b/chromium/components/arc/session/arc_session_runner.h index 42e0c18f5d1..fcd005eb279 100644 --- a/chromium/components/arc/session/arc_session_runner.h +++ b/chromium/components/arc/session/arc_session_runner.h @@ -147,7 +147,7 @@ class ArcSessionRunner : public ArcSession::Observer { std::string user_id_hash_; // WeakPtrFactory to use callbacks. - base::WeakPtrFactory<ArcSessionRunner> weak_ptr_factory_; + base::WeakPtrFactory<ArcSessionRunner> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcSessionRunner); }; diff --git a/chromium/components/arc/session/arc_session_runner_unittest.cc b/chromium/components/arc/session/arc_session_runner_unittest.cc index dcea0d3be8e..f8ae89159c1 100644 --- a/chromium/components/arc/session/arc_session_runner_unittest.cc +++ b/chromium/components/arc/session/arc_session_runner_unittest.cc @@ -13,7 +13,7 @@ #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/test/metrics/histogram_tester.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "chromeos/dbus/session_manager/session_manager_client.h" #include "components/arc/arc_util.h" #include "components/arc/session/arc_session_runner.h" @@ -56,8 +56,7 @@ class ArcSessionRunnerTest : public testing::Test, public ArcSessionRunner::Observer { public: ArcSessionRunnerTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) {} + : task_environment_(base::test::TaskEnvironment::MainThreadType::UI) {} void SetUp() override { chromeos::SessionManagerClient::InitializeFakeInMemory(); @@ -137,7 +136,7 @@ class ArcSessionRunnerTest : public testing::Test, bool stopped_called_; bool restarting_called_; std::unique_ptr<ArcSessionRunner> arc_session_runner_; - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; DISALLOW_COPY_AND_ASSIGN(ArcSessionRunnerTest); }; diff --git a/chromium/components/arc/session/arc_vm_client_adapter.cc b/chromium/components/arc/session/arc_vm_client_adapter.cc index 2cd1ba715f6..caae3723ce9 100644 --- a/chromium/components/arc/session/arc_vm_client_adapter.cc +++ b/chromium/components/arc/session/arc_vm_client_adapter.cc @@ -9,50 +9,22 @@ #include <vector> #include "base/bind.h" -#include "base/guid.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" -#include "base/system/sys_info.h" +#include "base/strings/stringprintf.h" #include "base/task/post_task.h" -#include "chromeos/dbus/concierge_client.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/debug_daemon_client.h" +#include "chromeos/dbus/login_manager/arc.pb.h" +#include "chromeos/dbus/upstart/upstart_client.h" #include "components/arc/arc_util.h" namespace arc { -namespace { - -constexpr char kHomeDirectory[] = "/home"; -constexpr char kKernelPath[] = "/opt/google/vms/android/vmlinux"; -constexpr char kRootFsPath[] = "/opt/google/vms/android/system.raw.img"; -constexpr char kVendorImagePath[] = "/opt/google/vms/android/vendor.raw.img"; - -chromeos::ConciergeClient* GetConciergeClient() { - return chromeos::DBusThreadManager::Get()->GetConciergeClient(); -} - -std::vector<std::string> CreateKernelParams() { - // TODO(cmtm): Generate the same parameters as arc-setup based on both - // StartArcMiniContainerRequest and UpgradeArcContainerRequest. - - // TODO(yusukes): Enable SELinux. - std::vector<std::string> params{ - {"androidboot.selinux=permissive"}, - {"androidboot.hardware=bertha"}, - {"androidboot.debuggable=1"}, - {"androidboot.native_bridge=libhoudini.so"}, - }; - return params; -} - -} // namespace - class ArcVmClientAdapter : public ArcClientAdapter { public: - ArcVmClientAdapter() : weak_factory_(this) {} + ArcVmClientAdapter() {} ~ArcVmClientAdapter() override = default; // ArcClientAdapter overrides: @@ -60,26 +32,43 @@ class ArcVmClientAdapter : public ArcClientAdapter { chromeos::VoidDBusMethodCallback callback) override { // TODO(yusukes): Support mini ARC. VLOG(2) << "Mini ARCVM instance is not supported."; + // Save the lcd density and auto update mode for the later call to + // UpgradeArc. + lcd_density_ = request.lcd_density(); + if (request.play_store_auto_update() == + login_manager:: + StartArcMiniContainerRequest_PlayStoreAutoUpdate_AUTO_UPDATE_ON) { + play_store_auto_update_ = true; + } else if ( + request.play_store_auto_update() == + login_manager:: + StartArcMiniContainerRequest_PlayStoreAutoUpdate_AUTO_UPDATE_OFF) { + play_store_auto_update_ = false; + } base::PostTask(FROM_HERE, base::BindOnce(std::move(callback), true)); } void UpgradeArc(const UpgradeArcContainerRequest& request, chromeos::VoidDBusMethodCallback callback) override { - VLOG(1) << "Starting Concierge service"; - chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()->StartConcierge( - base::BindOnce(&ArcVmClientAdapter::OnConciergeStarted, - weak_factory_.GetWeakPtr(), std::move(callback), - CreateKernelParams())); + VLOG(1) << "Starting ARCVM"; + std::vector<std::string> env{ + {"USER_ID_HASH=" + user_id_hash_}, + {base::StringPrintf("ARC_LCD_DENSITY=%d", lcd_density_)}, + }; + if (play_store_auto_update_) { + env.push_back(base::StringPrintf("PLAY_STORE_AUTO_UPDATE=%d", + *play_store_auto_update_)); + } + chromeos::UpstartClient::Get()->StartJob("arcvm", env, std::move(callback)); } void StopArcInstance() override { VLOG(1) << "Stopping arcvm"; - vm_tools::concierge::StopVmRequest request; - request.set_name(kArcVmName); - request.set_owner_id(user_id_hash_); - GetConciergeClient()->StopVm( - request, base::BindOnce(&ArcVmClientAdapter::OnVmStopped, - weak_factory_.GetWeakPtr())); + std::vector<std::string> env{{"USER_ID_HASH=" + user_id_hash_}}; + chromeos::UpstartClient::Get()->StopJob( + "arcvm", env, + base::BindOnce(&ArcVmClientAdapter::OnVmStopped, + weak_factory_.GetWeakPtr())); } void SetUserIdHashForProfile(const std::string& hash) override { @@ -96,147 +85,21 @@ class ArcVmClientAdapter : public ArcClientAdapter { observer.ArcInstanceStopped(); } - void OnConciergeStarted(chromeos::VoidDBusMethodCallback callback, - std::vector<std::string> params, - bool success) { - if (!success) { - LOG(ERROR) << "Failed to start Concierge service for arcvm"; - std::move(callback).Run(false); - return; - } - VLOG(1) << "Concierge service started for arcvm."; - - // TODO(cmtm): Export host-side /data to the VM, and remove the call. - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, - base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, - base::FilePath(kHomeDirectory)), - base::BindOnce(&ArcVmClientAdapter::CreateDiskImageAfterSizeCheck, - weak_factory_.GetWeakPtr(), std::move(callback), - std::move(params))); - } - - // TODO(cmtm): Export host-side /data to the VM, and remove the function. - void CreateDiskImageAfterSizeCheck(chromeos::VoidDBusMethodCallback callback, - std::vector<std::string> params, - int64_t free_disk_bytes) { - VLOG(2) << "Got free disk size: " << free_disk_bytes; - if (user_id_hash_.empty()) { - LOG(ERROR) << "User ID hash is not set"; - std::move(callback).Run(false); - return; - } - - vm_tools::concierge::CreateDiskImageRequest request; - request.set_cryptohome_id(user_id_hash_); - request.set_disk_path(kArcVmName); - // The type of disk image to be created. - request.set_image_type(vm_tools::concierge::DISK_IMAGE_AUTO); - request.set_storage_location(vm_tools::concierge::STORAGE_CRYPTOHOME_ROOT); - // The logical size of the new disk image, in bytes. - request.set_disk_size(free_disk_bytes / 2); - - GetConciergeClient()->CreateDiskImage( - std::move(request), - base::BindOnce(&ArcVmClientAdapter::OnDiskImageCreated, - weak_factory_.GetWeakPtr(), std::move(callback), - std::move(params))); - } - - void OnDiskImageCreated( - chromeos::VoidDBusMethodCallback callback, - std::vector<std::string> params, - base::Optional<vm_tools::concierge::CreateDiskImageResponse> reply) { - if (!reply.has_value()) { - LOG(ERROR) << "Failed to create disk image. Empty response."; - std::move(callback).Run(false); - return; - } - - const vm_tools::concierge::CreateDiskImageResponse& response = - reply.value(); - if (response.status() != vm_tools::concierge::DISK_STATUS_EXISTS && - response.status() != vm_tools::concierge::DISK_STATUS_CREATED) { - LOG(ERROR) << "Failed to create disk image: " - << response.failure_reason(); - std::move(callback).Run(false); - return; - } - VLOG(1) << "Disk image for arcvm created. status=" << response.status() - << ", disk=" << response.disk_path(); - - DCHECK(!user_id_hash_.empty()); - vm_tools::concierge::StartArcVmRequest request; - request.set_name(kArcVmName); - request.set_owner_id(user_id_hash_); - - request.add_params("root=/dev/vda"); - // TODO(b/135229848): Use ro unless rw is requested. - request.add_params("rw"); - request.add_params("init=/init"); - for (auto& param : params) - request.add_params(std::move(param)); - - vm_tools::concierge::VirtualMachineSpec* vm = request.mutable_vm(); - vm->set_kernel(kKernelPath); - // Add / as /dev/vda. - vm->set_rootfs(kRootFsPath); - - // Add /data as /dev/vdb. - vm_tools::concierge::DiskImage* disk_image = request.add_disks(); - disk_image->set_path(response.disk_path()); - disk_image->set_image_type(vm_tools::concierge::DISK_IMAGE_AUTO); - disk_image->set_writable(true); - disk_image->set_do_mount(true); - // Add /vendor as /dev/vdc. - disk_image = request.add_disks(); - disk_image->set_path(kVendorImagePath); - disk_image->set_image_type(vm_tools::concierge::DISK_IMAGE_AUTO); - disk_image->set_writable(false); - disk_image->set_do_mount(true); - - GetConciergeClient()->StartArcVm( - request, - base::BindOnce(&ArcVmClientAdapter::OnVmStarted, - weak_factory_.GetWeakPtr(), std::move(callback))); - } - - void OnVmStarted(chromeos::VoidDBusMethodCallback callback, - base::Optional<vm_tools::concierge::StartVmResponse> reply) { - if (!reply.has_value()) { - LOG(ERROR) << "Failed to start arcvm. Empty response."; - std::move(callback).Run(false); - return; - } - - const vm_tools::concierge::StartVmResponse& response = reply.value(); - if (response.status() != vm_tools::concierge::VM_STATUS_RUNNING) { - LOG(ERROR) << "Failed to start arcvm: status=" << response.status() - << ", reason=" << response.failure_reason(); - std::move(callback).Run(false); - return; - } - VLOG(1) << "arcvm started."; - std::move(callback).Run(true); - // TODO(yusukes): Share folders like Downloads/ with ARCVM. - } - - void OnVmStopped(base::Optional<vm_tools::concierge::StopVmResponse> reply) { - if (!reply.has_value()) { - LOG(ERROR) << "Failed to stop arcvm. Empty response."; - } else { - const vm_tools::concierge::StopVmResponse& response = reply.value(); - if (!response.success()) - LOG(ERROR) << "Failed to stop arcvm: " << response.failure_reason(); - } + void OnVmStopped(bool result) { + if (!result) + LOG(ERROR) << "Failed to stop arcvm."; OnArcInstanceStopped(); } // A hash of the primary profile user ID. std::string user_id_hash_; + int32_t lcd_density_; + + base::Optional<bool> play_store_auto_update_; + // For callbacks. - base::WeakPtrFactory<ArcVmClientAdapter> weak_factory_; + base::WeakPtrFactory<ArcVmClientAdapter> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcVmClientAdapter); }; diff --git a/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc b/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc deleted file mode 100644 index a957206e046..00000000000 --- a/chromium/components/arc/session/arc_vm_client_adapter_unittest.cc +++ /dev/null @@ -1,303 +0,0 @@ -// 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/session/arc_vm_client_adapter.h" - -#include <memory> -#include <utility> - -#include "base/bind.h" -#include "base/memory/ptr_util.h" -#include "base/run_loop.h" -#include "base/task/post_task.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_concierge_client.h" -#include "chromeos/dbus/fake_debug_daemon_client.h" -#include "chromeos/dbus/login_manager/arc.pb.h" -#include "content/public/test/test_browser_thread_bundle.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace arc { -namespace { - -constexpr const char kUserIdHash[] = "this_is_a_valid_user_id_hash"; - -// A debugd client that can fail to start Concierge. -// TODO(yusukes): Merge the feature to FakeDebugDaemonClient. -class TestDebugDaemonClient : public chromeos::FakeDebugDaemonClient { - public: - TestDebugDaemonClient() = default; - ~TestDebugDaemonClient() override = default; - - void StartConcierge(ConciergeCallback callback) override { - start_concierge_called_ = true; - std::move(callback).Run(start_concierge_result_); - } - - bool start_concierge_called() const { return start_concierge_called_; } - void set_start_concierge_result(bool result) { - start_concierge_result_ = result; - } - - private: - bool start_concierge_called_ = false; - bool start_concierge_result_ = true; - - DISALLOW_COPY_AND_ASSIGN(TestDebugDaemonClient); -}; - -// A concierge that remembers the parameter passed to StartArcVm. -// TODO(yusukes): Merge the feature to FakeConciergeClient. -class TestConciergeClient : public chromeos::FakeConciergeClient { - public: - TestConciergeClient() = default; - ~TestConciergeClient() override = default; - - void StartArcVm( - const vm_tools::concierge::StartArcVmRequest& request, - chromeos::DBusMethodCallback<vm_tools::concierge::StartVmResponse> - callback) override { - start_arc_vm_request_ = request; - chromeos::FakeConciergeClient::StartArcVm(request, std::move(callback)); - } - - const vm_tools::concierge::StartArcVmRequest& start_arc_vm_request() const { - return start_arc_vm_request_; - } - - private: - vm_tools::concierge::StartArcVmRequest start_arc_vm_request_; - - DISALLOW_COPY_AND_ASSIGN(TestConciergeClient); -}; - -class ArcVmClientAdapterTest : public testing::Test, - public ArcClientAdapter::Observer { - public: - ArcVmClientAdapterTest() { - // Create and set new fake clients every time to reset clients' status. - chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( - std::make_unique<TestDebugDaemonClient>()); - chromeos::DBusThreadManager::GetSetterForTesting()->SetConciergeClient( - std::make_unique<TestConciergeClient>()); - } - - ~ArcVmClientAdapterTest() override { - chromeos::DBusThreadManager::GetSetterForTesting()->SetConciergeClient( - nullptr); - chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( - nullptr); - } - - void SetUp() override { - run_loop_ = std::make_unique<base::RunLoop>(); - adapter_ = CreateArcVmClientAdapter(); - arc_instance_stopped_called_ = false; - adapter_->AddObserver(this); - - // The fake client returns VM_STATUS_STARTING by default. Change it - // to VM_STATUS_RUNNING which is used by ARCVM. - vm_tools::concierge::StartVmResponse start_vm_response; - start_vm_response.set_status(vm_tools::concierge::VM_STATUS_RUNNING); - GetTestConciergeClient()->set_start_vm_response(start_vm_response); - } - - void TearDown() override { - adapter_->RemoveObserver(this); - adapter_.reset(); - run_loop_.reset(); - } - - // ArcClientAdapter::Observer: - void ArcInstanceStopped() override { - arc_instance_stopped_called_ = true; - run_loop()->Quit(); - } - - void ExpectTrueThenQuit(bool result) { - EXPECT_TRUE(result); - run_loop()->Quit(); - } - - void ExpectFalseThenQuit(bool result) { - EXPECT_FALSE(result); - run_loop()->Quit(); - } - - protected: - bool GetStartConciergeCalled() { - return GetTestDebugDaemonClient()->start_concierge_called(); - } - - void SetStartConciergeResponse(bool response) { - GetTestDebugDaemonClient()->set_start_concierge_result(response); - } - - void SetValidUserIdHash() { adapter()->SetUserIdHashForProfile(kUserIdHash); } - - void RestartRunLoop() { run_loop_ = std::make_unique<base::RunLoop>(); } - - base::RunLoop* run_loop() { return run_loop_.get(); } - ArcClientAdapter* adapter() { return adapter_.get(); } - bool arc_instance_stopped_called() const { - return arc_instance_stopped_called_; - } - TestConciergeClient* GetTestConciergeClient() { - return static_cast<TestConciergeClient*>( - chromeos::DBusThreadManager::Get()->GetConciergeClient()); - } - - private: - TestDebugDaemonClient* GetTestDebugDaemonClient() { - return static_cast<TestDebugDaemonClient*>( - chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()); - } - - std::unique_ptr<base::RunLoop> run_loop_; - std::unique_ptr<ArcClientAdapter> adapter_; - bool arc_instance_stopped_called_; - - content::TestBrowserThreadBundle test_browser_thread_bundle_; - - DISALLOW_COPY_AND_ASSIGN(ArcVmClientAdapterTest); -}; - -// Tests that SetUserIdHashForProfile() doesn't crash. -TEST_F(ArcVmClientAdapterTest, SetUserIdHashForProfile) { - adapter()->SetUserIdHashForProfile("deadbeef"); -} - -// Tests that StartMiniArc() always succeeds. -TEST_F(ArcVmClientAdapterTest, StartMiniArc) { - StartArcMiniContainerRequest req; - adapter()->StartMiniArc( - req, base::BindOnce(&ArcVmClientAdapterTest::ExpectTrueThenQuit, - base::Unretained(this))); - run_loop()->Run(); - // Also confirm that no VM is started. ARCVM doesn't support mini ARC. - EXPECT_FALSE(GetTestConciergeClient()->start_arc_vm_called()); -} - -// Tests that StopArcInstance() notifies the observer. -TEST_F(ArcVmClientAdapterTest, StopArcInstance) { - adapter()->StopArcInstance(); - run_loop()->Run(); - EXPECT_TRUE(GetTestConciergeClient()->stop_vm_called()); - EXPECT_TRUE(arc_instance_stopped_called()); -} - -// Tests that UpgradeArc() handles StartConcierge() failures properly. This test -// inherits ArcVmClientAdapterTest because it uses its own DebugDaemonClient -// instead of the default one for testing. -TEST_F(ArcVmClientAdapterTest, UpgradeArc_StartConciergeFailure) { - SetValidUserIdHash(); - // Inject failure to StartConcierge(). - SetStartConciergeResponse(false); - UpgradeArcContainerRequest req; - adapter()->UpgradeArc( - req, base::BindOnce(&ArcVmClientAdapterTest::ExpectFalseThenQuit, - base::Unretained(this))); - run_loop()->Run(); - EXPECT_TRUE(GetStartConciergeCalled()); - EXPECT_FALSE(GetTestConciergeClient()->start_arc_vm_called()); - EXPECT_FALSE(arc_instance_stopped_called()); - - // Try to stop the VM. - RestartRunLoop(); - adapter()->StopArcInstance(); - run_loop()->Run(); - EXPECT_TRUE(GetTestConciergeClient()->stop_vm_called()); - EXPECT_TRUE(arc_instance_stopped_called()); -} - -// Tests that "no user ID hash" failure is handled properly. -TEST_F(ArcVmClientAdapterTest, UpgradeArc_NoUserId) { - // Don't call SetValidUserIdHash(). Note that we cannot call StartArcVm() - // without a valid ID. - UpgradeArcContainerRequest req; - adapter()->UpgradeArc( - req, base::BindOnce(&ArcVmClientAdapterTest::ExpectFalseThenQuit, - base::Unretained(this))); - run_loop()->Run(); - EXPECT_TRUE(GetStartConciergeCalled()); - EXPECT_FALSE(GetTestConciergeClient()->start_arc_vm_called()); - EXPECT_FALSE(arc_instance_stopped_called()); - - // Try to stop the VM. - RestartRunLoop(); - adapter()->StopArcInstance(); - run_loop()->Run(); - EXPECT_TRUE(GetTestConciergeClient()->stop_vm_called()); - EXPECT_TRUE(arc_instance_stopped_called()); -} - -// Tests that StartArcVm() failure is handled properly. -TEST_F(ArcVmClientAdapterTest, UpgradeArc_StartArcVmFailure) { - SetValidUserIdHash(); - // Inject failure to StartArcVm(). - vm_tools::concierge::StartVmResponse start_vm_response; - start_vm_response.set_status(vm_tools::concierge::VM_STATUS_UNKNOWN); - GetTestConciergeClient()->set_start_vm_response(start_vm_response); - - UpgradeArcContainerRequest req; - adapter()->UpgradeArc( - req, base::BindOnce(&ArcVmClientAdapterTest::ExpectFalseThenQuit, - base::Unretained(this))); - run_loop()->Run(); - EXPECT_TRUE(GetStartConciergeCalled()); - EXPECT_TRUE(GetTestConciergeClient()->start_arc_vm_called()); - EXPECT_FALSE(arc_instance_stopped_called()); - - // Try to stop the VM. - RestartRunLoop(); - adapter()->StopArcInstance(); - run_loop()->Run(); - EXPECT_TRUE(GetTestConciergeClient()->stop_vm_called()); - EXPECT_TRUE(arc_instance_stopped_called()); -} - -// Tests that successful StartArcVm() call is handled properly. -TEST_F(ArcVmClientAdapterTest, UpgradeArc_Success) { - SetValidUserIdHash(); - UpgradeArcContainerRequest req; - adapter()->UpgradeArc( - req, base::BindOnce(&ArcVmClientAdapterTest::ExpectTrueThenQuit, - base::Unretained(this))); - run_loop()->Run(); - EXPECT_TRUE(GetStartConciergeCalled()); - EXPECT_TRUE(GetTestConciergeClient()->start_arc_vm_called()); - EXPECT_FALSE(arc_instance_stopped_called()); - - // Try to stop the VM. - RestartRunLoop(); - adapter()->StopArcInstance(); - run_loop()->Run(); - EXPECT_TRUE(GetTestConciergeClient()->stop_vm_called()); - EXPECT_TRUE(arc_instance_stopped_called()); -} - -// Tests that StartArcVm() is called with valid parameters. -TEST_F(ArcVmClientAdapterTest, UpgradeArc_StartArcVmParams) { - SetValidUserIdHash(); - UpgradeArcContainerRequest req; - adapter()->UpgradeArc( - req, base::BindOnce(&ArcVmClientAdapterTest::ExpectTrueThenQuit, - base::Unretained(this))); - run_loop()->Run(); - ASSERT_TRUE(GetTestConciergeClient()->start_arc_vm_called()); - - // Verify parameters - const auto& params = GetTestConciergeClient()->start_arc_vm_request(); - EXPECT_EQ("arcvm", params.name()); - EXPECT_EQ(kUserIdHash, params.owner_id()); - EXPECT_FALSE(params.vm().kernel().empty()); - // Make sure system.raw.img is passed. - EXPECT_FALSE(params.vm().rootfs().empty()); - // Make sure vendor.raw.img is passed. - EXPECT_LE(1, params.disks_size()); - EXPECT_LT(0, params.params_size()); -} - -} // namespace -} // namespace arc diff --git a/chromium/components/arc/session/connection_holder.h b/chromium/components/arc/session/connection_holder.h index d7dd71a7a11..74763701f9b 100644 --- a/chromium/components/arc/session/connection_holder.h +++ b/chromium/components/arc/session/connection_holder.h @@ -63,7 +63,7 @@ template <typename InstanceType, typename HostType> class ConnectionHolderImpl { public: explicit ConnectionHolderImpl(ConnectionNotifier* connection_notifier) - : connection_notifier_(connection_notifier), weak_ptr_factory_(this) {} + : connection_notifier_(connection_notifier) {} InstanceType* instance() { return IsConnected() ? instance_ : nullptr; } uint32_t instance_version() const { @@ -174,7 +174,7 @@ class ConnectionHolderImpl { // Created when both |instance_| and |host_| ptr are set. std::unique_ptr<mojo::Binding<HostType>> binding_; - base::WeakPtrFactory<ConnectionHolderImpl> weak_ptr_factory_; + base::WeakPtrFactory<ConnectionHolderImpl> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ConnectionHolderImpl); }; diff --git a/chromium/components/arc/storage_manager/arc_storage_manager.h b/chromium/components/arc/storage_manager/arc_storage_manager.h index ccad8538b92..e1002a3535f 100644 --- a/chromium/components/arc/storage_manager/arc_storage_manager.h +++ b/chromium/components/arc/storage_manager/arc_storage_manager.h @@ -9,7 +9,7 @@ #include "base/callback.h" #include "base/macros.h" -#include "components/arc/common/storage_manager.mojom.h" +#include "components/arc/mojom/storage_manager.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace content { diff --git a/chromium/components/arc/timer/OWNERS b/chromium/components/arc/timer/OWNERS index ef5cf841917..012a33c0b1c 100644 --- a/chromium/components/arc/timer/OWNERS +++ b/chromium/components/arc/timer/OWNERS @@ -1,3 +1,3 @@ -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/timer/arc_timer_bridge.cc b/chromium/components/arc/timer/arc_timer_bridge.cc index 5f327b7a424..091b2ff9f56 100644 --- a/chromium/components/arc/timer/arc_timer_bridge.cc +++ b/chromium/components/arc/timer/arc_timer_bridge.cc @@ -17,7 +17,7 @@ #include "components/arc/arc_service_manager.h" #include "components/arc/session/arc_bridge_service.h" #include "components/arc/timer/arc_timer_bridge.h" -#include "components/arc/timer/arc_timer_struct_traits.h" +#include "components/arc/timer/arc_timer_mojom_traits.h" #include "mojo/public/cpp/system/handle.h" #include "mojo/public/cpp/system/platform_handle.h" @@ -100,9 +100,7 @@ ArcTimerBridge* ArcTimerBridge::GetForBrowserContextForTesting( ArcTimerBridge::ArcTimerBridge(content::BrowserContext* context, ArcBridgeService* bridge_service) - : arc_bridge_service_(bridge_service), - binding_(this), - weak_ptr_factory_(this) { + : arc_bridge_service_(bridge_service), binding_(this) { arc_bridge_service_->timer()->SetHost(this); arc_bridge_service_->timer()->AddObserver(this); } diff --git a/chromium/components/arc/timer/arc_timer_bridge.h b/chromium/components/arc/timer/arc_timer_bridge.h index 7657e36e0aa..f67c7d4d461 100644 --- a/chromium/components/arc/timer/arc_timer_bridge.h +++ b/chromium/components/arc/timer/arc_timer_bridge.h @@ -15,7 +15,7 @@ #include "base/optional.h" #include "base/sequenced_task_runner.h" #include "base/time/time.h" -#include "components/arc/common/timer.mojom.h" +#include "components/arc/mojom/timer.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "mojo/public/cpp/bindings/binding.h" @@ -87,7 +87,7 @@ class ArcTimerBridge : public KeyedService, mojo::Binding<mojom::TimerHost> binding_; - base::WeakPtrFactory<ArcTimerBridge> weak_ptr_factory_; + base::WeakPtrFactory<ArcTimerBridge> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcTimerBridge); }; diff --git a/chromium/components/arc/timer/arc_timer_bridge_unittest.cc b/chromium/components/arc/timer/arc_timer_bridge_unittest.cc index f0b6ecb44c8..0d0a485c313 100644 --- a/chromium/components/arc/timer/arc_timer_bridge_unittest.cc +++ b/chromium/components/arc/timer/arc_timer_bridge_unittest.cc @@ -17,16 +17,16 @@ #include "base/time/time.h" #include "chromeos/dbus/power/power_manager_client.h" #include "components/arc/arc_service_manager.h" -#include "components/arc/common/timer.mojom.h" +#include "components/arc/mojom/timer.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "components/arc/session/connection_holder.h" #include "components/arc/test/connection_holder_util.h" #include "components/arc/test/fake_timer_instance.h" #include "components/arc/test/test_browser_context.h" #include "components/arc/timer/arc_timer_bridge.h" -#include "components/arc/timer/arc_timer_struct_traits.h" +#include "components/arc/timer/arc_timer_mojom_traits.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/browser_task_environment.h" #include "mojo/public/cpp/system/handle.h" #include "mojo/public/cpp/system/platform_handle.h" #include "testing/gtest/include/gtest/gtest.h" @@ -89,7 +89,7 @@ class ArcTimerStore { class ArcTimerTest : public testing::Test { public: ArcTimerTest() - : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { + : task_environment_(content::BrowserTaskEnvironment::IO_MAINLOOP) { chromeos::PowerManagerClient::InitializeFake(); timer_bridge_ = ArcTimerBridge::GetForBrowserContextForTesting(&context_); // This results in ArcTimerBridge::OnInstanceReady being called. @@ -125,7 +125,7 @@ class ArcTimerTest : public testing::Test { bool StoreReadFds(const std::vector<clockid_t> clocks, std::vector<base::ScopedFD> read_fds); - content::TestBrowserThreadBundle thread_bundle_; + content::BrowserTaskEnvironment task_environment_; ArcServiceManager arc_service_manager_; TestBrowserContext context_; FakeTimerInstance timer_instance_; diff --git a/chromium/components/arc/timer/arc_timer_struct_traits.cc b/chromium/components/arc/timer/arc_timer_mojom_traits.cc index 77c37ae8eff..c6360545edc 100644 --- a/chromium/components/arc/timer/arc_timer_struct_traits.cc +++ b/chromium/components/arc/timer/arc_timer_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/timer/arc_timer_struct_traits.h" +#include "components/arc/timer/arc_timer_mojom_traits.h" #include <utility> diff --git a/chromium/components/arc/timer/arc_timer_struct_traits.h b/chromium/components/arc/timer/arc_timer_mojom_traits.h index 40adac5a39c..3ab26b086f4 100644 --- a/chromium/components/arc/timer/arc_timer_struct_traits.h +++ b/chromium/components/arc/timer/arc_timer_mojom_traits.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_TIMER_ARC_TIMER_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_TIMER_ARC_TIMER_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_TIMER_ARC_TIMER_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_TIMER_ARC_TIMER_MOJOM_TRAITS_H_ #include <time.h> -#include "components/arc/common/timer.mojom.h" +#include "components/arc/mojom/timer.mojom.h" namespace mojo { @@ -19,4 +19,4 @@ struct EnumTraits<arc::mojom::ClockId, clockid_t> { } // namespace mojo -#endif // COMPONENTS_ARC_TIMER_ARC_TIMER_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_TIMER_ARC_TIMER_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/usb/usb_host_bridge.cc b/chromium/components/arc/usb/usb_host_bridge.cc index c0c12d8894f..49a2c88ea11 100644 --- a/chromium/components/arc/usb/usb_host_bridge.cc +++ b/chromium/components/arc/usb/usb_host_bridge.cc @@ -194,6 +194,9 @@ void ArcUsbHostBridge::GetDeviceInfo(const std::string& guid, device::mojom::UsbDeviceInfoPtr info = iter->second->Clone(); // b/69295049 the other side doesn't like optional strings. + info->manufacturer_name = info->manufacturer_name.value_or(base::string16()); + info->product_name = info->product_name.value_or(base::string16()); + info->serial_number = info->serial_number.value_or(base::string16()); for (const device::mojom::UsbConfigurationInfoPtr& cfg : info->configurations) { cfg->configuration_name = @@ -214,19 +217,18 @@ void ArcUsbHostBridge::OnConnectionReady() { if (delegate_) delegate_->AttachDevicesToArcVm(); - // Request UsbDeviceManagerPtr from DeviceService. - content::GetSystemConnector()->BindInterface( - device::mojom::kServiceName, mojo::MakeRequest(&usb_manager_)); - usb_manager_.set_connection_error_handler( + // Receive mojo::Remote<UsbDeviceManager> from DeviceService. + content::GetSystemConnector()->Connect( + device::mojom::kServiceName, usb_manager_.BindNewPipeAndPassReceiver()); + usb_manager_.set_disconnect_handler( base::BindOnce(&ArcUsbHostBridge::Disconnect, base::Unretained(this))); // Listen for added/removed device events. - DCHECK(!client_binding_); - device::mojom::UsbDeviceManagerClientAssociatedPtrInfo client; - client_binding_.Bind(mojo::MakeRequest(&client)); + DCHECK(!client_receiver_.is_bound()); usb_manager_->EnumerateDevicesAndSetClient( - std::move(client), base::BindOnce(&ArcUsbHostBridge::InitDeviceList, - weak_factory_.GetWeakPtr())); + client_receiver_.BindNewEndpointAndPassRemote(), + base::BindOnce(&ArcUsbHostBridge::InitDeviceList, + weak_factory_.GetWeakPtr())); } void ArcUsbHostBridge::OnConnectionClosed() { @@ -327,7 +329,7 @@ void ArcUsbHostBridge::Disconnect() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_); usb_manager_.reset(); - client_binding_.Close(); + client_receiver_.reset(); devices_.clear(); } diff --git a/chromium/components/arc/usb/usb_host_bridge.h b/chromium/components/arc/usb/usb_host_bridge.h index 265e06064ce..8082b97470e 100644 --- a/chromium/components/arc/usb/usb_host_bridge.h +++ b/chromium/components/arc/usb/usb_host_bridge.h @@ -12,10 +12,11 @@ #include "base/callback_forward.h" #include "base/macros.h" #include "base/sequence_checker.h" -#include "components/arc/common/usb_host.mojom.h" +#include "components/arc/mojom/usb_host.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" -#include "mojo/public/cpp/bindings/associated_binding.h" +#include "mojo/public/cpp/bindings/associated_receiver.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/device/public/mojom/usb_device.mojom.h" #include "services/device/public/mojom/usb_manager.mojom.h" #include "services/device/public/mojom/usb_manager_client.mojom.h" @@ -110,9 +111,9 @@ class ArcUsbHostBridge : public KeyedService, mojom::UsbHostHostPtr usb_host_ptr_; // Connection to the DeviceService for usb manager. - device::mojom::UsbDeviceManagerPtr usb_manager_; - mojo::AssociatedBinding<device::mojom::UsbDeviceManagerClient> - client_binding_{this}; + mojo::Remote<device::mojom::UsbDeviceManager> usb_manager_; + mojo::AssociatedReceiver<device::mojom::UsbDeviceManagerClient> + client_receiver_{this}; // A mapping from GUID -> UsbDeviceInfoPtr for each attached USB device. std::map<std::string, device::mojom::UsbDeviceInfoPtr> devices_; diff --git a/chromium/components/arc/video_accelerator/BUILD.gn b/chromium/components/arc/video_accelerator/BUILD.gn index 4f20af52d73..5674e657faa 100644 --- a/chromium/components/arc/video_accelerator/BUILD.gn +++ b/chromium/components/arc/video_accelerator/BUILD.gn @@ -19,7 +19,7 @@ static_library("video_accelerator") { ] deps = [ - "//components/arc/common:media", + "//components/arc/mojom:media", "//media", "//ui/ozone", ] diff --git a/chromium/components/arc/video_accelerator/DEPS b/chromium/components/arc/video_accelerator/DEPS index ab60a062a08..affce5ebc9e 100644 --- a/chromium/components/arc/video_accelerator/DEPS +++ b/chromium/components/arc/video_accelerator/DEPS @@ -1,5 +1,5 @@ include_rules = [ - "+components/arc/common", + "+components/arc/mojom", "+gpu/config/gpu_preferences.h", "+media/base", "+media/gpu", diff --git a/chromium/components/arc/video_accelerator/OWNERS b/chromium/components/arc/video_accelerator/OWNERS index 346d6c9af8a..8794119b983 100644 --- a/chromium/components/arc/video_accelerator/OWNERS +++ b/chromium/components/arc/video_accelerator/OWNERS @@ -1,4 +1,3 @@ hiroh@chromium.org kcwu@chromium.org -piman@chromium.org posciak@chromium.org diff --git a/chromium/components/arc/video_accelerator/arc_video_accelerator_util.cc b/chromium/components/arc/video_accelerator/arc_video_accelerator_util.cc index adc6db3c2e4..ad5eba91784 100644 --- a/chromium/components/arc/video_accelerator/arc_video_accelerator_util.cc +++ b/chromium/components/arc/video_accelerator/arc_video_accelerator_util.cc @@ -8,14 +8,98 @@ #include <unistd.h> #include "base/files/platform_file.h" +#include "base/numerics/checked_math.h" +#include "base/numerics/safe_conversions.h" +#include "media/base/video_frame.h" #include "media/gpu/macros.h" #include "mojo/public/cpp/system/platform_handle.h" namespace arc { +namespace { + +bool VerifyGpuMemoryBufferHandle(media::VideoPixelFormat pixel_format, + const gfx::Size& coded_size, + const gfx::GpuMemoryBufferHandle& gmb_handle) { + if (gmb_handle.type != gfx::NATIVE_PIXMAP) { + VLOGF(1) << "Unexpected GpuMemoryBufferType: " << gmb_handle.type; + return false; + } + + const size_t num_planes = media::VideoFrame::NumPlanes(pixel_format); + if (num_planes != gmb_handle.native_pixmap_handle.planes.size() || + num_planes == 0) { + VLOGF(1) << "Invalid number of dmabuf planes passed: " + << gmb_handle.native_pixmap_handle.planes.size() + << ", expected: " << num_planes; + return false; + } + + // Offsets monotonically increase and strides monotonically decrease. + // Note: this offset assumption might not be correct if planes are stored in + // multiple buffers. + // TODO(b/127230761): Remove this offset check once one fd is given per one + // plane. + for (size_t i = 1; i < num_planes; i++) { + if (gmb_handle.native_pixmap_handle.planes[i].offset < + gmb_handle.native_pixmap_handle.planes[i - 1].offset) { + return false; + } + if (gmb_handle.native_pixmap_handle.planes[i - 1].stride < + gmb_handle.native_pixmap_handle.planes[i].stride) { + return false; + } + } + + size_t prev_buffer_end = 0; + for (size_t i = 0; i < num_planes; i++) { + const auto& plane = gmb_handle.native_pixmap_handle.planes[i]; + DVLOGF(4) << "Plane " << i << ", offset: " << plane.offset + << ", stride: " << plane.stride; + + size_t file_size_in_bytes; + if (!plane.fd.is_valid() || + !GetFileSize(plane.fd.get(), &file_size_in_bytes)) + return false; + + size_t plane_height = + media::VideoFrame::Rows(i, pixel_format, coded_size.height()); + base::CheckedNumeric<size_t> min_plane_size = + base::CheckMul(plane.stride, plane_height); + if (!min_plane_size.IsValid() || min_plane_size.ValueOrDie() > plane.size) { + VLOGF(1) << "Invalid strides/sizes"; + return false; + } + + // Check |offset| + (the size of a plane) on each plane is not larger than + // |file_size_in_bytes|. This ensures we don't access out of a buffer + // referred by |fd|. + base::CheckedNumeric<size_t> min_buffer_size = + base::CheckAdd(plane.offset, plane.size); + if (!min_buffer_size.IsValid() || + min_buffer_size.ValueOrDie() > file_size_in_bytes) { + VLOGF(1) << "Invalid strides/offsets"; + return false; + } + + // The end of the previous plane must not be bigger than the offset of the + // current plane. + // TODO(b/127230761): Remove this check once one fd is given per one plane. + if (prev_buffer_end > base::checked_cast<size_t>(plane.offset)) { + VLOGF(1) << "Invalid offset"; + return false; + } + prev_buffer_end = min_buffer_size.ValueOrDie(); + } + + return true; +} + +} // namespace + base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle) { if (!handle.is_valid()) { - VLOGF(1) << "Handle is invalid."; + VLOGF(1) << "Handle is invalid"; return base::ScopedFD(); } @@ -31,10 +115,15 @@ base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle) { } bool GetFileSize(const int fd, size_t* size) { + if (fd < 0) { + VLOGF(1) << "Invalid file descriptor"; + return false; + } + off_t fd_size = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); if (fd_size < 0u) { - VPLOGF(1) << "Fail to find the size of fd."; + VPLOGF(1) << "Fail to find the size of fd"; return false; } @@ -50,4 +139,60 @@ bool GetFileSize(const int fd, size_t* size) { return true; } +base::Optional<gfx::GpuMemoryBufferHandle> CreateGpuMemoryBufferHandle( + media::VideoPixelFormat pixel_format, + const gfx::Size& coded_size, + base::ScopedFD fd, + const std::vector<VideoFramePlane>& planes) { + const size_t num_planes = media::VideoFrame::NumPlanes(pixel_format); + if (planes.size() != num_planes || planes.size() == 0) { + VLOGF(1) << "Invalid number of dmabuf planes passed: " << planes.size() + << ", expected: " << num_planes; + return base::nullopt; + } + + std::array<base::ScopedFD, media::VideoFrame::kMaxPlanes> scoped_fds; + DCHECK_LE(num_planes, media::VideoFrame::kMaxPlanes); + scoped_fds[0] = std::move(fd); + for (size_t i = 1; i < num_planes; ++i) { + scoped_fds[i].reset(HANDLE_EINTR(dup(scoped_fds[0].get()))); + if (!scoped_fds[i].is_valid()) { + VLOGF(1) << "Failed to duplicate fd"; + return base::nullopt; + } + } + + gfx::GpuMemoryBufferHandle gmb_handle; + gmb_handle.type = gfx::NATIVE_PIXMAP; + for (size_t i = 0; i < num_planes; ++i) { + // NOTE: planes[i].stride and planes[i].offset both are int32_t. stride and + // offset in NativePixmapPlane are uint32_t and uint64_t, respectively. + if (!base::IsValueInRangeForNumericType<uint32_t>(planes[i].stride)) { + VLOGF(1) << "Invalid stride"; + return base::nullopt; + } + if (!base::IsValueInRangeForNumericType<uint64_t>(planes[i].offset)) { + VLOGF(1) << "Invalid offset"; + return base::nullopt; + } + uint32_t stride = base::checked_cast<uint32_t>(planes[i].stride); + uint64_t offset = base::checked_cast<uint64_t>(planes[i].offset); + + size_t plane_height = + media::VideoFrame::Rows(i, pixel_format, coded_size.height()); + base::CheckedNumeric<uint64_t> current_size = + base::CheckMul(stride, plane_height); + if (!current_size.IsValid()) { + VLOGF(1) << "Invalid stride/height"; + return base::nullopt; + } + gmb_handle.native_pixmap_handle.planes.emplace_back( + stride, offset, current_size.ValueOrDie(), std::move(scoped_fds[i])); + } + + if (!VerifyGpuMemoryBufferHandle(pixel_format, coded_size, gmb_handle)) + return base::nullopt; + return gmb_handle; +} + } // namespace arc diff --git a/chromium/components/arc/video_accelerator/arc_video_accelerator_util.h b/chromium/components/arc/video_accelerator/arc_video_accelerator_util.h index 3bcfa385ada..cb7fa51e6a5 100644 --- a/chromium/components/arc/video_accelerator/arc_video_accelerator_util.h +++ b/chromium/components/arc/video_accelerator/arc_video_accelerator_util.h @@ -5,16 +5,32 @@ #ifndef COMPONENTS_ARC_VIDEO_ACCELERATOR_ARC_VIDEO_ACCELERATOR_UTIL_H_ #define COMPONENTS_ARC_VIDEO_ACCELERATOR_ARC_VIDEO_ACCELERATOR_UTIL_H_ +#include <vector> + #include "base/files/scoped_file.h" +#include "base/optional.h" +#include "components/arc/video_accelerator/video_frame_plane.h" +#include "media/base/video_types.h" #include "mojo/public/cpp/system/handle.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/gpu_memory_buffer.h" + namespace arc { // Creates ScopedFD from given mojo::ScopedHandle. // Returns invalid ScopedFD on failure. base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle); -// Return the file size of |fd|. +// Return the file size of |fd| in bytes. bool GetFileSize(const int fd, size_t* size); +// Return GpuMemoryBufferHandle iff |planes| are valid for a video frame located +// on |fd| and of |pixel_format| and |coded_size|. Otherwise returns +// base::nullopt. +base::Optional<gfx::GpuMemoryBufferHandle> CreateGpuMemoryBufferHandle( + media::VideoPixelFormat pixel_format, + const gfx::Size& coded_size, + base::ScopedFD fd, + const std::vector<VideoFramePlane>& planes); } // namespace arc #endif // COMPONENTS_ARC_VIDEO_ACCELERATOR_ARC_VIDEO_ACCELERATOR_UTIL_H_ 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 86e04b25c0f..54e75950b54 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 @@ -68,42 +68,6 @@ arc::mojom::VideoDecodeAccelerator::Result ConvertErrorCode( } } -// Return true iff |planes| is valid for a video frame located on |dmabuf_fd| -// and of |pixel_format|. -bool VerifyDmabuf(media::VideoPixelFormat pixel_format, - const gfx::Size& coded_size, - int dmabuf_fd, - const std::vector<arc::VideoFramePlane>& planes) { - const size_t num_planes = media::VideoFrame::NumPlanes(pixel_format); - if (planes.size() != num_planes || num_planes == 0) { - VLOGF(1) << "Invalid number of dmabuf planes passed: " << planes.size() - << ", expected: " << num_planes; - return false; - } - - size_t size; - if (!arc::GetFileSize(dmabuf_fd, &size)) - return false; - - for (size_t i = 0; i < planes.size(); ++i) { - const auto& plane = planes[i]; - - DVLOGF(4) << "Plane " << i << ", offset: " << plane.offset - << ", stride: " << plane.stride; - - size_t rows = media::VideoFrame::Rows(i, pixel_format, coded_size.height()); - base::CheckedNumeric<size_t> current_size(plane.offset); - current_size += base::CheckMul(plane.stride, rows); - - if (!current_size.IsValid() || current_size.ValueOrDie() > size) { - VLOGF(1) << "Invalid strides/offsets."; - return false; - } - } - - return true; -} - } // namespace namespace arc { @@ -438,13 +402,7 @@ void GpuArcVideoDecodeAccelerator::Decode( } } -void GpuArcVideoDecodeAccelerator::AssignPictureBuffersDeprecated( - uint32_t count) { - AssignPictureBuffers(count, pending_coded_size_); -} - -void GpuArcVideoDecodeAccelerator::AssignPictureBuffers(uint32_t count, - const gfx::Size& size) { +void GpuArcVideoDecodeAccelerator::AssignPictureBuffers(uint32_t count) { VLOGF(2) << "count=" << count; DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!vda_) { @@ -458,15 +416,17 @@ void GpuArcVideoDecodeAccelerator::AssignPictureBuffers(uint32_t count, mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT); return; } - - coded_size_ = size; - std::vector<media::PictureBuffer> buffers; - for (uint32_t id = 0; id < count; ++id) { - buffers.push_back( - media::PictureBuffer(static_cast<int32_t>(id), coded_size_)); + if (assign_picture_buffers_called_) { + VLOGF(1) << "AssignPictureBuffers is called twice without " + << "ImportBufferForPicture()"; + client_->NotifyError( + mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT); + return; } + + coded_size_ = pending_coded_size_; output_buffer_count_ = static_cast<size_t>(count); - vda_->AssignPictureBuffers(buffers); + assign_picture_buffers_called_ = true; } void GpuArcVideoDecodeAccelerator::ImportBufferForPicture( @@ -527,33 +487,30 @@ void GpuArcVideoDecodeAccelerator::ImportBufferForPicture( } gmb_handle.native_pixmap_handle = std::move(protected_native_pixmap); } else { - if (!VerifyDmabuf(pixel_format, coded_size_, handle_fd.get(), planes)) { - VLOGF(1) << "Failed verifying dmabuf"; + auto handle = CreateGpuMemoryBufferHandle(pixel_format, coded_size_, + std::move(handle_fd), planes); + if (!handle) { + VLOGF(1) << "Failed to create GpuMemoryBufferHandle"; client_->NotifyError( mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT); return; } + gmb_handle = std::move(handle).value(); + } - const size_t num_planes = media::VideoFrame::NumPlanes(pixel_format); - - // TODO(crbug.com/911370): Remove this workaround once Android passes one fd - // per plane. - std::array<base::ScopedFD, media::VideoFrame::kMaxPlanes> scoped_fds; - scoped_fds[0].reset(handle_fd.release()); - for (size_t i = 1; i < num_planes; ++i) { - scoped_fds[i].reset(HANDLE_EINTR(dup(scoped_fds[0].get()))); - if (!scoped_fds[i].is_valid()) { - VLOGF(1) << "Failed to duplicate fd."; - client_->NotifyError( - mojom::VideoDecodeAccelerator::Result::PLATFORM_FAILURE); - return; - } + // This is the first time of ImportBufferForPicture() after + // AssignPictureBuffers() is called. Call VDA::AssignPictureBuffers() here. + if (assign_picture_buffers_called_) { + gfx::Size picture_size(gmb_handle.native_pixmap_handle.planes[0].stride, + coded_size_.height()); + std::vector<media::PictureBuffer> buffers; + for (size_t id = 0; id < output_buffer_count_; ++id) { + buffers.push_back( + media::PictureBuffer(static_cast<int32_t>(id), picture_size)); } - for (size_t i = 0; i < planes.size(); ++i) { - gmb_handle.native_pixmap_handle.planes.emplace_back( - planes[i].stride, planes[i].offset, 0, std::move(scoped_fds[i])); - } + vda_->AssignPictureBuffers(std::move(buffers)); + assign_picture_buffers_called_ = false; } vda_->ImportBufferForPicture(picture_buffer_id, pixel_format, 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 b7a0433234f..5de76657dd5 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 @@ -13,7 +13,7 @@ #include "base/callback_forward.h" #include "base/files/scoped_file.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/video_decode_accelerator.mojom.h" +#include "components/arc/mojom/video_decode_accelerator.mojom.h" #include "gpu/config/gpu_preferences.h" #include "media/video/video_decode_accelerator.h" @@ -64,8 +64,7 @@ class GpuArcVideoDecodeAccelerator mojom::VideoDecodeClientPtr client, InitializeCallback callback) override; void Decode(mojom::BitstreamBufferPtr bitstream_buffer) override; - void AssignPictureBuffersDeprecated(uint32_t count) override; - void AssignPictureBuffers(uint32_t count, const gfx::Size& size) override; + void AssignPictureBuffers(uint32_t count) override; void ImportBufferForPicture(int32_t picture_buffer_id, mojom::HalPixelFormat format, mojo::ScopedHandle handle, @@ -152,6 +151,7 @@ class GpuArcVideoDecodeAccelerator bool secure_mode_ = false; size_t output_buffer_count_ = 0; + bool assign_picture_buffers_called_ = false; THREAD_CHECKER(thread_checker_); DISALLOW_COPY_AND_ASSIGN(GpuArcVideoDecodeAccelerator); 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 7dfb9b31c93..214cf3b94ba 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 @@ -8,7 +8,10 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/logging.h" +#include "base/memory/platform_shared_memory_region.h" +#include "base/memory/unsafe_shared_memory_region.h" +#include "base/numerics/checked_math.h" +#include "base/numerics/safe_conversions.h" #include "base/system/sys_info.h" #include "components/arc/video_accelerator/arc_video_accelerator_util.h" #include "media/base/video_types.h" @@ -20,6 +23,43 @@ namespace arc { +namespace { +base::Optional<media::VideoFrameLayout> CreateVideoFrameLayout( + media::VideoPixelFormat format, + const gfx::Size& coded_size, + const gfx::GpuMemoryBufferHandle& gmb_handle) { + const size_t num_planes = gmb_handle.native_pixmap_handle.planes.size(); + + std::vector<media::VideoFrameLayout::Plane> layout_planes(num_planes); + for (size_t i = 0; i < num_planes; i++) { + const auto& plane = gmb_handle.native_pixmap_handle.planes[i]; + if (!base::IsValueInRangeForNumericType<int32_t>(plane.stride)) { + DLOG(ERROR) << "Invalid stride"; + return base::nullopt; + } + if (!base::IsValueInRangeForNumericType<size_t>(plane.offset)) { + DLOG(ERROR) << "Invalid offset"; + return base::nullopt; + } + if (!base::IsValueInRangeForNumericType<size_t>(plane.size)) { + DLOG(ERROR) << "Invalid size"; + return base::nullopt; + } + + // convert uint32_t -> int32_t. + layout_planes[i].stride = base::checked_cast<int32_t>(plane.stride); + // convert uint64_t -> size_t + layout_planes[i].offset = base::checked_cast<size_t>(plane.offset); + // convert uint64_t -> size_t + layout_planes[i].size = base::checked_cast<size_t>(plane.size); + } + + gfx::Size frame_size(layout_planes[0].stride, coded_size.height()); + return media::VideoFrameLayout::CreateWithPlanes(format, frame_size, + std::move(layout_planes)); +} +} // namespace + GpuArcVideoEncodeAccelerator::GpuArcVideoEncodeAccelerator( const gpu::GpuPreferences& gpu_preferences) : gpu_preferences_(gpu_preferences), @@ -134,8 +174,42 @@ void GpuArcVideoEncodeAccelerator::EncodeDmabuf( int64_t timestamp, bool force_keyframe, EncodeCallback callback) { - client_->NotifyError(Error::kInvalidArgumentError); - NOTIMPLEMENTED(); + if (format != media::PIXEL_FORMAT_NV12) { + DLOG(ERROR) << "Formats other than NV12 are unsupported. format=" << format; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + + auto gmb_handle = + CreateGpuMemoryBufferHandle(format, coded_size_, std::move(fd), planes); + if (!gmb_handle) { + DLOG(ERROR) << "Failed to create GpuMemoryBufferHandle"; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + + auto layout = CreateVideoFrameLayout(format, coded_size_, *gmb_handle); + if (!layout) { + DLOG(ERROR) << "Failed to create VideoFrameLayout."; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + + std::vector<base::ScopedFD> scoped_fds; + for (auto& plane : gmb_handle->native_pixmap_handle.planes) { + scoped_fds.push_back(std::move(plane.fd)); + } + auto frame = media::VideoFrame::WrapExternalDmabufs( + *layout, gfx::Rect(visible_size_), visible_size_, std::move(scoped_fds), + base::TimeDelta::FromMicroseconds(timestamp)); + if (!frame) { + DLOG(ERROR) << "Failed to create VideoFrame"; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + + frame->AddDestructionObserver(std::move(callback)); + accelerator_->Encode(std::move(frame), force_keyframe); } void GpuArcVideoEncodeAccelerator::EncodeSharedMemory( @@ -151,48 +225,67 @@ void GpuArcVideoEncodeAccelerator::EncodeSharedMemory( return; } - size_t allocation_size = - media::VideoFrame::AllocationSize(format, coded_size_); + auto gmb_handle = CreateGpuMemoryBufferHandle( + format, coded_size_, base::ScopedFD(HANDLE_EINTR(dup(fd.get()))), planes); + if (!gmb_handle) { + DLOG(ERROR) << "Failed to create GpuMemoryBufferHandle"; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + + auto layout = CreateVideoFrameLayout(format, coded_size_, *gmb_handle); + if (!layout) { + DLOG(ERROR) << "Failed to create VideoFrameLayout."; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + + base::CheckedNumeric<size_t> map_size = 0; + for (const auto& plane : layout->planes()) { + map_size = map_size.Max(plane.offset + plane.size); + } + if (!map_size.IsValid()) { + DLOG(ERROR) << "Invalid map_size"; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + // TODO(rockot): Pass GUIDs through Mojo. https://crbug.com/713763. // TODO(rockot): This fd comes from a mojo::ScopedHandle in // GpuArcVideoService::BindSharedMemory. That should be passed through, // rather than pulling out the fd. https://crbug.com/713763. - // TODO(rockot): Pass through a real size rather than |0|. base::UnguessableToken guid = base::UnguessableToken::Create(); - base::SharedMemoryHandle shm_handle(base::FileDescriptor(fd.release(), true), - 0u, guid); - auto shm = std::make_unique<base::SharedMemory>(shm_handle, true); - - base::CheckedNumeric<off_t> map_offset = planes[0].offset; - base::CheckedNumeric<size_t> map_size = allocation_size; - const uint32_t aligned_offset = - planes[0].offset % base::SysInfo::VMAllocationGranularity(); - map_offset -= aligned_offset; - map_size += aligned_offset; - - if (!map_offset.IsValid() || !map_size.IsValid()) { - DLOG(ERROR) << "Invalid map_offset or map_size"; - client_->NotifyError(Error::kInvalidArgumentError); - return; - } - if (!shm->MapAt(map_offset.ValueOrDie(), map_size.ValueOrDie())) { + base::subtle::PlatformSharedMemoryRegion platform_region = + base::subtle::PlatformSharedMemoryRegion::Take( + std::move(fd), + base::subtle::PlatformSharedMemoryRegion::Mode::kUnsafe, + map_size.ValueOrDie(), guid); + base::UnsafeSharedMemoryRegion shared_region = + base::UnsafeSharedMemoryRegion::Deserialize(std::move(platform_region)); + base::WritableSharedMemoryMapping mapping = + shared_region.MapAt(0u, map_size.ValueOrDie()); + if (!mapping.IsValid()) { DLOG(ERROR) << "Failed to map memory."; client_->NotifyError(Error::kPlatformFailureError); return; } - uint8_t* shm_memory = reinterpret_cast<uint8_t*>(shm->memory()); - auto frame = media::VideoFrame::WrapExternalSharedMemory( - format, coded_size_, gfx::Rect(visible_size_), visible_size_, - shm_memory + aligned_offset, allocation_size, shm_handle, - planes[0].offset, base::TimeDelta::FromMicroseconds(timestamp)); - - // Add the function to relase |shm| and |callback| to |frame|'s destruction - // observer. When the |frame| goes out of scope, it unmaps and releases the - // shared memory as well as executes |callback|. - frame->AddDestructionObserver(base::BindOnce( - base::DoNothing::Once<std::unique_ptr<base::SharedMemory>>(), - std::move(shm))); + uint8_t* shm_memory = mapping.GetMemoryAsSpan<uint8_t>().data(); + auto frame = media::VideoFrame::WrapExternalYuvDataWithLayout( + *layout, gfx::Rect(visible_size_), visible_size_, + shm_memory + layout->planes()[0].offset, + shm_memory + layout->planes()[1].offset, + shm_memory + layout->planes()[2].offset, + base::TimeDelta::FromMicroseconds(timestamp)); + if (!frame) { + DLOG(ERROR) << "Failed to create VideoFrame"; + client_->NotifyError(Error::kInvalidArgumentError); + return; + } + frame->BackWithOwnedSharedMemory(std::move(shared_region), + std::move(mapping)); + // Add the function to |callback| to |frame|'s destruction observer. When the + // |frame| goes out of scope, it executes |callback|. frame->AddDestructionObserver(std::move(callback)); accelerator_->Encode(frame, force_keyframe); } 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 806b8dc8e59..523e04ff4e5 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 @@ -11,7 +11,7 @@ #include "base/files/scoped_file.h" #include "base/macros.h" -#include "components/arc/common/video_encode_accelerator.mojom.h" +#include "components/arc/mojom/video_encode_accelerator.mojom.h" #include "components/arc/video_accelerator/video_frame_plane.h" #include "gpu/config/gpu_preferences.h" #include "media/video/video_encode_accelerator.h" diff --git a/chromium/components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h b/chromium/components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h index 4235d86344f..26fe128192c 100644 --- a/chromium/components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h +++ b/chromium/components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "components/arc/common/video_protected_buffer_allocator.mojom.h" +#include "components/arc/mojom/video_protected_buffer_allocator.mojom.h" #include "mojo/public/cpp/system/handle.h" namespace arc { diff --git a/chromium/components/arc/video_accelerator/protected_buffer_manager.cc b/chromium/components/arc/video_accelerator/protected_buffer_manager.cc index af955f36d34..3acab7df92b 100644 --- a/chromium/components/arc/video_accelerator/protected_buffer_manager.cc +++ b/chromium/components/arc/video_accelerator/protected_buffer_manager.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/shared_memory.h" #include "base/system/sys_info.h" +#include "base/threading/thread_checker.h" #include "components/arc/video_accelerator/protected_buffer_allocator.h" #include "media/gpu/macros.h" #include "mojo/public/cpp/system/buffer.h" diff --git a/chromium/components/arc/video_accelerator/protected_buffer_manager_proxy.h b/chromium/components/arc/video_accelerator/protected_buffer_manager_proxy.h index 79e3c2c3452..3390984a80a 100644 --- a/chromium/components/arc/video_accelerator/protected_buffer_manager_proxy.h +++ b/chromium/components/arc/video_accelerator/protected_buffer_manager_proxy.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_PROXY_H_ #define COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_PROXY_H_ -#include "components/arc/common/protected_buffer_manager.mojom.h" +#include "components/arc/mojom/protected_buffer_manager.mojom.h" namespace arc { diff --git a/chromium/components/arc/volume_mounter/OWNERS b/chromium/components/arc/volume_mounter/OWNERS index be9c82ab353..a4479e996dc 100644 --- a/chromium/components/arc/volume_mounter/OWNERS +++ b/chromium/components/arc/volume_mounter/OWNERS @@ -1,5 +1,5 @@ hashimoto@chromium.org -per-file *_struct_traits*.*=set noparent -per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS -per-file *_struct_traits*.*=file://components/arc/common/ARC_SECURITY_OWNERS +per-file *_mojom_traits*.*=set noparent +per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS +per-file *_mojom_traits*.*=file://components/arc/mojom/ARC_SECURITY_OWNERS diff --git a/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.cc b/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.cc index a79e6d18dda..0470fac7ecb 100644 --- a/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.cc +++ b/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.cc @@ -8,6 +8,7 @@ #include "base/feature_list.h" #include "base/logging.h" #include "base/memory/singleton.h" +#include "base/metrics/histogram_functions.h" #include "base/task/post_task.h" #include "chromeos/constants/chromeos_features.h" #include "chromeos/disks/disk.h" @@ -72,8 +73,7 @@ ArcVolumeMounterBridge* ArcVolumeMounterBridge::GetForBrowserContextForTesting( ArcVolumeMounterBridge::ArcVolumeMounterBridge(content::BrowserContext* context, ArcBridgeService* bridge_service) : arc_bridge_service_(bridge_service), - pref_service_(user_prefs::UserPrefs::Get(context)), - weak_ptr_factory_(this) { + pref_service_(user_prefs::UserPrefs::Get(context)) { DCHECK(pref_service_); arc_bridge_service_->volume_mounter()->AddObserver(this); arc_bridge_service_->volume_mounter()->SetHost(this); @@ -81,11 +81,11 @@ ArcVolumeMounterBridge::ArcVolumeMounterBridge(content::BrowserContext* context, DiskMountManager::GetInstance()->AddObserver(this); change_registerar_.Init(pref_service_); - // Start monitoring |kArcHasAccessToRemovableMedia| changes. Note that the + // Start monitoring |kArcVisibleExternalStorages| changes. Note that the // registerar automatically stops monitoring the pref in its dtor. change_registerar_.Add( - prefs::kArcHasAccessToRemovableMedia, - base::BindRepeating(&ArcVolumeMounterBridge::OnPrefChanged, + prefs::kArcVisibleExternalStorages, + base::BindRepeating(&ArcVolumeMounterBridge::OnVisibleStoragesChanged, weak_ptr_factory_.GetWeakPtr())); } @@ -97,8 +97,7 @@ ArcVolumeMounterBridge::~ArcVolumeMounterBridge() { // Sends MountEvents of all existing MountPoints in cros-disks. void ArcVolumeMounterBridge::SendAllMountEvents() { - if (base::FeatureList::IsEnabled(chromeos::features::kMyFilesVolume)) - SendMountEventForMyFiles(); + SendMountEventForMyFiles(); for (const auto& keyValue : DiskMountManager::GetInstance()->mount_points()) { OnMountEvent(DiskMountManager::MountEvent::MOUNTING, @@ -123,28 +122,31 @@ void ArcVolumeMounterBridge::SendMountEventForMyFiles() { volume_mounter_instance->OnMountEvent(mojom::MountPointInfo::New( DiskMountManager::MOUNTING, kMyFilesPath, kMyFilesPath, kMyFilesUuid, - device_label, device_type)); + device_label, device_type, false)); } -bool ArcVolumeMounterBridge::HasAccessToRemovableMedia() const { - DCHECK(pref_service_); - // If the UI is not enabled, allow the access. - if (!base::FeatureList::IsEnabled(arc::kUsbStorageUIFeature)) - return true; - return pref_service_->GetBoolean(prefs::kArcHasAccessToRemovableMedia); +bool ArcVolumeMounterBridge::IsVisibleToAndroidApps( + const std::string& uuid) const { + const base::ListValue* uuid_list = + pref_service_->GetList(prefs::kArcVisibleExternalStorages); + for (auto& value : uuid_list->GetList()) { + if (value.is_string() && value.GetString() == uuid) + return true; + } + return false; } -void ArcVolumeMounterBridge::OnPrefChanged() { - if (HasAccessToRemovableMedia()) { - // Mount everything again. Mounting the same disk (e.g. MyFiles) again is - // allowed and is no-op. - SendAllMountEvents(); - return; - } - // Unmount everything except for MyFiles. - for (const auto& keyValue : DiskMountManager::GetInstance()->mount_points()) { +void ArcVolumeMounterBridge::OnVisibleStoragesChanged() { + // Remount all external mount points when the list of visible storage changes. + for (const auto& key_value : + DiskMountManager::GetInstance()->mount_points()) { OnMountEvent(DiskMountManager::MountEvent::UNMOUNTING, - chromeos::MountError::MOUNT_ERROR_NONE, keyValue.second); + chromeos::MountError::MOUNT_ERROR_NONE, key_value.second); + } + for (const auto& key_value : + DiskMountManager::GetInstance()->mount_points()) { + OnMountEvent(DiskMountManager::MountEvent::MOUNTING, + chromeos::MountError::MOUNT_ERROR_NONE, key_value.second); } } @@ -174,15 +176,6 @@ void ArcVolumeMounterBridge::OnMountEvent( return; } - // Do not propagate MOUNTING event to ARC when the media sharing setting is - // turned off. The other event (i.e. UNMOUNTING) should still go through. - if (event == DiskMountManager::MountEvent::MOUNTING && - !HasAccessToRemovableMedia()) { - VLOG(2) << "Disk at " << mount_info.source_path - << " is not allowed to be shared with ARC"; - return; - } - // Get disks informations that are needed by Android MountService. const chromeos::disks::Disk* disk = DiskMountManager::GetInstance()->FindDiskBySourcePath( @@ -213,9 +206,18 @@ void ArcVolumeMounterBridge::OnMountEvent( if (!volume_mounter_instance) return; + const bool visible = IsVisibleToAndroidApps(fs_uuid); volume_mounter_instance->OnMountEvent(mojom::MountPointInfo::New( event, mount_info.source_path, mount_info.mount_path, fs_uuid, - device_label, device_type)); + device_label, device_type, visible)); + if (event == DiskMountManager::MountEvent::MOUNTING && + (device_type == chromeos::DeviceType::DEVICE_TYPE_USB || + device_type == chromeos::DeviceType::DEVICE_TYPE_SD)) { + // Record visibilities of the mounted devices only when they are removable + // storages (e.g. USB sticks or SD cards). + base::UmaHistogramBoolean("Arc.ExternalStorage.MountedMediaVisibility", + visible); + } } void ArcVolumeMounterBridge::RequestAllMountPoints() { diff --git a/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.h b/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.h index abc8daf3306..27cf43fa0c9 100644 --- a/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.h +++ b/chromium/components/arc/volume_mounter/arc_volume_mounter_bridge.h @@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chromeos/disks/disk_mount_manager.h" -#include "components/arc/common/volume_mounter.mojom.h" +#include "components/arc/mojom/volume_mounter.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_change_registrar.h" @@ -55,29 +55,20 @@ class ArcVolumeMounterBridge // mojom::VolumeMounterHost overrides: void RequestAllMountPoints() override; - bool files_app_toast_shown() const { return files_app_toast_shown_; } - void set_files_app_toast_shown(bool files_app_toast_shown) { - files_app_toast_shown_ = files_app_toast_shown; - } - private: void SendAllMountEvents(); void SendMountEventForMyFiles(); - bool HasAccessToRemovableMedia() const; - void OnPrefChanged(); + bool IsVisibleToAndroidApps(const std::string& uuid) const; + void OnVisibleStoragesChanged(); ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. PrefService* const pref_service_; PrefChangeRegistrar change_registerar_; - // A flag to remember if the ARC toast UI in Files.app has been shown in the - // current user session. - bool files_app_toast_shown_ = false; - - base::WeakPtrFactory<ArcVolumeMounterBridge> weak_ptr_factory_; + base::WeakPtrFactory<ArcVolumeMounterBridge> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcVolumeMounterBridge); }; diff --git a/chromium/components/arc/volume_mounter/volume_mounter_struct_traits.cc b/chromium/components/arc/volume_mounter/volume_mounter_mojom_traits.cc index b516fd79d4d..54299f5c80d 100644 --- a/chromium/components/arc/volume_mounter/volume_mounter_struct_traits.cc +++ b/chromium/components/arc/volume_mounter/volume_mounter_mojom_traits.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/arc/volume_mounter/volume_mounter_struct_traits.h" +#include "components/arc/volume_mounter/volume_mounter_mojom_traits.h" #include "base/logging.h" diff --git a/chromium/components/arc/volume_mounter/volume_mounter_struct_traits.h b/chromium/components/arc/volume_mounter/volume_mounter_mojom_traits.h index e235db29637..c18da661fdf 100644 --- a/chromium/components/arc/volume_mounter/volume_mounter_struct_traits.h +++ b/chromium/components/arc/volume_mounter/volume_mounter_mojom_traits.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_ARC_VOLUME_MOUNTER_VOLUME_MOUNTER_STRUCT_TRAITS_H_ -#define COMPONENTS_ARC_VOLUME_MOUNTER_VOLUME_MOUNTER_STRUCT_TRAITS_H_ +#ifndef COMPONENTS_ARC_VOLUME_MOUNTER_VOLUME_MOUNTER_MOJOM_TRAITS_H_ +#define COMPONENTS_ARC_VOLUME_MOUNTER_VOLUME_MOUNTER_MOJOM_TRAITS_H_ #include "chromeos/disks/disk_mount_manager.h" -#include "components/arc/common/volume_mounter.mojom.h" +#include "components/arc/mojom/volume_mounter.mojom.h" namespace mojo { @@ -28,4 +28,4 @@ struct EnumTraits<arc::mojom::MountEvent, } // namespace mojo -#endif // COMPONENTS_ARC_VOLUME_MOUNTER_VOLUME_MOUNTER_STRUCT_TRAITS_H_ +#endif // COMPONENTS_ARC_VOLUME_MOUNTER_VOLUME_MOUNTER_MOJOM_TRAITS_H_ diff --git a/chromium/components/arc/wake_lock/arc_wake_lock_bridge.cc b/chromium/components/arc/wake_lock/arc_wake_lock_bridge.cc index f5bfb90338f..fda1d063dd0 100644 --- a/chromium/components/arc/wake_lock/arc_wake_lock_bridge.cc +++ b/chromium/components/arc/wake_lock/arc_wake_lock_bridge.cc @@ -14,7 +14,7 @@ #include "components/arc/session/arc_bridge_service.h" #include "components/arc/wake_lock/arc_wake_lock_bridge.h" #include "content/public/browser/system_connector.h" -#include "mojo/public/cpp/bindings/interface_request.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/device/public/mojom/constants.mojom.h" #include "services/device/public/mojom/wake_lock_provider.mojom.h" #include "services/service_manager/public/cpp/connector.h" @@ -69,12 +69,12 @@ class ArcWakeLockBridge::WakeLockRequester { // Initialize |wake_lock_| if this is the first time we're using it. DVLOG(1) << "Partial wake lock new acquire. Count: " << wake_lock_count_; if (!wake_lock_) { - device::mojom::WakeLockProviderPtr provider; - connector_->BindInterface(device::mojom::kServiceName, - mojo::MakeRequest(&provider)); + mojo::Remote<device::mojom::WakeLockProvider> provider; + connector_->Connect(device::mojom::kServiceName, + provider.BindNewPipeAndPassReceiver()); provider->GetWakeLockWithoutContext( type_, device::mojom::WakeLockReason::kOther, kWakeLockReason, - mojo::MakeRequest(&wake_lock_)); + wake_lock_.BindNewPipeAndPassReceiver()); } wake_lock_->RequestWakeLock(); @@ -118,7 +118,7 @@ class ArcWakeLockBridge::WakeLockRequester { int64_t wake_lock_count_ = 0; // Lazily initialized in response to first request. - device::mojom::WakeLockPtr wake_lock_; + mojo::Remote<device::mojom::WakeLock> wake_lock_; DISALLOW_COPY_AND_ASSIGN(WakeLockRequester); }; @@ -142,9 +142,7 @@ ArcWakeLockBridge* ArcWakeLockBridge::GetForBrowserContextForTesting( ArcWakeLockBridge::ArcWakeLockBridge(content::BrowserContext* context, ArcBridgeService* bridge_service) - : arc_bridge_service_(bridge_service), - binding_(this), - weak_ptr_factory_(this) { + : arc_bridge_service_(bridge_service), binding_(this) { arc_bridge_service_->wake_lock()->SetHost(this); arc_bridge_service_->wake_lock()->AddObserver(this); } diff --git a/chromium/components/arc/wake_lock/arc_wake_lock_bridge.h b/chromium/components/arc/wake_lock/arc_wake_lock_bridge.h index 4a1d1cdc962..ade0bd71b29 100644 --- a/chromium/components/arc/wake_lock/arc_wake_lock_bridge.h +++ b/chromium/components/arc/wake_lock/arc_wake_lock_bridge.h @@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "components/arc/common/wake_lock.mojom.h" +#include "components/arc/mojom/wake_lock.mojom.h" #include "components/arc/session/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "content/public/common/service_manager_connection.h" @@ -80,7 +80,7 @@ class ArcWakeLockBridge : public KeyedService, mojo::Binding<mojom::WakeLockHost> binding_; - base::WeakPtrFactory<ArcWakeLockBridge> weak_ptr_factory_; + base::WeakPtrFactory<ArcWakeLockBridge> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ArcWakeLockBridge); }; diff --git a/chromium/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc b/chromium/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc index e0605d89094..19601946010 100644 --- a/chromium/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc +++ b/chromium/components/arc/wake_lock/arc_wake_lock_bridge_unittest.cc @@ -9,8 +9,8 @@ #include "base/bind.h" #include "base/run_loop.h" -#include "base/test/scoped_task_environment.h" -#include "components/arc/common/power.mojom.h" +#include "base/test/task_environment.h" +#include "components/arc/mojom/power.mojom.h" #include "components/arc/session/arc_bridge_service.h" #include "components/arc/test/connection_holder_util.h" #include "components/arc/test/fake_power_instance.h" @@ -27,8 +27,7 @@ using device::mojom::WakeLockType; class ArcWakeLockBridgeTest : public testing::Test { public: ArcWakeLockBridgeTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME), wake_lock_provider_( connector_factory_.RegisterInstance(device::mojom::kServiceName)) { bridge_service_ = std::make_unique<ArcBridgeService>(); @@ -98,7 +97,7 @@ class ArcWakeLockBridgeTest : public testing::Test { } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + base::test::TaskEnvironment task_environment_; service_manager::TestConnectorFactory connector_factory_; device::TestWakeLockProvider wake_lock_provider_; |