[FeatureList] Load local state file into a pref_store, and use the pref store to init local state later. [1/3]

The reason to create local state in two steps is because we need to read some value from the
local state file first, and at that time it's too early to create the full local state object.

We read local state file by creating a simple pref_service from the pref_store, and when
local state is ready, reset all the objects that uses the simple pref_service to use the
full local state.

This is the first step to move feature list creation earlier on
content_main_runner. We need the simple pref service to create feature list.

This CL comes from https://crrev.com/c/1081759. See previous discussion there.

More info is available on design doc
https://docs.google.com/document/d/1czDvrWU5bE9okOiX-uMwJuZ09SzqxTEW3zHAJG11RVI/edit

Bug: 848615, 729596
Change-Id: I3e58768ab68e75d51b9a64155923565823e154e3
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Reviewed-on: https://chromium-review.googlesource.com/1148959
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Commit-Queue: Xi Han <[email protected]>
Cr-Commit-Position: refs/heads/master@{#586445}
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h
index 4d0e815..b31d95a4 100644
--- a/chrome/browser/chrome_browser_main.h
+++ b/chrome/browser/chrome_browser_main.h
@@ -21,6 +21,7 @@
 
 class BrowserProcessImpl;
 class ChromeBrowserMainExtraParts;
+class ChromeFeatureListCreator;
 class FieldTrialSynchronizer;
 class PrefService;
 class Profile;
@@ -55,8 +56,9 @@
 #endif
 
  protected:
-  explicit ChromeBrowserMainParts(const content::MainFunctionParams& parameters,
-                                  std::unique_ptr<ui::DataPack> data_pack);
+  ChromeBrowserMainParts(const content::MainFunctionParams& parameters,
+                         std::unique_ptr<ui::DataPack> data_pack,
+                         ChromeFeatureListCreator* chrome_feature_list_creator);
 
   // content::BrowserMainParts overrides.
   bool ShouldContentCreateFeatureList() override;
@@ -206,6 +208,8 @@
   // resource bundle gets created.
   std::unique_ptr<ui::DataPack> service_manifest_data_pack_;
 
+  ChromeFeatureListCreator* chrome_feature_list_creator_;
+
   DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts);
 };