diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-24 12:15:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:30:04 +0000 |
commit | b014812705fc80bff0a5c120dfcef88f349816dc (patch) | |
tree | 25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/components/arc | |
parent | 9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff) | |
download | qtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz |
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/arc')
42 files changed, 548 insertions, 226 deletions
diff --git a/chromium/components/arc/BUILD.gn b/chromium/components/arc/BUILD.gn index a14b74ff51d..ee4af0d1166 100644 --- a/chromium/components/arc/BUILD.gn +++ b/chromium/components/arc/BUILD.gn @@ -77,12 +77,12 @@ static_library("arc") { "//chromeos", "//chromeos:login_manager_proto", "//chromeos:power_manager_proto", + "//components/account_id", "//components/exo", "//components/google/core/browser", "//components/onc", "//components/prefs", "//components/session_manager/core", - "//components/signin/core/account_id", "//components/timers", "//components/url_formatter", "//components/user_manager", @@ -118,10 +118,26 @@ static_library("prefs") { defines = [ "ARC_IMPLEMENTATION" ] deps = [ + ":arc_base_enums", "//components/prefs", ] } +static_library("arc_base_enums") { + sources = [ + "arc_instance_mode.cc", + "arc_instance_mode.h", + "arc_stop_reason.cc", + "arc_stop_reason.h", + "arc_supervision_transition.cc", + "arc_supervision_transition.h", + ] + + deps = [ + "//base", + ] +} + static_library("arc_base") { # TODO(hidehiko): Revisit here and move back some files to "arc" # on completion to move ArcSession task to ArcSessionManager. @@ -135,8 +151,6 @@ static_library("arc_base") { "arc_data_remover.h", "arc_features.cc", "arc_features.h", - "arc_instance_mode.cc", - "arc_instance_mode.h", "arc_service_manager.cc", "arc_service_manager.h", "arc_session.cc", @@ -145,14 +159,8 @@ static_library("arc_base") { "arc_session_impl.h", "arc_session_runner.cc", "arc_session_runner.h", - "arc_stop_reason.cc", - "arc_stop_reason.h", "arc_util.cc", "arc_util.h", - "connection_holder.h", - "connection_notifier.cc", - "connection_notifier.h", - "connection_observer.h", ] deps = [ @@ -160,24 +168,55 @@ static_library("arc_base") { "//base", "//chromeos", "//chromeos:login_manager_proto", + "//components/account_id", "//components/keyed_service/content", "//components/prefs", - "//components/signin/core/account_id", "//components/user_manager", + "//content/public/common", "//mojo/edk", "//ui/aura", ] public_deps = [ + ":arc_base_enums", + ":connection_holder", ":prefs", "//components/arc/common", ] } -static_library("arc_test_support") { +source_set("connection_holder") { + sources = [ + "connection_holder.h", + "connection_notifier.cc", + "connection_notifier.h", + "connection_observer.h", + "mojo_channel.h", + ] + + deps = [ + "//base", + "//mojo/public/cpp/bindings", + ] +} + +static_library("notification_test_support") { testonly = true sources = [ "test/connection_holder_util.h", + "test/fake_notifications_instance.cc", + "test/fake_notifications_instance.h", + ] + + public_deps = [ + ":connection_holder", + "//components/arc/common:notifications", + ] +} + +static_library("arc_test_support") { + testonly = true + sources = [ "test/fake_accessibility_helper_instance.cc", "test/fake_accessibility_helper_instance.h", "test/fake_app_instance.cc", @@ -194,8 +233,6 @@ static_library("arc_test_support") { "test/fake_file_system_instance.h", "test/fake_intent_helper_instance.cc", "test/fake_intent_helper_instance.h", - "test/fake_notifications_instance.cc", - "test/fake_notifications_instance.h", "test/fake_policy_instance.cc", "test/fake_policy_instance.h", "test/fake_power_instance.cc", @@ -214,6 +251,7 @@ static_library("arc_test_support") { public_deps = [ ":arc", + ":notification_test_support", ] deps = [ @@ -257,9 +295,9 @@ source_set("unit_tests") { "//chromeos", "//chromeos:power_manager_proto", "//chromeos:test_support_without_gmock", + "//components/account_id", "//components/keyed_service/content", "//components/prefs:test_support", - "//components/signin/core/account_id", "//components/user_manager", "//components/user_manager:test_support", "//content/public/common", diff --git a/chromium/components/arc/DEPS b/chromium/components/arc/DEPS index 320c49e4fe5..3839f7c4845 100644 --- a/chromium/components/arc/DEPS +++ b/chromium/components/arc/DEPS @@ -3,12 +3,12 @@ include_rules = [ "+chromeos/chromeos_switches.h", "+chromeos/cryptohome", "+chromeos/dbus", + "+components/account_id", "+components/exo", "+components/keyed_service", "+components/pref_registry", "+components/prefs", "+components/session_manager/core", - "+components/signin/core/account_id", "+components/timers", "+components/user_manager", "+media/base/video_codecs.h", @@ -22,6 +22,11 @@ include_rules = [ ] specific_include_rules = { + "arc_bridge_host_impl.cc": [ + "+ash/public", + "+content/public/common/service_manager_connection.h", + "+services/service_manager/public", + ], "arc_util.cc": [ "+ui/aura", ], diff --git a/chromium/components/arc/arc_bridge_host_impl.cc b/chromium/components/arc/arc_bridge_host_impl.cc index 5b42f0a1bc7..c59d2db6b9e 100644 --- a/chromium/components/arc/arc_bridge_host_impl.cc +++ b/chromium/components/arc/arc_bridge_host_impl.cc @@ -7,66 +7,17 @@ #include <algorithm> #include <utility> +#include "ash/public/interfaces/ash_message_center_controller.mojom.h" +#include "ash/public/interfaces/constants.mojom.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "components/arc/arc_bridge_service.h" +#include "components/arc/mojo_channel.h" +#include "content/public/common/service_manager_connection.h" +#include "services/service_manager/public/cpp/connector.h" namespace arc { -// Thin interface to wrap InterfacePtr<T> with type erasure. -class ArcBridgeHostImpl::MojoChannel { - public: - virtual ~MojoChannel() = default; - - protected: - MojoChannel() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(MojoChannel); -}; - -namespace { - -// The thin wrapper for InterfacePtr<T>, where T is one of ARC mojo Instance -// class. -template <typename InstanceType, typename HostType> -class MojoChannelImpl : public ArcBridgeHostImpl::MojoChannel { - public: - MojoChannelImpl(ConnectionHolder<InstanceType, HostType>* holder, - mojo::InterfacePtr<InstanceType> ptr) - : holder_(holder), ptr_(std::move(ptr)) { - // Delay registration to the ConnectionHolder until the version is ready. - } - - ~MojoChannelImpl() override { holder_->CloseInstance(ptr_.get()); } - - void set_connection_error_handler(base::OnceClosure error_handler) { - ptr_.set_connection_error_handler(std::move(error_handler)); - } - - void QueryVersion() { - // Note: the callback will not be called if |ptr_| is destroyed. - ptr_.QueryVersion( - base::Bind(&MojoChannelImpl::OnVersionReady, base::Unretained(this))); - } - - private: - void OnVersionReady(uint32_t unused_version) { - holder_->SetInstance(ptr_.get(), ptr_.version()); - } - - // Owned by ArcBridgeService. - ConnectionHolder<InstanceType, HostType>* const holder_; - - // Put as a last member to ensure that any callback tied to the |ptr_| - // is not invoked. - mojo::InterfacePtr<InstanceType> ptr_; - - DISALLOW_COPY_AND_ASSIGN(MojoChannelImpl); -}; - -} // namespace - ArcBridgeHostImpl::ArcBridgeHostImpl(ArcBridgeService* arc_bridge_service, mojom::ArcBridgeInstancePtr instance) : arc_bridge_service_(arc_bridge_service), @@ -159,6 +110,12 @@ void ArcBridgeHostImpl::OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) { OnInstanceReady(arc_bridge_service_->ime(), std::move(ime_ptr)); } +void ArcBridgeHostImpl::OnInputMethodManagerInstanceReady( + mojom::InputMethodManagerInstancePtr input_method_manager_ptr) { + OnInstanceReady(arc_bridge_service_->input_method_manager(), + std::move(input_method_manager_ptr)); +} + void ArcBridgeHostImpl::OnIntentHelperInstanceReady( mojom::IntentHelperInstancePtr intent_helper_ptr) { OnInstanceReady(arc_bridge_service_->intent_helper(), @@ -192,8 +149,13 @@ void ArcBridgeHostImpl::OnNetInstanceReady(mojom::NetInstancePtr net_ptr) { void ArcBridgeHostImpl::OnNotificationsInstanceReady( mojom::NotificationsInstancePtr notifications_ptr) { - OnInstanceReady(arc_bridge_service_->notifications(), - std::move(notifications_ptr)); + // Forward notification instance to ash. + ash::mojom::AshMessageCenterControllerPtr ash_message_center_controller; + content::ServiceManagerConnection::GetForProcess() + ->GetConnector() + ->BindInterface(ash::mojom::kServiceName, &ash_message_center_controller); + ash_message_center_controller->SetArcNotificationsInstance( + std::move(notifications_ptr)); } void ArcBridgeHostImpl::OnObbMounterInstanceReady( @@ -320,7 +282,7 @@ void ArcBridgeHostImpl::OnInstanceReady( // closed on ArcBridgeHost/Instance closing or the ArcBridgeHostImpl's // destruction. auto* channel = - new MojoChannelImpl<InstanceType, HostType>(holder, std::move(ptr)); + new MojoChannel<InstanceType, HostType>(holder, std::move(ptr)); mojo_channels_.emplace_back(channel); // Since |channel| is managed by |mojo_channels_|, its lifetime is shorter @@ -334,11 +296,11 @@ void ArcBridgeHostImpl::OnInstanceReady( channel->QueryVersion(); } -void ArcBridgeHostImpl::OnChannelClosed(MojoChannel* channel) { +void ArcBridgeHostImpl::OnChannelClosed(MojoChannelBase* channel) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); mojo_channels_.erase( std::find_if(mojo_channels_.begin(), mojo_channels_.end(), - [channel](std::unique_ptr<MojoChannel>& ptr) { + [channel](std::unique_ptr<MojoChannelBase>& ptr) { return ptr.get() == channel; })); } diff --git a/chromium/components/arc/arc_bridge_host_impl.h b/chromium/components/arc/arc_bridge_host_impl.h index 2738a94f7f3..07ca1b8d308 100644 --- a/chromium/components/arc/arc_bridge_host_impl.h +++ b/chromium/components/arc/arc_bridge_host_impl.h @@ -18,6 +18,7 @@ namespace arc { class ArcBridgeService; +class MojoChannelBase; // Implementation of the ArcBridgeHost. // The lifetime of ArcBridgeHost and ArcBridgeInstance mojo channels are tied @@ -30,9 +31,6 @@ class ArcBridgeService; // Note that ArcBridgeService must be alive while ArcBridgeHostImpl is alive. class ArcBridgeHostImpl : public mojom::ArcBridgeHost { public: - // Interface to keep the Mojo channel InterfacePtr. - class MojoChannel; - ArcBridgeHostImpl(ArcBridgeService* arc_bridge_service, mojom::ArcBridgeInstancePtr instance); ~ArcBridgeHostImpl() override; @@ -62,6 +60,8 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost { void OnFileSystemInstanceReady( mojom::FileSystemInstancePtr file_system_ptr) override; void OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) override; + void OnInputMethodManagerInstanceReady( + mojom::InputMethodManagerInstancePtr input_method_manager_ptr) override; void OnIntentHelperInstanceReady( mojom::IntentHelperInstancePtr intent_helper_ptr) override; void OnKioskInstanceReady(mojom::KioskInstancePtr kiosk_ptr) override; @@ -114,7 +114,7 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost { mojo::InterfacePtr<InstanceType> ptr); // Called if one of the established channels is closed. - void OnChannelClosed(MojoChannel* channel); + void OnChannelClosed(MojoChannelBase* channel); THREAD_CHECKER(thread_checker_); @@ -126,7 +126,7 @@ class ArcBridgeHostImpl : public mojom::ArcBridgeHost { // Put as a last member to ensure that any callback tied to the elements // is not invoked. - std::vector<std::unique_ptr<MojoChannel>> mojo_channels_; + std::vector<std::unique_ptr<MojoChannelBase>> mojo_channels_; DISALLOW_COPY_AND_ASSIGN(ArcBridgeHostImpl); }; diff --git a/chromium/components/arc/arc_bridge_service.h b/chromium/components/arc/arc_bridge_service.h index d7cd39501db..43bd651aaa1 100644 --- a/chromium/components/arc/arc_bridge_service.h +++ b/chromium/components/arc/arc_bridge_service.h @@ -40,6 +40,8 @@ class FileSystemHost; class FileSystemInstance; class ImeHost; class ImeInstance; +class InputMethodManagerHost; +class InputMethodManagerInstance; class IntentHelperHost; class IntentHelperInstance; class KioskHost; @@ -51,8 +53,6 @@ class MidisHost; class MidisInstance; class NetHost; class NetInstance; -class NotificationsHost; -class NotificationsInstance; class ObbMounterHost; class ObbMounterInstance; class OemCryptoHost; @@ -146,6 +146,11 @@ class ArcBridgeService { return &file_system_; } ConnectionHolder<mojom::ImeInstance, mojom::ImeHost>* ime() { return &ime_; } + ConnectionHolder<mojom::InputMethodManagerInstance, + mojom::InputMethodManagerHost>* + input_method_manager() { + return &input_method_manager_; + } ConnectionHolder<mojom::IntentHelperInstance, mojom::IntentHelperHost>* intent_helper() { return &intent_helper_; @@ -163,10 +168,6 @@ class ArcBridgeService { return &midis_; } ConnectionHolder<mojom::NetInstance, mojom::NetHost>* net() { return &net_; } - ConnectionHolder<mojom::NotificationsInstance, mojom::NotificationsHost>* - notifications() { - return ¬ifications_; - } ConnectionHolder<mojom::ObbMounterInstance, mojom::ObbMounterHost>* obb_mounter() { return &obb_mounter_; @@ -250,6 +251,9 @@ class ArcBridgeService { ConnectionHolder<mojom::FileSystemInstance, mojom::FileSystemHost> file_system_; ConnectionHolder<mojom::ImeInstance, mojom::ImeHost> ime_; + ConnectionHolder<mojom::InputMethodManagerInstance, + mojom::InputMethodManagerHost> + input_method_manager_; ConnectionHolder<mojom::IntentHelperInstance, mojom::IntentHelperHost> intent_helper_; ConnectionHolder<mojom::KioskInstance, mojom::KioskHost> kiosk_; @@ -257,8 +261,6 @@ class ArcBridgeService { ConnectionHolder<mojom::MetricsInstance, mojom::MetricsHost> metrics_; ConnectionHolder<mojom::MidisInstance, mojom::MidisHost> midis_; ConnectionHolder<mojom::NetInstance, mojom::NetHost> net_; - ConnectionHolder<mojom::NotificationsInstance, mojom::NotificationsHost> - notifications_; ConnectionHolder<mojom::ObbMounterInstance, mojom::ObbMounterHost> obb_mounter_; ConnectionHolder<mojom::OemCryptoInstance, mojom::OemCryptoHost> oemcrypto_; diff --git a/chromium/components/arc/arc_data_remover_unittest.cc b/chromium/components/arc/arc_data_remover_unittest.cc index d2ea11ea977..39693b8040b 100644 --- a/chromium/components/arc/arc_data_remover_unittest.cc +++ b/chromium/components/arc/arc_data_remover_unittest.cc @@ -12,9 +12,9 @@ #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_session_manager_client.h" +#include "components/account_id/account_id.h" #include "components/arc/arc_prefs.h" #include "components/prefs/testing_pref_service.h" -#include "components/signin/core/account_id/account_id.h" #include "testing/gtest/include/gtest/gtest.h" namespace arc { diff --git a/chromium/components/arc/arc_features.cc b/chromium/components/arc/arc_features.cc index 355a78b04ec..b87808fd3c1 100644 --- a/chromium/components/arc/arc_features.cc +++ b/chromium/components/arc/arc_features.cc @@ -8,7 +8,7 @@ namespace arc { // Controls whether ARC is available for CHILD accounts. const base::Feature kAvailableForChildAccountFeature{ - "ArcAvailableForChildAccount", base::FEATURE_DISABLED_BY_DEFAULT}; + "ArcAvailableForChildAccount", base::FEATURE_ENABLED_BY_DEFAULT}; // Controls ACTION_BOOT_COMPLETED broadcast for third party applications on ARC. // When disabled, third party apps will not receive this broadcast. @@ -16,6 +16,19 @@ const base::Feature kBootCompletedBroadcastFeature { "ArcBootCompletedBroadcast", base::FEATURE_ENABLED_BY_DEFAULT }; +// Controls whether we should delete all ARC data before transitioning a user +// from regular to child account. +const base::Feature kCleanArcDataOnRegularToChildTransitionFeature{ + "ArcCleanDataOnRegularToChildTransition", base::FEATURE_ENABLED_BY_DEFAULT}; + +// Controls whether ARC handles child->regular account transition. +const base::Feature kEnableChildToRegularTransitionFeature{ + "ArcEnableChildToRegularTransition", base::FEATURE_ENABLED_BY_DEFAULT}; + +// Controls whether ARC handles regular->child account transition. +const base::Feature kEnableRegularToChildTransitionFeature{ + "ArcEnableRegularToChildTransition", base::FEATURE_ENABLED_BY_DEFAULT}; + // Controls experimental native bridge feature for ARC. const base::Feature kNativeBridgeExperimentFeature { "ArcNativeBridgeExperiment", base::FEATURE_ENABLED_BY_DEFAULT diff --git a/chromium/components/arc/arc_features.h b/chromium/components/arc/arc_features.h index 2489c6949ad..25fd5a603a7 100644 --- a/chromium/components/arc/arc_features.h +++ b/chromium/components/arc/arc_features.h @@ -14,6 +14,9 @@ namespace arc { // Please keep alphabetized. extern const base::Feature kAvailableForChildAccountFeature; extern const base::Feature kBootCompletedBroadcastFeature; +extern const base::Feature kCleanArcDataOnRegularToChildTransitionFeature; +extern const base::Feature kEnableChildToRegularTransitionFeature; +extern const base::Feature kEnableRegularToChildTransitionFeature; extern const base::Feature kNativeBridgeExperimentFeature; extern const base::Feature kUsbHostFeature; extern const base::Feature kVpnFeature; diff --git a/chromium/components/arc/arc_prefs.cc b/chromium/components/arc/arc_prefs.cc index d60f5d50f3d..7527b09f3b2 100644 --- a/chromium/components/arc/arc_prefs.cc +++ b/chromium/components/arc/arc_prefs.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/arc/arc_prefs.h" +#include "components/arc/arc_supervision_transition.h" #include <string> @@ -40,6 +41,9 @@ const char kArcInitialSettingsPending[] = "arc.initial.settings.pending"; // A preference that indicated whether Android reported it's compliance status // with provided policies. This is used only as a signal to start Android kiosk. const char kArcPolicyComplianceReported[] = "arc.policy_compliance_reported"; +// A preference that indicates that a supervision transition is necessary, in +// response to a CHILD_ACCOUNT transiting to a REGULAR_ACCOUNT or vice-versa. +const char kArcSupervisionTransition[] = "arc.supervision_transition"; // A preference that indicates that user accepted PlayStore terms. const char kArcTermsAccepted[] = "arc.terms.accepted"; // A preference that indicates that ToS was shown in OOBE flow. @@ -61,6 +65,9 @@ const char kArcSetNotificationsEnabledDeferred[] = "arc.set_notifications_enabled_deferred"; // A preference that indicates status of Android sign-in. const char kArcSignedIn[] = "arc.signedin"; +// A preference that indicates that ARC skipped the setup UI flows that +// contain a notice related to reporting of diagnostic information. +const char kArcSkippedReportingNotice[] = "arc.skipped.reporting.notice"; // A preference that indicates an ARC comaptible filesystem was chosen for // the user directory (i.e., the user finished required migration.) const char kArcCompatibleFilesystemChosen[] = @@ -99,6 +106,10 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { // This is used to decide whether migration from ecryptfs to ext4 is allowed. registry->RegisterIntegerPref(prefs::kEcryptfsMigrationStrategy, 0); + registry->RegisterIntegerPref( + kArcSupervisionTransition, + static_cast<int>(ArcSupervisionTransition::NO_TRANSITION)); + // Sorted in lexicographical order. registry->RegisterBooleanPref(kArcDataRemoveRequested, false); registry->RegisterBooleanPref(kArcEnabled, false); @@ -106,6 +117,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(kArcPaiStarted, false); registry->RegisterBooleanPref(kArcPolicyComplianceReported, false); registry->RegisterBooleanPref(kArcSignedIn, false); + registry->RegisterBooleanPref(kArcSkippedReportingNotice, false); registry->RegisterBooleanPref(kArcTermsAccepted, false); registry->RegisterBooleanPref(kArcTermsShownInOobe, false); registry->RegisterBooleanPref(kArcVoiceInteractionValuePropAccepted, false); diff --git a/chromium/components/arc/arc_prefs.h b/chromium/components/arc/arc_prefs.h index 99fd759c647..20adee6b35f 100644 --- a/chromium/components/arc/arc_prefs.h +++ b/chromium/components/arc/arc_prefs.h @@ -29,6 +29,8 @@ ARC_EXPORT extern const char kArcPushInstallAppsRequested[]; ARC_EXPORT extern const char kArcPushInstallAppsPending[]; ARC_EXPORT extern const char kArcSetNotificationsEnabledDeferred[]; ARC_EXPORT extern const char kArcSignedIn[]; +ARC_EXPORT extern const char kArcSkippedReportingNotice[]; +ARC_EXPORT extern const char kArcSupervisionTransition[]; ARC_EXPORT extern const char kArcCompatibleFilesystemChosen[]; ARC_EXPORT extern const char kArcVoiceInteractionValuePropAccepted[]; ARC_EXPORT extern const char kEcryptfsMigrationStrategy[]; diff --git a/chromium/components/arc/arc_service_manager.h b/chromium/components/arc/arc_service_manager.h index 1e84e21d97b..dc79627c7fc 100644 --- a/chromium/components/arc/arc_service_manager.h +++ b/chromium/components/arc/arc_service_manager.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "components/signin/core/account_id/account_id.h" +#include "components/account_id/account_id.h" namespace content { class BrowserContext; diff --git a/chromium/components/arc/arc_session_impl.cc b/chromium/components/arc/arc_session_impl.cc index a3d733afaad..e9b77cfd837 100644 --- a/chromium/components/arc/arc_session_impl.cc +++ b/chromium/components/arc/arc_session_impl.cc @@ -114,7 +114,7 @@ class ArcSessionDelegateImpl : public ArcSessionImpl::Delegate { // connected socket's file descriptor. This is designed to run on a // blocking thread. static mojo::ScopedMessagePipeHandle ConnectMojoInternal( - mojo::edk::ScopedPlatformHandle socket_fd, + mojo::edk::ScopedInternalPlatformHandle socket_fd, base::ScopedFD cancel_fd); // Called when Mojo connection is established or canceled. @@ -150,10 +150,10 @@ 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. - mojo::edk::PlatformHandle raw_handle(socket_fd.release()); + mojo::edk::InternalPlatformHandle raw_handle(socket_fd.release()); raw_handle.needs_connection = true; - mojo::edk::ScopedPlatformHandle mojo_socket_fd(raw_handle); + mojo::edk::ScopedInternalPlatformHandle mojo_socket_fd(raw_handle); base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::BindOnce(&ArcSessionDelegateImpl::ConnectMojoInternal, @@ -165,14 +165,14 @@ base::ScopedFD ArcSessionDelegateImpl::ConnectMojo( // static mojo::ScopedMessagePipeHandle ArcSessionDelegateImpl::ConnectMojoInternal( - mojo::edk::ScopedPlatformHandle socket_fd, + mojo::edk::ScopedInternalPlatformHandle socket_fd, base::ScopedFD cancel_fd) { if (!WaitForSocketReadable(socket_fd.get().handle, cancel_fd.get())) { VLOG(1) << "Mojo connection was cancelled."; return mojo::ScopedMessagePipeHandle(); } - mojo::edk::ScopedPlatformHandle scoped_fd; + mojo::edk::ScopedInternalPlatformHandle scoped_fd; if (!mojo::edk::ServerAcceptConnection(socket_fd, &scoped_fd, /* check_peer_user = */ false) || !scoped_fd.is_valid()) { @@ -192,7 +192,7 @@ mojo::ScopedMessagePipeHandle ArcSessionDelegateImpl::ConnectMojoInternal( mojo::edk::ConnectionParams(mojo::edk::TransportProtocol::kLegacy, channel_pair.PassServerHandle())); - std::vector<mojo::edk::ScopedPlatformHandle> handles; + std::vector<mojo::edk::ScopedInternalPlatformHandle> handles; handles.emplace_back(channel_pair.PassClientHandle()); // We need to send the length of the message as a single byte, so make sure it diff --git a/chromium/components/arc/arc_session_impl_unittest.cc b/chromium/components/arc/arc_session_impl_unittest.cc index 379eb47c007..15eb937bb34 100644 --- a/chromium/components/arc/arc_session_impl_unittest.cc +++ b/chromium/components/arc/arc_session_impl_unittest.cc @@ -18,9 +18,9 @@ #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_session_manager_client.h" +#include "components/account_id/account_id.h" #include "components/arc/arc_session_impl.h" #include "components/arc/test/fake_arc_bridge_host.h" -#include "components/signin/core/account_id/account_id.h" #include "components/user_manager/fake_user_manager.h" #include "components/user_manager/scoped_user_manager.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chromium/components/arc/arc_supervision_transition.cc b/chromium/components/arc/arc_supervision_transition.cc new file mode 100644 index 00000000000..d9b03ffdd8d --- /dev/null +++ b/chromium/components/arc/arc_supervision_transition.cc @@ -0,0 +1,27 @@ +// 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. + +#include "components/arc/arc_supervision_transition.h" +#include "base/logging.h" + +namespace arc { + +std::ostream& operator<<(std::ostream& os, + ArcSupervisionTransition supervision_transition) { + switch (supervision_transition) { + case ArcSupervisionTransition::NO_TRANSITION: + return os << "NO_TRANSITION"; + case ArcSupervisionTransition::CHILD_TO_REGULAR: + return os << "CHILD_TO_REGULAR"; + case ArcSupervisionTransition::REGULAR_TO_CHILD: + return os << "REGULAR_TO_CHILD"; + } + NOTREACHED() << "Unexpected value for ArcSupervisionTransition: " + << static_cast<int>(supervision_transition); + + return os << "ArcSupervisionTransition(" + << static_cast<int>(supervision_transition) << ")"; +} + +} // namespace arc diff --git a/chromium/components/arc/arc_supervision_transition.h b/chromium/components/arc/arc_supervision_transition.h new file mode 100644 index 00000000000..bc3fb9fcb0f --- /dev/null +++ b/chromium/components/arc/arc_supervision_transition.h @@ -0,0 +1,31 @@ +// 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. + +#ifndef COMPONENTS_ARC_ARC_SUPERVISION_TRANSITION_H_ +#define COMPONENTS_ARC_ARC_SUPERVISION_TRANSITION_H_ + +#include <ostream> + +namespace arc { + +// These values must be kept in sync with +// UpgradeArcInstanceRequest.SupervisionTransition in +// third_party/cros_system_api/dbus/arc.proto. +enum class ArcSupervisionTransition : int { + // No transition necessary. + NO_TRANSITION = 0, + // Child user is transitioning to a regular account, need to lift + // supervision. + CHILD_TO_REGULAR = 1, + // Regular user is transitioning to a child account, need to enable + // supervision. + REGULAR_TO_CHILD = 2, +}; + +std::ostream& operator<<(std::ostream& os, + ArcSupervisionTransition supervisionTransition); + +} // namespace arc + +#endif // COMPONENTS_ARC_ARC_SUPERVISION_TRANSITION_H_ diff --git a/chromium/components/arc/arc_util.cc b/chromium/components/arc/arc_util.cc index b1925365724..880db840e9b 100644 --- a/chromium/components/arc/arc_util.cc +++ b/chromium/components/arc/arc_util.cc @@ -176,8 +176,7 @@ bool IsArcAllowedForUser(const user_manager::User* user) { } bool IsArcOptInVerificationDisabled() { - const auto* command_line = base::CommandLine::ForCurrentProcess(); - return command_line->HasSwitch( + return base::CommandLine::ForCurrentProcess()->HasSwitch( chromeos::switches::kDisableArcOptInVerification); } @@ -202,4 +201,9 @@ void SetArcCpuRestriction(bool do_restrict) { state, base::BindOnce(SetArcCpuRestrictionCallback, state)); } +bool IsArcDataCleanupOnStartRequested() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kArcDataCleanupOnStart); +} + } // namespace arc diff --git a/chromium/components/arc/arc_util.h b/chromium/components/arc/arc_util.h index 5af1de11355..c706565aa15 100644 --- a/chromium/components/arc/arc_util.h +++ b/chromium/components/arc/arc_util.h @@ -97,6 +97,9 @@ bool IsArcOptInVerificationDisabled(); // |window| is nullptr, returns false. bool IsArcAppWindow(aura::Window* window); +// Returns true if data clean up is requested for each ARC start. +bool IsArcDataCleanupOnStartRequested(); + // Adjusts the amount of CPU the ARC instance is allowed to use. When // |do_restrict| is true, the limit is adjusted so ARC can only use tightly // restricted CPU resources. diff --git a/chromium/components/arc/arc_util_unittest.cc b/chromium/components/arc/arc_util_unittest.cc index f83a51d9fb8..3fc9482a4a2 100644 --- a/chromium/components/arc/arc_util_unittest.cc +++ b/chromium/components/arc/arc_util_unittest.cc @@ -13,7 +13,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/test/scoped_feature_list.h" -#include "components/signin/core/account_id/account_id.h" +#include "components/account_id/account_id.h" #include "components/user_manager/fake_user_manager.h" #include "components/user_manager/scoped_user_manager.h" #include "components/user_manager/user.h" @@ -198,7 +198,7 @@ TEST_F(ArcUtilTest, IsArcAllowedForUser) { {user_manager::USER_TYPE_PUBLIC_ACCOUNT, true}, {user_manager::USER_TYPE_SUPERVISED, false}, {user_manager::USER_TYPE_KIOSK_APP, false}, - {user_manager::USER_TYPE_CHILD, false}, + {user_manager::USER_TYPE_CHILD, true}, {user_manager::USER_TYPE_ARC_KIOSK_APP, true}, {user_manager::USER_TYPE_ACTIVE_DIRECTORY, true}, }; diff --git a/chromium/components/arc/bluetooth/bluetooth_struct_traits.cc b/chromium/components/arc/bluetooth/bluetooth_struct_traits.cc index f778315c2ff..dfb74234812 100644 --- a/chromium/components/arc/bluetooth/bluetooth_struct_traits.cc +++ b/chromium/components/arc/bluetooth/bluetooth_struct_traits.cc @@ -37,13 +37,31 @@ struct AdvertisementEntry { virtual void AddTo(device::BluetoothAdvertisement::Data* data) {} }; +struct ServiceUUID16Entry : public AdvertisementEntry { + std::vector<uint16_t> service_uuids_16; + + ~ServiceUUID16Entry() override {} + + void AddTo(device::BluetoothAdvertisement::Data* data) override { + auto string_uuids = data->service_uuids(); + if (string_uuids == nullptr) + string_uuids = std::make_unique<std::vector<std::string>>(); + for (const auto& uuid : service_uuids_16) { + string_uuids->emplace_back(base::StringPrintf("%04x", uuid)); + } + data->set_service_uuids(std::move(string_uuids)); + } +}; + struct ServiceUUIDEntry : public AdvertisementEntry { std::vector<device::BluetoothUUID> service_uuids; ~ServiceUUIDEntry() override {} void AddTo(device::BluetoothAdvertisement::Data* data) override { - auto string_uuids = std::make_unique<std::vector<std::string>>(); + auto string_uuids = data->service_uuids(); + if (string_uuids == nullptr) + string_uuids = std::make_unique<std::vector<std::string>>(); for (const auto& uuid : service_uuids) { string_uuids->emplace_back(uuid.value()); } @@ -167,6 +185,15 @@ struct UnionTraits<arc::mojom::BluetoothAdvertisingDataDataView, static bool Read(arc::mojom::BluetoothAdvertisingDataDataView data, std::unique_ptr<AdvertisementEntry>* output) { switch (data.tag()) { + case arc::mojom::BluetoothAdvertisingDataDataView::Tag:: + SERVICE_UUIDS_16: { + std::unique_ptr<ServiceUUID16Entry> service_uuids_16 = + std::make_unique<ServiceUUID16Entry>(); + if (!data.ReadServiceUuids16(&service_uuids_16->service_uuids_16)) + return false; + *output = std::move(service_uuids_16); + break; + } case arc::mojom::BluetoothAdvertisingDataDataView::Tag::SERVICE_UUIDS: { std::unique_ptr<ServiceUUIDEntry> service_uuids = std::make_unique<ServiceUUIDEntry>(); diff --git a/chromium/components/arc/bluetooth/bluetooth_struct_traits_unittest.cc b/chromium/components/arc/bluetooth/bluetooth_struct_traits_unittest.cc index 8532e5f4080..933461ca1ee 100644 --- a/chromium/components/arc/bluetooth/bluetooth_struct_traits_unittest.cc +++ b/chromium/components/arc/bluetooth/bluetooth_struct_traits_unittest.cc @@ -74,9 +74,14 @@ TEST(BluetoothStructTraitsTest, DeserializeBluetoothAdvertisement) { arc::mojom::BluetoothAdvertisement::New(); std::vector<arc::mojom::BluetoothAdvertisingDataPtr> adv_data; - // Create service UUIDs. + // Create 16bit service UUIDs. arc::mojom::BluetoothAdvertisingDataPtr data = arc::mojom::BluetoothAdvertisingData::New(); + data->set_service_uuids_16({kUuid16}); + adv_data.push_back(std::move(data)); + + // Create service UUIDs. + data = arc::mojom::BluetoothAdvertisingData::New(); std::vector<device::BluetoothUUID> service_uuids; service_uuids.push_back((device::BluetoothUUID(kUuidStr))); data->set_service_uuids(service_uuids); @@ -110,8 +115,9 @@ TEST(BluetoothStructTraitsTest, DeserializeBluetoothAdvertisement) { std::unique_ptr<device::BluetoothAdvertisement::UUIDList> converted_uuids = advertisement->service_uuids(); - EXPECT_EQ(converted_uuids->size(), 1U); - EXPECT_EQ(*converted_uuids->begin(), kUuidStr); + EXPECT_EQ(converted_uuids->size(), 2U); + EXPECT_EQ(converted_uuids->at(0), kUuid16Str); + EXPECT_EQ(converted_uuids->at(1), kUuidStr); std::unique_ptr<device::BluetoothAdvertisement::ServiceData> converted_service = advertisement->service_data(); diff --git a/chromium/components/arc/bluetooth/bluetooth_type_converters.cc b/chromium/components/arc/bluetooth/bluetooth_type_converters.cc index dd4c6137a22..9581d5138fc 100644 --- a/chromium/components/arc/bluetooth/bluetooth_type_converters.cc +++ b/chromium/components/arc/bluetooth/bluetooth_type_converters.cc @@ -77,44 +77,6 @@ std::string TypeConverter<std::string, arc::mojom::BluetoothAddress>::Convert( } // static -arc::mojom::BluetoothGattStatus -TypeConverter<arc::mojom::BluetoothGattStatus, - device::BluetoothGattService::GattErrorCode>:: - Convert(const device::BluetoothGattService::GattErrorCode& error_code) { - arc::mojom::BluetoothGattStatus ret; - - switch (error_code) { - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_INVALID_LENGTH: - ret = arc::mojom::BluetoothGattStatus::GATT_INVALID_ATTRIBUTE_LENGTH; - break; - - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PERMITTED: - ret = arc::mojom::BluetoothGattStatus::GATT_READ_NOT_PERMITTED; - break; - - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_AUTHORIZED: - ret = arc::mojom::BluetoothGattStatus::GATT_INSUFFICIENT_AUTHENTICATION; - break; - - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_SUPPORTED: - ret = arc::mojom::BluetoothGattStatus::GATT_REQUEST_NOT_SUPPORTED; - break; - - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_UNKNOWN: - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED: - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_IN_PROGRESS: - case device::BluetoothGattService::GattErrorCode::GATT_ERROR_NOT_PAIRED: - ret = arc::mojom::BluetoothGattStatus::GATT_FAILURE; - break; - - default: - ret = arc::mojom::BluetoothGattStatus::GATT_FAILURE; - break; - } - return ret; -} - -// static arc::mojom::BluetoothSdpAttributePtr TypeConverter<arc::mojom::BluetoothSdpAttributePtr, bluez::BluetoothServiceAttributeValueBlueZ>:: diff --git a/chromium/components/arc/bluetooth/bluetooth_type_converters.h b/chromium/components/arc/bluetooth/bluetooth_type_converters.h index 295e3c8ea95..67a43e7436e 100644 --- a/chromium/components/arc/bluetooth/bluetooth_type_converters.h +++ b/chromium/components/arc/bluetooth/bluetooth_type_converters.h @@ -41,13 +41,6 @@ struct TypeConverter<std::string, arc::mojom::BluetoothAddress> { }; template <> -struct TypeConverter<arc::mojom::BluetoothGattStatus, - device::BluetoothGattService::GattErrorCode> { - static arc::mojom::BluetoothGattStatus Convert( - const device::BluetoothGattService::GattErrorCode& error_code); -}; - -template <> struct TypeConverter<arc::mojom::BluetoothSdpAttributePtr, bluez::BluetoothServiceAttributeValueBlueZ> { static arc::mojom::BluetoothSdpAttributePtr Convert( diff --git a/chromium/components/arc/common/BUILD.gn b/chromium/components/arc/common/BUILD.gn index ce86afffc18..b8da88bd7a0 100644 --- a/chromium/components/arc/common/BUILD.gn +++ b/chromium/components/arc/common/BUILD.gn @@ -17,7 +17,6 @@ if (is_chromeos) { "audio.mojom", "auth.mojom", "backup_settings.mojom", - "bitmap.mojom", "bluetooth.mojom", "boot_phase_monitor.mojom", "cast_receiver.mojom", @@ -27,13 +26,13 @@ if (is_chromeos) { "enterprise_reporting.mojom", "file_system.mojom", "ime.mojom", + "input_method_manager.mojom", "intent_helper.mojom", "kiosk.mojom", "lock_screen.mojom", "metrics.mojom", "midis.mojom", "net.mojom", - "notifications.mojom", "obb_mounter.mojom", "oemcrypto.mojom", "oemcrypto_daemon.mojom", @@ -58,12 +57,23 @@ if (is_chromeos) { public_deps = [ ":media", + ":notifications", "//device/usb/public/mojom", - "//mojo/common:common_custom_types", "//mojo/public/mojom/base", "//ui/gfx/geometry/mojo", ] } + + mojom("notifications") { + sources = [ + "bitmap.mojom", + "notifications.mojom", + ] + + deps = [ + ":media", # for gfx.mojom + ] + } } # Media related mojo interfaces. There are used by @@ -81,7 +91,6 @@ mojom("media") { ] public_deps = [ - "//mojo/common:common_custom_types", "//ui/gfx/geometry/mojo", ] } diff --git a/chromium/components/arc/common/app.mojom b/chromium/components/arc/common/app.mojom index e4f00485f06..450e6879561 100644 --- a/chromium/components/arc/common/app.mojom +++ b/chromium/components/arc/common/app.mojom @@ -2,36 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Next MinVersion: 28 +// Next MinVersion: 32 module arc.mojom; import "components/arc/common/gfx.mojom"; import "components/arc/common/scale_factor.mojom"; -// Describes OrientationLock request. -// Note: ChromeOS currently assumes the internal panel is always landscape. -// All rotation angles mentioned here are measured clockwise. -// DEPRECATED: OrientationLock passed by Wayland instead. -[Extensible] -enum OrientationLockDeprecated { - NONE = 0, - // Rotated 90 or 270 deg. - PORTRAIT = 1, - // Rotated 0 or 180 deg. - LANDSCAPE = 2, - // Keep the current orientation. - CURRENT = 3, - // Rotated 90 deg. - PORTRAIT_PRIMARY = 4, - // Rotated 0 deg. - LANDSCAPE_PRIMARY = 5, - // Rotated 270 deg. - PORTRAIT_SECONDARY = 6, - // Rotated 180 deg. - LANDSCAPE_SECONDARY = 7, -}; - // Describes installation result. struct InstallationResult { string package_name; @@ -45,8 +22,6 @@ struct AppInfo { string activity; [MinVersion=2] bool sticky; // true if the app cannot be uninstalled [MinVersion=7] bool notifications_enabled; - // DEPRECATED: OrientationLock passed by Wayland instead. - [MinVersion=12] OrientationLockDeprecated orientation_lock_deprecated; }; // Describes ARC package. @@ -135,14 +110,26 @@ enum AppDiscoveryRequestState { PHONESKY_RESULT_INVALID_DATA = 16, }; +// Describes the type/category of an app data search result. +[Extensible] +enum AppDataResultType { + PERSON = 0, // Person search result. + NOTE_DOCUMENT = 1, // Note document search result. +}; + // Describes an app data search result. struct AppDataResult { // Intent uri to launch the result. - string launch_intent_uri; + string launch_intent_uri@0; // Label for the result. - string label; - // Icon information in png format. It could be null if not provided. - array<uint8>? icon_png_data; + string label@1; + // Text information for the result. + string text@3; + // Icon information in png format. It could be null if not provided. Decoded + // in the utility process. + array<uint8>? icon_png_data@2; + // Type of this app data search result. + [MinVersion=28] AppDataResultType type@4; }; // Describes the status of an app data search request, including completed @@ -169,6 +156,22 @@ enum AppDataRequestState { FAILED_TO_CALL_GLOBALQUERY = 8, }; +// Describes app shortcut that is published by Android's ShortcutManager. +struct AppShortcutItem { + // The ID of this shortcut. Unique within each publisher app and stable across + // devices. + string shortcut_id; + + // The short description of this shortcut. + string short_label; + + // The icon for this shortcut, decoded in the utility process. + array<uint8> icon_png; + + // The package name of the publisher app. + [MinVersion=31] string? package_name; +}; + // Next method ID: 18 interface AppHost { // Sends newly added ARC app to Chrome. This message is sent when ARC receives @@ -224,11 +227,6 @@ interface AppHost { // Notifies that task has been destroyed. [MinVersion=4] OnTaskDestroyed@5(int32 task_id); - // Notifies that task requested orientation lock. - // DEPRECATED: OrientationLock passed by Wayland instead. - [MinVersion=12] OnTaskOrientationLockRequestedDeprecated@12( - int32 task_id, OrientationLockDeprecated lock); - // Notifies that task has been activated. [MinVersion=4] OnTaskSetActive@6(int32 task_id); @@ -256,7 +254,7 @@ interface AppHost { }; // TODO(lhchavez): Migrate all request/response messages to Mojo. -// Next method ID: 23 +// Next method ID: 25 interface AppInstance { // DEPRECATED: Please use Init@21 instead. InitDeprecated@0(AppHost host_ptr); @@ -286,6 +284,11 @@ interface AppInstance { [MinVersion=23] LaunchApp@18(string package_name, string activity, int64 display_id); + // Sends a request to ARC for the Android launcher to launch the specified app + // shortcut. + [MinVersion=30] LaunchAppShortcutItem@24( + string package_name, string shortcut_id, int64 display_id); + [MinVersion=9] LaunchIntentDeprecated@12(string intent_uri, Rect? dimension_on_screen); @@ -340,13 +343,19 @@ interface AppInstance { // happens) is ignored, and uninstall option should appear in the UI. [MinVersion=2] UninstallPackage@5(string package_name); - // Starts a query for Play Store apps. - [MinVersion=20] GetRecentAndSuggestedAppsFromPlayStore@16( - string query, int32 max_results) => - (AppDiscoveryRequestState state@1, array<AppDiscoveryResult> results@0); + // Sends a request to ARC to get app shortcuts for app with |package_name|. If + // |package_name| is empty, it will query for all launchable activities. + [MinVersion=29] GetAppShortcutItems@23(string package_name) => + (array<AppShortcutItem> shortcut_items); // Starts a query for app data, which is querying icing indexable contents. [MinVersion=27] GetIcingGlobalQueryResults@22( string query, int32 max_results) => (AppDataRequestState state, array<AppDataResult> results); + + // Starts a query for Play Store apps. + [MinVersion=20] GetRecentAndSuggestedAppsFromPlayStore@16( + string query, int32 max_results) => + (AppDiscoveryRequestState state@1, + array<AppDiscoveryResult> results@0); }; diff --git a/chromium/components/arc/common/arc_bridge.mojom b/chromium/components/arc/common/arc_bridge.mojom index 778c73dc266..6966f3e53be 100644 --- a/chromium/components/arc/common/arc_bridge.mojom +++ b/chromium/components/arc/common/arc_bridge.mojom @@ -18,6 +18,7 @@ import "components/arc/common/crash_collector.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/kiosk.mojom"; import "components/arc/common/lock_screen.mojom"; @@ -45,9 +46,9 @@ import "components/arc/common/volume_mounter.mojom"; import "components/arc/common/wake_lock.mojom"; import "components/arc/common/wallpaper.mojom"; -// Next MinVersion: 38 +// Next MinVersion: 39 // Deprecated method IDs: 101, 105 -// Next method ID: 143 +// Next method ID: 144 interface ArcBridgeHost { // Keep the entries alphabetical. In order to do so without breaking // compatibility with the ARC instance, explicitly assign each interface a @@ -102,6 +103,10 @@ interface ArcBridgeHost { // Notifies Chrome that the ImeInstance interface is ready. [MinVersion=3] OnImeInstanceReady@110(ImeInstance instance_ptr); + // Notifies Chrome that the InputMethodManagerInstance interface is ready. + [MinVersion=38] OnInputMethodManagerInstanceReady@143( + InputMethodManagerInstance instance_ptr); + // Notifies Chrome that the IntentHelperInstance interface is ready. [MinVersion=4] OnIntentHelperInstanceReady@111( IntentHelperInstance instance_ptr); diff --git a/chromium/components/arc/common/auth.mojom b/chromium/components/arc/common/auth.mojom index e1975919ac2..5cf12bdbfec 100644 --- a/chromium/components/arc/common/auth.mojom +++ b/chromium/components/arc/common/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: 13 +// Next MinVersion: 14 module arc.mojom; @@ -99,6 +99,32 @@ enum AccountCheckStatus { // corresponding UMA callsite in Chrome arc::UpdateAuthAccountCheckStatus. }; +// These values describe the result of ARC attempting to change supervision +// state after an account type change. +[Extensible] +enum SupervisionChangeStatus { + // CloudDPC supervision was disabled successfully. + [MinVersion=13] CLOUD_DPC_DISABLED = 0, + + // CloudDPC supervision was already disabled. + [MinVersion=13] CLOUD_DPC_ALREADY_DISABLED = 1, + + // CloudDPC supervision was enabled successfully. + [MinVersion=13] CLOUD_DPC_ENABLED = 2, + + // CloudDPC supervision was already enabled. + [MinVersion=13] CLOUD_DPC_ALREADY_ENABLED = 3, + + // Invalid state returned from Chrome. + [MinVersion=13] INVALID_SUPERVISION_STATE = 4, + + // Failed to disable CloudDPC due to an unspecified error. + [MinVersion=13] CLOUD_DPC_DISABLING_FAILED = 5, + + // Failed to enable CloudDPC due to an unspecified error. + [MinVersion=13] CLOUD_DPC_ENABLING_FAILED = 6, +}; + // These values describe the type of the Chrome account to provision. [Extensible] enum ChromeAccountType { @@ -144,8 +170,8 @@ struct AccountInfo { [MinVersion=9] string? account_name@4; // The authorization code that can be used in Android to sign in when - // account_type is USER_ACCOUNT or ROBOT_ACCOUNT. If it is null in these - // cases, sign-in will be skipped. + // account_type is USER_ACCOUNT, ROBOT_ACCOUNT or CHILD_ACCOUNT. If it is + // null in these cases, sign-in will be skipped. string? auth_code@0; // If account_type is ACTIVE_DIRECTORY_ACCOUNT, this contains an enrollment @@ -160,7 +186,7 @@ struct AccountInfo { bool is_managed@2; }; -// Next Method ID: 11. +// Next Method ID: 12. interface AuthHost { // Notifies Chrome that the authorization flow is completed and provides // resulting |status|. If |initial_signin| is true then this indicates that @@ -185,6 +211,13 @@ interface AuthHost { // Reports result of account check. [MinVersion=9] ReportAccountCheckStatus@9(AccountCheckStatus status); + + // Reports to Chrome the result of changing the supervision state. + // Chrome informs ARC on every boot if a supervision transition is necessary + // or not (see https://crrev.com/c/1069031). ARC should report back only if + // a transition was necessary. + [MinVersion=13] ReportSupervisionChangeStatus@11( + SupervisionChangeStatus status); }; // Next Method ID: 3 @@ -204,4 +237,5 @@ interface AuthInstance { // of failure, other than SUCCESS. [MinVersion=5] OnAccountInfoReady@1( AccountInfo? account_info, [MinVersion=10] ArcSignInStatus status); + }; diff --git a/chromium/components/arc/common/bluetooth.mojom b/chromium/components/arc/common/bluetooth.mojom index c3e0ebf5e4f..548f35b268d 100644 --- a/chromium/components/arc/common/bluetooth.mojom +++ b/chromium/components/arc/common/bluetooth.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: 10 +// Next MinVersion: 11 module arc.mojom; @@ -278,8 +278,8 @@ struct BluetoothSdpAttribute { // change. This field is introduced between version 7 and 8, though // MinVersion is not annotated because of breaking change, too. // See details in the bug linked below. - // TODO(crbug.com/767313): Use mojo/common/values.mojom, when new libmojo - // (440057 or later) is rolled to ARC repository. + // TODO(crbug.com/767313): Use mojo/public/mojom/base/values.mojom, when new + // libmojo (440057 or later) is rolled to ARC repository. string? json_value@3; }; @@ -405,7 +405,7 @@ interface BluetoothHost { => (BluetoothGattStatus status); }; -// Next Method ID: 19 +// Next Method ID: 20 interface BluetoothInstance { // DEPRECATED: Please use Init@18 instead. InitDeprecated@0(BluetoothHost host_ptr); @@ -465,10 +465,11 @@ interface BluetoothInstance { array<uint8> value, [MinVersion=9] BluetoothGattDBAttributeType attribute_type) => (BluetoothGattStatus status); + [MinVersion=10] OnMTUReceived@19(BluetoothAddress remote_addr, uint16 mtu); // Bluetooth SDP function [MinVersion=5] OnGetSdpRecords@17(BluetoothStatus status, - BluetoothAddress remove_addr, + BluetoothAddress remote_addr, BluetoothUUID target_uuid, array<BluetoothSdpRecord> records); }; diff --git a/chromium/components/arc/common/ime.mojom b/chromium/components/arc/common/ime.mojom index 032f539bd6a..732a37bcbd4 100644 --- a/chromium/components/arc/common/ime.mojom +++ b/chromium/components/arc/common/ime.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: 9 +// Next MinVersion: 10 module arc.mojom; @@ -34,7 +34,7 @@ struct CompositionSegment { bool emphasized; }; -// Next method ID: 4 +// Next method ID: 6 interface ImeHost { // Notifies Chrome that the text input focus is changed. OnTextInputTypeChanged@0(TextInputType type); @@ -75,6 +75,12 @@ interface ImeHost { [MinVersion=8] bool is_screen_coordinates // Whether or not the |rect| // are in screen coordinates. ); + + // Requests Chrome to hide the virtual keyboard. + // Howver, hiding can be canceled if a text field gets focus. + // TODO(yhanada): We might be able to remove this method by adding an argument + // to OnTextInputTypeChanged(). + [MinVersion=9] RequestHideIme@5(); }; // Next method ID: 7 diff --git a/chromium/components/arc/common/input_method_manager.mojom b/chromium/components/arc/common/input_method_manager.mojom new file mode 100644 index 00000000000..e7ffdec2b25 --- /dev/null +++ b/chromium/components/arc/common/input_method_manager.mojom @@ -0,0 +1,50 @@ +// 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. + +module arc.mojom; + +// Represents the information of an Android IME. +struct ImeInfo { + // The unique ID for the Android IME. Corresponds to InputMethodInfo.getId(). + string ime_id; + // The user-displayed label for the IME. Corresponds to + // InputMethodInfo.loadLabel(). + string display_name; + // Whether the IME is enabled or not. It's equivalent to whether the IME is + // in ENABLED_INPUT_METHODS settings. + bool enabled; + // intent: URL to open the settings activity of the IME. + string settings_url; +}; + +// This interface is called by container when Android's InputMethodManager state +// is changed. +// In Android container, ArcInputMethodService IME is pre-installed to bridge +// Chrome OS's IME to Android apps. The bridge is defined in ime.mojom. +// +// Next method ID: 2 +interface InputMethodManagerHost { + // Notifies Chrome that active IME in Android is changed. + OnActiveImeChanged@0(string ime_id); + + // Notifies Chrome of information of installed IMEs in Android. + // The passed list doesn't contain information of our bridge IME, + // ArcInputMethodService. + OnImeInfoChanged@1(array<ImeInfo> ime_infos); +}; + +// This interface provides methods to control Android's InputMethodManager. +// +// Next method ID: 3 +interface InputMethodManagerInstance { + // Establishes full-duplex communication with the host. + Init@0(InputMethodManagerHost host_ptr) => (); + + // Enables/Disables an IME in Android. Calling this method will add/remove + // the specified IME to/from ENABLED_INPUT_METHODS settings. + EnableIme@1(string ime_id, bool enable) => (bool success); + + // Switches active IME in Android. + SwitchImeTo@2(string ime_id) => (bool success); +}; diff --git a/chromium/components/arc/common/notifications.mojom b/chromium/components/arc/common/notifications.mojom index 12848868c07..ffcbcc5b67b 100644 --- a/chromium/components/arc/common/notifications.mojom +++ b/chromium/components/arc/common/notifications.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: 16 +// Next MinVersion: 17 module arc.mojom; @@ -34,14 +34,16 @@ enum ArcNotificationType { BUNDLED = 4, }; -// These values are corresponding to the priorities of Android notification. +// These values are corresponding to the priorities or importance of Android +// notification. [Extensible] enum ArcNotificationPriority { - MIN = -2, // same value as Notification.PRIORITY_MIN - LOW = -1, // same value as Notification.PRIORITY_LOW - DEFAULT = 0, // same value as Notification.PRIORITY_DEFAULT - HIGH = 1, // same value as Notification.PRIORITY_HIGH - MAX = 2, // same value as Notification.PRIORITY_MAX + NONE = -3, + MIN = -2, + LOW = -1, + DEFAULT = 0, + HIGH = 1, + MAX = 2, }; // DEPRECATED @@ -139,7 +141,7 @@ struct ArcNotificationData { string? package_name; }; -// Next Method ID: 6 +// Next Method ID: 7 interface NotificationsHost { // Tells the Chrome that a notification is posted (created or updated) on // Android. If you know that the notification exists, please consider to use @@ -154,6 +156,10 @@ interface NotificationsHost { [MinVersion=13] // Notifies that an existing notiication is updated on Android. OnNotificationUpdated@5(ArcNotificationData notification_data); + + [MinVersion=16] + // Opens the Chrome OS message center. + OpenMessageCenter@6(); }; // Next Method ID: 6 diff --git a/chromium/components/arc/common/policy.mojom b/chromium/components/arc/common/policy.mojom index 2c0f02589fe..f2a8804d84a 100644 --- a/chromium/components/arc/common/policy.mojom +++ b/chromium/components/arc/common/policy.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: 4 +// Next MinVersion: 5 module arc.mojom; @@ -50,6 +50,15 @@ enum InstallErrorReason { USER_INVALID = 10, }; +// Should be kept in sync with device_management_backend.proto/ +// RemoteCommandResult/ResultType. +[Extensible] +enum CommandResultType { + IGNORED = 0, // The command was ignored as obsolete. + FAILURE = 1, // The command could not be executed. + SUCCESS = 2, // The command was successfully executed. +}; + // Next Method ID: 2 interface PolicyHost { // Get policies from Chrome OS, as JSON-encoded dictionary with the policies' @@ -76,7 +85,7 @@ interface PolicyHost { InstallErrorReason reason); }; -// Next Method ID: 3 +// Next Method ID: 4 interface PolicyInstance { // DEPRECATED: Please use Init@2 instead. InitDeprecated@0(PolicyHost host_ptr); @@ -86,4 +95,11 @@ interface PolicyInstance { // Indicates some policies have changed OnPolicyUpdated@1(); + + // Forwards a command received from the management server. The payload is + // opaque to Chrome OS (it contains JSON from the RemoteCommand.payload field + // for the USER_ARC_COMMAND RemoteCommand - cf. + // device_management_backend.proto). + [MinVersion=4] OnCommandReceived@3(string command) + => (CommandResultType result); }; 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 e75aadaa3db..bb49c4d3c73 100644 --- a/chromium/components/arc/crash_collector/arc_crash_collector_bridge.cc +++ b/chromium/components/arc/crash_collector/arc_crash_collector_bridge.cc @@ -27,7 +27,7 @@ void RunCrashReporter(const std::string& crash_type, const std::string& device, const std::string& board, const std::string& cpu_abi, - mojo::edk::ScopedPlatformHandle pipe) { + mojo::edk::ScopedInternalPlatformHandle pipe) { base::LaunchOptions options; options.fds_to_remap.push_back( std::make_pair(pipe.get().handle, STDIN_FILENO)); @@ -91,8 +91,9 @@ ArcCrashCollectorBridge::~ArcCrashCollectorBridge() { void ArcCrashCollectorBridge::DumpCrash(const std::string& type, mojo::ScopedHandle pipe) { - mojo::edk::ScopedPlatformHandle pipe_handle; - mojo::edk::PassWrappedPlatformHandle(pipe.release().value(), &pipe_handle); + mojo::edk::ScopedInternalPlatformHandle pipe_handle; + mojo::edk::PassWrappedInternalPlatformHandle(pipe.release().value(), + &pipe_handle); base::PostTaskWithTraits( FROM_HERE, {base::WithBaseSyncPrimitives()}, diff --git a/chromium/components/arc/ime/arc_ime_bridge.h b/chromium/components/arc/ime/arc_ime_bridge.h index 09cfce68d8c..b982b8b0c04 100644 --- a/chromium/components/arc/ime/arc_ime_bridge.h +++ b/chromium/components/arc/ime/arc_ime_bridge.h @@ -40,6 +40,7 @@ class ArcImeBridge { const base::string16& text_in_range, const gfx::Range& selection_range, bool is_screen_coordinates) = 0; + virtual void RequestHideIme() = 0; }; // Serializes and sends IME related requests through IPCs. diff --git a/chromium/components/arc/ime/arc_ime_bridge_impl.cc b/chromium/components/arc/ime/arc_ime_bridge_impl.cc index 348b2da2675..47b41789f54 100644 --- a/chromium/components/arc/ime/arc_ime_bridge_impl.cc +++ b/chromium/components/arc/ime/arc_ime_bridge_impl.cc @@ -162,4 +162,8 @@ void ArcImeBridgeImpl::OnCursorRectChangedWithSurroundingText( is_screen_coordinates); } +void ArcImeBridgeImpl::RequestHideIme() { + delegate_->RequestHideIme(); +} + } // namespace arc diff --git a/chromium/components/arc/ime/arc_ime_bridge_impl.h b/chromium/components/arc/ime/arc_ime_bridge_impl.h index a71fdba2483..fdbffcab3d7 100644 --- a/chromium/components/arc/ime/arc_ime_bridge_impl.h +++ b/chromium/components/arc/ime/arc_ime_bridge_impl.h @@ -48,6 +48,7 @@ class ArcImeBridgeImpl : public ArcImeBridge, public mojom::ImeHost { const std::string& text_in_range, const gfx::Range& selection_range, bool screen_coordinates) override; + void RequestHideIme() override; private: Delegate* const delegate_; diff --git a/chromium/components/arc/ime/arc_ime_service.cc b/chromium/components/arc/ime/arc_ime_service.cc index e541650473c..d6155b3297e 100644 --- a/chromium/components/arc/ime/arc_ime_service.cc +++ b/chromium/components/arc/ime/arc_ime_service.cc @@ -322,6 +322,12 @@ void ArcImeService::OnCursorRectChangedWithSurroundingText( input_method->OnCaretBoundsChanged(this); } +void ArcImeService::RequestHideIme() { + auto* keyboard_controller = keyboard::KeyboardController::GetInstance(); + if (keyboard_controller) + keyboard_controller->MaybeHideKeyboard(); +} + //////////////////////////////////////////////////////////////////////////////// // Overridden from keyboard::KeyboardControllerObserver void ArcImeService::OnKeyboardAppearanceChanged( @@ -478,6 +484,13 @@ bool ArcImeService::HasCompositionText() const { return has_composition_text_; } +ui::TextInputClient::FocusReason ArcImeService::GetFocusReason() const { + // TODO(https://crbug.com/824604): Determine how the current input client got + // focused. + NOTIMPLEMENTED_LOG_ONCE(); + return ui::TextInputClient::FOCUS_REASON_OTHER; +} + bool ArcImeService::GetCompositionTextRange(gfx::Range* range) const { return false; } @@ -506,6 +519,12 @@ const std::string& ArcImeService::GetClientSourceInfo() const { return base::EmptyString(); } +bool ArcImeService::ShouldDoLearning() { + // TODO(https://crbug.com/311180): Implement this method. + NOTIMPLEMENTED_LOG_ONCE(); + return true; +} + // static void ArcImeService::SetOverrideDefaultDeviceScaleFactorForTesting( base::Optional<double> scale_factor) { diff --git a/chromium/components/arc/ime/arc_ime_service.h b/chromium/components/arc/ime/arc_ime_service.h index e74646a6b7f..a1beae6cdb7 100644 --- a/chromium/components/arc/ime/arc_ime_service.h +++ b/chromium/components/arc/ime/arc_ime_service.h @@ -96,6 +96,7 @@ class ArcImeService : public KeyedService, const base::string16& text_in_range, const gfx::Range& selection_range, bool is_screen_coordinates) override; + void RequestHideIme() override; // Overridden from keyboard::KeyboardControllerObserver. void OnKeyboardAppearanceChanged( @@ -124,6 +125,7 @@ class ArcImeService : public KeyedService, bool GetCompositionCharacterBounds(uint32_t index, gfx::Rect* rect) const override; bool HasCompositionText() const override; + FocusReason GetFocusReason() const override; bool GetCompositionTextRange(gfx::Range* range) const override; bool SetSelectionRange(const gfx::Range& range) override; bool DeleteRange(const gfx::Range& range) override; @@ -136,6 +138,7 @@ class ArcImeService : public KeyedService, void SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) override { } const std::string& GetClientSourceInfo() const override; + bool ShouldDoLearning() override; // Normally, the default device scale factor is used to convert from DPI to // physical pixels. This method provides a way to override it for testing. diff --git a/chromium/components/arc/midis/arc_midis_bridge.cc b/chromium/components/arc/midis/arc_midis_bridge.cc index 110586467df..5cc0ecfe9d6 100644 --- a/chromium/components/arc/midis/arc_midis_bridge.cc +++ b/chromium/components/arc/midis/arc_midis_bridge.cc @@ -86,7 +86,7 @@ void ArcMidisBridge::Connect(mojom::MidisServerRequest request, base::kNullProcessHandle, mojo::edk::ConnectionParams(mojo::edk::TransportProtocol::kLegacy, channel_pair.PassServerHandle())); - mojo::edk::ScopedPlatformHandle child_handle = + mojo::edk::ScopedInternalPlatformHandle child_handle = channel_pair.PassClientHandle(); base::ScopedFD fd(child_handle.release().handle); diff --git a/chromium/components/arc/mojo_channel.h b/chromium/components/arc/mojo_channel.h new file mode 100644 index 00000000000..400607dfd19 --- /dev/null +++ b/chromium/components/arc/mojo_channel.h @@ -0,0 +1,67 @@ +// 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. + +#ifndef COMPONENTS_ARC_MOJO_CHANNEL_H_ +#define COMPONENTS_ARC_MOJO_CHANNEL_H_ + +#include <utility> + +#include "base/bind.h" +#include "base/macros.h" +#include "components/arc/connection_holder.h" + +namespace arc { + +// Thin interface to wrap InterfacePtr<T> with type erasure. +class MojoChannelBase { + public: + virtual ~MojoChannelBase() = default; + + protected: + MojoChannelBase() = default; + + private: + DISALLOW_COPY_AND_ASSIGN(MojoChannelBase); +}; + +// Thin wrapper for InterfacePtr<T>, where T is one of ARC mojo Instance class. +template <typename InstanceType, typename HostType> +class MojoChannel : public MojoChannelBase { + public: + MojoChannel(ConnectionHolder<InstanceType, HostType>* holder, + mojo::InterfacePtr<InstanceType> ptr) + : holder_(holder), ptr_(std::move(ptr)) { + // Delay registration to the ConnectionHolder until the version is ready. + } + + ~MojoChannel() override { holder_->CloseInstance(ptr_.get()); } + + void set_connection_error_handler(base::OnceClosure error_handler) { + ptr_.set_connection_error_handler(std::move(error_handler)); + } + + void QueryVersion() { + // Note: the callback will not be called if |ptr_| is destroyed. + ptr_.QueryVersion( + base::Bind(&MojoChannel::OnVersionReady, base::Unretained(this))); + } + + private: + void OnVersionReady(uint32_t unused_version) { + holder_->SetInstance(ptr_.get(), ptr_.version()); + } + + // Externally owned ConnectionHolder instance. + ConnectionHolder<InstanceType, HostType>* const holder_; + + // Put as a last member to ensure that any callback tied to the |ptr_| + // is not invoked. + mojo::InterfacePtr<InstanceType> ptr_; + + DISALLOW_COPY_AND_ASSIGN(MojoChannel); +}; + +} // namespace arc + +#endif // COMPONENTS_ARC_MOJO_CHANNEL_H_ diff --git a/chromium/components/arc/power/DEPS b/chromium/components/arc/power/DEPS index 2a902196e7c..8d35727fbcb 100644 --- a/chromium/components/arc/power/DEPS +++ b/chromium/components/arc/power/DEPS @@ -1,7 +1,7 @@ include_rules = [ "+ash/shell.h", "+content/public/common/service_manager_connection.h", - "+ui/display/manager/chromeos", + "+ui/display/manager", "+services/device/public", "+services/service_manager/public", ] diff --git a/chromium/components/arc/power/arc_power_bridge.h b/chromium/components/arc/power/arc_power_bridge.h index bacd4acfbd0..5697d7c004b 100644 --- a/chromium/components/arc/power/arc_power_bridge.h +++ b/chromium/components/arc/power/arc_power_bridge.h @@ -15,7 +15,7 @@ #include "components/arc/connection_observer.h" #include "components/keyed_service/core/keyed_service.h" #include "services/device/public/mojom/wake_lock.mojom.h" -#include "ui/display/manager/chromeos/display_configurator.h" +#include "ui/display/manager/display_configurator.h" namespace content { class BrowserContext; diff --git a/chromium/components/arc/usb/usb_host_bridge.cc b/chromium/components/arc/usb/usb_host_bridge.cc index 111b9d8957c..b88ab1a9e30 100644 --- a/chromium/components/arc/usb/usb_host_bridge.cc +++ b/chromium/components/arc/usb/usb_host_bridge.cc @@ -51,10 +51,10 @@ void OnDeviceOpened(mojom::UsbHostHost::OpenDeviceCallback callback, std::move(callback).Run(mojo::ScopedHandle()); return; } - mojo::edk::ScopedPlatformHandle platform_handle{ - mojo::edk::PlatformHandle(fd.release())}; + mojo::edk::ScopedInternalPlatformHandle platform_handle{ + mojo::edk::InternalPlatformHandle(fd.release())}; MojoHandle wrapped_handle; - MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper( + MojoResult wrap_result = mojo::edk::CreateInternalPlatformHandleWrapper( std::move(platform_handle), &wrapped_handle); if (wrap_result != MOJO_RESULT_OK) { LOG(ERROR) << "Failed to wrap device FD. Closing: " << wrap_result; |