As per battre@'s comment on https://codereview.chromium.org/2805833002/, the correct way to register prefs is to have our own KeyedService.
This is also needed for listening to prefs changes in order to enable/disable Tether when 'TetherAllowed' changes. will also expose if Tether is enabled/disabled to settings. Bumping up priority.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8d01f3ac9dad3f4833d868e253989ed88b705d1c commit 8d01f3ac9dad3f4833d868e253989ed88b705d1c Author: hansberry <hansberry@chromium.org> Date: Mon Apr 24 18:58:46 2017 Create TetherService, a TetherAllowed pref, and use DependencyManager for RegisterProfilePrefs calls. TetherService dynamically starts and stops Tether when prefs::kTetherAllowed changes value (from policy changing). This is expected from policy settings in Chrome. Please see: https://sites.google.com/a/chromium.org/dev/developers/how-tos/enterprise/adding-new-policies. This CL also tweaks EasyUnlockServiceFactory and ChromeCryptAuthServiceFactory to call RegisterProfilePrefs on their respective services. These calls are automagically handled by DependencyManager: it ensures that the RegisterProfilePrefs calls are made in the correct order and only once per context. A subsequent CL will come after this one that actually creates the enterprise policy for Tether, and maps to prefs::kTetherAllowed. BUG= 710174 Review-Url: https://codereview.chromium.org/2819713002 Cr-Commit-Position: refs/heads/master@{#466702} [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/BUILD.gn [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/login/session/user_session_manager.cc [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/BUILD.gn [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/DEPS [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/OWNERS [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/tether_service.cc [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/tether_service.h [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/tether_service_factory.cc [add] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/chromeos/tether/tether_service_factory.h [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/cryptauth/chrome_cryptauth_service_factory.cc [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/cryptauth/chrome_cryptauth_service_factory.h [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/prefs/browser_prefs.cc [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/signin/easy_unlock_service_factory.cc [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/browser/signin/easy_unlock_service_factory.h [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/common/pref_names.cc [modify] https://crrev.com/8d01f3ac9dad3f4833d868e253989ed88b705d1c/chrome/common/pref_names.h
Comment 1 by hansberry@chromium.org
, Apr 12 2017