Commit 2265de70 authored by Jordy Greenblatt's avatar Jordy Greenblatt Committed by Commit Bot

[CrOS MultiDevice] Register suite pref and surface in setting

This CL implements the skeleton of the prefs controlling MultiDevice
features as laid out in khorimoto's mini design doc
https://docs.google.com/document/d/1XvTd1kuU7ZigOFwau39oDstg_-wjjjGD3Lf02Cc9Oek/edit#

Note that the MultiDeviceSetupService::RegisterProfilePrefs() call
in profile_impl.cc needs to be moved outside the flag progected if
block where it currently is because it will eventually include the
registration of some prefs that are not not controlled by the same
flags (e.g. Instant Tethering).

Note that I also deleted the old kSmsConnectEnabled pref to avoid
confusion. It was added according to a now deprecated design and is
not used anywhere so this will have no effect. It will soon be moved
to chromeos/services/multidevice_setup/public/cpp/prefs and, once
the SMS Connect Item is added to the MultiDevice Settings UI subpage,
added back in. However, in order to have the prefs in settings
reflect the state of the MultiDevice Settings UI, I don't want it
in Settings UI (especially not whitelisted from a misleading
file and namespace).


-------------

To test it I surfaced the pref in the settings pref singleton and
verified that it appears as expected. Here is a screenshot from the
settings page console on my dev PixelBook:

https://drive.google.com/open?id=0B1-cJJPK-cu6dS10ZGRId3U3Sm56a3JaZ04tbWdDTGt2aTE0

Bug: 824568
Change-Id: I3537e19b81e8c3db9bc7cc6f6fedf7780465ea22
Reviewed-on: https://chromium-review.googlesource.com/1149194
Commit-Queue: Jordy Greenblatt <jordynass@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578391}
parent 38ca7b11
......@@ -996,6 +996,7 @@ jumbo_static_library("extensions") {
"//ash/public/cpp",
"//chromeos/components/proximity_auth",
"//chromeos/components/proximity_auth/logging",
"//chromeos/services/multidevice_setup/public/cpp:prefs",
"//components/arc",
"//components/chrome_apps",
"//components/constrained_window",
......
......@@ -51,6 +51,7 @@
#include "chrome/browser/chromeos/system/timezone_util.h"
#include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_method_short.h"
#include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/arc/arc_prefs.h"
#include "ui/chromeos/events/pref_names.h"
......@@ -471,8 +472,9 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_NUMBER;
// Multidevice settings.
(*s_whitelist)[arc::prefs::kSmsConnectEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)
[chromeos::multidevice_setup::kMultiDeviceSuiteEnabledPrefName] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
// Native Printing settings.
(*s_whitelist)[::prefs::kUserNativePrintersAllowed] =
......
......@@ -268,6 +268,7 @@
#include "chromeos/audio/audio_devices_pref_handler_impl.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/network/proxy/proxy_config_handler.h"
#include "chromeos/services/multidevice_setup/multidevice_setup_service.h"
#include "chromeos/timezone/timezone_resolver.h"
#include "components/arc/arc_prefs.h"
#include "components/invalidation/impl/invalidator_storage.h"
......@@ -667,6 +668,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
chromeos::first_run::RegisterProfilePrefs(registry);
chromeos::file_system_provider::RegisterProfilePrefs(registry);
chromeos::KeyPermissions::RegisterProfilePrefs(registry);
chromeos::multidevice_setup::MultiDeviceSetupService::RegisterProfilePrefs(
registry);
chromeos::MultiProfileUserController::RegisterProfilePrefs(registry);
chromeos::quick_unlock::FingerprintStorage::RegisterProfilePrefs(registry);
chromeos::quick_unlock::PinStoragePrefs::RegisterProfilePrefs(registry);
......
......@@ -1184,14 +1184,13 @@ void ProfileImpl::RegisterInProcessServices(StaticServiceMap* services) {
if (base::FeatureList::IsEnabled(
chromeos::features::kEnableUnifiedMultiDeviceSetup) &&
base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) {
chromeos::multidevice_setup::MultiDeviceSetupService::RegisterProfilePrefs(
pref_registry_.get());
service_manager::EmbeddedServiceInfo info;
info.task_runner = base::ThreadTaskRunnerHandle::Get();
info.factory = base::BindRepeating(
&ProfileImpl::CreateMultiDeviceSetupService, base::Unretained(this));
services->emplace(chromeos::multidevice_setup::mojom::kServiceName, info);
}
#endif
#if !defined(OS_ANDROID)
......
......@@ -48,6 +48,7 @@ static_library("multidevice_setup") {
"//chromeos/services/device_sync/public/cpp",
"//chromeos/services/device_sync/public/mojom",
"//chromeos/services/multidevice_setup/proto",
"//chromeos/services/multidevice_setup/public/cpp:prefs",
"//chromeos/services/multidevice_setup/public/mojom",
"//chromeos/services/secure_channel/public/cpp/client",
"//chromeos/services/secure_channel/public/mojom",
......
......@@ -10,6 +10,7 @@
#include "chromeos/services/multidevice_setup/host_verifier_impl.h"
#include "chromeos/services/multidevice_setup/multidevice_setup_base.h"
#include "chromeos/services/multidevice_setup/multidevice_setup_initializer.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
namespace chromeos {
......@@ -21,6 +22,7 @@ void MultiDeviceSetupService::RegisterProfilePrefs(
AccountStatusChangeDelegateNotifierImpl::RegisterPrefs(registry);
HostBackendDelegateImpl::RegisterPrefs(registry);
HostVerifierImpl::RegisterPrefs(registry);
RegisterFeaturePrefs(registry);
}
MultiDeviceSetupService::MultiDeviceSetupService(
......
......@@ -20,6 +20,18 @@ source_set("cpp") {
]
}
source_set("prefs") {
sources = [
"prefs.cc",
"prefs.h",
]
deps = [
"//base",
"//components/prefs:prefs",
]
}
static_library("test_support") {
testonly = true
......
// 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 "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "components/prefs/pref_registry_simple.h"
namespace chromeos {
namespace multidevice_setup {
const char kMultiDeviceSuiteEnabledPrefName[] =
"multidevice_setup.enable_feature_suite";
void RegisterFeaturePrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(kMultiDeviceSuiteEnabledPrefName, false);
}
} // namespace multidevice_setup
} // namespace chromeos
// 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 CHROMEOS_SERVICES_MULTIDEVICE_SETUP_PUBLIC_CPP_PREFS_H_
#define CHROMEOS_SERVICES_MULTIDEVICE_SETUP_PUBLIC_CPP_PREFS_H_
class PrefRegistrySimple;
namespace chromeos {
namespace multidevice_setup {
// This pref is a gatekeeper for all MultiDevice features (e.g. Easy Unlock,
// Instant Tethering). Setting the pref to 'true' is necessary but not
// sufficient to enable the individual features, which are each controlled by
// their own pref and may involve additional setup steps.
extern const char kMultiDeviceSuiteEnabledPrefName[];
void RegisterFeaturePrefs(PrefRegistrySimple* registry);
} // namespace multidevice_setup
} // namespace chromeos
#endif // CHROMEOS_SERVICES_MULTIDEVICE_SETUP_PUBLIC_CPP_PREFS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment