Remove BrowserProcess dep in c/b/chromeos/settings

DeviceSettingsProvider in chrome/browser/chromeos/settings has an
undesirable dependency on g_browser_process, which it uses to access
the LocalState singleton. This CL removes the dependency on
g_browser_process by passing in LocalState explicitly.

Note that the tests and test helpers still depend on BrowserProcess
or TestingBrowserProcess, which they use to initialize and access the
LocalState. For tests in the settings package, I need to find a way to
remove this dependency in a follow up CL, so that the settings package
along with tests & test helpers can be moved out of chrome/browser.

See go/cros-untangle2

Bug: 446937
Change-Id: If9b14940f05ceef1fa8f33e612df22d3d9173d8f
Reviewed-on: https://chromium-review.googlesource.com/1233711
Reviewed-by: Jochen Eisinger <[email protected]>
Reviewed-by: Maksim Ivanov <[email protected]>
Reviewed-by: Steven Bennetts <[email protected]>
Commit-Queue: A Olsen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#593199}
diff --git a/chrome/browser/chromeos/settings/cros_settings.h b/chrome/browser/chromeos/settings/cros_settings.h
index a7b9ccc..ff37ea6 100644
--- a/chrome/browser/chromeos/settings/cros_settings.h
+++ b/chrome/browser/chromeos/settings/cros_settings.h
@@ -17,6 +17,8 @@
 #include "chromeos/settings/cros_settings_names.h"
 #include "chromeos/settings/cros_settings_provider.h"
 
+class PrefService;
+
 namespace base {
 class DictionaryValue;
 class ListValue;
@@ -31,7 +33,7 @@
 class CrosSettings {
  public:
   // Manage singleton instance.
-  static void Initialize();
+  static void Initialize(PrefService* local_state);
   static bool IsInitialized();
   static void Shutdown();
   static CrosSettings* Get();
@@ -44,7 +46,8 @@
 
   // Creates a device settings service instance. This is meant for unit tests,
   // production code uses the singleton returned by Get() above.
-  explicit CrosSettings(DeviceSettingsService* device_settings_service);
+  CrosSettings(DeviceSettingsService* device_settings_service,
+               PrefService* local_state);
   virtual ~CrosSettings();
 
   // Helper function to test if the given |path| is a valid cros setting.
@@ -149,7 +152,7 @@
 // construction and tears it down again on destruction.
 class ScopedTestCrosSettings {
  public:
-  ScopedTestCrosSettings();
+  explicit ScopedTestCrosSettings(PrefService* local_state);
   ~ScopedTestCrosSettings();
 
  private: