Migrate iOS ApplicationContext to TaskScheduler.

(this doesn't use the TaskScheduler API directly because that's the
default behavior on JsonPrefStore now when not provided an explicit
SequencedTaskRunner at construction :))

R=rohitrao@chromium.org

Bug: 667892
Change-Id: Ifa0549e4ddf65ad8606451a47724234981c35467
Reviewed-on: https://chromium-review.googlesource.com/590573
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490766}
diff --git a/ios/web_view/internal/app/application_context.cc b/ios/web_view/internal/app/application_context.cc
index 9e0e539e..1de712d 100644
--- a/ios/web_view/internal/app/application_context.cc
+++ b/ios/web_view/internal/app/application_context.cc
@@ -28,10 +28,7 @@
   return base::Singleton<ApplicationContext>::get();
 }
 
-ApplicationContext::ApplicationContext()
-    : local_state_task_runner_(JsonPrefStore::GetTaskRunnerForFile(
-          GetLocalStatePath(),
-          web::WebThread::GetBlockingPool())) {
+ApplicationContext::ApplicationContext() {
   net_log_ = base::MakeUnique<net_log::ChromeNetLog>();
 
   SetApplicationLocale(l10n_util::GetLocaleOverride());
@@ -74,8 +71,15 @@
     PrefProxyConfigTrackerImpl::RegisterPrefs(pref_registry.get());
     ssl_config::SSLConfigServiceManager::RegisterPrefs(pref_registry.get());
 
-    scoped_refptr<PersistentPrefStore> user_pref_store = new JsonPrefStore(
-        GetLocalStatePath(), local_state_task_runner_, nullptr);
+    base::FilePath local_state_path;
+    PathService::Get(base::DIR_APP_DATA, &local_state_path);
+    local_state_path =
+        local_state_path.Append(FILE_PATH_LITERAL("ChromeWebView"));
+    local_state_path =
+        local_state_path.Append(FILE_PATH_LITERAL("Local State"));
+
+    scoped_refptr<PersistentPrefStore> user_pref_store =
+        new JsonPrefStore(std::move(local_state_path));
 
     PrefServiceFactory factory;
     factory.set_user_prefs(user_pref_store);
@@ -114,15 +118,6 @@
   return web_view_io_thread_.get();
 }
 
-base::FilePath ApplicationContext::GetLocalStatePath() {
-  base::FilePath local_state_path;
-  PathService::Get(base::DIR_APP_DATA, &local_state_path);
-  local_state_path =
-      local_state_path.Append(FILE_PATH_LITERAL("ChromeWebView"));
-  local_state_path = local_state_path.Append(FILE_PATH_LITERAL("Local State"));
-  return local_state_path;
-}
-
 void ApplicationContext::SetApplicationLocale(const std::string& locale) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   application_locale_ = locale;
diff --git a/ios/web_view/internal/app/application_context.h b/ios/web_view/internal/app/application_context.h
index 2ae5789..a496836 100644
--- a/ios/web_view/internal/app/application_context.h
+++ b/ios/web_view/internal/app/application_context.h
@@ -9,14 +9,11 @@
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/ref_counted.h"
 #include "base/sequence_checker.h"
 
 namespace base {
 template <typename T>
 struct DefaultSingletonTraits;
-class FilePath;
-class SequencedTaskRunner;
 }
 
 namespace net {
@@ -71,9 +68,6 @@
   // Gets the WebViewIOThread.
   WebViewIOThread* GetWebViewIOThread();
 
-  // Returns the path to the application level preferences.
-  static base::FilePath GetLocalStatePath();
-
   // Sets the locale used by the application.
   void SetApplicationLocale(const std::string& locale);
 
@@ -83,9 +77,6 @@
   std::unique_ptr<WebViewIOThread> web_view_io_thread_;
   std::string application_locale_;
 
-  // Sequenced task runner for local state related I/O tasks.
-  const scoped_refptr<base::SequencedTaskRunner> local_state_task_runner_;
-
   DISALLOW_COPY_AND_ASSIGN(ApplicationContext);
 };