diff --git a/DEPS b/DEPS
index 53ba48a9..1afd7e7 100644
--- a/DEPS
+++ b/DEPS
@@ -167,11 +167,11 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': 'd26e865f413be435a6933140e4e854ac0414b94a',
+  'skia_revision': '61386966b2adc3adfa9f65ae7b1b47d15c34d67a',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
-  'v8_revision': 'b32cc6513131fb1a4327d7d8a15e533eb20e64b4',
+  'v8_revision': 'cf414fd415a50825b8bf7c9a08c10be30acee6f5',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling swarming_client
   # and whatever else without interference from each other.
@@ -179,7 +179,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling ANGLE
   # and whatever else without interference from each other.
-  'angle_revision': '68591effc086ae99611e5c5f7db46960f99a3bc6',
+  'angle_revision': '4a80ba25e67b56bd32b90f9665c35129ca705217',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling SwiftShader
   # and whatever else without interference from each other.
@@ -230,7 +230,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling catapult
   # and whatever else without interference from each other.
-  'catapult_revision': 'a5c8651cfccb3c3ee2849a92acbf2719011d59fc',
+  'catapult_revision': '03882834cb5581b9e36e1190d65187f0138a73f0',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
@@ -240,6 +240,10 @@
   # and whatever else without interference from each other.
   'devtools_node_modules_revision': '207c67362bdb7e135dc5735fb46b9c508d4e4c5e',
   # Three lines of non-changing comments so that
+  # the commit queue can handle CLs rolling devtools-frontend
+  # and whatever else without interference from each other.
+  'devtools_frontend_revision': '032591d6921120a1744e893e8712ee4bb84b8d62',
+  # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libprotobuf-mutator
   # and whatever else without interference from each other.
   'libprotobuf-mutator': '439e81f8f4847ec6e2bf11b3aa634a5d8485633d',
@@ -286,7 +290,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling feed
   # and whatever else without interference from each other.
-  'spv_tools_revision': '3cdd6444cf91a5d74007eb0685885f0512066c4d',
+  'spv_tools_revision': 'e8c3f9b0b463c24eab839c82332344ccaddfa19d',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling feed
   # and whatever else without interference from each other.
@@ -302,7 +306,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling feed
   # and whatever else without interference from each other.
-  'dawn_revision': '8d000e0cc230663dbeae86f59aaa16fc91b1eac1',
+  'dawn_revision': '3c79cf2ab9f26f69d172c1cf71d63b31d89d20d1',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling feed
   # and whatever else without interference from each other.
@@ -862,7 +866,7 @@
 
   # Build tools for Chrome OS. Note: This depends on third_party/pyelftools.
   'src/third_party/chromite': {
-      'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'ff30294118086d516a195c906fadf781f5d7d5f7',
+      'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '6efb3466e0f278bda4ad4ca73f26ba56f90f5ee8',
       'condition': 'checkout_linux',
   },
 
@@ -887,11 +891,14 @@
   },
 
   'src/third_party/depot_tools':
-    Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'acf922ce48cfd1ecf88582d9dbecf14e8d1fe369',
+    Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'a0aed87f71211aff48e3c06802d173cdf21328cf',
 
   'src/third_party/devtools-node-modules':
     Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'),
 
+  'src/third_party/devtools-frontend/src':
+    Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'),
+
   'src/third_party/dom_distiller_js/dist':
     Var('chromium_git') + '/chromium/dom-distiller/dist.git' + '@' + '3093c3e238768ab27ff756bd7563ccbb12129d9f',
 
@@ -1280,7 +1287,7 @@
   },
 
   'src/third_party/perfetto':
-    Var('android_git') + '/platform/external/perfetto.git' + '@' + '8fac64fcd1ec3895f089cdd30344a295d567cd72',
+    Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f0a4d95ef687abfcb242626fabb07a88ee83c2d6',
 
   'src/third_party/perl': {
       'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3',
@@ -1470,7 +1477,7 @@
     Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '2701c130839edbeb226735b0775966b6423d9e83',
 
   'src/third_party/webrtc':
-    Var('webrtc_git') + '/src.git' + '@' + '3663ed3ad67893746efd86267a936a7295031ab1',
+    Var('webrtc_git') + '/src.git' + '@' + '682dabd1c153f5ccbd4e0c1cf7d0bfd2da46436a',
 
   'src/third_party/xdg-utils': {
       'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
@@ -1532,7 +1539,7 @@
     Var('chromium_git') + '/v8/v8.git' + '@' +  Var('v8_revision'),
 
   'src-internal': {
-    'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3fc7fb0892055e587930b3b5369b9cb44d9b47b4',
+    'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@f11f58996811b2ad3c4ebe572282c29d0909770c',
     'condition': 'checkout_src_internal',
   },
 
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 13b2ae5..51b30c2 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -2423,7 +2423,7 @@
                  r"^remoting[\\/]base[\\/]logging\.h$",
                  r"^remoting[\\/]host[\\/].*",
                  r"^sandbox[\\/]linux[\\/].*",
-                 r"^storage[\\/]browser[\\/]fileapi[\\/]" +
+                 r"^storage[\\/]browser[\\/]file_system[\\/]" +
                      r"dump_file_system.cc$",
                  r"^tools[\\/]",
                  r"^ui[\\/]base[\\/]resource[\\/]data_pack.cc$",
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
index 47b83d7..da788f7 100644
--- a/android_webview/BUILD.gn
+++ b/android_webview/BUILD.gn
@@ -623,6 +623,7 @@
     "//components/content_capture/android:java",
     "//components/crash/android:handler_java",
     "//components/crash/android:java",
+    "//components/embedder_support/android:application_java",
     "//components/embedder_support/android:web_contents_delegate_java",
     "//components/minidump_uploader:minidump_uploader_java",
     "//components/navigation_interception/android:navigation_interception_java",
diff --git a/android_webview/glue/BUILD.gn b/android_webview/glue/BUILD.gn
index dde944083..ce36f0b 100644
--- a/android_webview/glue/BUILD.gn
+++ b/android_webview/glue/BUILD.gn
@@ -20,6 +20,7 @@
     "//base:jni_java",
     "//components/autofill/android:autofill_java",
     "//components/autofill/android:provider_java",
+    "//components/embedder_support/android:application_java",
     "//content/public/android:content_java",
     "//net/android:net_java",
     "//ui/android:ui_java",
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
index 91d9962..d16f8a1 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
@@ -60,7 +60,6 @@
 import org.chromium.android_webview.AwContentsStatics;
 import org.chromium.android_webview.AwPrintDocumentAdapter;
 import org.chromium.android_webview.AwSettings;
-import org.chromium.android_webview.ResourcesContextWrapperFactory;
 import org.chromium.android_webview.gfx.AwDrawFnImpl;
 import org.chromium.android_webview.renderer_priority.RendererPriority;
 import org.chromium.base.BuildInfo;
@@ -70,6 +69,7 @@
 import org.chromium.base.metrics.ScopedSysTraceEvent;
 import org.chromium.base.task.PostTask;
 import org.chromium.components.autofill.AutofillProvider;
+import org.chromium.components.embedder_support.application.ClassLoaderContextWrapperFactory;
 import org.chromium.content_public.browser.NavigationHistory;
 import org.chromium.content_public.browser.SmartClipProvider;
 import org.chromium.content_public.browser.UiThreadTaskTraits;
@@ -249,7 +249,7 @@
             mWebView = webView;
             mWebViewPrivate = webViewPrivate;
             mHitTestResult = new WebView.HitTestResult();
-            mContext = ResourcesContextWrapperFactory.get(mWebView.getContext());
+            mContext = ClassLoaderContextWrapperFactory.get(mWebView.getContext());
             mAppTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion;
             mFactory = factory;
             mShouldDisableThreadChecking = shouldDisableThreadChecking;
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
index 011a48c..5c14bd21 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -35,7 +35,6 @@
 import org.chromium.android_webview.AwBrowserProcess;
 import org.chromium.android_webview.AwSettings;
 import org.chromium.android_webview.AwSwitches;
-import org.chromium.android_webview.ResourcesContextWrapperFactory;
 import org.chromium.android_webview.WebViewChromiumRunQueue;
 import org.chromium.android_webview.common.CommandLineUtil;
 import org.chromium.base.BuildInfo;
@@ -53,6 +52,7 @@
 import org.chromium.base.metrics.CachedMetrics.TimesHistogramSample;
 import org.chromium.base.metrics.ScopedSysTraceEvent;
 import org.chromium.components.autofill.AutofillProvider;
+import org.chromium.components.embedder_support.application.ClassLoaderContextWrapperFactory;
 import org.chromium.content_public.browser.LGEmailActionModeWorkaround;
 
 import java.io.File;
@@ -264,7 +264,7 @@
             }
 
             // WebView needs to make sure to always use the wrapped application context.
-            ContextUtils.initApplicationContext(ResourcesContextWrapperFactory.get(ctx));
+            ContextUtils.initApplicationContext(ClassLoaderContextWrapperFactory.get(ctx));
 
             // Find the package ID for the package that WebView's resources come from.
             // This will be the donor package if there is one, not our main package.
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 1715ef9e..10be1de8 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -1623,9 +1623,11 @@
 
     public void findAllAsync(String searchString) {
         if (TRACE) Log.i(TAG, "%s findAllAsync", this);
-        if (!isDestroyed(WARN)) {
-            AwContentsJni.get().findAllAsync(mNativeAwContents, AwContents.this, searchString);
+        if (isDestroyed(WARN)) return;
+        if (searchString == null) {
+            throw new IllegalArgumentException("Search string shouldn't be null");
         }
+        AwContentsJni.get().findAllAsync(mNativeAwContents, AwContents.this, searchString);
     }
 
     public void findNext(boolean forward) {
diff --git a/android_webview/java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java b/android_webview/java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java
index 3a242f8e..dfa9b5a9 100644
--- a/android_webview/java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java
+++ b/android_webview/java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java
@@ -4,121 +4,18 @@
 
 package org.chromium.android_webview;
 
-import android.content.ComponentCallbacks;
 import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.Intent;
-import android.view.LayoutInflater;
 
-import org.chromium.base.ContextUtils;
-
-import java.lang.ref.WeakReference;
-import java.util.WeakHashMap;
+import org.chromium.components.embedder_support.application.ClassLoaderContextWrapperFactory;
 
 /**
- * This class allows us to wrap the application context so that the WebView implementation can
- * correctly reference both org.chromium.* and application classes which is necessary to properly
- * inflate UI.
+ * This class was migrated to embedder_support; this forwarding wrapper exists to avoid breaking
+ * downstream code until it's updated.
  */
 public class ResourcesContextWrapperFactory {
     private ResourcesContextWrapperFactory() {}
 
-    // Note WeakHashMap only guarantees that keys are weakly held, and ContextWrapper holds a strong
-    // reference to the wrapped context. So need a WeakReference here to ensure the Context does not
-    // leak.
-    private static final WeakHashMap<Context, WeakReference<WebViewContextWrapper>> sCtxToWrapper =
-            new WeakHashMap<>();
-    private static final Object sLock = new Object();
-
     public static Context get(Context ctx) {
-        // Avoid double-wrapping a context.
-        if (ctx instanceof WebViewContextWrapper) {
-            return ctx;
-        }
-        WebViewContextWrapper wrapper = null;
-        synchronized (sLock) {
-            WeakReference<WebViewContextWrapper> ref = sCtxToWrapper.get(ctx);
-            wrapper = (ref == null) ? null : ref.get();
-            if (wrapper == null) {
-                wrapper = new WebViewContextWrapper(ctx);
-                sCtxToWrapper.put(ctx, new WeakReference<>(wrapper));
-            }
-        }
-        return wrapper;
-    }
-
-    private static class WebViewContextWrapper extends ContextWrapper {
-        private Context mApplicationContext;
-
-        public WebViewContextWrapper(Context base) {
-            super(base);
-        }
-
-        @Override
-        public ClassLoader getClassLoader() {
-            final ClassLoader appCl = getBaseContext().getClassLoader();
-            final ClassLoader webViewCl = this.getClass().getClassLoader();
-            return new ClassLoader() {
-                @Override
-                protected Class<?> findClass(String name) throws ClassNotFoundException {
-                    // First look in the WebViewProvider class loader.
-                    try {
-                        return webViewCl.loadClass(name);
-                    } catch (ClassNotFoundException e) {
-                        // Look in the app class loader; allowing it to throw
-                        // ClassNotFoundException.
-                        return appCl.loadClass(name);
-                    }
-                }
-            };
-        }
-
-        @Override
-        public Object getSystemService(String name) {
-            if (Context.LAYOUT_INFLATER_SERVICE.equals(name)) {
-                LayoutInflater i = (LayoutInflater) getBaseContext().getSystemService(name);
-                return i.cloneInContext(this);
-            } else {
-                return getBaseContext().getSystemService(name);
-            }
-        }
-
-        @Override
-        @SuppressWarnings("NoContextGetApplicationContext")
-        public Context getApplicationContext() {
-            if (mApplicationContext == null) {
-                Context appCtx = getBaseContext().getApplicationContext();
-                if (appCtx == getBaseContext()) {
-                    mApplicationContext = this;
-                } else {
-                    mApplicationContext = get(appCtx);
-                }
-            }
-            return mApplicationContext;
-        }
-
-        @Override
-        public void registerComponentCallbacks(ComponentCallbacks callback) {
-            // We have to override registerComponentCallbacks and unregisterComponentCallbacks
-            // since they call getApplicationContext().[un]registerComponentCallbacks()
-            // which causes us to go into a loop.
-            getBaseContext().registerComponentCallbacks(callback);
-        }
-
-        @Override
-        public void unregisterComponentCallbacks(ComponentCallbacks callback) {
-            getBaseContext().unregisterComponentCallbacks(callback);
-        }
-
-        @Override
-        public void startActivity(Intent intent) {
-            if (ContextUtils.activityFromContext(this) == null) {
-                // FLAG_ACTIVITY_NEW_TASK is needed to start activities from a non-activity
-                // context.
-                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            }
-
-            super.startActivity(intent);
-        }
+        return ClassLoaderContextWrapperFactory.get(ctx);
     }
 }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
index ea7c052c..7443b95 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
@@ -1007,4 +1007,19 @@
                 RecordHistogram.getHistogramValueCountForTesting(
                         AwContents.LOAD_URL_SCHEME_HISTOGRAM_NAME, expectedSchemeEnum));
     }
+
+    @Test
+    @Feature({"AndroidWebView"})
+    @SmallTest
+    public void testFindAllAsyncEmptySearchString() {
+        AwTestContainerView testView =
+                mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
+        final AwContents awContents = testView.getAwContents();
+        try {
+            awContents.findAllAsync(null);
+            Assert.fail("A null searchString should cause an exception to be thrown");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
 }
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
index 7da4489..b19f57c 100644
--- a/ash/shelf/shelf_view_unittest.cc
+++ b/ash/shelf/shelf_view_unittest.cc
@@ -64,6 +64,7 @@
 #include "base/test/scoped_feature_list.h"
 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
 #include "base/time/time.h"
+#include "chromeos/constants/chromeos_features.h"
 #include "chromeos/constants/chromeos_switches.h"
 #include "components/prefs/pref_service.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -711,6 +712,26 @@
   DISALLOW_COPY_AND_ASSIGN(ShelfViewTest);
 };
 
+// TODO(https://crbug.com/1009638): remove this class and all its descendants
+// when scrollable shelf is launched.
+class ShelfViewTestNotScrollable : public ShelfViewTest {
+ public:
+  ShelfViewTestNotScrollable() = default;
+  ~ShelfViewTestNotScrollable() override = default;
+
+  void SetUp() override {
+    scoped_feature_list_.InitWithFeatures({},
+                                          {chromeos::features::kShelfScrollable,
+                                           chromeos::features::kShelfHotseat});
+    ShelfViewTest::SetUp();
+  }
+
+ private:
+  base::test::ScopedFeatureList scoped_feature_list_;
+
+  DISALLOW_COPY_AND_ASSIGN(ShelfViewTestNotScrollable);
+};
+
 const char*
     ShelfViewTest::kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName =
         ShelfButtonPressedMetricTracker::
@@ -766,12 +787,7 @@
 
 // Adds platform app button until overflow and verifies that the last added
 // platform app button is hidden.
-TEST_F(ShelfViewTest, AddBrowserUntilOverflow) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, AddBrowserUntilOverflow) {
   // All buttons should be visible.
   ASSERT_EQ(test_api_->GetButtonCount(), shelf_view_->last_visible_index() + 1);
 
@@ -791,12 +807,7 @@
   EXPECT_FALSE(GetButtonByID(last_added)->GetVisible());
 }
 
-TEST_F(ShelfViewTest, OverflowVisibleIndex) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, OverflowVisibleIndex) {
   AddAppShortcutsUntilOverflow();
   ASSERT_TRUE(shelf_view_->GetOverflowButton()->GetVisible());
   const int last_visible_index = shelf_view_->last_visible_index();
@@ -824,12 +835,8 @@
 // Adds one platform app button then adds app shortcut until overflow. Verifies
 // that the browser button gets hidden on overflow and last added app shortcut
 // is still visible.
-TEST_F(ShelfViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable,
+       AddAppShortcutWithBrowserButtonUntilOverflow) {
   // All buttons should be visible.
   ASSERT_EQ(test_api_->GetButtonCount(), shelf_view_->last_visible_index() + 1);
 
@@ -853,12 +860,7 @@
 
 // Making sure that no buttons on the shelf will ever overlap after adding many
 // of them.
-TEST_F(ShelfViewTest, AssertNoButtonsOverlap) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, AssertNoButtonsOverlap) {
   std::vector<ShelfID> button_ids;
   // Add app icons until the overflow button is visible.
   while (!shelf_view_->GetOverflowButton()->GetVisible()) {
@@ -912,12 +914,7 @@
 // Adds button until overflow then removes first added one. Verifies that
 // the last added one changes from invisible to visible and overflow
 // chevron is gone.
-TEST_F(ShelfViewTest, RemoveButtonRevealsOverflowed) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, RemoveButtonRevealsOverflowed) {
   // All buttons should be visible.
   ASSERT_EQ(test_api_->GetButtonCount(), shelf_view_->last_visible_index() + 1);
 
@@ -946,12 +943,7 @@
 }
 
 // Verifies that remove last overflowed button should hide overflow chevron.
-TEST_F(ShelfViewTest, RemoveLastOverflowed) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, RemoveLastOverflowed) {
   // All buttons should be visible.
   ASSERT_EQ(test_api_->GetButtonCount(), shelf_view_->last_visible_index() + 1);
 
@@ -970,12 +962,7 @@
 
 // Tests the visiblity of certain shelf items when the overflow bubble is open
 // and entering or exiting tablet mode.
-TEST_F(ShelfViewTest, OverflowVisibleItemsInTabletMode) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, OverflowVisibleItemsInTabletMode) {
   // Helper to check whether the item with index |index| is visible on the shelf
   // associated with |shelf_test_api|.
   auto is_visible_on_shelf = [](int index, ShelfViewTestAPI* shelf_test_api) {
@@ -1019,12 +1006,7 @@
 
 // Adds platform app button without waiting for animation to finish and verifies
 // that all added buttons are visible.
-TEST_F(ShelfViewTest, AddButtonQuickly) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, AddButtonQuickly) {
   // All buttons should be visible.
   ASSERT_EQ(test_api_->GetButtonCount(), shelf_view_->last_visible_index() + 1);
 
@@ -1399,12 +1381,7 @@
   EXPECT_EQ(nullptr, tooltip_manager->GetCurrentAnchorView());
 }
 
-TEST_F(ShelfViewTest, ButtonTitlesTest) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, ButtonTitlesTest) {
   AddAppShortcutsUntilOverflow();
   EXPECT_EQ(base::UTF8ToUTF16("Launcher"),
             shelf_view_->shelf_widget()->GetHomeButton()->GetAccessibleName());
@@ -1601,12 +1578,7 @@
 // Resizing shelf view while an add animation without fade-in is running,
 // which happens when overflow happens. Home button should end up in its
 // new ideal bounds.
-TEST_F(ShelfViewTest, ResizeDuringOverflowAddAnimation) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, ResizeDuringOverflowAddAnimation) {
   // All buttons should be visible.
   ASSERT_EQ(test_api_->GetButtonCount(), shelf_view_->last_visible_index() + 1);
 
@@ -1640,12 +1612,7 @@
 }
 
 // Checks the overflow bubble size when an item is ripped off and re-inserted.
-TEST_F(ShelfViewTest, OverflowBubbleSize) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, OverflowBubbleSize) {
   AddAppShortcutsUntilOverflow();
   // Add one more button to prevent the overflow bubble to disappear upon
   // dragging an item out on windows (flakiness, see crbug.com/436131).
@@ -1698,12 +1665,8 @@
             overflow_shelf_view->GetPreferredSize().width());
 }
 
-TEST_F(ShelfViewTest, DISABLED_OverflowShelfColorIsDerivedFromWallpaper) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable,
+       DISABLED_OverflowShelfColorIsDerivedFromWallpaper) {
   WallpaperControllerTestApi wallpaper_test_api(
       Shell::Get()->wallpaper_controller());
   const SkColor opaque_expected_color =
@@ -1717,12 +1680,8 @@
 }
 
 // Check the drag insertion bounds of scrolled overflow bubble.
-TEST_F(ShelfViewTest, CheckDragInsertBoundsOfScrolledOverflowBubble) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable,
+       CheckDragInsertBoundsOfScrolledOverflowBubble) {
   UpdateDisplay("400x300");
 
   AddAppShortcutsUntilOverflow();
@@ -1796,12 +1755,7 @@
 }
 
 // Check the drag insertion bounds of shelf view in multi monitor environment.
-TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, CheckDragInsertBoundsWithMultiMonitor) {
   UpdateDisplay("800x600,800x600");
   Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]);
   ShelfView* shelf_view_for_secondary =
@@ -1905,12 +1859,7 @@
 
 // Checks various drag and drop operations from OverflowBubble to Shelf, and
 // vice versa.
-TEST_F(ShelfViewTest, CheckDragAndDropFromShelfToOtherShelf) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, CheckDragAndDropFromShelfToOtherShelf) {
   AddAppShortcutsUntilOverflow();
   // Add one more button to prevent the overflow bubble to disappear upon
   // dragging an item out on windows (flakiness, see crbug.com/425097).
@@ -1928,12 +1877,7 @@
 }
 
 // Checks taking a screenshot while dragging an app into the overflow menu.
-TEST_F(ShelfViewTest, TestDragToOverflowAndTakeScreenshot) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, TestDragToOverflowAndTakeScreenshot) {
   // We'll need UI controls to trigger the accelerator for taking a screenshot.
   ui_controls::InstallUIControlsAura(test::CreateAshUIControls());
 
@@ -1998,12 +1942,7 @@
 }
 
 // Checks drag-reorder items within the overflow shelf.
-TEST_F(ShelfViewTest, TestDragWithinOverflow) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, TestDragWithinOverflow) {
   // Prepare the overflow and open it.
   AddAppShortcutsUntilOverflow();
   // Add a couple more to make sure we have things to drag.
@@ -2051,12 +1990,7 @@
 
 // Checks how the overflow button and menu get laid out when the display is
 // very narrow.
-TEST_F(ShelfViewTest, TestOverflowWithNarrowDisplay) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, TestOverflowWithNarrowDisplay) {
   UpdateDisplay("200x600");
 
   AddAppShortcutsUntilOverflow();
@@ -2072,12 +2006,7 @@
 
 // Checks creating app shortcut for an opened platform app in overflow bubble
 // should be invisible to the shelf. See crbug.com/605793.
-TEST_F(ShelfViewTest, CheckOverflowStatusPinOpenedAppToShelf) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, CheckOverflowStatusPinOpenedAppToShelf) {
   AddAppShortcutsUntilOverflow();
 
   // Add a running Platform app.
@@ -2143,12 +2072,7 @@
       kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1);
 }
 
-TEST_F(ShelfViewTest, TestHideOverflow) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, TestHideOverflow) {
   // Use an event generator instead of SimulateClick because the overflow bubble
   // uses a Shell pre-target EventHandler to observe input events.
   ui::test::EventGenerator* generator = GetEventGenerator();
@@ -2224,12 +2148,7 @@
   EXPECT_TRUE(shelf_view_->IsShowingOverflowBubble());
 }
 
-TEST_F(ShelfViewTest, UnpinningCancelsOverflow) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, UnpinningCancelsOverflow) {
   // Add just enough items for overflow; one fewer would not require overflow.
   const ShelfID first_shelf_id = AddAppShortcut();
   AddAppShortcutsUntilOverflow();
@@ -2358,12 +2277,7 @@
 }
 
 // Tests that the overflow button does not show a context menu.
-TEST_F(ShelfViewTest, NoContextMenuOnOverflowButton) {
-  // No overflow bubble when scrollable shelf enabled.
-  // TODO(https://crbug.com/1002576): revisit when scrollable shelf is launched.
-  if (chromeos::switches::ShouldShowScrollableShelf())
-    return;
-
+TEST_F(ShelfViewTestNotScrollable, NoContextMenuOnOverflowButton) {
   ui::test::EventGenerator* generator = GetEventGenerator();
   AddAppShortcutsUntilOverflow();
   views::View* overflow_button = shelf_view_->GetOverflowButton();
@@ -2650,19 +2564,13 @@
   EXPECT_FALSE(shelf_view_->IsShowingMenu());
 }
 
-class OverflowBubbleViewTest : public ShelfViewTest {
+class OverflowBubbleViewTest : public ShelfViewTestNotScrollable {
  public:
   OverflowBubbleViewTest() = default;
   ~OverflowBubbleViewTest() override = default;
 
   void SetUp() override {
-    ShelfViewTest::SetUp();
-
-    // No overflow bubble when scrollable shelf enabled.
-    // TODO(https://crbug.com/1002576): revisit when scrollable shelf is
-    // launched.
-    if (chromeos::switches::ShouldShowScrollableShelf())
-      GTEST_SKIP();
+    ShelfViewTestNotScrollable::SetUp();
 
     UpdateDisplay("300x600");
     AddAppShortcutsUntilOverflow();
@@ -3613,19 +3521,13 @@
 }
 
 // Test fixture for testing material design ink drop on overflow button.
-class OverflowButtonInkDropTest : public ShelfViewInkDropTest {
+class OverflowButtonInkDropTest : public ShelfViewTestNotScrollable {
  public:
   OverflowButtonInkDropTest() = default;
   ~OverflowButtonInkDropTest() override = default;
 
   void SetUp() override {
-    ShelfViewInkDropTest::SetUp();
-
-    // No overflow bubble when scrollable shelf enabled.
-    // TODO(https://crbug.com/1002576): revisit when scrollable shelf is
-    // launched.
-    if (chromeos::switches::ShouldShowScrollableShelf())
-      GTEST_SKIP();
+    ShelfViewTestNotScrollable::SetUp();
 
     overflow_button_ = shelf_view_->GetOverflowButton();
 
@@ -3870,16 +3772,6 @@
   OverflowButtonTextDirectionTest() : scoped_locale_(GetParam() ? "he" : "") {}
   ~OverflowButtonTextDirectionTest() override = default;
 
-  void SetUp() override {
-    OverflowButtonInkDropTest::SetUp();
-
-    // No overflow bubble when scrollable shelf enabled.
-    // TODO(https://crbug.com/1002576): revisit when scrollable shelf is
-    // launched.
-    if (chromeos::switches::ShouldShowScrollableShelf())
-      GTEST_SKIP();
-  }
-
  private:
   // Restores locale to the default when destructor is called.
   base::test::ScopedRestoreICUDefaultLocale scoped_locale_;
@@ -3902,12 +3794,6 @@
   void SetUp() override {
     OverflowButtonInkDropTest::SetUp();
 
-    // No overflow bubble when scrollable shelf enabled.
-    // TODO(https://crbug.com/1002576): revisit when scrollable shelf is
-    // launched.
-    if (chromeos::switches::ShouldShowScrollableShelf())
-      GTEST_SKIP();
-
     test_api_->ShowOverflowBubble();
     ASSERT_TRUE(shelf_view_->IsShowingOverflowBubble());
     EXPECT_EQ(views::InkDropState::ACTIVATED,
@@ -4241,6 +4127,7 @@
   ExpectNotFocused(shelf_view_);
 }
 
+// TODO(https://crbug.com/1009638): remove when scrollable shelf is launched.
 class ShelfViewOverflowFocusTest : public ShelfViewFocusTest {
  public:
   ShelfViewOverflowFocusTest() = default;
@@ -4248,14 +4135,11 @@
 
   // AshTestBase:
   void SetUp() override {
+    scoped_feature_list_.InitWithFeatures({},
+                                          {chromeos::features::kShelfScrollable,
+                                           chromeos::features::kShelfHotseat});
     ShelfViewFocusTest::SetUp();
 
-    // No overflow bubble when scrollable shelf enabled.
-    // TODO(https://crbug.com/1002576): revisit when scrollable shelf is
-    // launched.
-    if (chromeos::switches::ShouldShowScrollableShelf())
-      GTEST_SKIP();
-
     // Add app shortcuts until the overflow button is visible. At this point
     // there will be two items on the overflow shelf.
     AddAppShortcutsUntilOverflow();
@@ -4284,6 +4168,8 @@
   std::unique_ptr<ShelfViewTestAPI> overflow_shelf_test_api_;
 
  private:
+  base::test::ScopedFeatureList scoped_feature_list_;
+
   DISALLOW_COPY_AND_ASSIGN(ShelfViewOverflowFocusTest);
 };
 
diff --git a/ash/wm/overview/overview_grid.cc b/ash/wm/overview/overview_grid.cc
index a36a45e..085c0f0 100644
--- a/ash/wm/overview/overview_grid.cc
+++ b/ash/wm/overview/overview_grid.cc
@@ -36,7 +36,6 @@
 #include "ash/wm/overview/overview_item.h"
 #include "ash/wm/overview/overview_session.h"
 #include "ash/wm/overview/overview_utils.h"
-#include "ash/wm/overview/overview_window_drag_controller.h"
 #include "ash/wm/overview/scoped_overview_animation_settings.h"
 #include "ash/wm/resize_shadow_controller.h"
 #include "ash/wm/splitview/split_view_constants.h"
@@ -305,6 +304,36 @@
   return bounds;
 }
 
+// Get the grid bounds if a window is snapped in splitview, or what they will be
+// when snapped based on |indicator_state|.
+gfx::Rect GetGridBoundsInScreenForSplitview(
+    aura::Window* window,
+    base::Optional<IndicatorState> indicator_state = base::nullopt) {
+  SplitViewController* split_view_controller = SplitViewController::Get(window);
+  auto state = split_view_controller->state();
+
+  // If we are in splitview mode already just use the given state, otherwise
+  // convert |indicator_state| to a splitview state.
+  if (!split_view_controller->InSplitViewMode() && indicator_state) {
+    if (*indicator_state == IndicatorState::kPreviewAreaLeft)
+      state = SplitViewController::State::kLeftSnapped;
+    else if (*indicator_state == IndicatorState::kPreviewAreaRight)
+      state = SplitViewController::State::kRightSnapped;
+  }
+
+  switch (state) {
+    case SplitViewController::State::kLeftSnapped:
+      return split_view_controller->GetSnappedWindowBoundsInScreen(
+          SplitViewController::RIGHT);
+    case SplitViewController::State::kRightSnapped:
+      return split_view_controller->GetSnappedWindowBoundsInScreen(
+          SplitViewController::LEFT);
+    default:
+      return screen_util::
+          GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(window);
+  }
+}
+
 gfx::Insets GetGridInsets(const gfx::Rect& grid_bounds) {
   const int horizontal_inset =
       gfx::ToFlooredInt(std::min(kOverviewInsetRatio * grid_bounds.width(),
@@ -782,7 +811,6 @@
                                        bool animate) {
   DCHECK_EQ(dragged_window->GetRootWindow(), root_window_);
   DCHECK(!drop_target_widget_);
-  dragged_window_ = dragged_window;
   drop_target_widget_ = CreateDropTargetWidget(dragged_window, animate);
   overview_session_->AddItem(drop_target_widget_->GetNativeWindow(),
                              /*reposition=*/true, animate);
@@ -797,7 +825,6 @@
 void OverviewGrid::OnWindowDragContinued(aura::Window* dragged_window,
                                          const gfx::PointF& location_in_screen,
                                          IndicatorState indicator_state) {
-  DCHECK_EQ(dragged_window_, dragged_window);
   DCHECK_EQ(dragged_window->GetRootWindow(), root_window_);
 
   RearrangeDuringDrag(dragged_window, indicator_state);
@@ -842,10 +869,8 @@
                                      const gfx::PointF& location_in_screen,
                                      bool should_drop_window_into_overview,
                                      bool snap) {
-  DCHECK_EQ(dragged_window_, dragged_window);
   DCHECK_EQ(dragged_window->GetRootWindow(), root_window_);
   DCHECK(drop_target_widget_.get());
-  dragged_window_ = nullptr;
 
   // Add the dragged window into drop target in overview if
   // |should_drop_window_into_overview| is true. Only consider add the dragged
@@ -1486,8 +1511,7 @@
   items_scrolling_bounds_.clear();
   presentation_time_recorder_.reset();
 
-  if (!overview_session_->is_shutting_down())
-    PositionWindows(/*animate=*/false);
+  PositionWindows(/*animate=*/false);
 }
 
 void OverviewGrid::MaybeInitDesksWidget() {
@@ -1660,9 +1684,13 @@
       continue;
     }
 
-    // Calculate the width and y position of the item.
+    // Maintains the aspect ratio from the original window. The window's
+    // original height will be shrunk to fit into |height|, minus the margin and
+    // overview header.
+    const float ratio = float{height - kHeaderHeightDp - kOverviewMargin} /
+                        item->GetWindow()->bounds().height();
     const int width =
-        CalculateWidthAndMaybeSetUnclippedBounds(window_list_[i].get(), height);
+        item->GetWindow()->bounds().width() * ratio + kOverviewMargin;
     const int y =
         height * (window_position % kTabletLayoutRow) + total_bounds.y();
 
@@ -1707,14 +1735,30 @@
 
   // All elements are of same height and only the height is necessary to
   // determine each item's scale.
+  const gfx::Size item_size(0, height);
   for (size_t i = 0u; i < window_count; ++i) {
     if (window_list_[i]->animating_to_close() ||
         ignored_items.contains(window_list_[i].get())) {
       continue;
     }
 
-    int width =
-        CalculateWidthAndMaybeSetUnclippedBounds(window_list_[i].get(), height);
+    const gfx::RectF target_bounds = window_list_[i]->GetTargetBoundsInScreen();
+    int width = std::max(
+        1, gfx::ToFlooredInt(target_bounds.width() *
+                             window_list_[i]->GetItemScale(item_size)) +
+               2 * kWindowMargin);
+    switch (window_list_[i]->GetWindowDimensionsType()) {
+      case ScopedOverviewTransformWindow::GridWindowFillMode::kLetterBoxed:
+        width = ScopedOverviewTransformWindow::kExtremeWindowRatioThreshold *
+                height;
+        break;
+      case ScopedOverviewTransformWindow::GridWindowFillMode::kPillarBoxed:
+        width = height /
+                ScopedOverviewTransformWindow::kExtremeWindowRatioThreshold;
+        break;
+      default:
+        break;
+    }
 
     if (left + width > bounds.right()) {
       // Move to the next row if possible.
@@ -1734,10 +1778,10 @@
     }
 
     // Position the current rect.
-    (*out_rects)[i] = gfx::RectF(left, top, width, height);
+    (*out_rects)[i] = gfx::RectF(gfx::Rect(left, top, width, height));
 
-    // Increment horizontal position using sanitized positive |width|.
-    left += width;
+    // Increment horizontal position using sanitized positive |width()|.
+    left += gfx::ToRoundedInt((*out_rects)[i].width());
 
     *out_max_bottom = top + height;
   }
@@ -1798,82 +1842,4 @@
                              /*animate=*/false);
 }
 
-int OverviewGrid::CalculateWidthAndMaybeSetUnclippedBounds(OverviewItem* item,
-                                                           int height) {
-  const gfx::Size item_size(0, height);
-  gfx::RectF target_bounds = item->GetTargetBoundsInScreen();
-  float scale = item->GetItemScale(item_size);
-
-  // The drop target, unlike the other windows has its bounds set directly, so
-  // |GetTargetBoundsInScreen()| won't return the value we want. Instead, get
-  // the scale from the window it was meant to be a placeholder for.
-  if (IsDropTargetWindow(item->GetWindow())) {
-    aura::Window* dragged_window = nullptr;
-    OverviewItem* item =
-        overview_session_->window_drag_controller()
-            ? overview_session_->window_drag_controller()->item()
-            : nullptr;
-    if (item)
-      dragged_window = item->GetWindow();
-    else if (dragged_window_)
-      dragged_window = dragged_window_;
-
-    if (dragged_window && dragged_window->parent()) {
-      target_bounds = ::ash::GetTargetBoundsInScreen(dragged_window);
-      const gfx::SizeF inset_size(0, height - 2 * kWindowMargin);
-      scale = ScopedOverviewTransformWindow::GetItemScale(
-          target_bounds.size(), inset_size,
-          dragged_window->GetProperty(aura::client::kTopViewInset),
-          kHeaderHeightDp);
-    }
-  }
-
-  int width = std::max(
-      1, gfx::ToFlooredInt(target_bounds.width() * scale) + 2 * kWindowMargin);
-  switch (item->GetWindowDimensionsType()) {
-    case ScopedOverviewTransformWindow::GridWindowFillMode::kLetterBoxed:
-      width =
-          ScopedOverviewTransformWindow::kExtremeWindowRatioThreshold * height;
-      break;
-    case ScopedOverviewTransformWindow::GridWindowFillMode::kPillarBoxed:
-      width =
-          height / ScopedOverviewTransformWindow::kExtremeWindowRatioThreshold;
-      break;
-    default:
-      break;
-  }
-
-  // Get the bounds of the window if there is a snapped window or a window
-  // about to be snapped.
-  base::Optional<gfx::RectF> split_view_bounds =
-      GetSplitviewBoundsMaintainingAspectRatio(item->GetWindow());
-  if (!split_view_bounds) {
-    item->set_unclipped_size(base::nullopt);
-    return width;
-  }
-
-  const bool is_landscape = IsCurrentScreenOrientationLandscape();
-  gfx::Size unclipped_size;
-  if (is_landscape) {
-    unclipped_size.set_width(width - 2 * kWindowMargin);
-    unclipped_size.set_height(height - 2 * kWindowMargin);
-    // For landscape mode, shrink |width| so that the aspect ratio matches
-    // that of |split_view_bounds|.
-    width = std::max(1, gfx::ToFlooredInt(split_view_bounds->width() * scale) +
-                            2 * kWindowMargin);
-  } else {
-    // For portrait mode, we want |height| to stay the same, so calculate
-    // what the unclipped height would be based on |split_view_bounds|.
-    width = split_view_bounds->width() * height / split_view_bounds->height();
-    int unclipped_height =
-        (target_bounds.height() * width) / target_bounds.width();
-    unclipped_size.set_width(width);
-    unclipped_size.set_height(unclipped_height);
-  }
-
-  DCHECK(!unclipped_size.IsEmpty());
-  item->set_unclipped_size(base::make_optional(unclipped_size));
-  return width;
-}
-
 }  // namespace ash
diff --git a/ash/wm/overview/overview_grid.h b/ash/wm/overview/overview_grid.h
index ef7456a..e1092445 100644
--- a/ash/wm/overview/overview_grid.h
+++ b/ash/wm/overview/overview_grid.h
@@ -396,12 +396,6 @@
   // the window's bounds if it has been resized.
   void AddDraggedWindowIntoOverviewOnDragEnd(aura::Window* dragged_window);
 
-  // Calculate the width of an item based on |height|. The width tries to keep
-  // the same aspect ratio as the original window, but may be modified if the
-  // bounds of the window are considered extreme, or if the window is in
-  // splitview or entering splitview.
-  int CalculateWidthAndMaybeSetUnclippedBounds(OverviewItem* item, int height);
-
   // Root window the grid is in.
   aura::Window* root_window_;
 
@@ -471,10 +465,6 @@
   // Records the presentation time of scrolling the grid in overview mode.
   std::unique_ptr<PresentationTimeRecorder> presentation_time_recorder_;
 
-  // Weak pointer to the window that is being dragged from the top, if there is
-  // one.
-  aura::Window* dragged_window_ = nullptr;
-
   DISALLOW_COPY_AND_ASSIGN(OverviewGrid);
 };
 
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc
index 5772780..906b280 100644
--- a/ash/wm/overview/overview_item.cc
+++ b/ash/wm/overview/overview_item.cc
@@ -1173,15 +1173,9 @@
   screen_rect.set_size(screen_size);
 
   const int top_view_inset = transform_window_.GetTopInset();
-  gfx::RectF transformed_bounds = target_bounds;
-  // Update |transformed_bounds| to match the unclipped size of the window, so
-  // we transform the window to the correct size.
-  if (unclipped_size_)
-    transformed_bounds.set_size(gfx::SizeF(*unclipped_size_));
-
   gfx::RectF overview_item_bounds =
       transform_window_.ShrinkRectToFitPreservingAspectRatio(
-          screen_rect, transformed_bounds, top_view_inset, kHeaderHeightDp);
+          screen_rect, target_bounds, top_view_inset, kHeaderHeightDp);
 
   const gfx::Transform transform =
       gfx::TransformBetweenRects(screen_rect, overview_item_bounds);
@@ -1192,24 +1186,17 @@
     return;
   }
 
-  {
-    ScopedOverviewTransformWindow::ScopedAnimationSettings animation_settings;
-    transform_window_.BeginScopedAnimation(animation_type, &animation_settings);
-    if (animation_type ==
-            OVERVIEW_ANIMATION_LAYOUT_OVERVIEW_ITEMS_IN_OVERVIEW &&
-        !animation_settings.empty()) {
-      animation_settings.front()->AddObserver(new AnimationObserver{
-          base::BindOnce(&OverviewItem::OnItemBoundsAnimationStarted,
-                         weak_ptr_factory_.GetWeakPtr()),
-          base::BindOnce(&OverviewItem::OnItemBoundsAnimationEnded,
-                         weak_ptr_factory_.GetWeakPtr())});
-    }
-    SetTransform(window, transform);
+  ScopedOverviewTransformWindow::ScopedAnimationSettings animation_settings;
+  transform_window_.BeginScopedAnimation(animation_type, &animation_settings);
+  if (animation_type == OVERVIEW_ANIMATION_LAYOUT_OVERVIEW_ITEMS_IN_OVERVIEW &&
+      !animation_settings.empty()) {
+    animation_settings.front()->AddObserver(new AnimationObserver{
+        base::BindOnce(&OverviewItem::OnItemBoundsAnimationStarted,
+                       weak_ptr_factory_.GetWeakPtr()),
+        base::BindOnce(&OverviewItem::OnItemBoundsAnimationEnded,
+                       weak_ptr_factory_.GetWeakPtr())});
   }
-
-  transform_window_.SetClipping(unclipped_size_
-                                    ? GetWindowTargetBoundsWithInsets().size()
-                                    : gfx::SizeF());
+  SetTransform(window, transform);
 }
 
 void OverviewItem::CreateWindowLabel() {
diff --git a/ash/wm/overview/overview_item.h b/ash/wm/overview/overview_item.h
index b3bc86e..e8855c1e 100644
--- a/ash/wm/overview/overview_item.h
+++ b/ash/wm/overview/overview_item.h
@@ -259,10 +259,6 @@
 
   void set_disable_mask(bool disable) { disable_mask_ = disable; }
 
-  void set_unclipped_size(base::Optional<gfx::Size> unclipped_size) {
-    unclipped_size_ = unclipped_size;
-  }
-
   views::ImageButton* GetCloseButtonForTesting();
   float GetCloseButtonVisibilityForTesting() const;
   float GetTitlebarOpacityForTesting() const;
@@ -351,9 +347,7 @@
   // The contained Window's wrapper.
   ScopedOverviewTransformWindow transform_window_;
 
-  // The target bounds this overview item is fit within. When in splitview,
-  // |item_widget_| is fit within these bounds, but the window itself is
-  // transformed to |unclipped_size_|, and then clipped.
+  // The target bounds this overview item is fit within.
   gfx::RectF target_bounds_;
 
   // True if running SetItemBounds. This prevents recursive calls resulting from
@@ -417,18 +411,9 @@
 
   bool prepared_for_overview_ = false;
 
-  // This has a value when there is a snapped window, or a window about to be
-  // snapped (triggering a splitview preview area). This will be set when items
-  // are positioned in OverviewGrid. The bounds delivered in |SetBounds| are the
-  // true bounds of this item, but we want to maintain the aspect ratio of the
-  // window, who's bounds are not set to split view size. So in |SetItemBounds|,
-  // we transform the window not to |target_bounds_| but to this value, and then
-  // apply clipping on the window to |target_bounds_|.
-  base::Optional<gfx::Size> unclipped_size_ = base::nullopt;
-
-  // Stores the last translations of the windows affected by |SetBounds|. Used
-  // for ease of calculations when swiping away overview mode using home
-  // launcher gesture.
+  // Stores the last translations of the windows affected by SetBounds. Used for
+  // ease of calculations when swiping away overview mode using home launcher
+  // gesture.
   base::flat_map<aura::Window*, int> translation_y_map_;
 
   // The shadow around the overview window. Shadows the original window, not
diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc
index 0a5e1650..fdad20b1 100644
--- a/ash/wm/overview/overview_session_unittest.cc
+++ b/ash/wm/overview/overview_session_unittest.cc
@@ -3820,92 +3820,6 @@
   EXPECT_EQ(expected_grid_bounds, GetGridBounds());
 }
 
-TEST_P(SplitViewOverviewSessionTest, Clipping) {
-  // Helper to check if two rectangles have roughly the same aspect ratio. They
-  // may be off by a bit due to insets and overview headers, but should have
-  // roughly the same shape.
-  auto aspect_ratio_near = [](const gfx::Rect& rect1, const gfx::Rect& rect2) {
-    DCHECK_GT(rect1.height(), 0);
-    DCHECK_GT(rect2.height(), 0);
-    constexpr float kEpsilon = 0.1f;
-    const float rect1_aspect_ratio =
-        float{rect1.width()} / float{rect1.height()};
-    const float rect2_aspect_ratio =
-        float{rect2.width()} / float{rect2.height()};
-    return std::abs(rect2_aspect_ratio - rect1_aspect_ratio) < kEpsilon;
-  };
-
-  std::unique_ptr<aura::Window> window1 = CreateTestWindow();
-  std::unique_ptr<aura::Window> window2 = CreateTestWindow();
-
-  for (bool portrait : {false, true}) {
-    SCOPED_TRACE(portrait ? "Portrait" : "Landscape");
-    if (portrait) {
-      ScreenOrientationControllerTestApi test_api(
-          Shell::Get()->screen_orientation_controller());
-      test_api.SetDisplayRotation(display::Display::ROTATE_90,
-                                  display::Display::RotationSource::ACTIVE);
-    }
-
-    const gfx::Rect clipping1 = window1->layer()->clip_rect();
-    const gfx::Rect clipping2 = window2->layer()->clip_rect();
-    const gfx::Rect maximized_bounds =
-        screen_util::GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(
-            window1.get());
-    const gfx::Rect split_view_bounds_right =
-        split_view_controller()->GetSnappedWindowBoundsInScreen(
-            SplitViewController::SnapPosition::RIGHT);
-
-    ToggleOverview();
-    // Tests that in regular overview, the clipping is unchanged.
-    ASSERT_TRUE(overview_controller()->InOverviewSession());
-    EXPECT_EQ(clipping1, window1->layer()->clip_rect());
-    EXPECT_EQ(clipping2, window2->layer()->clip_rect());
-
-    OverviewItem* item1 = GetOverviewItemForWindow(window1.get());
-    OverviewItem* item2 = GetOverviewItemForWindow(window2.get());
-    overview_session()->InitiateDrag(item1,
-                                     item1->target_bounds().CenterPoint(),
-                                     /*is_touch_dragging=*/false);
-
-    // Tests that after we drag to a preview area, the items target bounds have
-    // a matching aspect ratio to what the window would have if it were to be
-    // snapped in splitview. The window clipping should match this, but the
-    // windows regular bounds remain unchanged (maximized).
-    overview_session()->Drag(item1, gfx::PointF());
-    EXPECT_EQ(IndicatorState::kPreviewAreaLeft,
-              overview_session()
-                  ->split_view_drag_indicators()
-                  ->current_indicator_state());
-    EXPECT_FALSE(window2->layer()->clip_rect().IsEmpty());
-    EXPECT_TRUE(aspect_ratio_near(window2->layer()->clip_rect(),
-                                  split_view_bounds_right));
-    EXPECT_TRUE(aspect_ratio_near(gfx::ToEnclosedRect(item2->target_bounds()),
-                                  split_view_bounds_right));
-    EXPECT_TRUE(
-        aspect_ratio_near(window2->GetBoundsInScreen(), maximized_bounds));
-
-    // Tests that after snapping, the aspect ratios should be the same as being
-    // in the preview area.
-    overview_session()->CompleteDrag(item1, gfx::PointF());
-    ASSERT_EQ(SplitViewController::State::kLeftSnapped,
-              split_view_controller()->state());
-    EXPECT_FALSE(window2->layer()->clip_rect().IsEmpty());
-    EXPECT_TRUE(aspect_ratio_near(window2->layer()->clip_rect(),
-                                  split_view_bounds_right));
-    EXPECT_TRUE(aspect_ratio_near(gfx::ToEnclosedRect(item2->target_bounds()),
-                                  split_view_bounds_right));
-    EXPECT_TRUE(
-        aspect_ratio_near(window2->GetBoundsInScreen(), maximized_bounds));
-
-    // Tests that the clipping is reset after exiting overview.
-    EndSplitView();
-    ToggleOverview();
-    EXPECT_EQ(clipping1, window1->layer()->clip_rect());
-    EXPECT_EQ(clipping2, window1->layer()->clip_rect());
-  }
-}
-
 // Tests that if there is only one window in the MRU window list in the overview
 // mode, snapping the window to one side of the screen will not end the overview
 // mode even if there is no more window left in the overview window grid.
diff --git a/ash/wm/overview/overview_utils.cc b/ash/wm/overview/overview_utils.cc
index 5c4f7718..1adc7e2 100644
--- a/ash/wm/overview/overview_utils.cc
+++ b/ash/wm/overview/overview_utils.cc
@@ -12,7 +12,6 @@
 #include "ash/public/cpp/shell_window_ids.h"
 #include "ash/public/cpp/window_properties.h"
 #include "ash/scoped_animation_disabler.h"
-#include "ash/screen_util.h"
 #include "ash/shell.h"
 #include "ash/wm/overview/cleanup_animation_observer.h"
 #include "ash/wm/overview/delayed_animation_observer_impl.h"
@@ -219,58 +218,6 @@
   }
 }
 
-// Get the grid bounds if a window is snapped in splitview, or what they will be
-// when snapped based on |indicator_state|.
-gfx::Rect GetGridBoundsInScreenForSplitview(
-    aura::Window* window,
-    base::Optional<IndicatorState> indicator_state) {
-  auto* split_view_controller =
-      SplitViewController::Get(Shell::GetPrimaryRootWindow());
-  auto state = split_view_controller->state();
-
-  // If we are in splitview mode already just use the given state, otherwise
-  // convert |indicator_state| to a splitview state.
-  if (!split_view_controller->InSplitViewMode() && indicator_state) {
-    if (*indicator_state == IndicatorState::kPreviewAreaLeft)
-      state = SplitViewController::State::kLeftSnapped;
-    else if (*indicator_state == IndicatorState::kPreviewAreaRight)
-      state = SplitViewController::State::kRightSnapped;
-  }
-
-  switch (state) {
-    case SplitViewController::State::kLeftSnapped:
-      return split_view_controller->GetSnappedWindowBoundsInScreen(
-          SplitViewController::RIGHT);
-    case SplitViewController::State::kRightSnapped:
-      return split_view_controller->GetSnappedWindowBoundsInScreen(
-          SplitViewController::LEFT);
-    default:
-      return screen_util::
-          GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(window);
-  }
-}
-
-base::Optional<gfx::RectF> GetSplitviewBoundsMaintainingAspectRatio(
-    aura::Window* window) {
-  if (!Shell::Get()->tablet_mode_controller()->InTabletMode())
-    return base::nullopt;
-  auto* overview_session =
-      Shell::Get()->overview_controller()->overview_session();
-  DCHECK(overview_session);
-  // TODO(sammiequon): This does not work for drag from top as they have
-  // different drag indicators object as regular overview.
-  auto indicator_state =
-      overview_session->split_view_drag_indicators()->current_indicator_state();
-  if (!SplitViewController::Get(Shell::GetPrimaryRootWindow())
-           ->InSplitViewMode() &&
-      !SplitViewDragIndicators::IsPreviewAreaState(indicator_state)) {
-    return base::nullopt;
-  }
-
-  return base::make_optional(gfx::RectF(GetGridBoundsInScreenForSplitview(
-      window, base::make_optional(indicator_state))));
-}
-
 bool ShouldUseTabletModeGridLayout() {
   return base::FeatureList::IsEnabled(features::kNewOverviewLayout) &&
          Shell::Get()->tablet_mode_controller()->InTabletMode();
diff --git a/ash/wm/overview/overview_utils.h b/ash/wm/overview/overview_utils.h
index 9947bdd..0190630 100644
--- a/ash/wm/overview/overview_utils.h
+++ b/ash/wm/overview/overview_utils.h
@@ -9,9 +9,7 @@
 
 #include "ash/ash_export.h"
 #include "ash/wm/overview/overview_animation_type.h"
-#include "ash/wm/splitview/split_view_drag_indicators.h"
 #include "ash/wm/window_transient_descendant_iterator.h"
-#include "base/optional.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/compositor/layer_type.h"
 #include "ui/gfx/geometry/rect.h"
@@ -78,18 +76,6 @@
 // Maximize the window if it is snapped without animation.
 void MaximizeIfSnapped(aura::Window* window);
 
-// Get the grid bounds if a window is snapped in splitview, or what they will be
-// when snapped based on |indicator_state|.
-gfx::Rect GetGridBoundsInScreenForSplitview(
-    aura::Window* window,
-    base::Optional<IndicatorState> indicator_state = base::nullopt);
-
-// Gets the bounds of a window if it were to be snapped or about to be snapped
-// in splitview. Returns nothing if we are not in tablet mode, or if we aren't
-// in splitview, or if we aren't showing a splitview preview.
-base::Optional<gfx::RectF> GetSplitviewBoundsMaintainingAspectRatio(
-    aura::Window* window);
-
 // Check if kNewOverviewLayout is enabled for tablet mode.
 bool ShouldUseTabletModeGridLayout();
 
diff --git a/ash/wm/overview/overview_window_drag_controller.cc b/ash/wm/overview/overview_window_drag_controller.cc
index 529eb85..866f8ad 100644
--- a/ash/wm/overview/overview_window_drag_controller.cc
+++ b/ash/wm/overview/overview_window_drag_controller.cc
@@ -580,10 +580,10 @@
   snap_position_ = GetSnapPosition(location_in_screen);
   IndicatorState indicator_state =
       GetIndicatorState(item_->GetWindow(), snap_position_);
-  overview_session_->SetSplitViewDragIndicatorsIndicatorState(
-      indicator_state, gfx::ToRoundedPoint(location_in_screen));
   item_->overview_grid()->RearrangeDuringDrag(item_->GetWindow(),
                                               indicator_state);
+  overview_session_->SetSplitViewDragIndicatorsIndicatorState(
+      indicator_state, gfx::ToRoundedPoint(location_in_screen));
 }
 
 gfx::Rect OverviewWindowDragController::GetWorkAreaOfDisplayBeingDraggedIn()
diff --git a/ash/wm/overview/scoped_overview_transform_window.cc b/ash/wm/overview/scoped_overview_transform_window.cc
index ce3061d..05858ec 100644
--- a/ash/wm/overview/scoped_overview_transform_window.cc
+++ b/ash/wm/overview/scoped_overview_transform_window.cc
@@ -285,22 +285,6 @@
     window->layer()->SetOpacity(opacity);
 }
 
-void ScopedOverviewTransformWindow::SetClipping(const gfx::SizeF& size) {
-  // If width or height are 0, restore the overview clipping.
-  if (size.IsEmpty()) {
-    window_->layer()->SetClipRect(overview_clip_rect_);
-    return;
-  }
-
-  // Compute the clip rect. Transform affects the clip rect, so take that into
-  // account.
-  gfx::Rect clip_rect;
-  const gfx::Vector2dF scale = window_->layer()->GetTargetTransform().Scale2d();
-  clip_rect.set_width(size.width() / scale.x());
-  clip_rect.set_height(size.height() / scale.y());
-  window_->layer()->SetClipRect(clip_rect);
-}
-
 gfx::RectF ScopedOverviewTransformWindow::ShrinkRectToFitPreservingAspectRatio(
     const gfx::RectF& rect,
     const gfx::RectF& bounds,
@@ -433,7 +417,6 @@
     ScopedOverviewAnimationSettings settings(
         OVERVIEW_ANIMATION_FRAME_HEADER_CLIP, window_);
     layer->SetClipRect(clip_rect);
-    overview_clip_rect_ = clip_rect;
   }
 }
 
diff --git a/ash/wm/overview/scoped_overview_transform_window.h b/ash/wm/overview/scoped_overview_transform_window.h
index 5d9521ce..7f5827ec 100644
--- a/ash/wm/overview/scoped_overview_transform_window.h
+++ b/ash/wm/overview/scoped_overview_transform_window.h
@@ -112,10 +112,6 @@
   // Sets the opacity of the managed windows.
   void SetOpacity(float opacity);
 
-  // Apply clipping on the managed windows. If |size| is empty, then restore
-  // |overview_clip_rect_|.
-  void SetClipping(const gfx::SizeF& size);
-
   // Returns |rect| having been shrunk to fit within |bounds| (preserving the
   // aspect ratio). Takes into account a window header that is |top_view_inset|
   // tall in the original window getting replaced by a window caption that is
@@ -215,11 +211,6 @@
   // mode.
   gfx::Rect original_clip_rect_;
 
-  // The clippng on the layer of |window_| after entering overview mode.
-  // Additional clipping may be added, and when that additional clipping is
-  // removed, we should go back to this clipping.
-  gfx::Rect overview_clip_rect_;
-
   std::unique_ptr<ScopedOverviewHideWindows> hidden_transient_children_;
 
   base::WeakPtrFactory<ScopedOverviewTransformWindow> weak_ptr_factory_{this};
diff --git a/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc b/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc
index 0a230ea9..d6bca14 100644
--- a/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc
+++ b/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc
@@ -1208,46 +1208,6 @@
   EXPECT_EQ(right_window.get(), window_util::GetActiveWindow());
 }
 
-// Test that if before tablet mode, the active window is an ARC window snapped
-// on the left and the previous window is snapped on the right, then split view
-// is not activated.
-TEST_P(TabletModeControllerTest,
-       StartTabletActiveArcLeftSnapPreviousRightSnap) {
-  std::unique_ptr<aura::Window> left_window = CreateDesktopWindowSnappedLeft();
-  left_window->SetProperty(aura::client::kAppType,
-                           static_cast<int>(AppType::ARC_APP));
-  std::unique_ptr<aura::Window> right_window =
-      CreateDesktopWindowSnappedRight();
-  wm::ActivateWindow(left_window.get());
-  tablet_mode_controller()->SetEnabledForTest(true);
-  EXPECT_EQ(SplitViewController::State::kNoSnap,
-            split_view_controller()->state());
-  EXPECT_FALSE(Shell::Get()->overview_controller()->InOverviewSession());
-}
-
-// Test that if before tablet mode, the active window is snapped on the left,
-// the previous window is an ARC window snapped on the right, and the third
-// window is snapped on the right (just to test that it is ignored after the ARC
-// window), then split view is activated with the active window on the left.
-TEST_P(TabletModeControllerTest,
-       StartTabletActiveLeftSnapPreviousArcRightSnap) {
-  std::unique_ptr<aura::Window> left_window = CreateDesktopWindowSnappedLeft();
-  std::unique_ptr<aura::Window> right_window =
-      CreateDesktopWindowSnappedRight();
-  right_window->SetProperty(aura::client::kAppType,
-                            static_cast<int>(AppType::ARC_APP));
-  std::unique_ptr<aura::Window> extra_right_window =
-      CreateDesktopWindowSnappedRight();
-  wm::ActivateWindow(right_window.get());
-  wm::ActivateWindow(left_window.get());
-  tablet_mode_controller()->SetEnabledForTest(true);
-  EXPECT_EQ(SplitViewController::State::kLeftSnapped,
-            split_view_controller()->state());
-  EXPECT_EQ(left_window.get(), split_view_controller()->left_window());
-  EXPECT_TRUE(Shell::Get()->overview_controller()->InOverviewSession());
-  EXPECT_EQ(left_window.get(), window_util::GetActiveWindow());
-}
-
 // Test that if before tablet mode, the active window is a transient child of a
 // window snapped on the left, then split view is activated with the parent
 // snapped on the left.
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.cc b/ash/wm/tablet_mode/tablet_mode_window_manager.cc
index 7a22b184..31f6265 100644
--- a/ash/wm/tablet_mode/tablet_mode_window_manager.cc
+++ b/ash/wm/tablet_mode/tablet_mode_window_manager.cc
@@ -41,17 +41,12 @@
 
 // This function is called to check if window[i] is eligible to be carried over
 // to split view mode during clamshell <-> tablet mode transition or multi-user
-// switch transition. Returns true if windows[i] exists, can snap in split view,
-// and is not an ARC window.
-// TODO(xdai): Make it work for ARC windows. (see
-// https://crbug.com/922282 and
-// https://buganizer.corp.google.com/issues/123432223).
+// switch transition. Returns true if windows[i] exists and can snap in split
+// view.
 bool IsCarryOverCandidateForSplitView(
     const MruWindowTracker::WindowList& windows,
     size_t i) {
-  return windows.size() > i && CanSnapInSplitview(windows[i]) &&
-         static_cast<ash::AppType>(windows[i]->GetProperty(
-             aura::client::kAppType)) != AppType::ARC_APP;
+  return windows.size() > i && CanSnapInSplitview(windows[i]);
 }
 
 // Returns the windows that are going to be carried over to splitview during
@@ -347,6 +342,7 @@
 }
 
 void TabletModeWindowManager::SetIgnoreWmEventsForExit() {
+  is_exiting_ = true;
   for (auto& pair : window_state_map_)
     pair.second->set_ignore_wm_events(true);
 }
@@ -382,6 +378,12 @@
 void TabletModeWindowManager::OnSplitViewStateChanged(
     SplitViewController::State previous_state,
     SplitViewController::State state) {
+  // All TabletModeWindowState will ignore further WMEvents, but we still have
+  // to manually prevent sending maximizing events to ClientControlledState ARC
+  // windows e.g. ARC apps.
+  if (is_exiting_)
+    return;
+
   if (state != SplitViewController::State::kNoSnap)
     return;
   switch (
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.h b/ash/wm/tablet_mode/tablet_mode_window_manager.h
index 0e8dba5..bf934f4 100644
--- a/ash/wm/tablet_mode/tablet_mode_window_manager.h
+++ b/ash/wm/tablet_mode/tablet_mode_window_manager.h
@@ -172,6 +172,9 @@
 
   std::unique_ptr<TabletModeEventHandler> event_handler_;
 
+  // True when tablet mode is about to end.
+  bool is_exiting_ = false;
+
   DISALLOW_COPY_AND_ASSIGN(TabletModeWindowManager);
 };
 
diff --git a/base/containers/intrusive_heap.h b/base/containers/intrusive_heap.h
index 99f61b4..96ad0b2 100644
--- a/base/containers/intrusive_heap.h
+++ b/base/containers/intrusive_heap.h
@@ -458,7 +458,7 @@
   // General operations.
 
   void swap(IntrusiveHeap& other) noexcept;
-  friend void swap(IntrusiveHeap& lhs, IntrusiveHeap& rhs);
+  friend void swap(IntrusiveHeap& lhs, IntrusiveHeap& rhs) { lhs.swap(rhs); }
 
   // Comparison operators. These check for exact equality. Two heaps that are
   // semantically equivalent (contain the same elements, but in different
diff --git a/base/containers/intrusive_heap_unittest.cc b/base/containers/intrusive_heap_unittest.cc
index 74afe670..f0927243 100644
--- a/base/containers/intrusive_heap_unittest.cc
+++ b/base/containers/intrusive_heap_unittest.cc
@@ -585,6 +585,17 @@
   ExpectCanonical(heap2);
 }
 
+TEST(IntrusiveHeapTest, Swap) {
+  IntrusiveHeapInt heap{CANONICAL_ELEMENTS};
+  IntrusiveHeapInt heap2;
+  swap(heap, heap2);
+  EXPECT_TRUE(heap.empty());
+  ExpectCanonical(heap2);
+  heap.swap(heap2);
+  EXPECT_TRUE(heap2.empty());
+  ExpectCanonical(heap);
+}
+
 TEST(IntrusiveHeapTest, ElementAccess) {
   IntrusiveHeapInt heap{CANONICAL_ELEMENTS};
   EXPECT_EQ(heap.front(), heap[0]);
diff --git a/base/system/sys_info.h b/base/system/sys_info.h
index 80577b1..e5ffb2a 100644
--- a/base/system/sys_info.h
+++ b/base/system/sys_info.h
@@ -83,6 +83,11 @@
     // Note: validate any new usage with the privacy team.
     // TODO(crbug.com/907518): Implement support on other platforms.
     std::string serial_number;
+
+    bool operator==(const HardwareInfo& rhs) const {
+      return manufacturer == rhs.manufacturer && model == rhs.model &&
+             serial_number == rhs.serial_number;
+    }
   };
   // Returns via |callback| a struct containing descriptive UTF-8 strings for
   // the current machine manufacturer and model, or empty strings if the
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1
index 9d82508..ea45d0b7 100644
--- a/build/fuchsia/linux.sdk.sha1
+++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@
-8899052292598171312
\ No newline at end of file
+8899000984677642128
\ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1
index 6e36654..740aaf3 100644
--- a/build/fuchsia/mac.sdk.sha1
+++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@
-8899056964225451136
\ No newline at end of file
+8899000414743257776
\ No newline at end of file
diff --git a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_payment_request_terms_and_conditions.xml b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_payment_request_terms_and_conditions.xml
index c74d7ef..21820f9 100644
--- a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_payment_request_terms_and_conditions.xml
+++ b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_payment_request_terms_and_conditions.xml
@@ -31,6 +31,5 @@
         android:layout_marginEnd="@dimen/autofill_assistant_bottombar_horizontal_spacing"
         android:background="@drawable/autofill_assistant_lightblue_rect_bg"
         android:padding="8dp"
-        android:text="@string/autofill_assistant_3rd_party_privacy_notice"
         android:textAppearance="@style/TextAppearance.AssistantBlackCaption"/>
 </LinearLayout>
\ No newline at end of file
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java
index 1b10fb9..a819b50 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java
@@ -49,6 +49,8 @@
     private AssistantBottomSheetContent mContent;
     private boolean mAnimate = true;
 
+    private boolean mOnboardingShown;
+
     AssistantOnboardingCoordinator(String experimentIds, Context context,
             BottomSheetController controller, @Nullable Tab tab) {
         mExperimentIds = experimentIds;
@@ -69,6 +71,7 @@
      */
     void show(Callback<Boolean> callback) {
         AutofillAssistantMetrics.recordOnBoarding(OnBoarding.OB_SHOWN);
+        mOnboardingShown = true;
 
         if (mTab != null) {
             // If there's a tab, cover it with an overlay.
@@ -128,6 +131,14 @@
     }
 
     /**
+     * Returns {@code true} if the onboarding has been shown at the beginning when this
+     * autofill assistant flow got triggered.
+     */
+    boolean getOnboardingShown() {
+        return mOnboardingShown;
+    }
+
+    /**
      * Set the content of the bottom sheet to be the Autofill Assistant onboarding.
      */
     private void initContent(Callback<Boolean> callback) {
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTagsForTesting.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTagsForTesting.java
index 0f442da7..68473d2 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTagsForTesting.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTagsForTesting.java
@@ -18,6 +18,7 @@
     public static final String COLLECT_USER_DATA_SHIPPING_ADDRESS_SECTION_TAG = "shipping";
     public static final String COLLECT_USER_DATA_DATE_RANGE_START_TAG = "date_start";
     public static final String COLLECT_USER_DATA_DATE_RANGE_END_TAG = "date_end";
+    public static final String COLLECT_USER_DATA_TERMS_SECTION_TAG = "terms";
     public static final String COLLECT_USER_DATA_TERMS_REQUIRE_REVIEW = "require_review";
     public static final String VERTICAL_EXPANDER_CHEVRON = "chevron";
     public static final String COLLECT_USER_DATA_CHOICE_LIST = "choicelist";
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java
index e7138c9..71b7d8dd 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java
@@ -112,6 +112,8 @@
                 AutofillAssistantClient.this, initialUrl, experimentIds,
                 parameters.keySet().toArray(new String[parameters.size()]),
                 parameters.values().toArray(new String[parameters.size()]), onboardingCoordinator,
+                /* onboardingShown= */
+                onboardingCoordinator != null && onboardingCoordinator.getOnboardingShown(),
                 AutofillAssistantServiceInjector.getServiceToInject());
     }
 
@@ -344,7 +346,8 @@
         AutofillAssistantClient fromWebContents(WebContents webContents);
         boolean start(long nativeClientAndroid, AutofillAssistantClient caller, String initialUrl,
                 String experimentIds, String[] parameterNames, String[] parameterValues,
-                @Nullable AssistantOnboardingCoordinator onboardingCoordinator, long nativeService);
+                @Nullable AssistantOnboardingCoordinator onboardingCoordinator,
+                boolean onboardingShown, long nativeService);
         void onAccessToken(long nativeClientAndroid, AutofillAssistantClient caller,
                 boolean success, String accessToken);
         String getPrimaryAccountName(long nativeClientAndroid, AutofillAssistantClient caller);
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataBinder.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataBinder.java
index 20e68d1..a49f4d8 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataBinder.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataBinder.java
@@ -19,7 +19,6 @@
 import org.chromium.chrome.browser.payments.ContactEditor;
 import org.chromium.chrome.browser.payments.PaymentInstrument;
 import org.chromium.chrome.browser.widget.prefeditor.EditorDialog;
-import org.chromium.components.url_formatter.UrlFormatter;
 import org.chromium.content_public.browser.WebContents;
 import org.chromium.payments.mojom.PaymentMethodData;
 import org.chromium.ui.modelutil.PropertyKey;
@@ -329,6 +328,24 @@
             view.mAppendedSections.setSections(
                     model.get(AssistantCollectUserDataModel.APPENDED_SECTIONS));
             return true;
+        } else if (propertyKey == AssistantCollectUserDataModel.ACCEPT_TERMS_AND_CONDITIONS_TEXT) {
+            view.mTermsSection.setAcceptTermsAndConditionsText(
+                    model.get(AssistantCollectUserDataModel.ACCEPT_TERMS_AND_CONDITIONS_TEXT));
+            view.mTermsAsCheckboxSection.setAcceptTermsAndConditionsText(
+                    model.get(AssistantCollectUserDataModel.ACCEPT_TERMS_AND_CONDITIONS_TEXT));
+            return true;
+        } else if (propertyKey == AssistantCollectUserDataModel.TERMS_REQUIRE_REVIEW_TEXT) {
+            view.mTermsSection.setTermsRequireReviewText(
+                    model.get(AssistantCollectUserDataModel.TERMS_REQUIRE_REVIEW_TEXT));
+            view.mTermsAsCheckboxSection.setTermsRequireReviewText(
+                    model.get(AssistantCollectUserDataModel.TERMS_REQUIRE_REVIEW_TEXT));
+            return true;
+        } else if (propertyKey == AssistantCollectUserDataModel.THIRDPARTY_PRIVACY_NOTICE_TEXT) {
+            view.mTermsSection.setThirdPartyPrivacyNoticeText(
+                    model.get(AssistantCollectUserDataModel.THIRDPARTY_PRIVACY_NOTICE_TEXT));
+            view.mTermsAsCheckboxSection.setThirdPartyPrivacyNoticeText(
+                    model.get(AssistantCollectUserDataModel.THIRDPARTY_PRIVACY_NOTICE_TEXT));
+            return true;
         }
 
         return false;
@@ -353,12 +370,6 @@
             view.mPaymentMethodSection.setVisible(
                     (model.get(AssistantCollectUserDataModel.REQUEST_PAYMENT)));
             return true;
-        } else if (propertyKey == AssistantCollectUserDataModel.ACCEPT_TERMS_AND_CONDITIONS_TEXT) {
-            view.mTermsSection.setAcceptTermsAndConditionsText(
-                    model.get(AssistantCollectUserDataModel.ACCEPT_TERMS_AND_CONDITIONS_TEXT));
-            view.mTermsAsCheckboxSection.setAcceptTermsAndConditionsText(
-                    model.get(AssistantCollectUserDataModel.ACCEPT_TERMS_AND_CONDITIONS_TEXT));
-            return true;
         } else if (propertyKey == AssistantCollectUserDataModel.SHOW_TERMS_AS_CHECKBOX) {
             if (model.get(AssistantCollectUserDataModel.SHOW_TERMS_AS_CHECKBOX)) {
                 view.mTermsSection.getView().setVisibility(View.GONE);
@@ -397,13 +408,7 @@
                 // Update available profiles and credit cards before PR is made visible.
                 updateAvailableProfiles(model, view);
                 updateAvailablePaymentMethods(model);
-                WebContents webContents = model.get(AssistantCollectUserDataModel.WEB_CONTENTS);
-                if (webContents != null) {
-                    String origin = UrlFormatter.formatUrlForSecurityDisplayOmitScheme(
-                            webContents.getLastCommittedUrl());
-                    view.mTermsSection.setOrigin(origin);
-                    view.mTermsAsCheckboxSection.setOrigin(origin);
-                }
+
                 view.startListenToPersonalDataManager(() -> {
                     AssistantCollectUserDataBinder.this.updateAvailableProfiles(model, view);
                     AssistantCollectUserDataBinder.this.updateAvailablePaymentMethods(model);
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataCoordinator.java
index ca3a28a..f478cdb 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataCoordinator.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataCoordinator.java
@@ -119,6 +119,7 @@
                 AssistantTagsForTesting.COLLECT_USER_DATA_PAYMENT_METHOD_SECTION_TAG);
         shippingAddressSection.getView().setTag(
                 AssistantTagsForTesting.COLLECT_USER_DATA_SHIPPING_ADDRESS_SECTION_TAG);
+        termsSection.getView().setTag(AssistantTagsForTesting.COLLECT_USER_DATA_TERMS_SECTION_TAG);
 
         // Bind view and mediator through the model.
         mViewHolder = new AssistantCollectUserDataBinder.ViewHolder(mPaymentRequestUI,
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java
index 7eaa1fb..346add8 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java
@@ -130,6 +130,12 @@
     public static final WritableObjectPropertyKey<List<AssistantAdditionalSectionFactory>>
             APPENDED_SECTIONS = new WritableObjectPropertyKey<>();
 
+    public static final WritableObjectPropertyKey<String> TERMS_REQUIRE_REVIEW_TEXT =
+            new WritableObjectPropertyKey<>();
+
+    public static final WritableObjectPropertyKey<String> THIRDPARTY_PRIVACY_NOTICE_TEXT =
+            new WritableObjectPropertyKey<>();
+
     public AssistantCollectUserDataModel() {
         super(DELEGATE, WEB_CONTENTS, VISIBLE, SHIPPING_ADDRESS, PAYMENT_METHOD, CONTACT_DETAILS,
                 LOGIN_SECTION_TITLE, SELECTED_LOGIN, TERMS_STATUS, DEFAULT_EMAIL, REQUEST_NAME,
@@ -139,7 +145,8 @@
                 SUPPORTED_BASIC_CARD_NETWORKS, SUPPORTED_PAYMENT_METHODS, AVAILABLE_LOGINS,
                 EXPANDED_SECTION, REQUIRE_BILLING_POSTAL_CODE, BILLING_POSTAL_CODE_MISSING_TEXT,
                 REQUEST_DATE_RANGE, DATE_RANGE_START, DATE_RANGE_START_LABEL, DATE_RANGE_END,
-                DATE_RANGE_END_LABEL, PREPENDED_SECTIONS, APPENDED_SECTIONS);
+                DATE_RANGE_END_LABEL, PREPENDED_SECTIONS, APPENDED_SECTIONS,
+                TERMS_REQUIRE_REVIEW_TEXT, THIRDPARTY_PRIVACY_NOTICE_TEXT);
 
         /**
          * Set initial state for basic type properties (others are implicitly null).
@@ -339,4 +346,14 @@
     private void setAppendedSections(List<AssistantAdditionalSectionFactory> sections) {
         set(APPENDED_SECTIONS, sections);
     }
+
+    @CalledByNative
+    private void setTermsRequireReviewText(String text) {
+        set(TERMS_REQUIRE_REVIEW_TEXT, text);
+    }
+
+    @CalledByNative
+    private void setThirdPartyPrivacyNoticeText(String text) {
+        set(THIRDPARTY_PRIVACY_NOTICE_TEXT, text);
+    }
 }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantTermsSection.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantTermsSection.java
index 78cd840..e8f2582 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantTermsSection.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantTermsSection.java
@@ -33,14 +33,11 @@
     private final AssistantChoiceList mTermsList;
     private final TextView mTermsAgree;
     @Nullable
-    private final TextView mTermsRequiresReview;
+    private final TextView mTermsRequireReview;
     private final TextView mThirdPartyPrivacyNotice;
     @Nullable
     private Delegate mDelegate;
 
-    private String mOrigin = "";
-    private String mAcceptTermsText = "";
-
     AssistantTermsSection(Context context, ViewGroup parent, boolean showAsSingleCheckbox) {
         mView = LayoutInflater.from(context).inflate(
                 R.layout.autofill_assistant_payment_request_terms_and_conditions, parent, false);
@@ -55,7 +52,7 @@
         mTermsAgree = new TextView(context);
         ApiCompatibilityUtils.setTextAppearance(mTermsAgree, R.style.TextAppearance_BlackCaption);
         mTermsAgree.setGravity(Gravity.CENTER_VERTICAL);
-        mTermsList.addItem(mTermsAgree, /*hasEditButton=*/false, selected -> {
+        mTermsList.addItem(mTermsAgree, /* hasEditButton= */ false, selected -> {
             if (selected) {
                 if (mDelegate != null) {
                     mDelegate.onStateChanged(AssistantTermsAndConditionsState.ACCEPTED);
@@ -63,48 +60,28 @@
             } else if (showAsSingleCheckbox && mDelegate != null) {
                 mDelegate.onStateChanged(AssistantTermsAndConditionsState.NOT_SELECTED);
             }
-        }, /* itemEditedListener=*/null);
+        }, /* itemEditedListener= */ null);
 
         if (showAsSingleCheckbox) {
-            mTermsRequiresReview = null;
+            mTermsRequireReview = null;
         } else {
-            mTermsRequiresReview = new TextView(context);
+            mTermsRequireReview = new TextView(context);
             ApiCompatibilityUtils.setTextAppearance(
-                    mTermsRequiresReview, R.style.TextAppearance_BlackCaption);
-            mTermsRequiresReview.setGravity(Gravity.CENTER_VERTICAL);
-            mTermsRequiresReview.setTag(
+                    mTermsRequireReview, R.style.TextAppearance_BlackCaption);
+            mTermsRequireReview.setGravity(Gravity.CENTER_VERTICAL);
+            mTermsRequireReview.setTag(
                     AssistantTagsForTesting.COLLECT_USER_DATA_TERMS_REQUIRE_REVIEW);
-            mTermsList.addItem(mTermsRequiresReview, /*hasEditButton=*/false, selected -> {
+            mTermsList.addItem(mTermsRequireReview, /* hasEditButton= */ false, selected -> {
                 if (selected && mDelegate != null) {
                     mDelegate.onStateChanged(AssistantTermsAndConditionsState.REQUIRES_REVIEW);
                 }
-            }, /* itemEditedListener=*/null);
+            }, /* itemEditedListener= */ null);
         }
 
         mThirdPartyPrivacyNotice =
                 mView.findViewById(R.id.payment_request_3rd_party_privacy_notice);
     }
 
-    public void setOrigin(String origin) {
-        mOrigin = origin;
-
-        setAcceptTermsText();
-        Context context = mView.getContext();
-        if (mTermsRequiresReview != null) {
-            AssistantTextUtils.applyVisualAppearanceTags(mTermsRequiresReview,
-                    context.getString(R.string.autofill_assistant_3rd_party_terms_review, origin),
-                    /* linkCallback= */ null);
-        }
-        AssistantTextUtils.applyVisualAppearanceTags(mThirdPartyPrivacyNotice,
-                context.getString(R.string.autofill_assistant_3rd_party_privacy_notice, origin),
-                /* linkCallback= */ null);
-    }
-
-    private void setAcceptTermsText() {
-        AssistantTextUtils.applyVisualAppearanceTags(mTermsAgree,
-                String.format(mAcceptTermsText, mOrigin), this::onTermsAndConditionsLinkClicked);
-    }
-
     private void onTermsAndConditionsLinkClicked(int link) {
         if (mDelegate != null) {
             mDelegate.onLinkClicked(link);
@@ -120,8 +97,8 @@
                 mTermsList.setCheckedItem(mTermsAgree);
                 break;
             case AssistantTermsAndConditionsState.REQUIRES_REVIEW:
-                if (mTermsRequiresReview != null) {
-                    mTermsList.setCheckedItem(mTermsRequiresReview);
+                if (mTermsRequireReview != null) {
+                    mTermsList.setCheckedItem(mTermsRequireReview);
                 }
                 break;
         }
@@ -141,11 +118,23 @@
             mTermsList.setVisibility(View.GONE);
         } else {
             mTermsList.setVisibility(View.VISIBLE);
-            mAcceptTermsText = text;
-            setAcceptTermsText();
+            AssistantTextUtils.applyVisualAppearanceTags(
+                    mTermsAgree, text, this::onTermsAndConditionsLinkClicked);
         }
     }
 
+    void setTermsRequireReviewText(String text) {
+        if (mTermsRequireReview != null) {
+            AssistantTextUtils.applyVisualAppearanceTags(
+                    mTermsRequireReview, text, /* linkCallback= */ null);
+        }
+    }
+
+    void setThirdPartyPrivacyNoticeText(String text) {
+        AssistantTextUtils.applyVisualAppearanceTags(
+                mThirdPartyPrivacyNotice, text, /* linkCallback= */ null);
+    }
+
     View getView() {
         return mView;
     }
diff --git a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
index 59f9fab..96e483d4 100644
--- a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
+++ b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
@@ -124,12 +124,6 @@
       <message name="IDS_AUTOFILL_ASSISTANT_GOOGLE_TERMS_URL" desc="URL for Google Autofill Assistant Terms of Service" translateable="false">
         http://support.google.com/assistant?p=fast_checkout
       </message>
-      <message name="IDS_AUTOFILL_ASSISTANT_3RD_PARTY_TERMS_REVIEW" desc="Message that indicates that the user wants to review the terms and conditions of a 3rd party's domain, e.g., 'odeon.co.uk'.">
-        Read and agree to the terms &amp; conditions on <ph name="BEGIN_BOLD">&lt;b&gt;</ph><ph name="DOMAIN">%1$s<ex>google.com</ex></ph><ph name="END_BOLD">&lt;/b&gt;</ph> later
-      </message>
-      <message name="IDS_AUTOFILL_ASSISTANT_3RD_PARTY_PRIVACY_NOTICE" desc="Privacy notice telling users that autofill assistant will send personal data to a third party’s website.">
-        Chrome will send personal data you selected to <ph name="BEGIN_BOLD">&lt;b&gt;</ph><ph name="DOMAIN">%1$s<ex>google.com</ex></ph><ph name="END_BOLD">&lt;/b&gt;</ph>
-      </message>
       <message name="IDS_AUTOFILL_ASSISTANT_GIVE_UP"
                desc="Text label that is shown when autofill assistant cannot help anymore, because of a user action."
                internal_comment="TODO(wnwen): Remove duplication in components/autofill_assistant_strings.grdp">
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java
index 20b90af..2feb6c3f 100644
--- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java
+++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinatorTest.java
@@ -157,6 +157,17 @@
                 instanceOf(AssistantBottomSheetContent.class));
     }
 
+    @Test
+    @MediumTest
+    @DisableIf.Build(sdk_is_greater_than = 22) // TODO(crbug/991938): re-enable
+    public void testShownFlag() throws Exception {
+        AssistantOnboardingCoordinator coordinator = createCoordinator(/* tab= */ null);
+        assertFalse(coordinator.getOnboardingShown());
+
+        showOnboardingAndWait(coordinator, mCallback);
+        assertTrue(coordinator.getOnboardingShown());
+    }
+
     /** Trigger onboarding and wait until it is fully displayed. */
     private void showOnboardingAndWait(
             AssistantOnboardingCoordinator coordinator, Callback<Boolean> callback) {
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java
index a9afb74..826e78d 100644
--- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java
+++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java
@@ -9,6 +9,7 @@
 import static org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataCoordinator.DIVIDER_TAG;
 
 import android.view.View;
+import android.widget.LinearLayout;
 
 import androidx.annotation.Nullable;
 
@@ -51,6 +52,7 @@
         final AssistantVerticalExpander mLoginsSection;
         final AssistantVerticalExpander mDateRangeStartSection;
         final AssistantVerticalExpander mDateRangeEndSection;
+        final LinearLayout mTermsSection;
         final AssistantChoiceList mContactList;
         final AssistantChoiceList mPaymentMethodList;
         final AssistantChoiceList mShippingAddressList;
@@ -72,6 +74,8 @@
                     AssistantTagsForTesting.COLLECT_USER_DATA_DATE_RANGE_START_TAG);
             mDateRangeEndSection = coordinator.getView().findViewWithTag(
                     AssistantTagsForTesting.COLLECT_USER_DATA_DATE_RANGE_END_TAG);
+            mTermsSection = coordinator.getView().findViewWithTag(
+                    AssistantTagsForTesting.COLLECT_USER_DATA_TERMS_SECTION_TAG);
             mDividers = findViewsWithTag(coordinator.getView(), DIVIDER_TAG);
             mContactList = (AssistantChoiceList) (findViewsWithTag(
                     mContactSection, COLLECT_USER_DATA_CHOICE_LIST)
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java
index bd8f2ec..13814c9 100644
--- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java
+++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java
@@ -35,6 +35,7 @@
 
 import android.support.test.filters.MediumTest;
 import android.view.View;
+import android.widget.TextView;
 
 import org.hamcrest.Matcher;
 import org.junit.Before;
@@ -636,9 +637,6 @@
                     acceptTermsText);
             model.set(AssistantCollectUserDataModel.SHOW_TERMS_AS_CHECKBOX, false);
             model.set(AssistantCollectUserDataModel.DELEGATE, delegate);
-
-            // Setting web contents will set the origin and the decline terms text.
-            model.set(AssistantCollectUserDataModel.WEB_CONTENTS, mTestRule.getWebContents());
             model.set(AssistantCollectUserDataModel.VISIBLE, true);
         });
 
@@ -688,6 +686,46 @@
         assertThat(delegate.mLastLinkClicked, is(42));
     }
 
+    @Test
+    @MediumTest
+    public void testTermsRequireReview() throws Exception {
+        AssistantCollectUserDataModel model = new AssistantCollectUserDataModel();
+        createCollectUserDataCoordinator(model);
+
+        // Setting a text from "backend".
+        TestThreadUtils.runOnUiThreadBlocking(() -> {
+            model.set(AssistantCollectUserDataModel.TERMS_REQUIRE_REVIEW_TEXT, "Check terms");
+            model.set(AssistantCollectUserDataModel.SHOW_TERMS_AS_CHECKBOX, false);
+            model.set(AssistantCollectUserDataModel.VISIBLE, true);
+        });
+
+        onView(withTagValue(is(COLLECT_USER_DATA_TERMS_REQUIRE_REVIEW)))
+                .check(matches(allOf(withText("Check terms"), isDisplayed())));
+    }
+
+    @Test
+    @MediumTest
+    public void testThirdpartyPrivacyNotice() throws Exception {
+        AssistantCollectUserDataModel model = new AssistantCollectUserDataModel();
+        AssistantCollectUserDataCoordinator coordinator = createCollectUserDataCoordinator(model);
+        AutofillAssistantCollectUserDataTestHelper
+                .ViewHolder viewHolder = TestThreadUtils.runOnUiThreadBlocking(
+                () -> new AutofillAssistantCollectUserDataTestHelper.ViewHolder(coordinator));
+
+        TextView privacyNotice = viewHolder.mTermsSection.findViewById(
+                R.id.payment_request_3rd_party_privacy_notice);
+
+        // Setting a text from "backend".
+        TestThreadUtils.runOnUiThreadBlocking(() -> {
+            model.set(AssistantCollectUserDataModel.THIRDPARTY_PRIVACY_NOTICE_TEXT,
+                    "Thirdparty privacy notice");
+            model.set(AssistantCollectUserDataModel.VISIBLE, true);
+        });
+
+        onView(is(privacyNotice))
+                .check(matches(allOf(withText("Thirdparty privacy notice"), isDisplayed())));
+    }
+
     /**
      * Test that if the billing address does not have a postal code and the postal code is required,
      * an error message is displayed.
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index b27b0d7..5fbc2f9 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -1744,6 +1744,8 @@
     "sync/sessions/sync_sessions_web_contents_router.h",
     "sync/sessions/sync_sessions_web_contents_router_factory.cc",
     "sync/sessions/sync_sessions_web_contents_router_factory.h",
+    "sync/sync_encryption_keys_tab_helper.cc",
+    "sync/sync_encryption_keys_tab_helper.h",
     "sync/sync_startup_tracker.cc",
     "sync/sync_startup_tracker.h",
     "sync/user_event_service_factory.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 1d2b2d0..2500833 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3601,11 +3601,6 @@
      flag_descriptions::kSyncDeviceInfoInTransportModeDescription, kOsAll,
      FEATURE_VALUE_TYPE(switches::kSyncDeviceInfoInTransportMode)},
 
-    {"enable-sync-uss-bookmarks",
-     flag_descriptions::kEnableSyncUSSBookmarksName,
-     flag_descriptions::kEnableSyncUSSBookmarksDescription, kOsAll,
-     FEATURE_VALUE_TYPE(switches::kSyncUSSBookmarks)},
-
     {"enable-lookalike-url-navigation-suggestions",
      flag_descriptions::kLookalikeUrlNavigationSuggestionsName,
      flag_descriptions::kLookalikeUrlNavigationSuggestionsDescription, kOsAll,
@@ -4342,9 +4337,9 @@
      FEATURE_VALUE_TYPE(features::kMouseSubframeNoImplicitCapture)},
 
 #if defined(OS_ANDROID)
-    {"touch-to-fill", flag_descriptions::kTouchToFillAndroidName,
-     flag_descriptions::kTouchToFillAndroidDescription, kOsAndroid,
-     FEATURE_VALUE_TYPE(autofill::features::kTouchToFillAndroid)},
+    {"touch-to-fill", flag_descriptions::kAutofillTouchToFillName,
+     flag_descriptions::kAutofillTouchToFillDescription, kOsAndroid,
+     FEATURE_VALUE_TYPE(autofill::features::kAutofillTouchToFill)},
 #endif  // defined(OS_ANDROID)
 
     {"enable-sync-uss-nigori", flag_descriptions::kEnableSyncUSSNigoriName,
diff --git a/chrome/browser/android/autofill_assistant/client_android.cc b/chrome/browser/android/autofill_assistant/client_android.cc
index f722488..dfb1878 100644
--- a/chrome/browser/android/autofill_assistant/client_android.cc
+++ b/chrome/browser/android/autofill_assistant/client_android.cc
@@ -131,6 +131,7 @@
                           const JavaParamRef<jobjectArray>& parameter_names,
                           const JavaParamRef<jobjectArray>& parameter_values,
                           const JavaParamRef<jobject>& jonboarding_coordinator,
+                          jboolean jonboarding_shown,
                           jlong jservice) {
   // When Start() is called, AA_START should have been measured. From now on,
   // the client is responsible for keeping track of dropouts, so that for each
@@ -151,6 +152,7 @@
   std::unique_ptr<TriggerContextImpl> trigger_context = CreateTriggerContext(
       env, jexperiment_ids, parameter_names, parameter_values);
   trigger_context->SetCCT(true);
+  trigger_context->SetOnboardingShown(jonboarding_shown);
 
   GURL initial_url(base::android::ConvertJavaStringToUTF8(env, jinitial_url));
   return controller_->Start(initial_url, std::move(trigger_context));
diff --git a/chrome/browser/android/autofill_assistant/client_android.h b/chrome/browser/android/autofill_assistant/client_android.h
index fd7df1f..28f46e7 100644
--- a/chrome/browser/android/autofill_assistant/client_android.h
+++ b/chrome/browser/android/autofill_assistant/client_android.h
@@ -47,6 +47,7 @@
       const base::android::JavaParamRef<jobjectArray>& parameter_names,
       const base::android::JavaParamRef<jobjectArray>& parameter_values,
       const base::android::JavaParamRef<jobject>& jonboarding_coordinator,
+      jboolean jonboarding_shown,
       jlong jservice);
   void DestroyUI(JNIEnv* env,
                  const base::android::JavaParamRef<jobject>& jcaller);
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.cc b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
index b4044d6..ced646e 100644
--- a/chrome/browser/android/autofill_assistant/ui_controller_android.cc
+++ b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
@@ -881,6 +881,14 @@
         base::android::ConvertUTF8ToJavaString(
             env, collect_user_data_options->date_time_range.end_label()));
   }
+  Java_AssistantCollectUserDataModel_setTermsRequireReviewText(
+      env, jmodel,
+      base::android::ConvertUTF8ToJavaString(
+          env, collect_user_data_options->terms_require_review_text));
+  Java_AssistantCollectUserDataModel_setThirdPartyPrivacyNoticeText(
+      env, jmodel,
+      base::android::ConvertUTF8ToJavaString(
+          env, collect_user_data_options->thirdparty_privacy_notice_text));
 
   Java_AssistantCollectUserDataModel_setPrependedSections(
       env, jmodel,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc
index d597ef2..54fccef 100644
--- a/chrome/browser/android/chrome_feature_list.cc
+++ b/chrome/browser/android/chrome_feature_list.cc
@@ -62,7 +62,7 @@
     &autofill::features::kAutofillEnableCompanyName,
     &autofill_assistant::features::kAutofillAssistant,
     &autofill_assistant::features::kAutofillAssistantDirectActions,
-    &autofill::features::kTouchToFillAndroid,
+    &autofill::features::kAutofillTouchToFill,
     &download::features::kDownloadAutoResumptionNative,
     &download::features::kUseDownloadOfflineContentProvider,
     &features::kAppNotificationStatusMessaging,
diff --git a/chrome/browser/apps/app_service/uninstall_dialog.cc b/chrome/browser/apps/app_service/uninstall_dialog.cc
index 5d235208..301c364 100644
--- a/chrome/browser/apps/app_service/uninstall_dialog.cc
+++ b/chrome/browser/apps/app_service/uninstall_dialog.cc
@@ -22,18 +22,20 @@
                                  const std::string& app_name,
                                  apps::mojom::IconKeyPtr icon_key,
                                  apps::IconLoader* icon_loader,
+                                 gfx::NativeWindow parent_window,
                                  UninstallCallback uninstall_callback)
     : profile_(profile),
       app_type_(app_type),
       app_id_(app_id),
       app_name_(app_name),
+      parent_window_(parent_window),
       uninstall_callback_(std::move(uninstall_callback)) {
   int32_t size_hint_in_dip;
   switch (app_type) {
     case apps::mojom::AppType::kCrostini:
       // Crostini uninstall dialog doesn't show the icon.
       UiBase::Create(profile_, app_type_, app_id_, app_name, gfx::ImageSkia(),
-                     this);
+                     parent_window, this);
       return;
     case apps::mojom::AppType::kArc:
       // Currently ARC apps only support 48*48 native icon.
@@ -72,7 +74,7 @@
   }
 
   UiBase::Create(profile_, app_type_, app_id_, app_name_,
-                 icon_value->uncompressed, this);
+                 icon_value->uncompressed, parent_window_, this);
 }
 
 }  // namespace apps
diff --git a/chrome/browser/apps/app_service/uninstall_dialog.h b/chrome/browser/apps/app_service/uninstall_dialog.h
index 8c1bae8..90f0a0d 100644
--- a/chrome/browser/apps/app_service/uninstall_dialog.h
+++ b/chrome/browser/apps/app_service/uninstall_dialog.h
@@ -9,6 +9,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
 #include "chrome/services/app_service/public/mojom/types.mojom.h"
+#include "ui/gfx/native_widget_types.h"
 
 class Profile;
 
@@ -57,6 +58,7 @@
                        const std::string& app_id,
                        const std::string& app_name,
                        gfx::ImageSkia image,
+                       gfx::NativeWindow parent_window,
                        UninstallDialog* uninstall_dialog);
 
     gfx::ImageSkia image() const { return image_; }
@@ -86,6 +88,7 @@
                   const std::string& app_name,
                   apps::mojom::IconKeyPtr icon_key,
                   IconLoader* icon_loader,
+                  gfx::NativeWindow parent_window,
                   UninstallCallback uninstall_callback);
   ~UninstallDialog();
 
@@ -101,6 +104,7 @@
   apps::mojom::AppType app_type_;
   const std::string app_id_;
   const std::string app_name_;
+  gfx::NativeWindow parent_window_;
   UninstallCallback uninstall_callback_;
 
   base::WeakPtrFactory<UninstallDialog> weak_ptr_factory_{this};
diff --git a/chrome/browser/apps/platform_apps/api/sync_file_system/extension_sync_event_observer.cc b/chrome/browser/apps/platform_apps/api/sync_file_system/extension_sync_event_observer.cc
index ee5e474..0a5c1e5 100644
--- a/chrome/browser/apps/platform_apps/api/sync_file_system/extension_sync_event_observer.cc
+++ b/chrome/browser/apps/platform_apps/api/sync_file_system/extension_sync_event_observer.cc
@@ -19,7 +19,7 @@
 #include "extensions/browser/extension_system_provider.h"
 #include "extensions/browser/extensions_browser_client.h"
 #include "extensions/common/extension_set.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using ::sync_file_system::SyncEventObserver;
diff --git a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.cc
index 897bb333..a89578e 100644
--- a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.cc
+++ b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.cc
@@ -25,8 +25,8 @@
 #include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/content_client.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.h b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.h
index 1bcfe19..c23dfd66 100644
--- a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.h
+++ b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h"
 #include "chrome/browser/sync_file_system/sync_file_status.h"
 #include "chrome/browser/sync_file_system/sync_status_code.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
 
 namespace storage {
diff --git a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api_helpers.cc b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api_helpers.cc
index 4a6918d..67aac4a 100644
--- a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api_helpers.cc
+++ b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_api_helpers.cc
@@ -6,7 +6,7 @@
 
 #include "base/logging.h"
 #include "base/values.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace chrome_apps {
diff --git a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_apitest.cc b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_apitest.cc
index 7b1fb41a..7b6a46e 100644
--- a/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_apitest.cc
+++ b/chrome/browser/apps/platform_apps/api/sync_file_system/sync_file_system_apitest.cc
@@ -16,7 +16,7 @@
 #include "chrome/browser/sync_file_system/sync_status_code.h"
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
 #include "extensions/browser/extension_function.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 0c1c6ca..3bf46cb7 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -389,6 +389,7 @@
         <include name="IDR_CROSTINI_INSTALLER_APP_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\crostini_installer\app.js" type="BINDATA" use_base_dir="false" />
         <include name="IDR_CROSTINI_INSTALLER_BROWSER_PROXY_JS" file="resources\chromeos\crostini_installer\browser_proxy.js" type="BINDATA" />
         <include name="IDR_CROSTINI_INSTALLER_MOJO_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\chromeos\crostini_installer\crostini_installer.mojom-lite.js" use_base_dir="false" type="BINDATA" />
+        <include name="IDR_CROSTINI_INSTALLER_TYPES_MOJO_LITE_JS" file="${root_gen_dir}\chrome\browser\chromeos\crostini\crostini_installer_types.mojom-lite.js" use_base_dir="false" type="BINDATA" />
         <include name="IDR_CRYPTOHOME_HTML" file="resources\chromeos\cryptohome.html" flattenhtml="true" type="BINDATA" />
         <include name="IDR_CRYPTOHOME_JS" file="resources\chromeos\cryptohome.js" type="BINDATA" />
         <!-- manifest file of Connectivity Diagnostics app -->
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
index 516a57e..a7bfbc6 100644
--- a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
@@ -16,8 +16,8 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "extensions/buildflags/buildflags.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
index 89f7a9c..4acbc814 100644
--- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
@@ -19,8 +19,8 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_browser_thread.h"
 #include "content/public/test/test_utils.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/browsing_data/browsing_data_media_license_helper.cc b/chrome/browser/browsing_data/browsing_data_media_license_helper.cc
index 1bb7657..a5d77c3 100644
--- a/chrome/browser/browsing_data/browsing_data_media_license_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_media_license_helper.cc
@@ -15,9 +15,9 @@
 #include "chrome/browser/browsing_data/browsing_data_helper.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/plugin_private_file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/plugin_private_file_system_backend.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/browsing_data/browsing_data_media_license_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_media_license_helper_unittest.cc
index d007653..13137ad 100644
--- a/chrome/browser/browsing_data/browsing_data_media_license_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_media_license_helper_unittest.cc
@@ -21,11 +21,11 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_browser_thread.h"
 #include "ppapi/shared_impl/ppapi_constants.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/chrome/browser/browsing_data/counters/site_data_counting_helper.cc b/chrome/browser/browsing_data/counters/site_data_counting_helper.cc
index 95c1604..735aef0 100644
--- a/chrome/browser/browsing_data/counters/site_data_counting_helper.cc
+++ b/chrome/browser/browsing_data/counters/site_data_counting_helper.cc
@@ -24,7 +24,7 @@
 #include "net/url_request/url_request_context_getter.h"
 #include "ppapi/buildflags/buildflags.h"
 #include "services/network/public/mojom/cookie_manager.mojom.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "url/gurl.h"
 #include "url/origin.h"
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index de70f9d..d776811 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -318,7 +318,7 @@
 #include "services/service_manager/sandbox/sandbox_type.h"
 #include "services/service_manager/sandbox/switches.h"
 #include "services/strings/grit/services_strings.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
 #include "third_party/blink/public/common/features.h"
 #include "third_party/blink/public/common/loader/url_loader_throttle.h"
diff --git a/chrome/browser/chrome_content_browser_client_parts.h b/chrome/browser/chrome_content_browser_client_parts.h
index aa9976ef..8add63d 100644
--- a/chrome/browser/chrome_content_browser_client_parts.h
+++ b/chrome/browser/chrome_content_browser_client_parts.h
@@ -9,7 +9,7 @@
 #include <vector>
 
 #include "services/service_manager/public/cpp/binder_registry.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace base {
 class CommandLine;
diff --git a/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.cc b/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.cc
index 1ec66bb..821cd74 100644
--- a/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.cc
+++ b/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.cc
@@ -28,8 +28,11 @@
 
 AccessibilityNodeInfoDataWrapper::AccessibilityNodeInfoDataWrapper(
     AXTreeSourceArc* tree_source,
-    AXNodeInfoData* node)
-    : AccessibilityInfoDataWrapper(tree_source), node_ptr_(node) {}
+    AXNodeInfoData* node,
+    bool is_clickable_leaf)
+    : AccessibilityInfoDataWrapper(tree_source),
+      node_ptr_(node),
+      is_clickable_leaf_(is_clickable_leaf) {}
 
 bool AccessibilityNodeInfoDataWrapper::IsNode() const {
   return true;
@@ -323,7 +326,7 @@
       out_data->SetName(names[0]);
     else if (names.size() > 1)
       out_data->SetName(base::JoinString(names, " "));
-  } else if (GetProperty(AXBooleanProperty::CLICKABLE)) {
+  } else if (is_clickable_leaf_) {
     // Compute the name by joining all nodes with names.
     std::vector<std::string> names;
     ComputeNameFromContents(this, &names);
@@ -375,7 +378,7 @@
   if (GetProperty(AXBooleanProperty::SCROLLABLE)) {
     out_data->AddBoolAttribute(ax::mojom::BoolAttribute::kScrollable, true);
   }
-  if (GetProperty(AXBooleanProperty::CLICKABLE)) {
+  if (is_clickable_leaf_) {
     out_data->AddBoolAttribute(ax::mojom::BoolAttribute::kClickable, true);
   }
   if (GetProperty(AXBooleanProperty::SELECTED)) {
diff --git a/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.h b/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.h
index 7690295..a8dbeaa8 100644
--- a/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.h
+++ b/chrome/browser/chromeos/arc/accessibility/accessibility_node_info_data_wrapper.h
@@ -17,7 +17,8 @@
 class AccessibilityNodeInfoDataWrapper : public AccessibilityInfoDataWrapper {
  public:
   AccessibilityNodeInfoDataWrapper(AXTreeSourceArc* tree_source,
-                                   mojom::AccessibilityNodeInfoData* node);
+                                   mojom::AccessibilityNodeInfoData* node,
+                                   bool is_clickable_leaf);
 
   // AccessibilityInfoDataWrapper overrides.
   bool IsNode() const override;
@@ -56,6 +57,8 @@
 
   mojom::AccessibilityNodeInfoData* node_ptr_ = nullptr;
 
+  bool is_clickable_leaf_;
+
   DISALLOW_COPY_AND_ASSIGN(AccessibilityNodeInfoDataWrapper);
 };
 
diff --git a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.cc b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.cc
index d9988985..d83e15c 100644
--- a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.cc
+++ b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.h"
 
-#include "components/arc/mojom/accessibility_helper.mojom.h"
 #include "ui/accessibility/ax_enums.mojom.h"
 
 namespace arc {
@@ -64,4 +63,16 @@
   return ax::mojom::Event::kChildrenChanged;
 }
 
+bool GetBooleanProperty(mojom::AccessibilityNodeInfoData* node,
+                        mojom::AccessibilityBooleanProperty prop) {
+  if (!node || !node->boolean_properties)
+    return false;
+
+  auto it = node->boolean_properties->find(prop);
+  if (it == node->boolean_properties->end())
+    return false;
+
+  return it->second;
+}
+
 }  // namespace arc
diff --git a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.h b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.h
index 9e4a1e4..702572e9 100644
--- a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.h
+++ b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_util.h
@@ -6,18 +6,36 @@
 #define CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_UTIL_H_
 
 #include <stdint.h>
+#include <vector>
 
+#include "components/arc/mojom/accessibility_helper.mojom.h"
 #include "ui/accessibility/ax_enum_util.h"
 
 namespace arc {
-namespace mojom {
-enum class AccessibilityEventType;
-class AccessibilityNodeInfoData;
-}  // namespace mojom
 
 ax::mojom::Event ToAXEvent(mojom::AccessibilityEventType arc_event_type,
                            mojom::AccessibilityNodeInfoData* node_info_data);
 
+// TODO(hirokisato) clean up GetProperty methods in AccessibilityNodeInfoData
+// and AccessibilityWindowInfoData.
+bool GetBooleanProperty(mojom::AccessibilityNodeInfoData* node,
+                        mojom::AccessibilityBooleanProperty prop);
+
+template <class InfoDataType, class PropType>
+bool GetIntListProperty(InfoDataType* node,
+                        PropType prop,
+                        std::vector<int32_t>* out_value) {
+  if (!node || !node->int_list_properties)
+    return false;
+
+  auto it = node->int_list_properties->find(prop);
+  if (it == node->int_list_properties->end())
+    return false;
+
+  *out_value = it->second;
+  return true;
+}
+
 }  // namespace arc
 
 #endif  // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_UTIL_H_
diff --git a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc
index 840dfd0..65cacfe 100644
--- a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc
+++ b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h"
 
+#include <stack>
 #include <string>
 
 #include "base/strings/stringprintf.h"
@@ -21,11 +22,14 @@
 
 namespace arc {
 
+using AXBooleanProperty = mojom::AccessibilityBooleanProperty;
 using AXEventData = mojom::AccessibilityEventData;
 using AXEventType = mojom::AccessibilityEventType;
 using AXIntListProperty = mojom::AccessibilityIntListProperty;
 using AXNodeInfoData = mojom::AccessibilityNodeInfoData;
+using AXNodeInfoDataPtr = mojom::AccessibilityNodeInfoDataPtr;
 using AXWindowInfoData = mojom::AccessibilityWindowInfoData;
+using AXWindowIntListProperty = mojom::AccessibilityWindowIntListProperty;
 
 AXTreeSourceArc::AXTreeSourceArc(Delegate* delegate)
     : current_tree_serializer_(new AXTreeArcSerializer(this)),
@@ -55,17 +59,21 @@
   // Finally, we cache each node's computed bounds, based on its descendants.
   std::map<int32_t, int32_t> all_parent_map;
   std::map<int32_t, std::vector<int32_t>> all_children_map;
+  // Mapping nodeId to index in event_data->node_data.
+  std::map<int32_t, int32_t> node_data_index_map;
+
   for (size_t i = 0; i < event_data->node_data.size(); ++i) {
-    if (!event_data->node_data[i]->int_list_properties)
-      continue;
-    auto it = event_data->node_data[i]->int_list_properties->find(
-        AXIntListProperty::CHILD_NODE_IDS);
-    if (it == event_data->node_data[i]->int_list_properties->end())
-      continue;
-    all_children_map[event_data->node_data[i]->id] = it->second;
-    for (size_t j = 0; j < it->second.size(); ++j)
-      all_parent_map[it->second[j]] = event_data->node_data[i]->id;
+    int32_t node_id = event_data->node_data[i]->id;
+    node_data_index_map[node_id] = i;
+    std::vector<int32_t> children;
+    if (GetIntListProperty(event_data->node_data[i].get(),
+                           AXIntListProperty::CHILD_NODE_IDS, &children)) {
+      for (const int32_t child : children)
+        all_parent_map[child] = node_id;
+      all_children_map.emplace(node_id, children);
+    }
   }
+
   if (event_data->window_data) {
     for (size_t i = 0; i < event_data->window_data->size(); ++i) {
       int32_t window_id = event_data->window_data->at(i)->window_id;
@@ -74,16 +82,15 @@
         all_parent_map[root_node_id] = window_id;
         all_children_map[window_id] = {root_node_id};
       }
-      if (!event_data->window_data->at(i)->int_list_properties)
-        continue;
-      auto it = event_data->window_data->at(i)->int_list_properties->find(
-          mojom::AccessibilityWindowIntListProperty::CHILD_WINDOW_IDS);
-      if (it == event_data->window_data->at(i)->int_list_properties->end())
-        continue;
-      all_children_map[window_id].insert(all_children_map[window_id].begin(),
-                                         it->second.begin(), it->second.end());
-      for (size_t j = 0; j < it->second.size(); ++j)
-        all_parent_map[it->second[j]] = window_id;
+      std::vector<int32_t> children;
+      if (GetIntListProperty(event_data->window_data->at(i).get(),
+                             AXWindowIntListProperty::CHILD_WINDOW_IDS,
+                             &children)) {
+        for (const int32_t child : children)
+          all_parent_map[child] = window_id;
+        all_children_map[window_id].insert(all_children_map[window_id].begin(),
+                                           children.begin(), children.end());
+      }
     }
   }
 
@@ -106,9 +113,9 @@
     int32_t parent = stack.top();
     stack.pop();
     const std::vector<int32_t>& children = all_children_map[parent];
-    for (auto it = children.begin(); it != children.end(); ++it) {
-      parent_map_[*it] = parent;
-      stack.push(*it);
+    for (const int32_t child : children) {
+      parent_map_[child] = parent;
+      stack.push(child);
     }
   }
 
@@ -119,8 +126,10 @@
     if (parent_map_.find(id) == parent_map_.end() && id != root_id_)
       continue;
     AXNodeInfoData* node = event_data->node_data[i].get();
-    tree_map_[id] =
-        std::make_unique<AccessibilityNodeInfoDataWrapper>(this, node);
+    bool is_clickable_leaf =
+        ComputeIsClickableLeaf(i, event_data->node_data, node_data_index_map);
+    tree_map_[id] = std::make_unique<AccessibilityNodeInfoDataWrapper>(
+        this, node, is_clickable_leaf);
 
     if (tree_map_[id]->IsFocused())
       focused_id_ = id;
@@ -366,6 +375,35 @@
   return;
 }
 
+bool AXTreeSourceArc::ComputeIsClickableLeaf(
+    int32_t root_index,
+    const std::vector<AXNodeInfoDataPtr>& nodes,
+    const std::map<int32_t, int32_t>& node_id_to_array_index) const {
+  AXNodeInfoData* node = nodes[root_index].get();
+  if (!GetBooleanProperty(node, AXBooleanProperty::CLICKABLE))
+    return false;
+
+  std::vector<int32_t> children;
+  if (!GetIntListProperty(node, AXIntListProperty::CHILD_NODE_IDS, &children))
+    return true;
+
+  std::stack<int32_t, std::vector<int32_t>> stack(children);
+  while (!stack.empty()) {
+    int32_t parent_id = stack.top();
+    stack.pop();
+    AXNodeInfoData* parent_node =
+        nodes[node_id_to_array_index.at(parent_id)].get();
+    if (GetBooleanProperty(parent_node, AXBooleanProperty::CLICKABLE))
+      return false;
+    if (GetIntListProperty(parent_node, AXIntListProperty::CHILD_NODE_IDS,
+                           &children)) {
+      for (const int32_t child : children)
+        stack.push(child);
+    }
+  }
+  return true;
+}
+
 void AXTreeSourceArc::Reset() {
   tree_map_.clear();
   parent_map_.clear();
diff --git a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h
index f0794e2..9a01baa 100644
--- a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h
+++ b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h
@@ -105,6 +105,12 @@
   void ComputeEnclosingBoundsInternal(AccessibilityInfoDataWrapper* info_data,
                                       gfx::Rect& computed_bounds) const;
 
+  // Computes the node is clickable and there is no clickable descendant of it.
+  bool ComputeIsClickableLeaf(
+      int32_t root_index,
+      const std::vector<mojom::AccessibilityNodeInfoDataPtr>& nodes,
+      const std::map<int32_t, int32_t>& node_id_to_array_index) const;
+
   // Resets tree state.
   void Reset();
 
diff --git a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc_unittest.cc b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc_unittest.cc
index 871e7721..9336add3 100644
--- a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc_unittest.cc
+++ b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc_unittest.cc
@@ -164,24 +164,25 @@
   void CallGetChildren(
       AXNodeInfoData* node,
       std::vector<AccessibilityInfoDataWrapper*>* out_children) const {
-    AccessibilityNodeInfoDataWrapper node_data(tree_source_.get(), node);
-    tree_source_->GetChildren(&node_data, out_children);
+    AccessibilityInfoDataWrapper* node_data = tree_source_->GetFromId(node->id);
+    tree_source_->GetChildren(node_data, out_children);
   }
 
   void CallSerializeNode(AXNodeInfoData* node,
                          std::unique_ptr<ui::AXNodeData>* out_data) const {
     ASSERT_TRUE(out_data);
-    AccessibilityNodeInfoDataWrapper node_data(tree_source_.get(), node);
+    AccessibilityInfoDataWrapper* node_data = tree_source_->GetFromId(node->id);
     *out_data = std::make_unique<ui::AXNodeData>();
-    tree_source_->SerializeNode(&node_data, out_data->get());
+    tree_source_->SerializeNode(node_data, out_data->get());
   }
 
   void CallSerializeWindow(AXWindowInfoData* window,
                            std::unique_ptr<ui::AXNodeData>* out_data) const {
     ASSERT_TRUE(out_data);
-    AccessibilityWindowInfoDataWrapper window_data(tree_source_.get(), window);
+    AccessibilityInfoDataWrapper* window_data =
+        tree_source_->GetFromId(window->window_id);
     *out_data = std::make_unique<ui::AXNodeData>();
-    tree_source_->SerializeNode(&window_data, out_data->get());
+    tree_source_->SerializeNode(window_data, out_data->get());
   }
 
   AccessibilityInfoDataWrapper* CallGetFromId(int32_t id) const {
@@ -484,6 +485,7 @@
   // Text (empty).
   SetProperty(root, AXStringProperty::TEXT, "");
 
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   // With crrev/1786363, empty text on node will not set the name.
   ASSERT_FALSE(
@@ -493,6 +495,7 @@
   root->string_properties->clear();
   SetProperty(root, AXStringProperty::TEXT, "label text");
 
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   ASSERT_TRUE(
       data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
@@ -501,6 +504,7 @@
   // Content description (empty), text (non-empty).
   SetProperty(root, AXStringProperty::CONTENT_DESCRIPTION, "");
 
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   ASSERT_TRUE(
       data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
@@ -510,6 +514,7 @@
   root->string_properties.value()[AXStringProperty::CONTENT_DESCRIPTION] =
       "label content description";
 
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   ASSERT_TRUE(
       data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
@@ -524,14 +529,27 @@
   SetProperty(child1, AXStringProperty::TEXT, "child1 label text");
   SetProperty(child2, AXStringProperty::TEXT, "child2 label text");
 
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   ASSERT_TRUE(
       data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
   ASSERT_EQ("child1 label text child2 label text", name);
 
+  // If a child is also clickable, do not use child property.
+  SetProperty(child1, AXBooleanProperty::CLICKABLE, true);
+  SetProperty(child2, AXBooleanProperty::CLICKABLE, true);
+
+  CallNotifyAccessibilityEvent(event.get());
+  CallSerializeNode(root, &data);
+  ASSERT_FALSE(
+      data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
+
   // If the node has a name, it should override the contents.
+  child1->boolean_properties->clear();
+  child2->boolean_properties->clear();
   SetProperty(root, AXStringProperty::TEXT, "root label text");
 
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   ASSERT_TRUE(
       data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
@@ -548,11 +566,10 @@
   // populated.
   root->boolean_properties->clear();
   root->string_properties->clear();
+  CallNotifyAccessibilityEvent(event.get());
   CallSerializeNode(root, &data);
   ASSERT_FALSE(
       data->GetStringAttribute(ax::mojom::StringAttribute::kName, &name));
-
-  EXPECT_EQ(1, GetDispatchedEventCount(ax::mojom::Event::kFocus));
 }
 
 TEST_F(AXTreeSourceArcTest, AccessibleNameComputationWindow) {
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h
index 3d1e647..35292f6 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h
@@ -7,7 +7,7 @@
 
 #include <memory>
 
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc
index 643f2a8..7a62a4d 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util_unittest.cc
@@ -22,7 +22,7 @@
 #include "components/arc/test/fake_file_system_instance.h"
 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc
index a99b40127..7d6e70cb 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_delegate.cc
@@ -8,8 +8,8 @@
 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h"
 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h
index 1314a145..408d5f6 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_reader.h
@@ -11,7 +11,7 @@
 #include "base/memory/weak_ptr.h"
 #include "mojo/public/cpp/system/handle.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_writer.h b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_writer.h
index f55f8af..1c4b085 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_writer.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_stream_writer.h
@@ -13,7 +13,7 @@
 #include "base/memory/weak_ptr.h"
 #include "mojo/public/cpp/system/handle.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
+#include "storage/browser/file_system/file_stream_writer.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.cc
index 7a589d6..ac381858 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.cc
@@ -7,7 +7,7 @@
 #include "base/files/file_path.h"
 #include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util_unittest.cc
index 31f99e8..2879ea7 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util_unittest.cc
@@ -2,11 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h"
+
+#include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
 #include "content/public/common/url_constants.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.cc
index 2ca856f..b4dcaca 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.cc
@@ -20,8 +20,8 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.h b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.h
index ee01fe7..0007121 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_async_file_util.h
@@ -9,7 +9,7 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc
index b43fc16..c619d7f 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.cc
@@ -10,8 +10,8 @@
 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h"
 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_writer.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
 #include "url/gurl.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc
index a3319ff..79baafc 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.cc
@@ -16,7 +16,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
index 291f76b..cfb83e2 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
@@ -12,7 +12,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 
 class GURL;
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_writer.h b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_writer.h
index 642e4da..929d191 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_writer.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_writer.h
@@ -15,8 +15,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 class GURL;
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h
index a166595..a078f3a 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h
@@ -20,8 +20,8 @@
 #include "base/time/time.h"
 #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h"
 #include "components/arc/mojom/file_system.mojom.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 class GURL;
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc
index e90b9bd..ade8c7e2 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc
@@ -22,7 +22,7 @@
 #include "components/arc/test/fake_file_system_instance.h"
 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.cc
index e8cb928..a8db20bc 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.cc
@@ -13,7 +13,7 @@
 #include "base/strings/stringprintf.h"
 #include "net/base/escape.h"
 #include "net/base/mime_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 namespace arc {
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util_unittest.cc
index 47861d8..fc6a0f77 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util_unittest.cc
@@ -2,9 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/files/file_path.h"
 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
+
+#include "base/files/file_path.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.cc b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.cc
index ebb0f57..673305e0 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.cc
@@ -12,7 +12,7 @@
 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 using storage::FileSystemURL;
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.h b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.h
index 06f196e..2d3f72a3 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_watcher_manager.h
@@ -7,7 +7,7 @@
 
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.cc
index d6f5dd8..30fb1b6 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.cc
@@ -37,7 +37,7 @@
 #include "mojo/public/cpp/platform/platform_handle.h"
 #include "mojo/public/cpp/system/platform_handle.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "url/gurl.h"
 
 namespace {
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.h b/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.h
index 15e1c83..fa696c78 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge.h
@@ -20,7 +20,7 @@
 #include "components/arc/mojom/file_system.mojom.h"
 #include "components/arc/session/connection_observer.h"
 #include "components/keyed_service/core/keyed_service.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 class BrowserContextKeyedServiceFactory;
 class GURL;
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge_unittest.cc
index 9cad575c..4196485a 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_bridge_unittest.cc
@@ -27,7 +27,7 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_service_manager_context.h"
 #include "content/public/test/test_utils.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace arc {
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_mounter.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_mounter.cc
index bba1159..8f1e97f 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_mounter.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_mounter.cc
@@ -10,7 +10,7 @@
 #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h"
 #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h
index f3d3bfc..d979e1f 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h
@@ -21,7 +21,7 @@
 #include "components/arc/mojom/file_system.mojom.h"
 #include "components/arc/session/connection_observer.h"
 #include "components/keyed_service/core/keyed_service.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 class BrowserContextKeyedServiceFactory;
 
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc
index 2878cfb..dc4b75af 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc
@@ -29,8 +29,8 @@
 #include "content/public/common/url_constants.h"
 #include "net/base/filename_util.h"
 #include "net/base/mime_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "ui/aura/window.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder.h b/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder.h
index 3c9e23c..b45bd8a 100644
--- a/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder.h
+++ b/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder.h
@@ -11,8 +11,8 @@
 #include "base/files/scoped_file.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc b/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc
index c79f3ab..fa299ef 100644
--- a/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc
@@ -14,7 +14,7 @@
 #include "base/rand_util.h"
 #include "base/run_loop.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc b/chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc
index 5d4f968..942d863 100644
--- a/chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc
+++ b/chrome/browser/chromeos/crostini/crostini_export_import_unittest.cc
@@ -19,7 +19,7 @@
 #include "chromeos/dbus/seneschal/seneschal_service.pb.h"
 #include "components/prefs/pref_service.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/message_center/public/cpp/notification.h"
 
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/chromeos/crostini/crostini_manager.cc
index 70c78bcd..8fe1e8b 100644
--- a/chrome/browser/chromeos/crostini/crostini_manager.cc
+++ b/chrome/browser/chromeos/crostini/crostini_manager.cc
@@ -59,7 +59,7 @@
 #include "services/device/public/mojom/usb_enumeration_options.mojom.h"
 #include "services/network/public/cpp/network_connection_tracker.h"
 #include "services/service_manager/public/cpp/connector.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "ui/base/window_open_disposition.h"
 
 namespace crostini {
diff --git a/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc b/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc
index a00e9fe..26fc704 100644
--- a/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc
+++ b/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc
@@ -28,7 +28,7 @@
 #include "content/public/test/browser_task_environment.h"
 #include "mojo/public/cpp/bindings/remote.h"
 #include "services/device/public/cpp/test/fake_usb_device_manager.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service.cc b/chrome/browser/chromeos/crostini/crostini_package_service.cc
index 6b0b3cf..419dd48 100644
--- a/chrome/browser/chromeos/crostini/crostini_package_service.cc
+++ b/chrome/browser/chromeos/crostini/crostini_package_service.cc
@@ -554,10 +554,14 @@
                                    PackageOperationStatus::SUCCEEDED, 100);
     }
 
-    // Clean up memory.
-    if (uninstall_queue.empty()) {
+    // As recursive calls to StartQueuedOperation might delete |uninstall_queue|
+    // and invalidate |uninstall_queue_iter| we must look it up again.
+    uninstall_queue_iter = queued_uninstalls_.find(container_id);
+    if (uninstall_queue_iter != queued_uninstalls_.end() &&
+        uninstall_queue_iter->second.empty()) {
+      // Clean up memory.
       queued_uninstalls_.erase(uninstall_queue_iter);
-      // Invalidates uninstall_queue.
+      // Invalidates |uninstall_queue_iter|.
     }
     return;
   }
@@ -590,10 +594,15 @@
                        weak_ptr_factory_.GetWeakPtr(), vm_name, container_name,
                        std::move(callback)));
 
-    // Clean up memory.
-    if (install_queue.empty()) {
+    // InstallLinuxPackage shouldn't be able to recursively call this method,
+    // but as future proofing consider |install_queue_iter| to be invalidated
+    // anyway.
+    install_queue_iter = queued_installs_.find(container_id);
+    if (install_queue_iter != queued_installs_.end() &&
+        install_queue_iter->second.empty()) {
+      // Clean up memory.
       queued_installs_.erase(install_queue_iter);
-      // Invalidates install_queue.
+      // Invalidates |install_queue_iter|.
     }
     return;
   }
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service.h b/chrome/browser/chromeos/crostini/crostini_package_service.h
index b88501b..d3434fa9 100644
--- a/chrome/browser/chromeos/crostini/crostini_package_service.h
+++ b/chrome/browser/chromeos/crostini/crostini_package_service.h
@@ -21,7 +21,7 @@
 #include "chrome/browser/chromeos/crostini/crostini_registry_service.h"
 #include "chrome/browser/chromeos/crostini/crostini_util.h"
 #include "components/keyed_service/core/keyed_service.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace crostini {
 
diff --git a/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc b/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc
index eb43b82..2b2a32b 100644
--- a/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc
+++ b/chrome/browser/chromeos/crostini/crostini_package_service_unittest.cc
@@ -30,7 +30,7 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -904,6 +904,8 @@
 }
 
 TEST_F(CrostiniPackageServiceTest, DuplicateUninstallSucceeds) {
+  // Use three uninstalls as a regression test for crbug.com/1015341
+  service_->QueueUninstallApplication(kDefaultAppId);
   service_->QueueUninstallApplication(kDefaultAppId);
   service_->QueueUninstallApplication(kDefaultAppId);
 
@@ -921,6 +923,7 @@
       Printable(notification_display_service_->GetDisplayedNotificationsForType(
           NotificationHandler::Type::TRANSIENT)),
       UnorderedElementsAre(IsUninstallSuccessNotification(DEFAULT_APP),
+                           IsUninstallSuccessNotification(DEFAULT_APP),
                            IsUninstallSuccessNotification(DEFAULT_APP)));
 }
 
diff --git a/chrome/browser/chromeos/crostini/crostini_util.h b/chrome/browser/chromeos/crostini/crostini_util.h
index ce343045..1d263a9 100644
--- a/chrome/browser/chromeos/crostini/crostini_util.h
+++ b/chrome/browser/chromeos/crostini/crostini_util.h
@@ -12,7 +12,7 @@
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/optional.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "ui/base/resource/scale_factor.h"
 
 namespace base {
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.cc b/chrome/browser/chromeos/drive/drive_integration_service.cc
index 6532ebb..fd72aa1 100644
--- a/chrome/browser/chromeos/drive/drive_integration_service.cc
+++ b/chrome/browser/chromeos/drive/drive_integration_service.cc
@@ -72,7 +72,7 @@
 #include "services/network/public/cpp/network_connection_tracker.h"
 #include "services/network/public/cpp/shared_url_loader_factory.h"
 #include "services/service_manager/public/cpp/connector.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
 
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
index 63755d2a0..ffa1a119 100644
--- a/chrome/browser/chromeos/drive/file_system_util.cc
+++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -44,7 +44,7 @@
 #include "content/public/browser/network_service_instance.h"
 #include "net/base/escape.h"
 #include "services/network/public/cpp/network_connection_tracker.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc
index add3b573..2424011 100644
--- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc
@@ -18,11 +18,11 @@
 #include "chrome/test/base/testing_profile_manager.h"
 #include "content/public/test/browser_task_environment.h"
 #include "google_apis/drive/test_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/test/test_file_system_options.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc b/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc
index dc04ba5..a821e6a 100644
--- a/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc
+++ b/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc
@@ -15,12 +15,12 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "mojo/public/cpp/bindings/callback_helpers.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/local_file_util.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/local_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace drive {
diff --git a/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.h b/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.h
index 9096df94..aef2e66 100644
--- a/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.h
+++ b/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.h
@@ -9,7 +9,7 @@
 
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
 
 class Profile;
 
diff --git a/chrome/browser/chromeos/drive/fileapi/drivefs_file_system_backend_delegate.cc b/chrome/browser/chromeos/drive/fileapi/drivefs_file_system_backend_delegate.cc
index 26077f2..e258a1f 100644
--- a/chrome/browser/chromeos/drive/fileapi/drivefs_file_system_backend_delegate.cc
+++ b/chrome/browser/chromeos/drive/fileapi/drivefs_file_system_backend_delegate.cc
@@ -6,9 +6,9 @@
 
 #include "chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
 
 namespace drive {
 
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
index 0a5ba8d1..b5e4512 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -52,7 +52,7 @@
 #include "extensions/browser/event_router.h"
 #include "extensions/browser/extension_host.h"
 #include "extensions/browser/extension_prefs.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.h b/chrome/browser/chromeos/extensions/file_manager/event_router.h
index 2ad7b18e..d1a89ad 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.h
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.h
@@ -31,7 +31,7 @@
 #include "components/arc/intent_helper/arc_intent_helper_observer.h"
 #include "components/keyed_service/core/keyed_service.h"
 #include "services/network/public/cpp/network_connection_tracker.h"
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation.h"
 
 class PrefChangeRegistrar;
 class Profile;
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
index 946b529..4686129 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc
@@ -49,8 +49,8 @@
 #include "content/public/browser/child_process_security_policy.h"
 #include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/common/fileapi/file_system_info.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "ui/shell_dialogs/select_file_dialog.h"
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
index fae85a3..d9967ed 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
@@ -29,7 +29,7 @@
 #include "extensions/browser/extension_function_registry.h"
 #include "extensions/common/extension.h"
 #include "extensions/test/result_catcher.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace utils = extension_function_test_utils;
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
index 506cffe6..7015ab3 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
@@ -40,7 +40,7 @@
 #include "extensions/common/extension.h"
 #include "extensions/common/install_warning.h"
 #include "google_apis/drive/test_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 using ::testing::_;
 using ::testing::ReturnRef;
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_stream_md5_digester.cc b/chrome/browser/chromeos/extensions/file_manager/file_stream_md5_digester.cc
index 0df9403..4c6eb40 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_stream_md5_digester.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_stream_md5_digester.cc
@@ -9,7 +9,7 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 
 namespace drive {
 namespace util {
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
index 4201d56..02193f2f 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
@@ -55,12 +55,12 @@
 #include "extensions/browser/extension_util.h"
 #include "net/base/escape.h"
 #include "services/device/public/mojom/mtp_manager.mojom.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/common/fileapi/file_system_info.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
index 2d709fc..2625d84 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
@@ -23,7 +23,7 @@
 #include "components/drive/file_errors.h"
 #include "extensions/browser/extension_function.h"
 #include "services/device/public/mojom/mtp_storage_info.mojom.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemContext;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
index 9c3d483..0d5efc65 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.h
@@ -19,7 +19,7 @@
 #include "chrome/browser/extensions/chrome_extension_function_details.h"
 #include "chrome/common/extensions/api/file_manager_private.h"
 #include "google_apis/drive/drive_api_error_codes.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace chromeos {
 class RecentFile;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc
index 65e1403..831a31c 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_tasks.cc
@@ -23,8 +23,8 @@
 #include "extensions/browser/api/file_handlers/mime_util.h"
 #include "extensions/browser/entry_info.h"
 #include "net/base/filename_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 using storage::FileSystemURL;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
index c71ffdb..84d264a3 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
@@ -33,8 +33,8 @@
 #include "components/drive/drive_api_util.h"
 #include "components/drive/file_errors.h"
 #include "content/public/browser/child_process_security_policy.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "ui/shell_dialogs/selected_file_info.h"
 
 namespace file_manager_private = extensions::api::file_manager_private;
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
index df93b7f..c639300d 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
@@ -20,7 +20,7 @@
 #include "chrome/browser/chromeos/file_system_provider/service.h"
 #include "chrome/common/extensions/api/file_system_provider.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 using chromeos::file_system_provider::MountOptions;
 using chromeos::file_system_provider::OpenedFiles;
diff --git a/chrome/browser/chromeos/file_manager/arc_file_tasks.cc b/chrome/browser/chromeos/file_manager/arc_file_tasks.cc
index 8d0a48c..13b1fe6 100644
--- a/chrome/browser/chromeos/file_manager/arc_file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/arc_file_tasks.cc
@@ -32,8 +32,8 @@
 #include "components/arc/session/arc_bridge_service.h"
 #include "content/public/browser/browser_thread.h"
 #include "extensions/browser/entry_info.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 namespace file_manager {
diff --git a/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc b/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc
index be42abb..d276a1f5 100644
--- a/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc
@@ -23,7 +23,7 @@
 #include "chrome/browser/chromeos/file_manager/app_id.h"
 #include "chrome/browser/chromeos/file_manager/path_util.h"
 #include "extensions/browser/entry_info.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "ui/base/layout.h"
 #include "ui/display/types/display_constants.h"
 #include "ui/gfx/codec/png_codec.h"
diff --git a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
index 7629c36..c11d273 100644
--- a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
+++ b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
@@ -37,7 +37,7 @@
 #include "google_apis/drive/drive_api_parser.h"
 #include "google_apis/drive/test_util.h"
 #include "google_apis/drive/time_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "ui/shell_dialogs/select_file_dialog_factory.h"
 #include "ui/shell_dialogs/select_file_policy.h"
 
diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
index 9245a4a..2aaba9d 100644
--- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
+++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
@@ -43,8 +43,8 @@
 #include "extensions/common/manifest_handlers/background_info.h"
 #include "extensions/common/url_pattern.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_info.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
index 5129c36..eb77eba6 100644
--- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
+++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -90,8 +90,8 @@
 #include "media/base/media_switches.h"
 #include "net/test/embedded_test_server/embedded_test_server.h"
 #include "services/service_manager/public/cpp/connector.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_tree_host.h"
diff --git a/chrome/browser/chromeos/file_manager/file_tasks.cc b/chrome/browser/chromeos/file_manager/file_tasks.cc
index e1bcb58..c3344b6 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks.cc
@@ -57,7 +57,7 @@
 #include "extensions/browser/extension_util.h"
 #include "extensions/common/constants.h"
 #include "extensions/common/extension_set.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/common/features.h"
 #include "third_party/blink/public/common/mime_util/mime_util.h"
 #include "ui/base/window_open_disposition.h"
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_notifier.cc b/chrome/browser/chromeos/file_manager/file_tasks_notifier.cc
index 38019659..21cff24 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks_notifier.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks_notifier.cc
@@ -20,9 +20,9 @@
 #include "content/public/browser/network_service_instance.h"
 #include "mojo/public/cpp/bindings/callback_helpers.h"
 #include "services/network/public/cpp/network_connection_tracker.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "ui/shell_dialogs/selected_file_info.h"
 
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_notifier_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_notifier_unittest.cc
index bb817cb..7b2620ff 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks_notifier_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks_notifier_unittest.cc
@@ -22,8 +22,8 @@
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/receiver.h"
 #include "mojo/public/cpp/bindings/remote.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "ui/shell_dialogs/selected_file_info.h"
diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.cc b/chrome/browser/chromeos/file_manager/fileapi_util.cc
index 2463e934..41c717e 100644
--- a/chrome/browser/chromeos/file_manager/fileapi_util.cc
+++ b/chrome/browser/chromeos/file_manager/fileapi_util.cc
@@ -27,9 +27,9 @@
 #include "extensions/common/extension.h"
 #include "google_apis/drive/task_util.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/open_file_system_mode.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/open_file_system_mode.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "ui/shell_dialogs/selected_file_info.h"
 #include "url/gurl.h"
diff --git a/chrome/browser/chromeos/file_manager/fileapi_util.h b/chrome/browser/chromeos/file_manager/fileapi_util.h
index a1b3bc0..17e1808 100644
--- a/chrome/browser/chromeos/file_manager/fileapi_util.h
+++ b/chrome/browser/chromeos/file_manager/fileapi_util.h
@@ -14,8 +14,8 @@
 #include "base/callback_forward.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
index 6595447..fab07f28 100644
--- a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
+++ b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
@@ -32,7 +32,7 @@
 #include "content/public/browser/storage_partition.h"
 #include "google_apis/drive/task_util.h"
 #include "mojo/public/cpp/bindings/callback_helpers.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace file_manager {
 namespace util {
diff --git a/chrome/browser/chromeos/file_manager/open_util.cc b/chrome/browser/chromeos/file_manager/open_util.cc
index 6558df9..4db6c4b 100644
--- a/chrome/browser/chromeos/file_manager/open_util.cc
+++ b/chrome/browser/chromeos/file_manager/open_util.cc
@@ -25,10 +25,10 @@
 #include "extensions/browser/api/file_handlers/directory_util.h"
 #include "extensions/browser/api/file_handlers/mime_util.h"
 #include "extensions/browser/entry_info.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 using storage::FileSystemURL;
diff --git a/chrome/browser/chromeos/file_manager/path_util.cc b/chrome/browser/chromeos/file_manager/path_util.cc
index 791c75b..190f9a3 100644
--- a/chrome/browser/chromeos/file_manager/path_util.cc
+++ b/chrome/browser/chromeos/file_manager/path_util.cc
@@ -35,7 +35,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "net/base/escape.h"
 #include "net/base/filename_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
 #include "url/gurl.h"
diff --git a/chrome/browser/chromeos/file_manager/path_util.h b/chrome/browser/chromeos/file_manager/path_util.h
index c57865b..8baac69e 100644
--- a/chrome/browser/chromeos/file_manager/path_util.h
+++ b/chrome/browser/chromeos/file_manager/path_util.h
@@ -9,7 +9,7 @@
 #include <vector>
 
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 class GURL;
 class Profile;
diff --git a/chrome/browser/chromeos/file_manager/path_util_unittest.cc b/chrome/browser/chromeos/file_manager/path_util_unittest.cc
index a8664b2..ed4fa59b 100644
--- a/chrome/browser/chromeos/file_manager/path_util_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/path_util_unittest.cc
@@ -38,7 +38,7 @@
 #include "components/user_manager/scoped_user_manager.h"
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_service_manager_context.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using base::FilePath;
diff --git a/chrome/browser/chromeos/file_manager/snapshot_manager.cc b/chrome/browser/chromeos/file_manager/snapshot_manager.cc
index c8d20b8..71cf426 100644
--- a/chrome/browser/chromeos/file_manager/snapshot_manager.cc
+++ b/chrome/browser/chromeos/file_manager/snapshot_manager.cc
@@ -19,7 +19,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "google_apis/drive/task_util.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "third_party/cros_system_api/constants/cryptohome.h"
 
 namespace file_manager {
diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc
index 5555f583..1b35252 100644
--- a/chrome/browser/chromeos/file_manager/volume_manager.cc
+++ b/chrome/browser/chromeos/file_manager/volume_manager.cc
@@ -54,7 +54,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "services/device/public/mojom/mtp_manager.mojom.h"
 #include "services/device/public/mojom/mtp_storage_info.mojom.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
 
diff --git a/chrome/browser/chromeos/file_manager/web_file_tasks.cc b/chrome/browser/chromeos/file_manager/web_file_tasks.cc
index 73ec081f..00c1df14 100644
--- a/chrome/browser/chromeos/file_manager/web_file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/web_file_tasks.cc
@@ -20,7 +20,7 @@
 #include "chrome/common/webui_url_constants.h"
 #include "extensions/browser/entry_info.h"
 #include "extensions/common/manifest_handlers/file_handler_info.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/common/features.h"
 #include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
 #include "ui/base/window_open_disposition.h"
diff --git a/chrome/browser/chromeos/file_system_provider/abort_callback.h b/chrome/browser/chromeos/file_system_provider/abort_callback.h
index 7c8e3f5..fbf6b30 100644
--- a/chrome/browser/chromeos/file_system_provider/abort_callback.h
+++ b/chrome/browser/chromeos/file_system_provider/abort_callback.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_ABORT_CALLBACK_H_
 
 #include "base/callback.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
index 7e033573..64c4f9f7 100644
--- a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
+++ b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
@@ -23,8 +23,8 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h"
 #include "chrome/browser/chromeos/file_system_provider/watcher.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc b/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc
index bfeb4f5..49a383c 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc
@@ -13,9 +13,9 @@
 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h"
 #include "chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.cc b/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.cc
index d4fc1b1..2ec52e9 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.cc
@@ -10,7 +10,7 @@
 #include "base/bind.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_system_backend.h"
+#include "storage/browser/file_system/file_system_backend.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.h b/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.h
index 220e900..1ae4ebb 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.h
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_reader.h
@@ -13,7 +13,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 
 namespace net {
 class IOBuffer;
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_writer.h b/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_writer.h
index d63438d..c23ec5f 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_writer.h
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/buffering_file_stream_writer.h
@@ -11,7 +11,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
+#include "storage/browser/file_system/file_stream_writer.h"
 
 namespace net {
 class IOBuffer;
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.h b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.h
index 4ce67e7..26fb527 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.h
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.h
@@ -15,8 +15,8 @@
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
 #include "net/base/completion_repeating_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
index 1e23f672..499aef4a 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
@@ -30,9 +30,9 @@
 #include "extensions/browser/extension_registry.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.h b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.h
index 5040c4c..8ed9e15 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.h
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer.h
@@ -13,8 +13,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc
index 910f32b..66a09c7 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc
@@ -28,9 +28,9 @@
 #include "extensions/browser/extension_registry.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
index 9a4b957..1271507 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
@@ -16,8 +16,8 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h
index 05858298..8a325558 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h
@@ -11,7 +11,7 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
index bf2fa6f..a5e9d08 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
@@ -27,10 +27,10 @@
 #include "content/public/test/browser_task_environment.h"
 #include "extensions/browser/extension_registry.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc b/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc
index 352732b..064cd0b 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc
@@ -12,7 +12,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h b/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h
index 5c72f15..bd31b3b 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h
@@ -5,7 +5,7 @@
 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_WATCHER_MANAGER_H_
 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_WATCHER_MANAGER_H_
 
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace storage {
 class FileSystemURL;
diff --git a/chrome/browser/chromeos/file_system_provider/mount_path_util.h b/chrome/browser/chromeos/file_system_provider/mount_path_util.h
index b26d0f73..3f62fa2 100644
--- a/chrome/browser/chromeos/file_system_provider/mount_path_util.h
+++ b/chrome/browser/chromeos/file_system_provider/mount_path_util.h
@@ -9,7 +9,7 @@
 
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 class Profile;
 
diff --git a/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc b/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc
index 47037fd0..ff5cc3b 100644
--- a/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc
@@ -26,8 +26,8 @@
 #include "content/public/browser/browser_context.h"
 #include "content/public/test/browser_task_environment.h"
 #include "extensions/browser/extension_registry.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/abort.h b/chrome/browser/chromeos/file_system_provider/operations/abort.h
index fc92952..bc80a029 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/abort.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/abort.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace extensions {
 class EventRouter;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc
index cd89da81..6caf880 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/add_watcher.h b/chrome/browser/chromeos/file_system_provider/operations/add_watcher.h
index 84be84f6..ae2f8cb 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/add_watcher.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/add_watcher.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc
index 15af114..4a86870 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/add_watcher_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file.h b/chrome/browser/chromeos/file_system_provider/operations/close_file.h
index 53ac5bb..59a84f4 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/close_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/close_file.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace extensions {
 class EventRouter;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
index 689bc0ee..2de140bf 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/configure.h b/chrome/browser/chromeos/file_system_provider/operations/configure.h
index d76e8c9..438fd71 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/configure.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/configure.h
@@ -10,7 +10,7 @@
 #include "base/files/file.h"
 #include "base/macros.h"
 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace extensions {
 class EventRouter;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/copy_entry.h b/chrome/browser/chromeos/file_system_provider/operations/copy_entry.h
index e61c9225e..da93c79 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/copy_entry.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/copy_entry.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc
index 8b6955d..0ab9c70 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_directory.h b/chrome/browser/chromeos/file_system_provider/operations/create_directory.h
index da6655d..dcef9d6 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/create_directory.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/create_directory.h
@@ -12,7 +12,7 @@
 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
index 0019a25..0af20cf 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
@@ -20,7 +20,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_file.h b/chrome/browser/chromeos/file_system_provider/operations/create_file.h
index fda919c..f321c4f5 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/create_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/create_file.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc
index 9b8a36b..7d65b24 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/delete_entry.h b/chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
index d170404..9d585405 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
@@ -12,7 +12,7 @@
 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
index bd2ef700..40c9f4c 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/execute_action.h b/chrome/browser/chromeos/file_system_provider/operations/execute_action.h
index 432fbe4..b06781bb 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/execute_action.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/execute_action.h
@@ -16,7 +16,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc
index bd98a23..0c0659d 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/execute_action_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc
index dd30b56..1f0d631 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/get_actions_unittest.cc
@@ -22,7 +22,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
index 8f51b08..bd5af22 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
@@ -21,7 +21,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/move_entry.h b/chrome/browser/chromeos/file_system_provider/operations/move_entry.h
index 9eca546..65c9ebd5 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/move_entry.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/move_entry.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc
index 5ebd11e3..4b6b6226 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file.h b/chrome/browser/chromeos/file_system_provider/operations/open_file.h
index 344c20e..bde0e32 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/open_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/open_file.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
index b75f64a..93b5034 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
@@ -19,7 +19,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/operation.h b/chrome/browser/chromeos/file_system_provider/operations/operation.h
index 68fe1e58..e57085c 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/operation.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/operation.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/request_manager.h"
 #include "extensions/browser/extension_event_histogram_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class ListValue;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory.h b/chrome/browser/chromeos/file_system_provider/operations/read_directory.h
index bc377eb..8d06599 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_directory.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory.h
@@ -12,7 +12,7 @@
 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
index 6355ca3..f28cc1e 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
@@ -23,7 +23,7 @@
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file.h b/chrome/browser/chromeos/file_system_provider/operations/read_file.h
index f633865..baec64f 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_file.h
@@ -17,7 +17,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace extensions {
 class EventRouter;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
index dd62fa4..c63c31c6 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
@@ -21,7 +21,7 @@
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/remove_watcher.h b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher.h
index c229f654b..8ec6255 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/remove_watcher.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher.h
@@ -13,7 +13,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
index c4ddb21d..e5a358e 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/remove_watcher_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/truncate.h b/chrome/browser/chromeos/file_system_provider/operations/truncate.h
index d34ea98..f13aef9 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/truncate.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/truncate.h
@@ -15,7 +15,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
index c7fcd09..29d6963 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
@@ -20,7 +20,7 @@
 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount.h b/chrome/browser/chromeos/file_system_provider/operations/unmount.h
index 10264c9..347a502 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unmount.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/unmount.h
@@ -10,7 +10,7 @@
 #include "base/files/file.h"
 #include "base/macros.h"
 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace extensions {
 class EventRouter;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/write_file.h b/chrome/browser/chromeos/file_system_provider/operations/write_file.h
index 3c4fea7..d1b4684 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/write_file.h
+++ b/chrome/browser/chromeos/file_system_provider/operations/write_file.h
@@ -17,7 +17,7 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace extensions {
 class EventRouter;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc
index 6a6b5483..fccd1059 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc
@@ -21,7 +21,7 @@
 #include "chrome/common/extensions/api/file_system_provider_internal.h"
 #include "extensions/browser/event_router.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system.h b/chrome/browser/chromeos/file_system_provider/provided_file_system.h
index 2973033..fed6e45 100644
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system.h
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system.h
@@ -21,8 +21,8 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h"
 #include "chrome/browser/chromeos/file_system_provider/queue.h"
 #include "chrome/browser/chromeos/file_system_provider/request_manager.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 class Profile;
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h
index 782c39d..43e6a51 100644
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h
@@ -21,8 +21,8 @@
 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h"
 #include "chrome/browser/chromeos/file_system_provider/watcher.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h
index 9c4428dc..20f1cc4 100644
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h
@@ -11,7 +11,7 @@
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "chrome/browser/chromeos/file_system_provider/watcher.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
index 530c43c..75a0c25 100644
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
@@ -32,7 +32,7 @@
 #include "content/public/test/browser_task_environment.h"
 #include "extensions/browser/event_router.h"
 #include "extensions/common/extension_id.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/queue.h b/chrome/browser/chromeos/file_system_provider/queue.h
index 5ead180..8890815 100644
--- a/chrome/browser/chromeos/file_system_provider/queue.h
+++ b/chrome/browser/chromeos/file_system_provider/queue.h
@@ -15,7 +15,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/registry.cc b/chrome/browser/chromeos/file_system_provider/registry.cc
index 8b2c91ab..490ad76 100644
--- a/chrome/browser/chromeos/file_system_provider/registry.cc
+++ b/chrome/browser/chromeos/file_system_provider/registry.cc
@@ -22,7 +22,7 @@
 #include "components/prefs/scoped_user_pref_update.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 namespace chromeos {
 namespace file_system_provider {
diff --git a/chrome/browser/chromeos/file_system_provider/service.cc b/chrome/browser/chromeos/file_system_provider/service.cc
index cc6af83..9dcc28ea 100644
--- a/chrome/browser/chromeos/file_system_provider/service.cc
+++ b/chrome/browser/chromeos/file_system_provider/service.cc
@@ -26,7 +26,7 @@
 #include "extensions/common/extension_id.h"
 #include "extensions/common/permissions/api_permission.h"
 #include "extensions/common/permissions/permissions_data.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/service.h b/chrome/browser/chromeos/file_system_provider/service.h
index cf15be2c..36fd223 100644
--- a/chrome/browser/chromeos/file_system_provider/service.h
+++ b/chrome/browser/chromeos/file_system_provider/service.h
@@ -35,7 +35,7 @@
 #include "extensions/browser/extension_registry_observer.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_id.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace extensions {
 class ExtensionRegistry;
diff --git a/chrome/browser/chromeos/file_system_provider/service_unittest.cc b/chrome/browser/chromeos/file_system_provider/service_unittest.cc
index 6f87480..843fe5c 100644
--- a/chrome/browser/chromeos/file_system_provider/service_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/service_unittest.cc
@@ -37,7 +37,7 @@
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_id.h"
 #include "extensions/common/manifest_constants.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/file_system_provider/throttled_file_system.h b/chrome/browser/chromeos/file_system_provider/throttled_file_system.h
index b4267d8..870b87c 100644
--- a/chrome/browser/chromeos/file_system_provider/throttled_file_system.h
+++ b/chrome/browser/chromeos/file_system_provider/throttled_file_system.h
@@ -19,8 +19,8 @@
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 namespace net {
diff --git a/chrome/browser/chromeos/file_system_provider/watcher.h b/chrome/browser/chromeos/file_system_provider/watcher.h
index 6c7538e..80520f1 100644
--- a/chrome/browser/chromeos/file_system_provider/watcher.h
+++ b/chrome/browser/chromeos/file_system_provider/watcher.h
@@ -11,7 +11,7 @@
 
 #include "base/callback.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/fileapi/external_file_resolver.cc b/chrome/browser/chromeos/fileapi/external_file_resolver.cc
index aaf6644..2dc7a6a6 100644
--- a/chrome/browser/chromeos/fileapi/external_file_resolver.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_resolver.cc
@@ -17,9 +17,9 @@
 #include "extensions/browser/api/file_handlers/mime_util.h"
 #include "net/http/http_request_headers.h"
 #include "net/http/http_util.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "url/gurl.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/fileapi/external_file_resolver.h b/chrome/browser/chromeos/fileapi/external_file_resolver.h
index 494f9a4..364d2eb 100644
--- a/chrome/browser/chromeos/fileapi/external_file_resolver.h
+++ b/chrome/browser/chromeos/fileapi/external_file_resolver.h
@@ -15,8 +15,8 @@
 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
 #include "net/base/net_errors.h"
 #include "net/http/http_byte_range.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "url/gurl.h"
 
 namespace net {
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc b/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc
index 5e09210..c765d01 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc
@@ -31,12 +31,12 @@
 #include "net/http/http_util.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/mojom/url_loader.mojom.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 
 namespace chromeos {
 namespace {
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_loader_factory_unittest.cc b/chrome/browser/chromeos/fileapi/external_file_url_loader_factory_unittest.cc
index 8027ec42..ffe082b 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_loader_factory_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_loader_factory_unittest.cc
@@ -30,7 +30,7 @@
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "net/url_request/redirect_info.h"
 #include "services/network/test/test_url_loader_client.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_util.cc b/chrome/browser/chromeos/fileapi/external_file_url_util.cc
index 75f84b845..ff58a30 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_util.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_util.cc
@@ -18,8 +18,8 @@
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/url_constants.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc b/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc
index 66cbd3b..2c4b418 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc
@@ -10,7 +10,7 @@
 #include "components/drive/file_system_core_util.h"
 #include "content/public/common/url_constants.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc
index 81a9e859..b152e49 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc
@@ -22,14 +22,14 @@
 #include "chromeos/constants/chromeos_switches.h"
 #include "chromeos/dbus/cros_disks_client.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.h b/chrome/browser/chromeos/fileapi/file_system_backend.h
index 10517a4..86268a1 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.h
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.h
@@ -15,8 +15,8 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace storage {
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h b/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h
index 09072d55..ea9b9a4 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h
+++ b/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h
@@ -10,7 +10,7 @@
 #include <memory>
 
 #include "base/callback_forward.h"
-#include "storage/browser/fileapi/file_system_backend.h"
+#include "storage/browser/file_system/file_system_backend.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace base {
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc
index 1fcbfed5..e2c590c1 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc
@@ -13,8 +13,8 @@
 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h"
 #include "chromeos/dbus/cros_disks_client.h"
 #include "extensions/common/constants.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/url_util.h"
 
diff --git a/chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.cc b/chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.cc
index c7795dc..9e6d6432 100644
--- a/chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.cc
+++ b/chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.cc
@@ -4,9 +4,9 @@
 
 #include "chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.h"
 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace chromeos {
 
diff --git a/chrome/browser/chromeos/fileapi/mtp_watcher_manager.h b/chrome/browser/chromeos/fileapi/mtp_watcher_manager.h
index 613d5ee..250051b 100644
--- a/chrome/browser/chromeos/fileapi/mtp_watcher_manager.h
+++ b/chrome/browser/chromeos/fileapi/mtp_watcher_manager.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_CHROMEOS_FILEAPI_MTP_WATCHER_MANAGER_H_
 
 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace storage {
 
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
index a9ec47d..a94344e 100644
--- a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
+++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
@@ -24,7 +24,7 @@
 #include "chrome/browser/profiles/profile.h"
 #include "components/arc/mojom/file_system.mojom.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/fileapi/recent_disk_source.cc b/chrome/browser/chromeos/fileapi/recent_disk_source.cc
index e8e771e..b22b771 100644
--- a/chrome/browser/chromeos/fileapi/recent_disk_source.cc
+++ b/chrome/browser/chromeos/fileapi/recent_disk_source.cc
@@ -14,11 +14,11 @@
 #include "base/time/time.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/fileapi/recent_disk_source.h b/chrome/browser/chromeos/fileapi/recent_disk_source.h
index c7ee9be8..c5de8ec 100644
--- a/chrome/browser/chromeos/fileapi/recent_disk_source.h
+++ b/chrome/browser/chromeos/fileapi/recent_disk_source.h
@@ -20,7 +20,7 @@
 #include "chrome/browser/chromeos/fileapi/recent_file.h"
 #include "chrome/browser/chromeos/fileapi/recent_model.h"
 #include "chrome/browser/chromeos/fileapi/recent_source.h"
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation.h"
 
 namespace chromeos {
 
diff --git a/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc b/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc
index e8aa92fd..faaedd2e 100644
--- a/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc
@@ -21,9 +21,9 @@
 #include "chrome/browser/chromeos/fileapi/recent_source.h"
 #include "chrome/test/base/testing_profile.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_types.h"
diff --git a/chrome/browser/chromeos/fileapi/recent_drive_source.cc b/chrome/browser/chromeos/fileapi/recent_drive_source.cc
index 5c8b292..d202339 100644
--- a/chrome/browser/chromeos/fileapi/recent_drive_source.cc
+++ b/chrome/browser/chromeos/fileapi/recent_drive_source.cc
@@ -18,9 +18,9 @@
 #include "chromeos/components/drivefs/drivefs_util.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/chromeos/fileapi/recent_file.h b/chrome/browser/chromeos/fileapi/recent_file.h
index b8b98c8..3cf3ee3 100644
--- a/chrome/browser/chromeos/fileapi/recent_file.h
+++ b/chrome/browser/chromeos/fileapi/recent_file.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_CHROMEOS_FILEAPI_RECENT_FILE_H_
 
 #include "base/time/time.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace chromeos {
 
diff --git a/chrome/browser/chromeos/fileapi/recent_model.cc b/chrome/browser/chromeos/fileapi/recent_model.cc
index 919bdb6e..fb994f8 100644
--- a/chrome/browser/chromeos/fileapi/recent_model.cc
+++ b/chrome/browser/chromeos/fileapi/recent_model.cc
@@ -22,7 +22,7 @@
 #include "chrome/browser/chromeos/fileapi/recent_file.h"
 #include "chrome/browser/chromeos/fileapi/recent_model_factory.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 using content::BrowserThread;
 
diff --git a/chrome/browser/chromeos/fileapi/recent_model.h b/chrome/browser/chromeos/fileapi/recent_model.h
index 1f268a29..454178f3 100644
--- a/chrome/browser/chromeos/fileapi/recent_model.h
+++ b/chrome/browser/chromeos/fileapi/recent_model.h
@@ -20,7 +20,7 @@
 #include "chrome/browser/chromeos/fileapi/recent_file.h"
 #include "chrome/browser/chromeos/fileapi/recent_source.h"
 #include "components/keyed_service/core/keyed_service.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 class GURL;
 class Profile;
diff --git a/chrome/browser/chromeos/fileapi/recent_model_unittest.cc b/chrome/browser/chromeos/fileapi/recent_model_unittest.cc
index 31ae54e3..e5393b6 100644
--- a/chrome/browser/chromeos/fileapi/recent_model_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/recent_model_unittest.cc
@@ -16,7 +16,7 @@
 #include "chrome/browser/chromeos/fileapi/test/fake_recent_source.h"
 #include "chrome/test/base/testing_profile.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/chromeos/fileapi/recent_source.h b/chrome/browser/chromeos/fileapi/recent_source.h
index ae59aee..b4d850a2 100644
--- a/chrome/browser/chromeos/fileapi/recent_source.h
+++ b/chrome/browser/chromeos/fileapi/recent_source.h
@@ -12,8 +12,8 @@
 #include "base/callback_forward.h"
 #include "base/memory/ref_counted.h"
 #include "base/time/time.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 namespace chromeos {
diff --git a/chrome/browser/chromeos/guest_os/guest_os_share_path.cc b/chrome/browser/chromeos/guest_os/guest_os_share_path.cc
index 1fc261b..f3f6a2c3 100644
--- a/chrome/browser/chromeos/guest_os/guest_os_share_path.cc
+++ b/chrome/browser/chromeos/guest_os/guest_os_share_path.cc
@@ -27,8 +27,8 @@
 #include "components/prefs/scoped_user_pref_update.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 namespace {
diff --git a/chrome/browser/chromeos/guest_os/guest_os_share_path_unittest.cc b/chrome/browser/chromeos/guest_os/guest_os_share_path_unittest.cc
index 58ef53b..2c7f1b9 100644
--- a/chrome/browser/chromeos/guest_os/guest_os_share_path_unittest.cc
+++ b/chrome/browser/chromeos/guest_os/guest_os_share_path_unittest.cc
@@ -34,7 +34,7 @@
 #include "components/prefs/scoped_user_pref_update.h"
 #include "components/user_manager/scoped_user_manager.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
diff --git a/chrome/browser/chromeos/login/eula_browsertest.cc b/chrome/browser/chromeos/login/eula_browsertest.cc
index 522e113..5f991413 100644
--- a/chrome/browser/chromeos/login/eula_browsertest.cc
+++ b/chrome/browser/chromeos/login/eula_browsertest.cc
@@ -247,7 +247,8 @@
 
 // Tests that offline version is shown when the online version is not
 // accessible.
-IN_PROC_BROWSER_TEST_F(EulaTest, LoadOffline) {
+// Disable due to flaky crbug.com/1015948
+IN_PROC_BROWSER_TEST_F(EulaTest, DISABLED_LoadOffline) {
   set_allow_online_eula(false);
   ShowEulaScreen();
 
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
index 9a830fd..607f56e 100644
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -485,6 +485,24 @@
           nullptr);
     }
   }
+
+  if (policy.has_device_web_based_attestation_allowed_urls()) {
+    const em::StringListPolicyProto& container(
+        policy.device_web_based_attestation_allowed_urls());
+
+    PolicyLevel level;
+    if (GetPolicyLevel(container.has_policy_options(),
+                       container.policy_options(), &level)) {
+      auto urls = std::make_unique<base::Value>(base::Value::Type::LIST);
+      for (const std::string& entry : container.value().entries()) {
+        urls->Append(entry);
+      }
+
+      policies->Set(key::kDeviceWebBasedAttestationAllowedUrls, level,
+                    POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, std::move(urls),
+                    nullptr);
+    }
+  }
 }
 
 void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy,
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
index e308fd7..70e4043 100644
--- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
+++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
@@ -92,7 +92,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
 using base::Time;
@@ -128,10 +128,6 @@
 // The location where stateful partition info is read from.
 const char kStatefulPartitionPath[] = "/home/.shadow";
 
-// How often the child's usage time is stored.
-static constexpr base::TimeDelta kUpdateChildActiveTimeInterval =
-    base::TimeDelta::FromSeconds(30);
-
 // Helper function (invoked via blocking pool) to fetch information about
 // mounted disks.
 std::vector<em::VolumeInfo> GetVolumeInfo(
@@ -841,9 +837,6 @@
   idle_poll_timer_.Start(FROM_HERE,
                          TimeDelta::FromSeconds(kIdlePollIntervalSeconds), this,
                          &DeviceStatusCollector::CheckIdleState);
-  update_child_usage_timer_.Start(FROM_HERE, kUpdateChildActiveTimeInterval,
-                                  this,
-                                  &DeviceStatusCollector::UpdateChildUsageTime);
   resource_usage_sampling_timer_.Start(
       FROM_HERE, TimeDelta::FromSeconds(kResourceUsageSampleIntervalSeconds),
       this, &DeviceStatusCollector::SampleResourceUsage);
@@ -878,8 +871,6 @@
       chromeos::kReportDeviceBoardStatus, callback);
 
   power_manager_->AddObserver(this);
-  // Watch for changes on the device state to calculate the child's active time.
-  chromeos::UsageTimeStateNotifier::GetInstance()->AddObserver(this);
 
   // Fetch the current values of the policies.
   UpdateReportingSettings();
@@ -916,7 +907,6 @@
 
 DeviceStatusCollector::~DeviceStatusCollector() {
   power_manager_->RemoveObserver(this);
-  chromeos::UsageTimeStateNotifier::GetInstance()->RemoveObserver(this);
 }
 
 // static
@@ -924,15 +914,6 @@
   registry->RegisterDictionaryPref(prefs::kDeviceActivityTimes);
 }
 
-TimeDelta DeviceStatusCollector::GetActiveChildScreenTime() {
-  if (!user_manager::UserManager::Get()->IsLoggedInAsChildUser())
-    return TimeDelta::FromSeconds(0);
-
-  UpdateChildUsageTime();
-  return TimeDelta::FromMilliseconds(
-      pref_service_->GetInteger(prefs::kChildScreenTimeMilliseconds));
-}
-
 void DeviceStatusCollector::CheckIdleState() {
   ProcessIdleState(ui::CalculateIdleState(kIdleStateThresholdSeconds));
 }
@@ -1016,12 +997,9 @@
 }
 
 void DeviceStatusCollector::ProcessIdleState(ui::IdleState state) {
-  // Do nothing if device activity reporting is disabled or if it's a child
-  // account. Usage time for child accounts are calculated differently.
-  if (!report_activity_times_ ||
-      user_manager::UserManager::Get()->IsLoggedInAsChildUser()) {
+  // Do nothing if device activity reporting is disabled.
+  if (!report_activity_times_)
     return;
-  }
 
   Time now = GetCurrentTime();
 
@@ -1048,60 +1026,12 @@
   last_idle_check_ = now;
 }
 
-void DeviceStatusCollector::OnUsageTimeStateChange(
-    chromeos::UsageTimeStateNotifier::UsageTimeState state) {
-  UpdateChildUsageTime();
-  last_state_active_ =
-      state == chromeos::UsageTimeStateNotifier::UsageTimeState::ACTIVE;
-}
-
 void DeviceStatusCollector::PowerChanged(
     const power_manager::PowerSupplyProperties& prop) {
   if (!power_status_callback_.is_null())
     std::move(power_status_callback_).Run(prop);
 }
 
-void DeviceStatusCollector::UpdateChildUsageTime() {
-  if (!report_activity_times_ ||
-      !user_manager::UserManager::Get()->IsLoggedInAsChildUser()) {
-    return;
-  }
-
-  // Only child accounts should be using this method.
-  CHECK(user_manager::UserManager::Get()->IsLoggedInAsChildUser());
-
-  Time now = GetCurrentTime();
-  Time reset_time = activity_storage_->GetBeginningOfDay(now);
-  if (reset_time > now)
-    reset_time -= TimeDelta::FromDays(1);
-  // Reset screen time if it has not been reset today.
-  if (reset_time > pref_service_->GetTime(prefs::kLastChildScreenTimeReset)) {
-    pref_service_->SetTime(prefs::kLastChildScreenTimeReset, now);
-    pref_service_->SetInteger(prefs::kChildScreenTimeMilliseconds, 0);
-    pref_service_->CommitPendingWrite();
-  }
-
-  if (!last_active_check_.is_null() && last_state_active_) {
-    // If it's been too long since the last report, or if the activity is
-    // negative (which can happen when the clock changes), assume a single
-    // interval of activity. This is the same strategy used to enterprise users.
-    base::TimeDelta active_seconds = now - last_active_check_;
-    if (active_seconds < base::TimeDelta::FromSeconds(0) ||
-        active_seconds >= (2 * kUpdateChildActiveTimeInterval)) {
-      activity_storage_->AddActivityPeriod(now - kUpdateChildActiveTimeInterval,
-                                           now, GetUserForActivityReporting());
-    } else {
-      activity_storage_->AddActivityPeriod(last_active_check_, now,
-                                           GetUserForActivityReporting());
-    }
-
-    activity_storage_->PruneActivityPeriods(
-        now, max_stored_past_activity_interval_,
-        max_stored_future_activity_interval_);
-  }
-  last_active_check_ = now;
-}
-
 void DeviceStatusCollector::SampleResourceUsage() {
   // Results must be written in the creation thread since that's where they
   // are read from in the Get*StatusAsync methods.
@@ -1350,8 +1280,7 @@
   if (!primary_user || !primary_user->HasGaiaAccount())
     return std::string();
 
-  // Report only affiliated users for enterprise reporting and signed-in user
-  // for consumer reporting.
+  // Report only affiliated users for enterprise reporting.
   std::string primary_user_email = primary_user->GetAccountId().GetUserEmail();
   if (!chromeos::ChromeUserManager::Get()->ShouldReportUser(
           primary_user_email)) {
@@ -1368,10 +1297,6 @@
 
 bool DeviceStatusCollector::GetActivityTimes(
     em::DeviceStatusReportRequest* status) {
-  if (user_manager::UserManager::Get()->IsLoggedInAsChildUser()) {
-    UpdateChildUsageTime();
-  }
-
   // If user reporting is off, data should be aggregated per day.
   // Signed-in user is reported in non-enterprise reporting.
   std::vector<ActivityStorage::ActivityPeriod> activity_times =
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.h b/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
index 2f528b1f..2ba1f41 100644
--- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
+++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.h
@@ -23,7 +23,6 @@
 #include "base/task/cancelable_task_tracker.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
-#include "chrome/browser/chromeos/child_accounts/usage_time_state_notifier.h"
 #include "chrome/browser/chromeos/policy/status_collector/status_collector.h"
 #include "chrome/browser/chromeos/settings/cros_settings.h"
 #include "chromeos/dbus/cryptohome/cryptohome_client.h"
@@ -111,7 +110,6 @@
 
 // Collects and summarizes the status of an enterprise-managed ChromeOS device.
 class DeviceStatusCollector : public StatusCollector,
-                              public chromeos::UsageTimeStateNotifier::Observer,
                               public chromeos::PowerManagerClient::Observer {
  public:
   using VolumeInfoFetcher =
@@ -196,10 +194,6 @@
   // The total number of hardware resource usage samples cached internally.
   static const unsigned int kMaxResourceUsageSamples = 10;
 
-  // Returns the amount of time the child has used so far today. If the user is
-  // not a child or if there is no user logged in, it returns 0.
-  base::TimeDelta GetActiveChildScreenTime();
-
  protected:
   using PowerStatusCallback = base::OnceCallback<void(
       const power_manager::PowerSupplyProperties& prop)>;
@@ -217,16 +211,9 @@
   // next device status update.
   void SampleResourceUsage();
 
-  // chromeos::UsageTimeStateNotifier::Observer:
-  void OnUsageTimeStateChange(
-      chromeos::UsageTimeStateNotifier::UsageTimeState state) override;
-
   // power_manager::PowerManagerClient::Observer:
   void PowerChanged(const power_manager::PowerSupplyProperties& prop) override;
 
-  // Updates the child's active time.
-  void UpdateChildUsageTime();
-
  private:
   // Callbacks used during sampling data collection, that allows to pass
   // additional data using partial function application.
@@ -336,13 +323,6 @@
   // The last time an idle state check was performed.
   base::Time last_idle_check_;
 
-  // The last time an active state check was performed.
-  base::Time last_active_check_;
-
-  // Whether the last state of the device was active. This is used for child
-  // accounts only. Active is defined as having the screen turned on.
-  bool last_state_active_ = true;
-
   // The maximum key that went into the last report generated by
   // GetStatusAsync(), and the duration for it. This is used to trim the stored
   // data in OnSubmittedSuccessfully(). Trimming is delayed so unsuccessful
@@ -351,7 +331,6 @@
   int duration_for_last_reported_day_ = 0;
 
   base::RepeatingTimer idle_poll_timer_;
-  base::RepeatingTimer update_child_usage_timer_;
   base::RepeatingTimer resource_usage_sampling_timer_;
 
   std::string os_version_;
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
index 2012b66..46fe70c1 100644
--- a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
+++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
@@ -55,7 +55,6 @@
 #include "chromeos/dbus/cros_healthd/cros_healthd_client.h"
 #include "chromeos/dbus/dbus_thread_manager.h"
 #include "chromeos/dbus/fake_update_engine_client.h"
-#include "chromeos/dbus/power/fake_power_manager_client.h"
 #include "chromeos/dbus/power_manager/idle.pb.h"
 #include "chromeos/dbus/shill/shill_device_client.h"
 #include "chromeos/dbus/shill/shill_ipconfig_client.h"
@@ -86,8 +85,8 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_utils.h"
 #include "mojo/core/embedder/embedder.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/mount_points.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -173,8 +172,6 @@
     SetBaselineTime(Time::Now().LocalMidnight() + kHour);
   }
 
-  void UpdateUsageTime() { UpdateChildUsageTime(); }
-
   void Simulate(ui::IdleState* states, int len) {
     for (int i = 0; i < len; i++)
       ProcessIdleState(states[i]);
@@ -514,56 +511,6 @@
   void TearDown() override { status_collector_.reset(); }
 
  protected:
-  // States tracked to calculate a child's active time.
-  enum class DeviceStateTransitions {
-    kEnterIdleState,
-    kLeaveIdleState,
-    kEnterSleep,
-    kLeaveSleep,
-    kEnterSessionActive,
-    kLeaveSessionActive,
-    kPeriodicCheckTriggered
-  };
-
-  void SimulateStateChanges(DeviceStateTransitions* states, int len) {
-    for (int i = 0; i < len; i++) {
-      switch (states[i]) {
-        case DeviceStateTransitions::kEnterIdleState: {
-          power_manager::ScreenIdleState state;
-          state.set_off(true);
-          chromeos::FakePowerManagerClient::Get()->SendScreenIdleStateChanged(
-              state);
-        } break;
-        case DeviceStateTransitions::kLeaveIdleState: {
-          power_manager::ScreenIdleState state;
-          state.set_off(false);
-          chromeos::FakePowerManagerClient::Get()->SendScreenIdleStateChanged(
-              state);
-        } break;
-        case DeviceStateTransitions::kEnterSleep:
-          chromeos::FakePowerManagerClient::Get()->SendSuspendImminent(
-              power_manager::SuspendImminent_Reason_LID_CLOSED);
-          break;
-        case DeviceStateTransitions::kLeaveSleep:
-          chromeos::FakePowerManagerClient::Get()->SendSuspendDone(
-              base::TimeDelta::FromSeconds(
-                  policy::DeviceStatusCollector::kIdlePollIntervalSeconds));
-          break;
-        case DeviceStateTransitions::kEnterSessionActive:
-          session_manager::SessionManager::Get()->SetSessionState(
-              session_manager::SessionState::ACTIVE);
-          break;
-        case DeviceStateTransitions::kLeaveSessionActive:
-          session_manager::SessionManager::Get()->SetSessionState(
-              session_manager::SessionState::LOCKED);
-          break;
-        case DeviceStateTransitions::kPeriodicCheckTriggered:
-          status_collector_->UpdateUsageTime();
-          break;
-      }
-    }
-  }
-
   void AddMountPoint(const std::string& mount_point) {
     mount_point_map_.insert(DiskMountManager::MountPointMap::value_type(
         mount_point, DiskMountManager::MountPointInfo(
@@ -640,13 +587,6 @@
                                    is_affiliated);
   }
 
-  void MockChildUser(const AccountId& account_id) {
-    MockUserWithTypeAndAffiliation(account_id, user_manager::USER_TYPE_CHILD,
-                                   false);
-    EXPECT_CALL(*user_manager_, IsLoggedInAsChildUser())
-        .WillRepeatedly(Return(true));
-  }
-
   void MockRunningKioskApp(const DeviceLocalAccount& account, bool arc_kiosk) {
     std::vector<DeviceLocalAccount> accounts;
     accounts.push_back(account);
diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc
index 8fd42d7..518f9d0 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -92,6 +92,7 @@
     kDeviceScheduledUpdateCheck,
     kDeviceSecondFactorAuthenticationMode,
     kDeviceUnaffiliatedCrostiniAllowed,
+    kDeviceWebBasedAttestationAllowedUrls,
     kDeviceWiFiAllowed,
     kDeviceWilcoDtcAllowed,
     kDisplayRotationDefault,
@@ -405,6 +406,19 @@
                                  policy.saml_login_authentication_type()
                                      .saml_login_authentication_type());
   }
+
+  if (policy.has_device_web_based_attestation_allowed_urls()) {
+    const em::StringListPolicyProto& container(
+        policy.device_web_based_attestation_allowed_urls());
+
+    base::Value urls(base::Value::Type::LIST);
+    for (const std::string& entry : container.value().entries()) {
+      urls.Append(entry);
+    }
+
+    new_values_cache->SetValue(kDeviceWebBasedAttestationAllowedUrls,
+                               std::move(urls));
+  }
 }
 
 void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy,
diff --git a/chrome/browser/chromeos/smb_client/smb_file_system.h b/chrome/browser/chromeos/smb_client/smb_file_system.h
index 036bb87..3cd6ccb 100644
--- a/chrome/browser/chromeos/smb_client/smb_file_system.h
+++ b/chrome/browser/chromeos/smb_client/smb_file_system.h
@@ -25,8 +25,8 @@
 #include "chrome/browser/chromeos/smb_client/smb_task_queue.h"
 #include "chrome/browser/chromeos/smb_client/temp_file_manager.h"
 #include "chromeos/dbus/smb_provider_client.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 namespace net {
diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc
index 15cedcc5..2313135 100644
--- a/chrome/browser/devtools/devtools_file_helper.cc
+++ b/chrome/browser/devtools/devtools_file_helper.cc
@@ -35,8 +35,8 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/url_constants.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/shell_dialogs/select_file_dialog.h"
diff --git a/chrome/browser/download/android/download_media_parser.cc b/chrome/browser/download/android/download_media_parser.cc
index 9fca9b5..55ff8cf 100644
--- a/chrome/browser/download/android/download_media_parser.cc
+++ b/chrome/browser/download/android/download_media_parser.cc
@@ -23,6 +23,7 @@
 #include "media/mojo/services/media_interface_provider.h"
 #include "media/renderers/paint_canvas_video_renderer.h"
 #include "media/video/gpu_video_accelerator_factories.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
 #include "services/service_manager/public/cpp/connector.h"
 #include "services/viz/public/cpp/gpu/context_provider_command_buffer.h"
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -209,15 +210,16 @@
 }
 
 void DownloadMediaParser::DecodeVideoFrame() {
-  media::mojom::VideoDecoderPtr video_decoder_ptr;
+  mojo::PendingRemote<media::mojom::VideoDecoder> video_decoder_remote;
   GetMediaInterfaceFactory()->CreateVideoDecoder(
-      mojo::MakeRequest(&video_decoder_ptr));
+      video_decoder_remote.InitWithNewPipeAndPassReceiver());
 
   // Build and config the decoder.
   DCHECK(gpu_factories_);
   auto mojo_decoder = std::make_unique<media::MojoVideoDecoder>(
       base::ThreadTaskRunnerHandle::Get(), gpu_factories_.get(), this,
-      std::move(video_decoder_ptr), media::VideoDecoderImplementation::kDefault,
+      std::move(video_decoder_remote),
+      media::VideoDecoderImplementation::kDefault,
       base::BindRepeating(&OnRequestOverlayInfo), gfx::ColorSpace());
 
   decoder_ = std::make_unique<media::VideoThumbnailDecoder>(
diff --git a/chrome/browser/exo_parts.cc b/chrome/browser/exo_parts.cc
index 5bf4d0e..84941bc 100644
--- a/chrome/browser/exo_parts.cc
+++ b/chrome/browser/exo_parts.cc
@@ -20,8 +20,8 @@
 #include "components/user_manager/user_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/drop_data.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace {
 
diff --git a/chrome/browser/extensions/api/cast_streaming/OWNERS b/chrome/browser/extensions/api/cast_streaming/OWNERS
index b44d282f..c0d2923c 100644
--- a/chrome/browser/extensions/api/cast_streaming/OWNERS
+++ b/chrome/browser/extensions/api/cast_streaming/OWNERS
@@ -1,3 +1,4 @@
 miu@chromium.org
+mfoltz@chromium.org
 
 # COMPONENT: Internals>Cast>Streaming
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 943cf99..f9ef074 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -95,11 +95,11 @@
 #include "extensions/common/permissions/permissions_data.h"
 #include "net/base/filename_util.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "third_party/re2/src/re2/re2.h"
 #include "ui/base/l10n/l10n_util.h"
 
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
index 33955e2..40b059d 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -37,8 +37,8 @@
 #include "extensions/browser/process_manager.h"
 #include "extensions/browser/process_manager_observer.h"
 #include "extensions/browser/warning_service.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
 #include "ui/shell_dialogs/select_file_dialog.h"
 
 class Profile;
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index 1bfce41..3aa0bd8 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -71,9 +71,9 @@
 #include "net/url_request/url_request_job.h"
 #include "net/url_request/url_request_job_factory.h"
 #include "net/url_request/url_request_job_factory_impl.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "ui/base/page_transition_types.h"
 #include "url/origin.h"
 
diff --git a/chrome/browser/extensions/api/file_system/chrome_file_system_delegate.cc b/chrome/browser/extensions/api/file_system/chrome_file_system_delegate.cc
index c5c066e..5c0439ac 100644
--- a/chrome/browser/extensions/api/file_system/chrome_file_system_delegate.cc
+++ b/chrome/browser/extensions/api/file_system/chrome_file_system_delegate.cc
@@ -36,8 +36,8 @@
 #include "extensions/browser/extension_util.h"
 #include "extensions/common/api/file_system.h"
 #include "extensions/common/extension.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "ui/shell_dialogs/select_file_dialog.h"
diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
index a3eab8e..002d308e 100644
--- a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
@@ -33,7 +33,7 @@
 #include "google_apis/drive/base_requests.h"
 #include "google_apis/drive/drive_api_parser.h"
 #include "google_apis/drive/test_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "ui/base/ui_base_types.h"
 
 // TODO(michaelpg): Port these tests to app_shell: crbug.com/505926.
diff --git a/chrome/browser/extensions/api/tab_capture/OWNERS b/chrome/browser/extensions/api/tab_capture/OWNERS
index ef6851e..99f680c 100644
--- a/chrome/browser/extensions/api/tab_capture/OWNERS
+++ b/chrome/browser/extensions/api/tab_capture/OWNERS
@@ -1,3 +1,4 @@
 miu@chromium.org
+mfoltz@chromium.org
 
 # COMPONENT: Blink>GetUserMedia>Tab
diff --git a/chrome/browser/extensions/app_data_migrator.cc b/chrome/browser/extensions/app_data_migrator.cc
index e376b07c..3b0fd39 100644
--- a/chrome/browser/extensions/app_data_migrator.cc
+++ b/chrome/browser/extensions/app_data_migrator.cc
@@ -14,8 +14,8 @@
 #include "content/public/browser/storage_partition.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "url/origin.h"
 
diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc
index 565cbd3..ace0db65 100644
--- a/chrome/browser/extensions/app_data_migrator_unittest.cc
+++ b/chrome/browser/extensions/app_data_migrator_unittest.cc
@@ -24,9 +24,9 @@
 #include "extensions/common/extension_builder.h"
 #include "extensions/common/manifest.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/mock_blob_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index 900afbe..334db28 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -55,7 +55,7 @@
 #include "content/public/browser/site_instance.h"
 #include "content/public/browser/storage_partition.h"
 #include "extensions/browser/extensions_browser_client.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "ui/chromeos/devicetype_utils.h"
 #include "ui/file_manager/grit/file_manager_resources.h"
 #endif
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 5f48abc..be5e483 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -110,8 +110,8 @@
 #if defined(OS_CHROMEOS)
 #include "chrome/browser/chromeos/extensions/install_limiter.h"
 #include "chrome/browser/chromeos/profiles/profile_helper.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
 #endif
 
 using content::BrowserContext;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index 4a6f668..bff958e 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -1186,7 +1186,7 @@
   },
   {
     "name": "enable-devtools-experiments",
-    "owners": [ "//third_party/blink/renderer/devtools/OWNERS" ],
+    "owners": [ "//third_party/devtools-frontend/src/OWNERS" ],
     // This is a catch-all for ongoing devtools experiments.
     "expiry_milestone": -1
   },
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index c4270cf..ac55595 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -924,10 +924,6 @@
     "Enable using server-provided resource loading hints to provide a preview "
     "over slow network connections.";
 
-const char kEnableSyncUSSBookmarksName[] = "Enable USS for bookmarks sync";
-const char kEnableSyncUSSBookmarksDescription[] =
-    "Enables the new, experimental implementation of bookmark sync";
-
 const char kEnableSyncUSSNigoriName[] = "Enable USS for sync encryption keys";
 const char kEnableSyncUSSNigoriDescription[] =
     "Enables the new, experimental implementation of sync encryption keys";
@@ -2104,11 +2100,6 @@
 const char kTouchSelectionStrategyCharacter[] = "Character";
 const char kTouchSelectionStrategyDirection[] = "Direction";
 
-const char kTouchToFillAndroidName[] = "Touch To Fill UI for Passwords";
-const char kTouchToFillAndroidDescription[] =
-    "Adds a Touch To Fill sheet to the keyboard accessory which will be shown "
-    "instead of the keyboard when a password can be filled.";
-
 const char kTraceUploadUrlName[] = "Trace label for navigation tracing";
 const char kTraceUploadUrlDescription[] =
     "This is to be used in conjunction with the enable-navigation-tracing "
@@ -2371,6 +2362,11 @@
     "Shows Autofill suggestions on top of the keyboard rather than in a "
     "dropdown.";
 
+const char kAutofillTouchToFillName[] = "Touch To Fill UI for Passwords";
+const char kAutofillTouchToFillDescription[] =
+    "Adds a Touch To Fill sheet to the keyboard accessory which will be shown "
+    "instead of the keyboard when a password can be filled.";
+
 const char kAutofillUseMobileLabelDisambiguationName[] =
     "Autofill Uses Mobile Label Disambiguation";
 const char kAutofillUseMobileLabelDisambiguationDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index f40f963..fce7b1d 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -546,9 +546,6 @@
 extern const char kEnableSubresourceRedirectName[];
 extern const char kEnableSubresourceRedirectDescription[];
 
-extern const char kEnableSyncUSSBookmarksName[];
-extern const char kEnableSyncUSSBookmarksDescription[];
-
 extern const char kEnableSyncUSSNigoriName[];
 extern const char kEnableSyncUSSNigoriDescription[];
 
@@ -1242,9 +1239,6 @@
 extern const char kTouchSelectionStrategyCharacter[];
 extern const char kTouchSelectionStrategyDirection[];
 
-extern const char kTouchToFillAndroidName[];
-extern const char kTouchToFillAndroidDescription[];
-
 extern const char kTraceUploadUrlName[];
 extern const char kTraceUploadUrlDescription[];
 extern const char kTraceUploadUrlChoiceOther[];
@@ -1400,6 +1394,9 @@
 extern const char kAutofillAssistantDirectActionsName[];
 extern const char kAutofillAssistantDirectActionsDescription[];
 
+extern const char kAutofillTouchToFillName[];
+extern const char kAutofillTouchToFillDescription[];
+
 extern const char kAutofillUseMobileLabelDisambiguationName[];
 extern const char kAutofillUseMobileLabelDisambiguationDescription[];
 
diff --git a/chrome/browser/global_keyboard_shortcuts_mac.mm b/chrome/browser/global_keyboard_shortcuts_mac.mm
index b414afc8..d52cf50 100644
--- a/chrome/browser/global_keyboard_shortcuts_mac.mm
+++ b/chrome/browser/global_keyboard_shortcuts_mac.mm
@@ -136,8 +136,8 @@
 const std::vector<KeyboardShortcutData>& GetShortcutsNotPresentInMainMenu() {
   // clang-format off
   static base::NoDestructor<std::vector<KeyboardShortcutData>> keys({
-    //cmd   shift  cntrl  option vkeycode               command
-    //---   -----  -----  ------ --------               -------
+  // cmd    shift  cntrl  option vkeycode               command
+  // ---    -----  -----  ------ --------               -------
     {true,  true,  false, false, kVK_ANSI_RightBracket, IDC_SELECT_NEXT_TAB},
     {true,  true,  false, false, kVK_ANSI_LeftBracket,  IDC_SELECT_PREVIOUS_TAB},
     {false, false, true,  false, kVK_PageDown,          IDC_SELECT_NEXT_TAB},
@@ -146,31 +146,31 @@
     {true,  false, false, true,  kVK_LeftArrow,         IDC_SELECT_PREVIOUS_TAB},
 
     // Cmd-0..8 select the nth tab, with cmd-9 being "last tab".
-    {true, false, false, false, kVK_ANSI_1,             IDC_SELECT_TAB_0},
-    {true, false, false, false, kVK_ANSI_Keypad1,       IDC_SELECT_TAB_0},
-    {true, false, false, false, kVK_ANSI_2,             IDC_SELECT_TAB_1},
-    {true, false, false, false, kVK_ANSI_Keypad2,       IDC_SELECT_TAB_1},
-    {true, false, false, false, kVK_ANSI_3,             IDC_SELECT_TAB_2},
-    {true, false, false, false, kVK_ANSI_Keypad3,       IDC_SELECT_TAB_2},
-    {true, false, false, false, kVK_ANSI_4,             IDC_SELECT_TAB_3},
-    {true, false, false, false, kVK_ANSI_Keypad4,       IDC_SELECT_TAB_3},
-    {true, false, false, false, kVK_ANSI_5,             IDC_SELECT_TAB_4},
-    {true, false, false, false, kVK_ANSI_Keypad5,       IDC_SELECT_TAB_4},
-    {true, false, false, false, kVK_ANSI_6,             IDC_SELECT_TAB_5},
-    {true, false, false, false, kVK_ANSI_Keypad6,       IDC_SELECT_TAB_5},
-    {true, false, false, false, kVK_ANSI_7,             IDC_SELECT_TAB_6},
-    {true, false, false, false, kVK_ANSI_Keypad7,       IDC_SELECT_TAB_6},
-    {true, false, false, false, kVK_ANSI_8,             IDC_SELECT_TAB_7},
-    {true, false, false, false, kVK_ANSI_Keypad8,       IDC_SELECT_TAB_7},
-    {true, false, false, false, kVK_ANSI_9,             IDC_SELECT_LAST_TAB},
-    {true, false, false, false, kVK_ANSI_Keypad9,       IDC_SELECT_LAST_TAB},
-    {true, true,  false, false, kVK_ANSI_M,             IDC_SHOW_AVATAR_MENU},
-    {true, false, false, true,  kVK_ANSI_L,             IDC_SHOW_DOWNLOADS},
+    {true,  false, false, false, kVK_ANSI_1,            IDC_SELECT_TAB_0},
+    {true,  false, false, false, kVK_ANSI_Keypad1,      IDC_SELECT_TAB_0},
+    {true,  false, false, false, kVK_ANSI_2,            IDC_SELECT_TAB_1},
+    {true,  false, false, false, kVK_ANSI_Keypad2,      IDC_SELECT_TAB_1},
+    {true,  false, false, false, kVK_ANSI_3,            IDC_SELECT_TAB_2},
+    {true,  false, false, false, kVK_ANSI_Keypad3,      IDC_SELECT_TAB_2},
+    {true,  false, false, false, kVK_ANSI_4,            IDC_SELECT_TAB_3},
+    {true,  false, false, false, kVK_ANSI_Keypad4,      IDC_SELECT_TAB_3},
+    {true,  false, false, false, kVK_ANSI_5,            IDC_SELECT_TAB_4},
+    {true,  false, false, false, kVK_ANSI_Keypad5,      IDC_SELECT_TAB_4},
+    {true,  false, false, false, kVK_ANSI_6,            IDC_SELECT_TAB_5},
+    {true,  false, false, false, kVK_ANSI_Keypad6,      IDC_SELECT_TAB_5},
+    {true,  false, false, false, kVK_ANSI_7,            IDC_SELECT_TAB_6},
+    {true,  false, false, false, kVK_ANSI_Keypad7,      IDC_SELECT_TAB_6},
+    {true,  false, false, false, kVK_ANSI_8,            IDC_SELECT_TAB_7},
+    {true,  false, false, false, kVK_ANSI_Keypad8,      IDC_SELECT_TAB_7},
+    {true,  false, false, false, kVK_ANSI_9,            IDC_SELECT_LAST_TAB},
+    {true,  false, false, false, kVK_ANSI_Keypad9,      IDC_SELECT_LAST_TAB},
+    {true,  true,  false, false, kVK_ANSI_M,            IDC_SHOW_AVATAR_MENU},
+    {true,  false, false, true,  kVK_ANSI_L,            IDC_SHOW_DOWNLOADS},
     {true,  true,  false, false, kVK_ANSI_C,            IDC_DEV_TOOLS_INSPECT},
-    {true,  false,  false, true, kVK_ANSI_C,            IDC_DEV_TOOLS_INSPECT},
+    {true,  false, false, true,  kVK_ANSI_C,            IDC_DEV_TOOLS_INSPECT},
 
-    {true, false, false, true, kVK_UpArrow,             IDC_FOCUS_NEXT_PANE},
-    {true, true, false, true,  kVK_UpArrow,             IDC_FOCUS_PREVIOUS_PANE},
+    {true,  false, false, true,  kVK_DownArrow,         IDC_FOCUS_NEXT_PANE},
+    {true,  false, false, true,  kVK_UpArrow,           IDC_FOCUS_PREVIOUS_PANE},
   });
   // clang-format on
   return *keys;
diff --git a/chrome/browser/media/OWNERS b/chrome/browser/media/OWNERS
index 6b0607a9..5844b64 100644
--- a/chrome/browser/media/OWNERS
+++ b/chrome/browser/media/OWNERS
@@ -4,6 +4,7 @@
 
 # For Cast-related changes.
 per-file cast_*=miu@chromium.org
+per-file cast_*=mfoltz@chromium.org
 
 # For Media Engagement
 per-file media_engagement*=beccahughes@chromium.org
diff --git a/chrome/browser/media/webrtc/webrtc_logging_controller.cc b/chrome/browser/media/webrtc/webrtc_logging_controller.cc
index 824464f..af4e3ba 100644
--- a/chrome/browser/media/webrtc/webrtc_logging_controller.cc
+++ b/chrome/browser/media/webrtc/webrtc_logging_controller.cc
@@ -26,7 +26,7 @@
 
 #if defined(OS_LINUX) || defined(OS_CHROMEOS)
 #include "content/public/browser/child_process_security_policy.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #endif  // defined(OS_LINUX) || defined(OS_CHROMEOS)
 
 using webrtc_event_logging::WebRtcEventLogManager;
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h b/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h
index a427cddb..246bed3 100644
--- a/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h
+++ b/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h
@@ -24,7 +24,7 @@
 #include "chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h"
 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 struct SnapshotRequestInfo;
 
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc
index 01b936f..7db730eb 100644
--- a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc
+++ b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc
@@ -20,7 +20,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "net/base/io_buffer.h"
 #include "services/device/public/mojom/mtp_manager.mojom.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h
index 5749e7f..85fe6694 100644
--- a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h
+++ b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h
@@ -17,7 +17,7 @@
 #include "base/memory/weak_ptr.h"
 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
 #include "services/device/public/mojom/mtp_file_entry.mojom.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 class MTPReadFileWorker;
 struct SnapshotRequestInfo;
diff --git a/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.h b/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.h
index 72dd8a5..a217315 100644
--- a/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.h
+++ b/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_AV_SCANNING_FILE_VALIDATOR_H_
 
 #include "base/macros.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
index f25f864..fdd963b 100644
--- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
@@ -24,11 +24,11 @@
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "content/public/browser/browser_thread.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/native_file_util.h"
 
 using storage::AsyncFileUtil;
 using storage::FileSystemOperationContext;
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
index 862ce251..cb9461b 100644
--- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
@@ -15,8 +15,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace storage {
 class FileSystemOperationContext;
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
index cd8f37b..6a2be2f4 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
@@ -35,14 +35,14 @@
 #include "content/public/browser/web_contents.h"
 #include "extensions/browser/extension_registry.h"
 #include "net/url_request/url_request.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.h b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
index 6b64a1b2..06e9c44 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
@@ -16,8 +16,8 @@
 #include "base/memory/ref_counted.h"
 #include "build/build_config.h"
 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace base {
 class SequencedTaskRunner;
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
index 79de05a..d19bfcd5 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
@@ -21,12 +21,12 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/browser_test.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/test/test_file_system_backend.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/common/fileapi/file_system_types.h"
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc
index 5b6e6cb..3e774b0 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc
@@ -8,8 +8,8 @@
 #include "base/macros.h"
 #include "chrome/browser/media_galleries/fileapi/supported_audio_video_checker.h"
 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace {
 
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_factory.h b/chrome/browser/media_galleries/fileapi/media_file_validator_factory.h
index 7e267d1..c46538b 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_factory.h
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_factory.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_VALIDATOR_FACTORY_H_
 
 #include "base/macros.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h b/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h
index 92a1e7d..6835248 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h
+++ b/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h
@@ -10,8 +10,8 @@
 #include "base/callback.h"
 #include "base/files/file.h"
 #include "base/memory/ref_counted.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc b/chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc
index 9441a72..8fb7e96 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc
+++ b/chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc
@@ -11,8 +11,8 @@
 #include "base/stl_util.h"
 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace {
 
diff --git a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc
index 2a3aed5..5d9ff6e 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc
+++ b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc
@@ -15,7 +15,7 @@
 #include "net/base/io_buffer.h"
 #include "net/base/mime_sniffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 using storage::FileStreamReader;
 
diff --git a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h
index 3976e13..333078e1 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h
+++ b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h
@@ -14,8 +14,8 @@
 #include "base/memory/weak_ptr.h"
 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemContext;
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
index cba4642e9..e3d4e6f7 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
@@ -22,9 +22,9 @@
 #include "net/base/io_buffer.h"
 #include "net/base/mime_sniffer.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "url/gurl.h"
 
 namespace {
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.h b/chrome/browser/media_galleries/fileapi/native_media_file_util.h
index d16b90b..b909674 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.h
@@ -12,7 +12,7 @@
 
 #include "base/macros.h"
 #include "base/sequenced_task_runner.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace net {
 class IOBuffer;
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
index e14962c..887ab9d 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
@@ -25,13 +25,13 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_utils.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_options.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/media_galleries/fileapi/readahead_file_stream_reader.h b/chrome/browser/media_galleries/fileapi/readahead_file_stream_reader.h
index 6a3ace0..10d427f3 100644
--- a/chrome/browser/media_galleries/fileapi/readahead_file_stream_reader.h
+++ b/chrome/browser/media_galleries/fileapi/readahead_file_stream_reader.h
@@ -12,7 +12,7 @@
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_once_callback.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 
 // Wraps a source FileStreamReader with a readahead buffer.
 class ReadaheadFileStreamReader : public storage::FileStreamReader {
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
index 35ace74..d655b1a 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
@@ -17,7 +17,7 @@
 #include "components/storage_monitor/image_capture_device_manager.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace {
 
diff --git a/chrome/browser/media_galleries/media_file_system_registry.cc b/chrome/browser/media_galleries/media_file_system_registry.cc
index 10c164c..5e88900 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry.cc
@@ -41,7 +41,7 @@
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_set.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_types.h"
 
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
index 0607bbc..ddc1ced7 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
@@ -18,7 +18,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string16.h"
 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/password_manager/touch_to_fill_controller.cc b/chrome/browser/password_manager/touch_to_fill_controller.cc
index dc02e3d4..7f1cc616 100644
--- a/chrome/browser/password_manager/touch_to_fill_controller.cc
+++ b/chrome/browser/password_manager/touch_to_fill_controller.cc
@@ -7,10 +7,8 @@
 #include <utility>
 
 #include "base/logging.h"
-#include "base/metrics/field_trial_params.h"
 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
 #include "chrome/browser/touch_to_fill/touch_to_fill_view.h"
-#include "components/autofill/core/common/autofill_features.h"
 #include "components/favicon/core/favicon_service.h"
 #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h"
 #include "components/password_manager/core/browser/origin_credential_store.h"
@@ -43,27 +41,18 @@
 
 void TouchToFillController::Show(base::span<const CredentialPair> credentials,
                                  base::WeakPtr<PasswordManagerDriver> driver) {
-  // Disable Touch To Fill for secure origins if specified by the server.
-  const GURL& url = driver->GetLastCommittedURL();
-  const TouchToFillView::IsOriginSecure is_origin_secure(
-      network::IsUrlPotentiallyTrustworthy(url));
-  if (base::GetFieldTrialParamByFeatureAsBool(
-          autofill::features::kTouchToFillAndroid, "insecure-origins-only",
-          /*default_value=*/false) &&
-      is_origin_secure) {
-    driver->TouchToFillDismissed();
-    return;
-  }
-
   DCHECK(!driver_ || driver_.get() == driver.get());
   driver_ = std::move(driver);
 
   if (!view_)
     view_ = TouchToFillViewFactory::Create(this);
 
+  const GURL& url = driver_->GetLastCommittedURL();
   view_->Show(url_formatter::FormatUrlForSecurityDisplay(
                   url, url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS),
-              is_origin_secure, credentials);
+              TouchToFillView::IsOriginSecure(
+                  network::IsUrlPotentiallyTrustworthy(url)),
+              credentials);
 }
 
 void TouchToFillController::OnCredentialSelected(
diff --git a/chrome/browser/password_manager/touch_to_fill_controller_unittest.cc b/chrome/browser/password_manager/touch_to_fill_controller_unittest.cc
index c44691b..88a46b2c 100644
--- a/chrome/browser/password_manager/touch_to_fill_controller_unittest.cc
+++ b/chrome/browser/password_manager/touch_to_fill_controller_unittest.cc
@@ -9,8 +9,6 @@
 
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/metrics/histogram_tester.h"
-#include "base/test/scoped_feature_list.h"
-#include "components/autofill/core/common/autofill_features.h"
 #include "components/password_manager/core/browser/origin_credential_store.h"
 #include "components/password_manager/core/browser/stub_password_manager_driver.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -143,16 +141,3 @@
   EXPECT_CALL(driver(), TouchToFillDismissed);
   touch_to_fill_controller().OnDismiss();
 }
-
-TEST_F(TouchToFillControllerTest, CanDisableOnHttps) {
-  base::test::ScopedFeatureList scoped_feature_list;
-  scoped_feature_list.InitAndEnableFeatureWithParameters(
-      autofill::features::kTouchToFillAndroid,
-      {
-          {"insecure-origins-only", "true"},
-      });
-
-  EXPECT_CALL(driver(), TouchToFillDismissed);
-  EXPECT_CALL(view(), Show).Times(0);
-  touch_to_fill_controller().Show({}, driver().AsWeakPtr());
-}
diff --git a/chrome/browser/platform_util_unittest.cc b/chrome/browser/platform_util_unittest.cc
index 7d9c38e6..4c01824 100644
--- a/chrome/browser/platform_util_unittest.cc
+++ b/chrome/browser/platform_util_unittest.cc
@@ -29,7 +29,7 @@
 #include "content/public/common/content_client.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/common/fileapi/file_system_types.h"
 #else
diff --git a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
index 00db4e2..0fa0fa34 100644
--- a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
+++ b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
@@ -25,7 +25,7 @@
 #include "ppapi/host/ppapi_host.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/file_system_util.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 
 #if BUILDFLAG(ENABLE_EXTENSIONS)
 #include "extensions/browser/extension_registry.h"
diff --git a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
index 1d5ff1f..b36248d 100644
--- a/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
+++ b/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
@@ -17,7 +17,7 @@
 #include "ppapi/c/private/ppb_isolated_file_system_private.h"
 #include "ppapi/host/resource_host.h"
 #include "ppapi/host/resource_message_filter.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "url/gurl.h"
 
 class Profile;
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc
index 7fad4df..a4acd03c 100644
--- a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc
+++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc
@@ -407,9 +407,9 @@
     performance_manager::mojom::LifecycleState state) {
   TabLifecycleUnit* lifecycle_unit = GetTabLifecycleUnit(web_contents);
 
-  // Some WebContents aren't attached to a tab, so there is no corresponding
-  // TabLifecycleUnit.
-  // TODO(fdoray): This may want to filter for the navigation_id.
+  // Lifecycle state is updated independently from navigations. Therefore, there
+  // is no need to filter out the event if it was generated before the last
+  // navigation.
   if (lifecycle_unit)
     lifecycle_unit->UpdateLifecycleState(state);
 }
diff --git a/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni b/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
index 0ae1562..eb284a84 100644
--- a/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
+++ b/chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni
@@ -16,7 +16,7 @@
                                 ".",
                                 "$closure_library_dir/../bin/build")
 jsbundler_modules +=
-    [ "//third_party/blink/renderer/devtools/scripts/build/rjsmin.py" ]
+    [ "//third_party/devtools-frontend/src/scripts/build/rjsmin.py" ]
 
 template("run_jsbundler") {
   assert(defined(invoker.mode))
diff --git a/chrome/browser/resources/chromeos/chromevox/tools/jsbundler.py b/chrome/browser/resources/chromeos/chromevox/tools/jsbundler.py
index 38c1a84..0e73be3 100755
--- a/chrome/browser/resources/chromeos/chromevox/tools/jsbundler.py
+++ b/chrome/browser/resources/chromeos/chromevox/tools/jsbundler.py
@@ -41,7 +41,7 @@
 _CHROME_SOURCE = os.path.realpath(
     os.path.join(_SCRIPT_DIR, *[os.path.pardir] * 6))
 sys.path.insert(0, os.path.join(
-    _CHROME_SOURCE, 'third_party/blink/renderer/devtools/scripts/build'))
+    _CHROME_SOURCE, 'third_party/devtools-frontend/src/scripts/build'))
 sys.path.insert(0, os.path.join(
     _CHROME_SOURCE, ('third_party/chromevox/third_party/' +
                      'closure-library/closure/bin/build')))
diff --git a/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn b/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn
index 2ce6341..7b3fd4c 100644
--- a/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn
+++ b/chrome/browser/resources/chromeos/crostini_installer/BUILD.gn
@@ -21,6 +21,7 @@
   deps = [
     ":browser_proxy",
     "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+    "//ui/webui/resources/js:load_time_data.m",
   ]
 }
 
diff --git a/chrome/browser/resources/chromeos/crostini_installer/app.html b/chrome/browser/resources/chromeos/crostini_installer/app.html
index 90ffed3..cf48f178 100644
--- a/chrome/browser/resources/chromeos/crostini_installer/app.html
+++ b/chrome/browser/resources/chromeos/crostini_installer/app.html
@@ -1,4 +1,101 @@
-<div>
-  Hello, Crostini Installer!!!
-  <cr-button on-click="onInstallButtonClick_">Install</cr-button>
+<style>
+  #img-linux-illustration {
+    align-self: center;
+    height: 180px;
+    margin-bottom: 80px;
+    width: 448px;
+  }
+
+  #icon {
+    fill: var(--google-blue-600);
+    height: 32px;
+    margin-top: 28px;
+    width: 32px;
+  }
+
+  #main {
+    box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
+    height: 608px;
+    justify-content: space-between;
+    padding: 0 64px;
+    width: 768px;
+  }
+
+  #title {
+    color: var(--cr-primary-text-color);
+    font-family: 'Google Sans';
+    font-size: 28px;
+    line-height: 1;
+    margin-top: 36px;
+  }
+
+  .message-container {
+    color: var(--cr-secondary-text-color);
+    flex-grow: 1;
+    font-family: Roboto;
+    font-size: 13px;
+    line-height: 18px;
+    margin-top: 14px;
+  }
+
+  .message-container > paper-progress {
+    --paper-progress-active-color: var(--google-blue-600);
+    --paper-progress-container-color: rgba(var(--google-blue-600-rgb), .24);
+    margin-top: 36px;
+    width: 100%;
+  }
+
+  #bottom-container {
+    text-align: center;
+  }
+
+  #button-container {
+    display: flex;
+    justify-content: flex-end;
+    margin: 32px 0;
+  }
+</style>
+
+<div id="main">
+  <svg id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 116 121">
+    <path fill-rule="evenodd" d="M33.525 111.127C18.692 103.147 9.128 87.46 8.81 66.719c-1.433.726-3.064.848-4.943.163-5.377-1.96-4.169-8.51-2.197-14.348 1.633-4.835 7.21-8.365 9.942-9.103C17.969 19.072 32.883 0 58 0c25.416 0 40.433 18.285 46.611 43.495 2.8.862 8.129 4.332 9.719 9.04 1.972 5.838 3.18 12.386-2.197 14.347-1.878.685-3.51.563-4.942-.163-.29 20.873-9.852 36.5-24.678 44.438.894.72 1.4 1.651 1.4 2.843 0 3.866 1.882 7-11.913 7-10.067 0-11.785-2.13-11.98-4.447-.668-.422-1.342-1.053-2.02-1.053-.68 0-1.355.682-2.025 1.103C55.76 118.901 53.994 121 44 121c-13.795 0-11.914-3.134-11.914-7 0-1.208.521-2.15 1.439-2.873zM58 107c28.664 0 39-20.35 39-47.4 0-22.444-9.4-43.056-25-46.497C67 12 63.5 24 58 24s-9.5-12-14-10.897C28.334 16.943 19 38.342 19 59.6 19 85.125 29.336 107 58 107zM40 47a6 6 0 110-12 6 6 0 010 12zm36 0a6 6 0 110-12 6 6 0 010 12zm-16.914 3.24l8.234 3.613a2.78 2.78 0 01.934 4.442l-8.188 8.802a2.85 2.85 0 01-4.166-.006l-8.16-8.824a2.77 2.77 0 01.18-3.945c.222-.2.476-.365.75-.487l8.114-3.591a2.856 2.856 0 012.302-.004z"></path>
+  </svg>
+  <div id="title">[[getTitle_(state_)]]</div>
+
+  <!-- Message containers. Depending on the current state, only one of them
+       is visible. -->
+  <div id="prompt-message" class="message-container"
+      hidden="[[!isState_(state_, State.PROMPT)]]">
+    <span>$i18n{promptMessage}</span>
+    <a href="$i18n{learnMoreUrl}" target="_blank">$i18n{learnMore}</a>
+  </div>
+  <div id="installing-message" class="message-container"
+      hidden="[[!isState_(state_, State.INSTALLING)]]">
+    <div>[[getProgressMessage_(installerState_)]]</div>
+    <paper-progress class="progress-bar" value="[[installerProgress_]]">
+    </paper-progress>
+  </div>
+  <div id="error-message" class="message-container"
+      hidden="[[!isState_(state_, State.ERROR)]]">
+    <div>[[getErrorMessage_(error_)]]</div>
+  </div>
+  <div id="canceling-message" class="message-container"
+      hidden="[[!isState_(state_, State.CANCELING)]]">
+    <div>$i18n{cancelingMessage}</div>
+    <paper-progress class="progress-bar" indeterminate></paper-progress>
+  </div>
+
+  <img id="img-linux-illustration" src="images/linux_illustration.png">
+  <div id="button-container">
+    <cr-button class="cancel-button" on-click="onCancelButtonClick_"
+        disabled="[[isState_(state_, State.CANCELING)]]">
+      $i18n{cancel}
+    </cr-button>
+    <cr-button class="action-button" on-click="onInstallButtonClick_"
+        hidden="[[!canInstall_(state_)]]">
+      [[getInstallButtonLabel_(state_)]]
+    </cr-button>
+  </div>
 </div>
diff --git a/chrome/browser/resources/chromeos/crostini_installer/app.js b/chrome/browser/resources/chromeos/crostini_installer/app.js
index 2a733855..27a62f7976 100644
--- a/chrome/browser/resources/chromeos/crostini_installer/app.js
+++ b/chrome/browser/resources/chromeos/crostini_installer/app.js
@@ -3,29 +3,281 @@
 // found in the LICENSE file.
 
 import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
+import 'chrome://resources/cr_elements/shared_vars_css.m.js';
+import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js';
+import './strings.m.js';
 
+import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js';
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
 import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
 
 import {BrowserProxy} from './browser_proxy.js';
 
+/**
+ * Enum for the state of `crostini-installer-app`. Not to confused with
+ * `installerState`.
+ * @enum {string}
+ */
+const State = {
+  PROMPT: 'prompt',
+  INSTALLING: 'installing',
+  ERROR: 'error',
+  CANCELING: 'canceling',
+};
+
+const InstallerState = crostini.mojom.InstallerState;
+const InstallerError = crostini.mojom.InstallerError;
+
 Polymer({
   is: 'crostini-installer-app',
 
   _template: html`{__html_template__}`,
 
+  properties: {
+    /** @private */
+    state_: {
+      type: String,
+      value: State.PROMPT,
+    },
+
+    /** @private */
+    installerState_: {
+      type: Number,
+    },
+
+    /** @private */
+    installerProgress_: {
+      type: Number,
+    },
+
+    /** @private */
+    error_: {
+      type: Number,
+    },
+
+    /**
+     * Enable the html template to use State.
+     * @private
+     */
+    State: {
+      type: Object,
+      value: State,
+    },
+  },
+
   /** @override */
   attached: function() {
     const callbackRouter = BrowserProxy.getInstance().callbackRouter;
-    // TODO(lxj)
+
+    this.listenerIds_ = [
+      callbackRouter.onProgressUpdate.addListener(
+          (installerState, progressFraction) => {
+            this.installerState_ = installerState;
+            this.installerProgress_ = progressFraction * 100;
+          }),
+      callbackRouter.onInstallFinished.addListener(error => {
+        if (error === InstallerError.kNone) {
+          // Install succeeded.
+          this.closeDialog_();
+        } else {
+          assert(this.state_ === State.INSTALLING);
+          this.error_ = error;
+          this.state_ = State.ERROR;
+        }
+      }),
+      callbackRouter.onCanceled.addListener(() => this.closeDialog_()),
+    ];
   },
 
   /** @override */
   detached: function() {
-    // TODO(lxj)
+    const callbackRouter = BrowserProxy.getInstance().callbackRouter;
+    this.listenerIds_.forEach(id => callbackRouter.removeListener(id));
   },
 
   /** @private */
   onInstallButtonClick_: function() {
-    // TODO(lxj)
+    assert(this.state_ === State.PROMPT || this.state_ === State.ERROR);
+    this.installerState_ = InstallerState.kStart;
+    this.installerProgress_ = 0;
+    this.state_ = State.INSTALLING;
+    BrowserProxy.getInstance().handler.install();
+  },
+
+  /** @private */
+  onCancelButtonClick_: function() {
+    switch (this.state_) {
+      case State.PROMPT:
+        BrowserProxy.getInstance().handler.cancelBeforeStart();
+        this.closeDialog_();
+        break;
+      case State.INSTALLING:
+        this.state_ = State.CANCELING;
+        BrowserProxy.getInstance().handler.cancel();
+        break;
+      case State.ERROR:
+        this.closeDialog_();
+        break;
+      default:
+        assertNotReached();
+    }
+  },
+
+  /** @private */
+  closeDialog_: function() {
+    BrowserProxy.getInstance().handler.close();
+  },
+
+  /**
+   * @param {State} state
+   * @returns {string}
+   * @private
+   */
+  getTitle_: function(state) {
+    let titleId;
+    switch (state) {
+      case State.PROMPT:
+        titleId = 'promptTitle';
+        break;
+      case State.INSTALLING:
+        titleId = 'installingTitle';
+        break;
+      case State.ERROR:
+        titleId = 'errorTitle';
+        break;
+      case State.CANCELING:
+        titleId = 'cancelingTitle';
+        break;
+      default:
+        assertNotReached();
+    }
+    return loadTimeData.getString(/** @type {string} */ (titleId));
+  },
+
+  /**
+   * @param {State} state1
+   * @param {State} state2
+   * @returns {boolean}
+   * @private
+   */
+  isState_: function(state1, state2) {
+    return state1 === state2;
+  },
+
+  /**
+   * @param {State} state
+   * @returns {boolean}
+   * @private
+   */
+  canInstall_: function(state) {
+    return state === State.PROMPT || state === State.ERROR;
+  },
+
+  /**
+   * @param {State} state
+   * @returns {string}
+   * @private
+   */
+  getInstallButtonLabel_: function(state) {
+    switch (state) {
+      case State.PROMPT:
+        return loadTimeData.getString('install');
+      case State.ERROR:
+        return loadTimeData.getString('retry');
+    }
+    return '';
+  },
+
+  /**
+   * @param {InstallerState} installerState
+   * @returns {string}
+   * @private
+   */
+  getProgressMessage_: function(installerState) {
+    let messageId = null;
+    switch (installerState) {
+      case InstallerState.kStart:
+        break;
+      case InstallerState.kInstallImageLoader:
+        messageId = 'loadTerminaMessage';
+        break;
+      case InstallerState.kStartConcierge:
+        messageId = 'startConciergeMessage';
+        break;
+      case InstallerState.kCreateDiskImage:
+        messageId = 'createDiskImageMessage';
+        break;
+      case InstallerState.kStartTerminaVm:
+        messageId = 'startTerminaVmMessage';
+        break;
+      case InstallerState.kCreateContainer:
+        // TODO(crbug.com/1015722): we are using the same message as for
+        // |START_CONTAINER|, which is weird because user is going to see
+        // message "start container" then "setup container" and then "start
+        // container" again.
+        messageId = 'startContainerMessage';
+        break;
+      case InstallerState.kSetupContainer:
+        messageId = 'setupContainerMessage';
+        break;
+      case InstallerState.kStartContainer:
+        messageId = 'startContainerMessage';
+        break;
+      case InstallerState.kFetchSshKeys:
+        messageId = 'fetchSshKeysMessage';
+        break;
+      case InstallerState.kMountContainer:
+        messageId = 'mountContainerMessage';
+        break;
+      default:
+        assertNotReached();
+    }
+
+    return messageId ? loadTimeData.getString(messageId) : '';
+  },
+
+  /**
+   * @param {InstallerError} error
+   * @returns {string}
+   * @private
+   */
+  getErrorMessage_: function(error) {
+    let messageId = null;
+    switch (error) {
+      case InstallerError.kErrorLoadingTermina:
+        messageId = 'loadTerminaError';
+        break;
+      case InstallerError.kErrorStartingConcierge:
+        messageId = 'startConciergeError';
+        break;
+      case InstallerError.kErrorCreatingDiskImage:
+        messageId = 'createDiskImageError';
+        break;
+      case InstallerError.kErrorStartingTermina:
+        messageId = 'startTerminaVmError';
+        break;
+      case InstallerError.kErrorStartingContainer:
+        messageId = 'startContainerError';
+        break;
+      case InstallerError.kErrorOffline:
+        messageId = 'offlineError';
+        break;
+      case InstallerError.kErrorFetchingSshKeys:
+        messageId = 'fetchSshKeysError';
+        break;
+      case InstallerError.kErrorMountingContainer:
+        messageId = 'mountContainerError';
+        break;
+      case InstallerError.kErrorSettingUpContainer:
+        messageId = 'setupContainerError';
+        break;
+      case InstallerError.kErrorInsufficientDiskSpace:
+        messageId = 'insufficientDiskError';
+        break;
+      default:
+        assertNotReached();
+    }
+
+    return messageId ? loadTimeData.getString(messageId) : '';
   },
 });
diff --git a/chrome/browser/resources/chromeos/crostini_installer/browser_proxy.js b/chrome/browser/resources/chromeos/crostini_installer/browser_proxy.js
index c9a34b3..e7a38ed 100644
--- a/chrome/browser/resources/chromeos/crostini_installer/browser_proxy.js
+++ b/chrome/browser/resources/chromeos/crostini_installer/browser_proxy.js
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// TODO(lxj): use es6 module when it is ready crbug/1004256
+import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
+import './crostini_installer_types.mojom-lite.js';
 import './crostini_installer.mojom-lite.js';
 
 import {addSingletonGetter} from 'chrome://resources/js/cr.m.js';
diff --git a/chrome/browser/resources/chromeos/crostini_installer/index.html b/chrome/browser/resources/chromeos/crostini_installer/index.html
index e72a408..8007847 100644
--- a/chrome/browser/resources/chromeos/crostini_installer/index.html
+++ b/chrome/browser/resources/chromeos/crostini_installer/index.html
@@ -2,8 +2,12 @@
 <html dir="$i18n{textdirection}" lang="$i18n{language}">
 <head>
   <meta charset="utf8">
-  <script src="chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js">
-  </script>
+  <style>
+    body {
+      margin: 0;
+    }
+  </style>
+  <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
   <script type="module" src="app.js"></script>
 </head>
 <body>
diff --git a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js
index 56cadb8..44806f0 100644
--- a/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js
+++ b/chrome/browser/resources/chromeos/login/screen_arc_terms_of_service.js
@@ -304,8 +304,7 @@
       if (!isDemoModeSetup) {
         this.getElement_('arc-review-settings').hidden = false;
       }
-      this.getElement_('arc-tos-container').scrollTop =
-          this.getElement_('arc-tos-container').scrollHeight;
+      $('arc-tos-root').getElement('arc-tos-dialog').scrollToBottom();
       this.getElement_('arc-tos-next-button').hidden = true;
       this.getElement_('arc-tos-accept-button').hidden = false;
       this.getElement_('arc-tos-accept-button').focus();
@@ -608,12 +607,11 @@
       this.getElement_('arc-pai-service').hidden = true;
       this.getElement_('arc-google-service-confirmation').hidden = true;
       this.getElement_('arc-review-settings').hidden = true;
-      this.getElement_('arc-tos-container').scrollTop =
-          this.getElement_('arc-tos-container').scrollHeight;
       this.getElement_('arc-tos-next-button').hidden = false;
       this.getElement_('arc-tos-accept-button').hidden = true;
       this.getElement_('arc-tos-next-button').focus();
       this.removeClass_('arc-tos-disable-skip');
+      $('arc-tos-root').getElement('arc-tos-dialog').scrollToBottom();
     },
 
     /**
diff --git a/chrome/browser/signin/signin_profile_attributes_updater.cc b/chrome/browser/signin/signin_profile_attributes_updater.cc
index 61a20a0d..8d5b5dc 100644
--- a/chrome/browser/signin/signin_profile_attributes_updater.cc
+++ b/chrome/browser/signin/signin_profile_attributes_updater.cc
@@ -63,7 +63,6 @@
       !gaia::AreEmailsSame(account_info.email,
                            base::UTF16ToUTF8(entry->GetUserName()))) {
     // Reset prefs. Note: this will also update the |ProfileAttributesEntry|.
-    prefs_->ClearPref(prefs::kProfileUsingDefaultName);
     prefs_->ClearPref(prefs::kProfileUsingDefaultAvatar);
     prefs_->ClearPref(prefs::kProfileUsingGAIAAvatar);
   }
diff --git a/chrome/browser/signin/signin_profile_attributes_updater_unittest.cc b/chrome/browser/signin/signin_profile_attributes_updater_unittest.cc
index 216796a..398b26eb 100644
--- a/chrome/browser/signin/signin_profile_attributes_updater_unittest.cc
+++ b/chrome/browser/signin/signin_profile_attributes_updater_unittest.cc
@@ -28,20 +28,17 @@
 
 #if !defined(OS_CHROMEOS)
 void CheckProfilePrefsReset(PrefService* pref_service) {
-  EXPECT_TRUE(pref_service->GetBoolean(prefs::kProfileUsingDefaultName));
   EXPECT_TRUE(pref_service->GetBoolean(prefs::kProfileUsingDefaultAvatar));
   EXPECT_FALSE(pref_service->GetBoolean(prefs::kProfileUsingGAIAAvatar));
 }
 
 void CheckProfilePrefsSet(PrefService* pref_service) {
-  EXPECT_FALSE(pref_service->GetBoolean(prefs::kProfileUsingDefaultName));
   EXPECT_FALSE(pref_service->GetBoolean(prefs::kProfileUsingDefaultAvatar));
   EXPECT_TRUE(pref_service->GetBoolean(prefs::kProfileUsingGAIAAvatar));
 }
 
 // Set the prefs to nondefault values.
 void SetProfilePrefs(PrefService* pref_service) {
-  pref_service->SetBoolean(prefs::kProfileUsingDefaultName, false);
   pref_service->SetBoolean(prefs::kProfileUsingDefaultAvatar, false);
   pref_service->SetBoolean(prefs::kProfileUsingGAIAAvatar, true);
   CheckProfilePrefsSet(pref_service);
diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc
index f65ddf9..66849ba 100644
--- a/chrome/browser/signin/signin_ui_util.cc
+++ b/chrome/browser/signin/signin_ui_util.cc
@@ -365,6 +365,13 @@
 
 void RecordProfileMenuViewShown(Profile* profile) {
   base::RecordAction(base::UserMetricsAction("ProfileMenu_Opened"));
+  if (profile->IsRegularProfile()) {
+    base::RecordAction(base::UserMetricsAction("ProfileMenu_Opened_Regular"));
+  } else if (profile->IsGuestSession()) {
+    base::RecordAction(base::UserMetricsAction("ProfileMenu_Opened_Guest"));
+  } else if (profile->IsIncognitoProfile()) {
+    base::RecordAction(base::UserMetricsAction("ProfileMenu_Opened_Incognito"));
+  }
 
   base::TimeTicks animation_last_shown =
       AnimatedIdentityUserData::GetLastShown(profile);
@@ -375,4 +382,19 @@
                               base::TimeTicks::Now() - animation_last_shown);
 }
 
+void RecordProfileMenuClick(Profile* profile) {
+  base::RecordAction(
+      base::UserMetricsAction("ProfileMenu_ActionableItemClicked"));
+  if (profile->IsRegularProfile()) {
+    base::RecordAction(
+        base::UserMetricsAction("ProfileMenu_ActionableItemClicked_Regular"));
+  } else if (profile->IsGuestSession()) {
+    base::RecordAction(
+        base::UserMetricsAction("ProfileMenu_ActionableItemClicked_Guest"));
+  } else if (profile->IsIncognitoProfile()) {
+    base::RecordAction(
+        base::UserMetricsAction("ProfileMenu_ActionableItemClicked_Incognito"));
+  }
+}
+
 }  // namespace signin_ui_util
diff --git a/chrome/browser/signin/signin_ui_util.h b/chrome/browser/signin/signin_ui_util.h
index 0248a4c6..18628b16 100644
--- a/chrome/browser/signin/signin_ui_util.h
+++ b/chrome/browser/signin/signin_ui_util.h
@@ -109,6 +109,9 @@
 // Called when the ProfileMenuView is opened. Used for metrics.
 void RecordProfileMenuViewShown(Profile* profile);
 
+// Called when a button/link in the profile menu was clicked.
+void RecordProfileMenuClick(Profile* profile);
+
 }  // namespace signin_ui_util
 
 #endif  // CHROME_BROWSER_SIGNIN_SIGNIN_UI_UTIL_H_
diff --git a/chrome/browser/sync/sync_encryption_keys_tab_helper.cc b/chrome/browser/sync/sync_encryption_keys_tab_helper.cc
new file mode 100644
index 0000000..8a312f4
--- /dev/null
+++ b/chrome/browser/sync/sync_encryption_keys_tab_helper.cc
@@ -0,0 +1,125 @@
+// Copyright 2019 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 "chrome/browser/sync/sync_encryption_keys_tab_helper.h"
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "base/no_destructor.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/common/sync_encryption_keys_extension.mojom.h"
+#include "components/sync/driver/sync_service.h"
+#include "components/sync/driver/sync_user_settings.h"
+#include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_binding_set.h"
+#include "google_apis/gaia/core_account_id.h"
+#include "google_apis/gaia/gaia_urls.h"
+#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
+#include "url/origin.h"
+
+namespace {
+
+const url::Origin& GetAllowedOrigin() {
+  static const base::NoDestructor<url::Origin> origin(
+      url::Origin::Create(GaiaUrls::GetInstance()->gaia_url()));
+  CHECK(!origin->opaque());
+  return *origin;
+}
+
+bool ShouldExposeMojoApi(content::NavigationHandle* navigation_handle) {
+  if (!navigation_handle->IsInMainFrame() ||
+      !navigation_handle->HasCommitted() || navigation_handle->IsErrorPage()) {
+    return false;
+  }
+  // Restrict to allowed origin only.
+  return url::Origin::Create(navigation_handle->GetURL()) == GetAllowedOrigin();
+}
+
+}  // namespace
+
+class SyncEncryptionKeysTabHelper::EncryptionKeyApi
+    : public chrome::mojom::SyncEncryptionKeysExtension {
+ public:
+  EncryptionKeyApi(content::WebContents* web_contents,
+                   syncer::SyncService* sync_service)
+      : sync_service_(sync_service), bindings_(web_contents, this) {
+    DCHECK(web_contents);
+    DCHECK(sync_service);
+  }
+
+  // chrome::mojom::SyncEncryptionKeysExtension:
+  void SetEncryptionKeys(const std::vector<std::string>& encryption_keys,
+                         const std::string& account_id,
+                         SetEncryptionKeysCallback callback) override {
+    CHECK_EQ(bindings_.GetCurrentTargetFrame()->GetLastCommittedOrigin(),
+             GetAllowedOrigin());
+
+    sync_service_->GetUserSettings()->AddTrustedVaultDecryptionKeys(
+        CoreAccountId(account_id), encryption_keys);
+    std::move(callback).Run();
+  }
+
+ private:
+  syncer::SyncService* const sync_service_;
+
+  content::WebContentsFrameBindingSet<
+      chrome::mojom::SyncEncryptionKeysExtension>
+      bindings_;
+
+  DISALLOW_COPY_AND_ASSIGN(EncryptionKeyApi);
+};
+
+// static
+void SyncEncryptionKeysTabHelper::CreateForWebContents(
+    content::WebContents* web_contents) {
+  DCHECK(web_contents);
+
+  if (FromWebContents(web_contents)) {
+    return;
+  }
+
+  if (web_contents->GetBrowserContext()->IsOffTheRecord()) {
+    return;
+  }
+
+  syncer::SyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(
+      Profile::FromBrowserContext(web_contents->GetBrowserContext()));
+  if (!sync_service) {
+    return;
+  }
+
+  web_contents->SetUserData(UserDataKey(),
+                            base::WrapUnique(new SyncEncryptionKeysTabHelper(
+                                web_contents, sync_service)));
+}
+
+SyncEncryptionKeysTabHelper::SyncEncryptionKeysTabHelper(
+    content::WebContents* web_contents,
+    syncer::SyncService* sync_service)
+    : content::WebContentsObserver(web_contents), sync_service_(sync_service) {
+  DCHECK(web_contents);
+  DCHECK(sync_service);
+}
+
+SyncEncryptionKeysTabHelper::~SyncEncryptionKeysTabHelper() = default;
+
+void SyncEncryptionKeysTabHelper::DidFinishNavigation(
+    content::NavigationHandle* navigation_handle) {
+  if (navigation_handle->IsSameDocument()) {
+    return;
+  }
+
+  if (!ShouldExposeMojoApi(navigation_handle)) {
+    encryption_key_api_.reset();
+  } else if (!encryption_key_api_) {
+    encryption_key_api_ =
+        std::make_unique<EncryptionKeyApi>(web_contents(), sync_service_);
+  }
+}
+
+WEB_CONTENTS_USER_DATA_KEY_IMPL(SyncEncryptionKeysTabHelper)
diff --git a/chrome/browser/sync/sync_encryption_keys_tab_helper.h b/chrome/browser/sync/sync_encryption_keys_tab_helper.h
new file mode 100644
index 0000000..d0f5e58e
--- /dev/null
+++ b/chrome/browser/sync/sync_encryption_keys_tab_helper.h
@@ -0,0 +1,55 @@
+// Copyright 2019 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 CHROME_BROWSER_SYNC_SYNC_ENCRYPTION_KEYS_TAB_HELPER_H_
+#define CHROME_BROWSER_SYNC_SYNC_ENCRYPTION_KEYS_TAB_HELPER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+namespace content {
+class WebContents;
+}  // namespace content
+
+namespace syncer {
+class SyncService;
+}  // namespace syncer
+
+// SyncEncryptionKeysTabHelper is responsible for installing Mojo API in order
+// to receive sync encryption keys from the renderer process.
+class SyncEncryptionKeysTabHelper
+    : public content::WebContentsUserData<SyncEncryptionKeysTabHelper>,
+      public content::WebContentsObserver {
+ public:
+  static void CreateForWebContents(content::WebContents* web_contents);
+
+  ~SyncEncryptionKeysTabHelper() override;
+
+  // content::WebContentsObserver:
+  void DidFinishNavigation(
+      content::NavigationHandle* navigation_handle) override;
+
+ private:
+  friend class content::WebContentsUserData<SyncEncryptionKeysTabHelper>;
+
+  SyncEncryptionKeysTabHelper(content::WebContents* web_contents,
+                              syncer::SyncService* sync_service);
+
+  syncer::SyncService* const sync_service_;
+
+  // EncryptionKeyApi represent the actual exposure of the Mojo API (i.e.
+  // chrome::mojom::SyncEncryptionKeysExtension) to the renderer. Instantiated
+  // only for allowed origins.
+  class EncryptionKeyApi;
+  std::unique_ptr<EncryptionKeyApi> encryption_key_api_;
+
+  WEB_CONTENTS_USER_DATA_KEY_DECL();
+
+  DISALLOW_COPY_AND_ASSIGN(SyncEncryptionKeysTabHelper);
+};
+
+#endif  // CHROME_BROWSER_SYNC_SYNC_ENCRYPTION_KEYS_TAB_HELPER_H_
diff --git a/chrome/browser/sync/sync_encryption_keys_tab_helper_unittest.cc b/chrome/browser/sync/sync_encryption_keys_tab_helper_unittest.cc
new file mode 100644
index 0000000..d551e5455
--- /dev/null
+++ b/chrome/browser/sync/sync_encryption_keys_tab_helper_unittest.cc
@@ -0,0 +1,87 @@
+// Copyright 2019 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 "chrome/browser/sync/sync_encryption_keys_tab_helper.h"
+
+#include "base/macros.h"
+#include "base/memory/scoped_refptr.h"
+#include "chrome/common/sync_encryption_keys_extension.mojom.h"
+#include "chrome/test/base/chrome_render_view_host_test_harness.h"
+#include "content/public/browser/web_contents_binding_set.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/test/web_contents_tester.h"
+#include "google_apis/gaia/gaia_urls.h"
+#include "net/base/net_errors.h"
+#include "net/http/http_response_headers.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+using testing::IsNull;
+using testing::NotNull;
+
+class SyncEncryptionKeysTabHelperTest : public ChromeRenderViewHostTestHarness {
+ protected:
+  SyncEncryptionKeysTabHelperTest() = default;
+
+  ~SyncEncryptionKeysTabHelperTest() override = default;
+
+  // content::RenderViewHostTestHarness:
+  void SetUp() override {
+    ChromeRenderViewHostTestHarness::SetUp();
+    SyncEncryptionKeysTabHelper::CreateForWebContents(web_contents());
+  }
+
+  content::WebContentsTester* web_contents_tester() {
+    return content::WebContentsTester::For(web_contents());
+  }
+
+  content::WebContentsBindingSet* frame_binding_set() {
+    return content::WebContentsBindingSet::GetForWebContents<
+        chrome::mojom::SyncEncryptionKeysExtension>(web_contents());
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(SyncEncryptionKeysTabHelperTest);
+};
+
+TEST_F(SyncEncryptionKeysTabHelperTest, ShouldExposeMojoApiToAllowedOrigin) {
+  ASSERT_THAT(frame_binding_set(), IsNull());
+  web_contents_tester()->NavigateAndCommit(GaiaUrls::GetInstance()->gaia_url());
+  EXPECT_THAT(frame_binding_set(), NotNull());
+}
+
+TEST_F(SyncEncryptionKeysTabHelperTest,
+       ShouldNotExposeMojoApiToUnallowedOrigin) {
+  web_contents_tester()->NavigateAndCommit(GURL("http://page.com"));
+  EXPECT_THAT(frame_binding_set(), IsNull());
+}
+
+TEST_F(SyncEncryptionKeysTabHelperTest, ShouldNotExposeMojoApiIfNavigatedAway) {
+  web_contents_tester()->NavigateAndCommit(GaiaUrls::GetInstance()->gaia_url());
+  ASSERT_THAT(frame_binding_set(), NotNull());
+  web_contents_tester()->NavigateAndCommit(GURL("http://page.com"));
+  EXPECT_THAT(frame_binding_set(), IsNull());
+}
+
+TEST_F(SyncEncryptionKeysTabHelperTest,
+       ShouldNotExposeMojoApiIfNavigationFailed) {
+  web_contents_tester()->NavigateAndFail(
+      GaiaUrls::GetInstance()->gaia_url(), net::ERR_ABORTED,
+      base::MakeRefCounted<net::HttpResponseHeaders>("some_headers"));
+  EXPECT_THAT(frame_binding_set(), IsNull());
+}
+
+TEST_F(SyncEncryptionKeysTabHelperTest,
+       ShouldNotExposeMojoApiIfNavigatedAwayToErrorPage) {
+  web_contents_tester()->NavigateAndCommit(GaiaUrls::GetInstance()->gaia_url());
+  ASSERT_THAT(frame_binding_set(), NotNull());
+  web_contents_tester()->NavigateAndFail(
+      GURL("http://page.com"), net::ERR_ABORTED,
+      base::MakeRefCounted<net::HttpResponseHeaders>("some_headers"));
+  EXPECT_THAT(frame_binding_set(), IsNull());
+}
+
+}  // namespace
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc
index c9b43fc..f51a5ab 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.cc
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -46,11 +46,11 @@
 #include "components/history/core/browser/history_types.h"
 #include "components/sync/driver/profile_sync_service.h"
 #include "components/sync/test/fake_server/entity_builder_factory.h"
-#include "components/sync_bookmarks/bookmark_change_processor.h"
 #include "content/public/test/test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "ui/base/models/tree_node_iterator.h"
+#include "ui/gfx/favicon_size.h"
 #include "ui/gfx/image/image_skia.h"
 
 using bookmarks::BookmarkModel;
@@ -58,6 +58,44 @@
 
 namespace {
 
+void ApplyBookmarkFavicon(
+    const BookmarkNode* bookmark_node,
+    favicon::FaviconService* favicon_service,
+    const GURL& icon_url,
+    const scoped_refptr<base::RefCountedMemory>& bitmap_data) {
+  // Some tests use no services.
+  if (favicon_service == nullptr)
+    return;
+
+  favicon_service->AddPageNoVisitForBookmark(bookmark_node->url(),
+                                             bookmark_node->GetTitle());
+
+  GURL icon_url_to_use = icon_url;
+
+  if (icon_url.is_empty()) {
+    if (bitmap_data->size() == 0) {
+      // Empty icon URL and no bitmap data means no icon mapping.
+      favicon_service->DeleteFaviconMappings({bookmark_node->url()},
+                                             favicon_base::IconType::kFavicon);
+      return;
+    } else {
+      // Ancient clients (prior to M25) may not be syncing the favicon URL. If
+      // the icon URL is not synced, use the page URL as a fake icon URL as it
+      // is guaranteed to be unique.
+      icon_url_to_use = bookmark_node->url();
+    }
+  }
+
+  // The client may have cached the favicon at 2x. Use MergeFavicon() as not to
+  // overwrite the cached 2x favicon bitmap. Sync favicons are always
+  // gfx::kFaviconSize in width and height. Store the favicon into history
+  // as such.
+  gfx::Size pixel_size(gfx::kFaviconSize, gfx::kFaviconSize);
+  favicon_service->MergeFavicon(bookmark_node->url(), icon_url_to_use,
+                                favicon_base::IconType::kFavicon, bitmap_data,
+                                pixel_size);
+}
+
 // History task which signals an event.
 class SignalEventTask : public history::HistoryDBTask {
  public:
@@ -248,14 +286,13 @@
   if (favicon_source == bookmarks_helper::FROM_UI) {
     favicon_service->SetFavicons({node->url()}, icon_url,
                                  favicon_base::IconType::kFavicon, image);
-    } else {
-      sync_bookmarks::BookmarkChangeProcessor::ApplyBookmarkFavicon(
-          node, favicon_service, icon_url, image.As1xPNGBytes());
-    }
+  } else {
+    ApplyBookmarkFavicon(node, favicon_service, icon_url, image.As1xPNGBytes());
+  }
 
-    // Wait for the favicon for |node| to be invalidated.
-    observer.WaitForSetFavicon();
-    model->GetFavicon(node);
+  // Wait for the favicon for |node| to be invalidated.
+  observer.WaitForSetFavicon();
+  model->GetFavicon(node);
 }
 
 // Expires the favicon for |profile| and |node|. |profile| may be
@@ -293,7 +330,7 @@
     favicon_service->DeleteFaviconMappings({node->url()},
                                            favicon_base::IconType::kFavicon);
   } else {
-    sync_bookmarks::BookmarkChangeProcessor::ApplyBookmarkFavicon(
+    ApplyBookmarkFavicon(
         node, favicon_service, /*icon_url=*/GURL(),
         scoped_refptr<base::RefCountedString>(new base::RefCountedString()));
   }
diff --git a/chrome/browser/sync/test/integration/encryption_helper.cc b/chrome/browser/sync/test/integration/encryption_helper.cc
index 497cddd..2fabb33 100644
--- a/chrome/browser/sync/test/integration/encryption_helper.cc
+++ b/chrome/browser/sync/test/integration/encryption_helper.cc
@@ -179,6 +179,23 @@
          std::string(desired_state_ ? "required" : "not required");
 }
 
+TrustedVaultKeyRequiredStateChecker::TrustedVaultKeyRequiredStateChecker(
+    syncer::ProfileSyncService* service,
+    bool desired_state)
+    : SingleClientStatusChangeChecker(service), desired_state_(desired_state) {}
+
+bool TrustedVaultKeyRequiredStateChecker::IsExitConditionSatisfied() {
+  return service()
+             ->GetUserSettings()
+             ->IsTrustedVaultKeyRequiredForPreferredDataTypes() ==
+         desired_state_;
+}
+
+std::string TrustedVaultKeyRequiredStateChecker::GetDebugMessage() const {
+  return "Waiting until trusted vault keys are " +
+         std::string(desired_state_ ? "required" : "not required");
+}
+
 ScopedScryptFeatureToggler::ScopedScryptFeatureToggler(
     bool force_disabled,
     bool use_for_new_passphrases) {
diff --git a/chrome/browser/sync/test/integration/encryption_helper.h b/chrome/browser/sync/test/integration/encryption_helper.h
index 4166bba..abac349 100644
--- a/chrome/browser/sync/test/integration/encryption_helper.h
+++ b/chrome/browser/sync/test/integration/encryption_helper.h
@@ -61,8 +61,8 @@
   std::string GetDebugMessage() const override;
 
  private:
-  fake_server::FakeServer* fake_server_;
-  syncer::PassphraseType expected_passphrase_type_;
+  fake_server::FakeServer* const fake_server_;
+  const syncer::PassphraseType expected_passphrase_type_;
 };
 
 // Checker used to block until Sync requires or stops requiring a passphrase.
@@ -75,7 +75,22 @@
   std::string GetDebugMessage() const override;
 
  private:
-  bool desired_state_;
+  const bool desired_state_;
+};
+
+// Checker used to block until Sync requires or stops requiring trusted vault
+// keys.
+class TrustedVaultKeyRequiredStateChecker
+    : public SingleClientStatusChangeChecker {
+ public:
+  TrustedVaultKeyRequiredStateChecker(syncer::ProfileSyncService* service,
+                                      bool desired_state);
+
+  bool IsExitConditionSatisfied() override;
+  std::string GetDebugMessage() const override;
+
+ private:
+  const bool desired_state_;
 };
 
 // Helper for setting scrypt-related feature flags.
diff --git a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
index abe9d89..4b089ea9 100644
--- a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
@@ -10,7 +10,6 @@
 #include "base/test/metrics/histogram_tester.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
-#include "chrome/browser/sync/test/integration/feature_toggler.h"
 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
 #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
 #include "chrome/browser/sync/test/integration/sync_test.h"
@@ -60,10 +59,9 @@
 // fake server across PRE_MyTest and MyTest.
 const char kBookmarkGuid[] = "e397ed62-9532-4dbf-ae55-200236eba15c";
 
-class SingleClientBookmarksSyncTest : public FeatureToggler, public SyncTest {
+class SingleClientBookmarksSyncTest : public SyncTest {
  public:
-  SingleClientBookmarksSyncTest()
-      : FeatureToggler(switches::kSyncUSSBookmarks), SyncTest(SINGLE_CLIENT) {}
+  SingleClientBookmarksSyncTest() : SyncTest(SINGLE_CLIENT) {}
   ~SingleClientBookmarksSyncTest() override {}
 
   // Verify that the local bookmark model (for the Profile corresponding to
@@ -92,7 +90,7 @@
   }
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, Sanity) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
 
   // Starting state:
@@ -226,7 +224,7 @@
     VerifyBookmarkModelMatchesFakeServer(kSingleProfileIndex);
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, CommitLocalCreations) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, CommitLocalCreations) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
 
   // Starting state:
@@ -267,7 +265,7 @@
   EXPECT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, InjectedBookmark) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, InjectedBookmark) {
   std::string title = "Montreal Canadiens";
   fake_server::EntityBuilderFactory entity_builder_factory;
   fake_server::BookmarkEntityBuilder bookmark_builder =
@@ -285,7 +283,7 @@
 // Test that a client doesn't mutate the favicon data in the process
 // of storing the favicon data from sync to the database or in the process
 // of requesting data from the database for sync.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        SetFaviconHiDPIDifferentCodec) {
   // Set the supported scale factors to 1x and 2x such that
   // BookmarkModel::GetFavicon() requests both 1x and 2x.
@@ -330,7 +328,7 @@
 
 // Test that a client deletes favicons from sync when they have been removed
 // from the local database.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, DeleteFaviconFromSync) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, DeleteFaviconFromSync) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
 
@@ -356,7 +354,7 @@
       GetBookmarkModel(kSingleProfileIndex)->GetFavicon(bookmark).IsEmpty());
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        BookmarkAllNodesRemovedEvent) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   // Starting state:
@@ -417,7 +415,7 @@
   ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, DownloadDeletedBookmark) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, DownloadDeletedBookmark) {
   std::string title = "Patrick Star";
   fake_server::EntityBuilderFactory entity_builder_factory;
   fake_server::BookmarkEntityBuilder bookmark_builder =
@@ -447,7 +445,7 @@
                   .Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        DownloadModifiedBookmark) {
   std::string title = "Syrup";
   GURL original_url = GURL("https://en.wikipedia.org/?title=Maple_syrup");
@@ -486,7 +484,7 @@
   ASSERT_EQ(1u, CountBookmarksWithTitlesMatching(kSingleProfileIndex, title));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, DownloadBookmarkFolder) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, DownloadBookmarkFolder) {
   const std::string title = "Seattle Sounders FC";
   fake_server::EntityBuilderFactory entity_builder_factory;
   fake_server::BookmarkEntityBuilder bookmark_builder =
@@ -502,7 +500,7 @@
   ASSERT_EQ(1u, CountFoldersWithTitlesMatching(kSingleProfileIndex, title));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        DownloadLegacyBookmarkFolder) {
   const std::string title = "Seattle Sounders FC";
   fake_server::EntityBuilderFactory entity_builder_factory;
@@ -523,7 +521,7 @@
 // before committing them because historically they were illegal server titles.
 // This test makes sure that this functionality is implemented for backward
 // compatibility with legacy clients.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        ShouldCommitBookmarksWithIllegalServerNames) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
@@ -558,7 +556,7 @@
 // commit because historically they were considered illegal server titles. This
 // test makes sure that this functionality is implemented for backward
 // compatibility with legacy clients.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        ShouldCreateLocalBookmarksWithIllegalServerNames) {
   const std::vector<std::string> illegal_titles = {"", ".", ".."};
 
@@ -586,7 +584,7 @@
 
 // Legacy bookmark clients append a blank space to empty titles. This tests that
 // this is respected when merging local and remote hierarchies.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        ShouldTruncateBlanksWhenMatchingTitles) {
   const std::string remote_blank_title = " ";
   const std::string local_empty_title = "";
@@ -621,7 +619,7 @@
 
 // Legacy bookmark clients truncate long titles up to 255 bytes. This tests that
 // this is respected when merging local and remote hierarchies.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        ShouldTruncateLongTitles) {
   const std::string remote_truncated_title =
       "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst"
@@ -661,7 +659,7 @@
                                                    remote_truncated_title));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        DownloadBookmarkFoldersWithPositions) {
   const std::string title0 = "Folder left";
   const std::string title1 = "Folder middle";
@@ -701,11 +699,11 @@
   EXPECT_EQ(base::ASCIIToUTF16(title2), bar->children()[2]->GetTitle());
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) {
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) {
   ASSERT_TRUE(SetupSync()) <<  "SetupSync() failed.";
 }
 
-IN_PROC_BROWSER_TEST_P(
+IN_PROC_BROWSER_TEST_F(
     SingleClientBookmarksSyncTest,
     RemoveRightAfterAddShouldNotSendCommitRequestsOrTombstones) {
   base::HistogramTester histogram_tester;
@@ -736,7 +734,7 @@
                                          /*LOCAL_DELETION=*/0));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        PRE_PersistProgressMarkerOnRestart) {
   const std::string title = "Seattle Sounders FC";
   fake_server::EntityBuilderFactory entity_builder_factory;
@@ -755,7 +753,7 @@
                                          /*REMOTE_INITIAL_UPDATE=*/5));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        PersistProgressMarkerOnRestart) {
   const std::string title = "Seattle Sounders FC";
   fake_server::EntityBuilderFactory entity_builder_factory;
@@ -789,12 +787,8 @@
 
 // TODO(crbug.com/1012222): re-enable this test on all builders once flakiness
 // is addressed.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        DISABLED_ApplyRemoteCreationWithValidGUID) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   // Start syncing.
   DisableVerifier();
   ASSERT_TRUE(SetupSync());
@@ -821,12 +815,8 @@
       GetBookmarkBarNode(kSingleProfileIndex)->children()[0].get()->guid());
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        ApplyRemoteCreationWithoutValidGUID) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   // Start syncing.
   DisableVerifier();
   ASSERT_TRUE(SetupSync());
@@ -866,12 +856,8 @@
 #define MAYBE_ApplyRemoteCreationWithoutValidGUIDOrOCII \
   ApplyRemoteCreationWithoutValidGUIDOrOCII
 #endif
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        MAYBE_ApplyRemoteCreationWithoutValidGUIDOrOCII) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   // Start syncing.
   DisableVerifier();
   ASSERT_TRUE(SetupSync());
@@ -901,12 +887,8 @@
                                             originator_client_item_id));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        MergeRemoteCreationWithValidGUID) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   const GURL url = GURL("http://www.foo.com");
   fake_server::EntityBuilderFactory entity_builder_factory;
   fake_server::BookmarkEntityBuilder bookmark_builder =
@@ -931,12 +913,8 @@
   EXPECT_TRUE(ContainsBookmarkNodeWithGUID(kSingleProfileIndex, guid));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        MergeRemoteCreationWithoutValidGUID) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   const GURL url = GURL("http://www.foo.com");
   const std::string originator_client_item_id = base::GenerateGUID();
   fake_server::EntityBuilderFactory entity_builder_factory;
@@ -965,12 +943,8 @@
                                            originator_client_item_id));
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        MergeRemoteCreationWithoutValidGUIDOrOCII) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   const GURL url = GURL("http://www.foo.com");
   const std::string originator_client_item_id = "INVALID OCII";
   fake_server::EntityBuilderFactory entity_builder_factory;
@@ -1002,13 +976,8 @@
 
 // TODO(crbug.com/1012223): re-enable this test on all builders once flakiness
 // is addressed.
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        DISABLED_ApplyRemoteUpdateWithValidGUID) {
-  // This test is only relevant for USS code path and when BookmarkNode GUID
-  // replacement is enabled.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   // Create a bookmark.
   const GURL url = GURL("https://foo.com");
   fake_server::EntityBuilderFactory entity_builder_factory;
@@ -1053,12 +1022,8 @@
       GetBookmarkBarNode(kSingleProfileIndex)->children()[0].get()->guid());
 }
 
-IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
                        MergeRemoteUpdateWithValidGUID) {
-  // This test is only relevant for USS code path.
-  if (!base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks))
-    return;
-
   DisableVerifier();
   ASSERT_TRUE(SetupClients());
 
@@ -1090,8 +1055,4 @@
   EXPECT_EQ(1u, GetBookmarkBarNode(kSingleProfileIndex)->children().size());
 }
 
-INSTANTIATE_TEST_SUITE_P(USS,
-                         SingleClientBookmarksSyncTest,
-                         ::testing::Values(false, true));
-
 }  // namespace
diff --git a/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc b/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc
index 95497c1..2c0161e 100644
--- a/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc
@@ -191,8 +191,7 @@
       // USS Nigori requires USS implementations to be enabled for all
       // datatypes.
       override_features_.InitWithFeatures(
-          /*enabled_features=*/{switches::kSyncUSSBookmarks,
-                                switches::kSyncUSSPasswords,
+          /*enabled_features=*/{switches::kSyncUSSPasswords,
                                 switches::kSyncUSSNigori},
           /*disabled_features=*/{});
     } else {
@@ -213,10 +212,21 @@
     : public SingleClientCustomPassphraseSyncTest {
  public:
   SingleClientCustomPassphraseForceDisableScryptSyncTest()
-      : features_(/*force_disabled=*/true, /*use_for_new_passphrases=*/false) {}
+      : features_(/*force_disabled=*/true, /*use_for_new_passphrases=*/false) {
+    // Creation of NigoriSpecifics with scrypt derivation method requires
+    // |force_disabled| temporary set to false.
+    ScopedScryptFeatureToggler toggler(/*force_disabled=*/false,
+                                       /*use_for_new_passphrases_=*/false);
+    KeyParams key_params = {
+        KeyDerivationParams::CreateForScrypt("someConstantSalt"), "hunter2"};
+    scrypt_nigori_ = CreateCustomPassphraseNigori(key_params);
+  }
+
+  const sync_pb::NigoriSpecifics& scrypt_nigori() { return scrypt_nigori_; }
 
  private:
   ScopedScryptFeatureToggler features_;
+  sync_pb::NigoriSpecifics scrypt_nigori_;
 };
 
 class SingleClientCustomPassphraseDoNotUseScryptSyncTest
@@ -374,27 +384,9 @@
   EXPECT_TRUE(WaitForClientBookmarkWithTitle("scypt-encrypted bookmark"));
 }
 
-// See crbug.com/915219. This test needs to be rewritten to not rely on
-// FeatureList mutation after browser threads have started.
-IN_PROC_BROWSER_TEST_F(
-    SingleClientCustomPassphraseForceDisableScryptSyncTest,
-    DISABLED_CannotDecryptScryptKeyEncryptedDataWhenScryptDisabled) {
-  sync_pb::NigoriSpecifics nigori;
-  {
-    // Creating a Nigori and injecting an encrypted bookmark both require key
-    // derivation using scrypt, so temporarily enable it. This overrides the
-    // feature toggle in the test fixture, which will be restored after this
-    // block.
-    ScopedScryptFeatureToggler toggler(/*force_disabled=*/false,
-                                       /*use_for_new_passphrases_=*/false);
-    KeyParams key_params = {
-        KeyDerivationParams::CreateForScrypt("someConstantSalt"), "hunter2"};
-    nigori = CreateCustomPassphraseNigori(key_params);
-    InjectEncryptedServerBookmark("scypt-encrypted bookmark",
-                                  GURL("http://example.com/doesnt-matter"),
-                                  key_params);
-  }
-  SetNigoriInFakeServer(GetFakeServer(), nigori);
+IN_PROC_BROWSER_TEST_F(SingleClientCustomPassphraseForceDisableScryptSyncTest,
+                       CannotDecryptScryptKeyEncryptedDataWhenScryptDisabled) {
+  SetNigoriInFakeServer(GetFakeServer(), scrypt_nigori());
   SetDecryptionPassphraseForClient(/*index=*/0, "hunter2");
 
   SetupSyncNoWaitingForCompletion();
@@ -459,8 +451,7 @@
       // key derivation method in ShouldLoadUSSCustomPassphraseInDirectoryMode,
       // once USS implementation support it for new passphrases.
       feature_list_.InitWithFeatures(
-          /*enabled_features=*/{switches::kSyncUSSBookmarks,
-                                switches::kSyncUSSPasswords,
+          /*enabled_features=*/{switches::kSyncUSSPasswords,
                                 switches::kSyncUSSNigori},
           /*disabled_features=*/{
               switches::kSyncUseScryptForNewCustomPassphrases});
@@ -510,8 +501,7 @@
       // when kSyncUSSNigori was disabled, without providing it again once
       // kSyncUSSNigori is enabled.
       feature_list_.InitWithFeatures(
-          /*enabled_features=*/{switches::kSyncUSSBookmarks,
-                                switches::kSyncUSSPasswords,
+          /*enabled_features=*/{switches::kSyncUSSPasswords,
                                 switches::kSyncUSSNigori},
           /*disabled_features=*/{});
     }
diff --git a/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc b/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc
index ba7480f2..028b933 100644
--- a/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc
@@ -6,18 +6,27 @@
 #include <string>
 
 #include "base/base64.h"
+#include "base/command_line.h"
 #include "base/macros.h"
+#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
 #include "base/test/scoped_feature_list.h"
 #include "base/time/time.h"
 #include "chrome/browser/sync/test/integration/encryption_helper.h"
 #include "chrome/browser/sync/test/integration/passwords_helper.h"
 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
+#include "chrome/browser/sync/test/integration/status_change_checker.h"
 #include "chrome/browser/sync/test/integration/sync_test.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_features.h"
+#include "chrome/test/base/ui_test_utils.h"
 #include "components/sync/base/time.h"
 #include "components/sync/driver/sync_driver_switches.h"
+#include "components/sync/engine/sync_engine_switches.h"
 #include "components/sync/nigori/cryptographer_impl.h"
 #include "components/sync/nigori/nigori.h"
 #include "crypto/ec_private_key.h"
+#include "google_apis/gaia/gaia_switches.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 namespace {
@@ -31,6 +40,25 @@
   std::string password;
 };
 
+MATCHER_P(IsDataEncryptedWith, key_params, "") {
+  const sync_pb::EncryptedData& encrypted_data = arg;
+  std::unique_ptr<syncer::Nigori> nigori = syncer::Nigori::CreateByDerivation(
+      key_params.derivation_params, key_params.password);
+  std::string nigori_name;
+  EXPECT_TRUE(nigori->Permute(syncer::Nigori::Type::Password,
+                              syncer::kNigoriKeyName, &nigori_name));
+  return encrypted_data.key_name() == nigori_name;
+}
+
+GURL GetTrustedVaultRetrievalURL(
+    const net::test_server::EmbeddedTestServer& test_server,
+    const std::string& encryption_key) {
+  const char kGaiaId[] = "gaia_id_for_user_gmail.com";
+  return test_server.GetURL(
+      base::StringPrintf("/sync/encryption_keys_retrieval.html?%s#%s", kGaiaId,
+                         encryption_key.c_str()));
+}
+
 KeyParams KeystoreKeyParams(const std::string& key) {
   // Due to mis-encode of keystore keys to base64 we have to always encode such
   // keys to provide backward compatibility.
@@ -84,16 +112,58 @@
   return specifics;
 }
 
-MATCHER_P(IsDataEncryptedWith, key_params, "") {
-  const sync_pb::EncryptedData& encrypted_data = arg;
-  std::unique_ptr<syncer::Nigori> nigori = syncer::Nigori::CreateByDerivation(
-      key_params.derivation_params, key_params.password);
-  std::string nigori_name;
-  EXPECT_TRUE(nigori->Permute(syncer::Nigori::Type::Password,
-                              syncer::kNigoriKeyName, &nigori_name));
-  return encrypted_data.key_name() == nigori_name;
+sync_pb::NigoriSpecifics BuildTrustedVaultNigoriSpecifics(
+    const std::vector<std::string>& trusted_vault_keys) {
+  sync_pb::NigoriSpecifics specifics;
+  specifics.set_passphrase_type(
+      sync_pb::NigoriSpecifics::TRUSTED_VAULT_PASSPHRASE);
+  specifics.set_keybag_is_frozen(true);
+
+  std::unique_ptr<syncer::CryptographerImpl> cryptographer =
+      syncer::CryptographerImpl::CreateEmpty();
+  for (const std::string& trusted_vault_key : trusted_vault_keys) {
+    const std::string key_name = cryptographer->EmplaceKey(
+        trusted_vault_key, syncer::KeyDerivationParams::CreateForPbkdf2());
+    cryptographer->SelectDefaultEncryptionKey(key_name);
+  }
+
+  EXPECT_TRUE(cryptographer->Encrypt(cryptographer->ToProto().key_bag(),
+                                     specifics.mutable_encryption_keybag()));
+  return specifics;
 }
 
+// Used to wait until a page's title changes to a certain value (useful to
+// detect Javascript events).
+class PageTitleChecker : public StatusChangeChecker,
+                         public content::WebContentsObserver {
+ public:
+  PageTitleChecker(const std::string& expected_title,
+                   content::WebContents* web_contents)
+      : WebContentsObserver(web_contents),
+        expected_title_(base::UTF8ToUTF16(expected_title)) {}
+  ~PageTitleChecker() override {}
+
+  // StatusChangeChecker overrides.
+  std::string GetDebugMessage() const override {
+    return "Waiting for page title";
+  }
+
+  bool IsExitConditionSatisfied() override {
+    return web_contents()->GetTitle() == expected_title_;
+  }
+
+  // content::WebContentsObserver overrides.
+  void DidStopLoading() override { CheckExitCondition(); }
+  void TitleWasSet(content::NavigationEntry* entry) override {
+    CheckExitCondition();
+  }
+
+ private:
+  const base::string16 expected_title_;
+
+  DISALLOW_COPY_AND_ASSIGN(PageTitleChecker);
+};
+
 class SingleClientNigoriSyncTestWithUssTests
     : public SyncTest,
       public testing::WithParamInterface<bool> {
@@ -103,8 +173,7 @@
       // USS Nigori requires USS implementations to be enabled for all
       // datatypes.
       override_features_.InitWithFeatures(
-          /*enabled_features=*/{switches::kSyncUSSBookmarks,
-                                switches::kSyncUSSPasswords,
+          /*enabled_features=*/{switches::kSyncUSSPasswords,
                                 switches::kSyncUSSNigori},
           /*disabled_features=*/{});
     } else {
@@ -113,6 +182,7 @@
       override_features_.InitAndDisableFeature(switches::kSyncUSSNigori);
     }
   }
+
   ~SingleClientNigoriSyncTestWithUssTests() override = default;
 
   bool WaitForPasswordForms(
@@ -121,9 +191,9 @@
   }
 
  private:
-  DISALLOW_COPY_AND_ASSIGN(SingleClientNigoriSyncTestWithUssTests);
-
   base::test::ScopedFeatureList override_features_;
+
+  DISALLOW_COPY_AND_ASSIGN(SingleClientNigoriSyncTestWithUssTests);
 };
 
 IN_PROC_BROWSER_TEST_P(SingleClientNigoriSyncTestWithUssTests,
@@ -146,6 +216,33 @@
   EXPECT_TRUE(specifics.has_keystore_migration_time());
 }
 
+// Tests that client can decrypt passwords, encrypted with implicit passphrase.
+// Test first injects implicit passphrase Nigori and encrypted password form to
+// fake server and then checks that client successfully received and decrypted
+// this password form.
+IN_PROC_BROWSER_TEST_P(SingleClientNigoriSyncTestWithUssTests,
+                       ShouldDecryptWithImplicitPassphraseNigori) {
+  const KeyParams kKeyParams = {syncer::KeyDerivationParams::CreateForPbkdf2(),
+                                "passphrase"};
+  sync_pb::NigoriSpecifics specifics;
+  std::unique_ptr<syncer::CryptographerImpl> cryptographer =
+      syncer::CryptographerImpl::FromSingleKeyForTesting(
+          kKeyParams.password, kKeyParams.derivation_params);
+  ASSERT_TRUE(cryptographer->Encrypt(cryptographer->ToProto().key_bag(),
+                                     specifics.mutable_encryption_keybag()));
+  SetNigoriInFakeServer(GetFakeServer(), specifics);
+
+  const autofill::PasswordForm password_form =
+      passwords_helper::CreateTestPasswordForm(0);
+  passwords_helper::InjectEncryptedServerPassword(
+      password_form, kKeyParams.password, kKeyParams.derivation_params,
+      GetFakeServer());
+
+  SetDecryptionPassphraseForClient(/*index=*/0, kKeyParams.password);
+  ASSERT_TRUE(SetupSync());
+  EXPECT_TRUE(WaitForPasswordForms({password_form}));
+}
+
 // Tests that client can decrypt passwords, encrypted with keystore key in case
 // Nigori node contains only this key. We first inject keystore Nigori and
 // encrypted password form to fake server and then check that client
@@ -234,4 +331,120 @@
                          SingleClientNigoriSyncTestWithUssTests,
                          ::testing::Values(false, true));
 
+class SingleClientNigoriWithWebApiTest : public SyncTest {
+ public:
+  SingleClientNigoriWithWebApiTest() : SyncTest(SINGLE_CLIENT) {
+    // USS Nigori requires USS implementations to be enabled for all
+    // datatypes.
+    override_features_.InitWithFeatures(
+        /*enabled_features=*/{switches::kSyncUSSPasswords,
+                              switches::kSyncUSSNigori,
+                              switches::kSyncSupportTrustedVaultPassphrase,
+                              features::kSyncEncryptionKeysWebApi},
+        /*disabled_features=*/{});
+  }
+  ~SingleClientNigoriWithWebApiTest() override = default;
+
+  // InProcessBrowserTest:
+  void SetUpCommandLine(base::CommandLine* command_line) override {
+    ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
+    const GURL& base_url = embedded_test_server()->base_url();
+    command_line->AppendSwitchASCII(switches::kGaiaUrl, base_url.spec());
+    SyncTest::SetUpCommandLine(command_line);
+  }
+
+  void SetUpOnMainThread() override {
+    SyncTest::SetUpOnMainThread();
+    embedded_test_server()->StartAcceptingConnections();
+  }
+
+ private:
+  base::test::ScopedFeatureList override_features_;
+
+  DISALLOW_COPY_AND_ASSIGN(SingleClientNigoriWithWebApiTest);
+};
+
+IN_PROC_BROWSER_TEST_F(SingleClientNigoriWithWebApiTest,
+                       ShouldAcceptEncryptionKeysFromTheWeb) {
+  const std::string kTestEncryptionKey = "testpassphrase1";
+
+  const GURL retrieval_url =
+      GetTrustedVaultRetrievalURL(*embedded_test_server(), kTestEncryptionKey);
+
+  // Mimic the account being already using a trusted vault passphrase.
+  encryption_helper::SetNigoriInFakeServer(
+      GetFakeServer(), BuildTrustedVaultNigoriSpecifics({kTestEncryptionKey}));
+
+  SetupSyncNoWaitingForCompletion();
+  ASSERT_TRUE(TrustedVaultKeyRequiredStateChecker(GetSyncService(0),
+                                                  /*desired_state=*/true)
+                  .Wait());
+
+  // Mimic opening a web page where the user can interact with the retrieval
+  // flow.
+  ui_test_utils::NavigateToURLWithDisposition(
+      GetBrowser(0), retrieval_url, WindowOpenDisposition::CURRENT_TAB,
+      ui_test_utils::BROWSER_TEST_NONE);
+
+  // Wait until the title changes to "OK" via Javascript, which indicates
+  // completion.
+  PageTitleChecker title_checker(
+      /*expected_title=*/"OK",
+      GetBrowser(0)->tab_strip_model()->GetActiveWebContents());
+  EXPECT_TRUE(title_checker.Wait());
+
+  ASSERT_TRUE(TrustedVaultKeyRequiredStateChecker(GetSyncService(0),
+                                                  /*desired_state=*/false)
+                  .Wait());
+}
+
+// Same as SingleClientNigoriWithWebApiTest but does NOT override
+// switches::kGaiaUrl, which means the embedded test server gets treated as
+// untrusted origin.
+class SingleClientNigoriWithWebApiFromUntrustedOriginTest
+    : public SingleClientNigoriWithWebApiTest {
+ public:
+  SingleClientNigoriWithWebApiFromUntrustedOriginTest() = default;
+  ~SingleClientNigoriWithWebApiFromUntrustedOriginTest() override = default;
+
+  // InProcessBrowserTest:
+  void SetUpCommandLine(base::CommandLine* command_line) override {
+    ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
+    SyncTest::SetUpCommandLine(command_line);
+  }
+};
+
+IN_PROC_BROWSER_TEST_F(SingleClientNigoriWithWebApiFromUntrustedOriginTest,
+                       ShouldNotExposeJavascriptApi) {
+  const std::string kTestEncryptionKey = "testpassphrase1";
+
+  const GURL retrieval_url =
+      GetTrustedVaultRetrievalURL(*embedded_test_server(), kTestEncryptionKey);
+
+  // Mimic the account being already using a trusted vault passphrase.
+  encryption_helper::SetNigoriInFakeServer(
+      GetFakeServer(), BuildTrustedVaultNigoriSpecifics({kTestEncryptionKey}));
+
+  SetupSyncNoWaitingForCompletion();
+  ASSERT_TRUE(TrustedVaultKeyRequiredStateChecker(GetSyncService(0),
+                                                  /*desired_state=*/true)
+                  .Wait());
+
+  // Mimic opening a web page where the user can interact with the retrival
+  // flow.
+  ui_test_utils::NavigateToURLWithDisposition(
+      GetBrowser(0), retrieval_url, WindowOpenDisposition::CURRENT_TAB,
+      ui_test_utils::BROWSER_TEST_NONE);
+
+  // Wait until the title reflects the function is undefined.
+  PageTitleChecker title_checker(
+      /*expected_title=*/"UNDEFINED",
+      GetBrowser(0)->tab_strip_model()->GetActiveWebContents());
+  EXPECT_TRUE(title_checker.Wait());
+
+  EXPECT_TRUE(GetSyncService(0)
+                  ->GetUserSettings()
+                  ->IsTrustedVaultKeyRequiredForPreferredDataTypes());
+}
+
 }  // namespace
diff --git a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
index 97901cc..2696945 100644
--- a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
@@ -16,7 +16,6 @@
 #include "chrome/browser/policy/profile_policy_connector_builder.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
-#include "chrome/browser/sync/test/integration/feature_toggler.h"
 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
 #include "chrome/browser/sync/test/integration/sync_test.h"
@@ -96,21 +95,7 @@
   DISALLOW_COPY_AND_ASSIGN(TwoClientBookmarksSyncTest);
 };
 
-// TODO(crbug.com/516866): Merge the two fixtures into one when all tests are
-// passing for USS.
-class TwoClientBookmarksSyncTestIncludingUssTests
-    : public FeatureToggler,
-      public TwoClientBookmarksSyncTest {
- public:
-  TwoClientBookmarksSyncTestIncludingUssTests()
-      : FeatureToggler(switches::kSyncUSSBookmarks) {}
-  ~TwoClientBookmarksSyncTestIncludingUssTests() override {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(TwoClientBookmarksSyncTestIncludingUssTests);
-};
-
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests, Sanity) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, Sanity) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -140,8 +125,7 @@
   ASSERT_TRUE(BookmarksMatchChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SimultaneousURLChanges) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SimultaneousURLChanges) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -162,8 +146,7 @@
   ASSERT_TRUE(BookmarksMatchChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_AddFirstFolder) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddFirstFolder) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -171,7 +154,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_Add3FoldersInShuffledOrder) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -182,7 +165,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_AddFirstBMWithoutFavicon) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -191,8 +174,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_AddFirstBMWithFavicon) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddFirstBMWithFavicon) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
   const GURL page_url(kGenericURL);
@@ -211,8 +193,7 @@
 // In particular, the synced 16x16 favicon bitmap should overwrite 16x16
 // favicon bitmaps on all clients. (Though non-16x16 favicon bitmaps
 // are unchanged).
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_SetFaviconHiDPI) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_SetFaviconHiDPI) {
   // Set the supported scale factors to include 2x such that CreateFavicon()
   // creates a favicon with hidpi representations and that methods in the
   // FaviconService request hidpi favicons.
@@ -251,7 +232,7 @@
 // favicon should be redownloaded when the web when the bookmark is visited.
 // If sync prevents the "last updated time" from expiring, the favicon is
 // never redownloaded from the web. (http://crbug.com/481414)
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_UpdatingTitleDoesNotUpdateFaviconLastUpdatedTime) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
 
@@ -297,7 +278,7 @@
 // ensures that sync has the most up to date data and prevents sync from
 // reverting the newly updated bookmark favicon back to the old favicon.
 // crbug.com/485657
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_SetFaviconTwoBookmarksSameIconURL) {
   const GURL page_url1("http://www.google.com/a");
   const GURL page_url2("http://www.google.com/b");
@@ -330,8 +311,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_DeleteFavicon) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_DeleteFavicon) {
   const GURL page_url("http://www.google.com/a");
   const GURL icon_url("http://www.google.com/favicon.ico");
 
@@ -360,8 +340,7 @@
   CheckHasNoFavicon(0, page_url);
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_AddNonHTTPBMs) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -371,8 +350,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_AddFirstBMUnderFolder) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddFirstBMUnderFolder) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -382,7 +360,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_AddSeveralBMsUnderBMBarAndOtherBM) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -396,8 +374,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_AddSeveralBMsAndFolders) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddSeveralBMsAndFolders) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -427,7 +404,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DuplicateBMWithDifferentURLSameName) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -440,7 +417,7 @@
 }
 
 // Add bookmarks with different name and same URL.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DuplicateBookmarksWithSameURL) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -452,8 +429,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_RenameBMName) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMName) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -467,8 +443,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_RenameBMURL) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMURL) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -483,7 +458,7 @@
 }
 
 // Renaming the same bookmark name twice.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_TwiceRenamingBookmarkName) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -502,7 +477,7 @@
 }
 
 // Renaming the same bookmark URL twice.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_TwiceRenamingBookmarkURL) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -520,8 +495,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_RenameBMFolder) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMFolder) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -535,8 +509,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_RenameEmptyBMFolder) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameEmptyBMFolder) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -549,7 +522,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_RenameBMFolderWithLongHierarchy) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -574,7 +547,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_RenameBMFolderThatHasParentAndChildren) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -605,8 +578,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_RenameBMNameAndURL) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMNameAndURL) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -624,7 +596,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DeleteBMEmptyAccountAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -636,7 +608,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelBMNonEmptyAccountAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -652,7 +624,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelFirstBMUnderBMFoldNonEmptyFoldAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -670,7 +642,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelLastBMUnderBMFoldNonEmptyFoldAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -688,7 +660,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelMiddleBMUnderBMFoldNonEmptyFoldAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -706,7 +678,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelBMsUnderBMFoldEmptyFolderAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -725,7 +697,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelEmptyBMFoldEmptyAccountAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -737,7 +709,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelEmptyBMFoldNonEmptyAccountAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -759,7 +731,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelBMFoldWithBMsNonEmptyAccountAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -788,7 +760,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelBMFoldWithBMsAndBMFoldsNonEmptyACAfterwards) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -836,7 +808,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_DelBMFoldWithParentAndChildrenBMsAndBMFolds) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -867,8 +839,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_ReverseTheOrderOfTwoBMs) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_ReverseTheOrderOfTwoBMs) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -886,8 +857,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_ReverseTheOrderOf10BMs) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_ReverseTheOrderOf10BMs) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -902,7 +872,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_MovingBMsFromBMBarToBMFolder) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -925,7 +895,7 @@
   }
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_MovingBMsFromBMFoldToBMBar) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -948,7 +918,7 @@
   }
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_MovingBMsFromParentBMFoldToChildBMFold) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -977,7 +947,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_MovingBMsFromChildBMFoldToParentBMFold) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1006,8 +976,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_HoistBMs10LevelUp) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_HoistBMs10LevelUp) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -1045,8 +1014,7 @@
 }
 
 // Flaky. http://crbug.com/107744.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_SinkBMs10LevelDown) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_SinkBMs10LevelDown) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -1083,7 +1051,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_SinkEmptyBMFold5LevelsDown) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1111,7 +1079,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_SinkNonEmptyBMFold5LevelsDown) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1144,8 +1112,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       SC_HoistFolder5LevelsUp) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_HoistFolder5LevelsUp) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -1178,7 +1145,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_ReverseTheOrderOfTwoBMFolders) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1199,7 +1166,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SC_ReverseTheOrderOfTenBMFolders) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1220,7 +1187,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_BiDirectionalPushAddingBM) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1238,7 +1205,7 @@
   ASSERT_FALSE(ContainsDuplicateBookmarks(0));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_BiDirectionalPush_AddingSameBMs) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1255,14 +1222,14 @@
   ASSERT_TRUE(BookmarksMatchChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_BootStrapEmptyStateEverywhere) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AwaitQuiescence());
   ASSERT_TRUE(AllModelsMatchVerifier());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_Merge_CaseInsensitivity_InNames) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1285,7 +1252,7 @@
   ASSERT_FALSE(ContainsDuplicateBookmarks(0));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_SimpleMergeOfDifferentBMModels) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1312,7 +1279,7 @@
   ASSERT_FALSE(ContainsDuplicateBookmarks(0));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_MergeSimpleBMHierarchyUnderBMBar) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1336,7 +1303,7 @@
   ASSERT_FALSE(ContainsDuplicateBookmarks(0));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_MergeSimpleBMHierarchyEqualSetsUnderBMBar) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1356,7 +1323,7 @@
 }
 
 // Merge bookmark folders with different bookmarks.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_MergeBMFoldersWithDifferentBMs) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1380,7 +1347,7 @@
 }
 
 // Merge moderately complex bookmark models.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_MergeDifferentBMModelsModeratelyComplex) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1423,7 +1390,7 @@
 }
 
 // Merge simple bookmark subset under bookmark folder.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_MergeSimpleBMHierarchySubsetUnderBMFolder) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1449,7 +1416,7 @@
 }
 
 // Merge subsets of bookmark under bookmark bar.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_MergeSimpleBMHierarchySubsetUnderBookmarkBar) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1474,7 +1441,7 @@
 }
 
 // Merge simple bookmark hierarchy under bookmark folder.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_Merge_SimpleBMHierarchy_Under_BMFolder) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1506,7 +1473,7 @@
 
 // Merge disjoint sets of bookmark hierarchy under bookmark
 // folder.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_Merge_SimpleBMHierarchy_DisjointSets_Under_BMFolder) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1536,8 +1503,8 @@
 }
 
 // Merge disjoint sets of bookmark hierarchy under bookmark bar.
-IN_PROC_BROWSER_TEST_P(
-    TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(
+    TwoClientBookmarksSyncTest,
     MC_Merge_SimpleBMHierarchy_DisjointSets_Under_BookmarkBar) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1560,7 +1527,7 @@
 }
 
 // Merge sets of duplicate bookmarks under bookmark bar.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_Merge_SimpleBMHierarchy_DuplicateBMs_Under_BMBar) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1591,8 +1558,7 @@
   }
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       DisableBookmarks) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableBookmarks) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -1607,8 +1573,7 @@
   ASSERT_TRUE(BookmarksMatchChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       DisableSync) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableSync) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -1625,8 +1590,7 @@
 }
 
 // Test adding duplicate folder - Both with different BMs underneath.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       MC_DuplicateFolders) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, MC_DuplicateFolders) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
 
@@ -1648,8 +1612,7 @@
   ASSERT_FALSE(ContainsDuplicateBookmarks(0));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       MC_DeleteBookmark) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, MC_DeleteBookmark) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(
       GetClient(1)->DisableSyncForType(syncer::UserSelectableType::kBookmarks));
@@ -1685,7 +1648,7 @@
 
 // Test a scenario of updating the name of the same bookmark from two clients at
 // the same time.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_BookmarkNameChangeConflict) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
 
@@ -1710,7 +1673,7 @@
 
 // Test a scenario of updating the URL of the same bookmark from two clients at
 // the same time.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_BookmarkURLChangeConflict) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
 
@@ -1737,7 +1700,7 @@
 
 // Test a scenario of updating the BM Folder name from two clients at the same
 // time.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        MC_FolderNameChangeConflict) {
   ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
   DisableVerifier();
@@ -1812,7 +1775,7 @@
   ASSERT_FALSE(ContainsDuplicateBookmarks(0));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SingleClientEnabledEncryption) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1824,7 +1787,7 @@
   ASSERT_TRUE(AllModelsMatchVerifier());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SingleClientEnabledEncryptionAndChanged) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1837,7 +1800,7 @@
   ASSERT_TRUE(AllModelsMatchVerifier());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        BothClientsEnabledEncryption) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1850,7 +1813,7 @@
   ASSERT_TRUE(AllModelsMatchVerifier());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SingleClientEnabledEncryptionBothChanged) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1867,7 +1830,7 @@
   ASSERT_TRUE(IsEncryptionComplete(1));
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        SingleClientEnabledEncryptionAndChangedMultipleTimes) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1884,7 +1847,7 @@
   ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        FirstClientEnablesEncryptionWithPassSecondChanges) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -1929,8 +1892,7 @@
 // Deliberately racy rearranging of bookmarks to test that our conflict resolver
 // code results in a consistent view across machines (no matter what the final
 // order is).
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       RacyPositionChanges) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, RacyPositionChanges) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -1989,8 +1951,7 @@
 // Trigger the server side creation of Synced Bookmarks. Ensure both clients
 // remain syncing afterwards. Add bookmarks to the synced bookmarks folder
 // and ensure both clients receive the bookmark.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       CreateSyncedBookmarks) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, CreateSyncedBookmarks) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
 
@@ -2016,7 +1977,7 @@
 // Enable enccryption and then trigger the server side creation of Synced
 // Bookmarks. Ensure both clients remain syncing afterwards. Add bookmarks to
 // the synced bookmarks folder and ensure both clients receive the bookmark.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        CreateSyncedBookmarksWithSingleClientEnableEncryption) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -2045,7 +2006,7 @@
   ASSERT_TRUE(BookmarksMatchChecker().Wait());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        BookmarkAllNodesRemovedEvent) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   ASSERT_TRUE(AllModelsMatchVerifier());
@@ -2099,8 +2060,7 @@
 }
 
 // Verifies that managed bookmarks (installed by policy) don't get synced.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       ManagedBookmarks) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ManagedBookmarks) {
   // Make sure the first Profile has an overridden policy provider.
   EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_))
       .WillRepeatedly(testing::Return(true));
@@ -2166,13 +2126,12 @@
   ASSERT_EQ(0u, managed_node1->children().size());
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
-                       E2E_ONLY(SanitySetup)) {
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) {
   ResetSyncForPrimaryAccount();
   ASSERT_TRUE(SetupSync()) <<  "SetupSync() failed.";
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        E2E_ONLY(OneClientAddsBookmark)) {
   ResetSyncForPrimaryAccount();
   ASSERT_TRUE(SetupSync()) <<  "SetupSync() failed.";
@@ -2198,7 +2157,7 @@
 }
 
 // TODO(shadi): crbug.com/569213: Enable this as E2E test.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        OneClientAddsFolderAndBookmark) {
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
   // All profiles should sync same bookmarks.
@@ -2223,7 +2182,7 @@
   }
 }
 
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        E2E_ONLY(TwoClientsAddBookmarks)) {
   ResetSyncForPrimaryAccount();
   ASSERT_TRUE(SetupSync()) <<  "SetupSync() failed.";
@@ -2254,7 +2213,7 @@
 
 // Verify that a bookmark added on a client with bookmark syncing disabled gets
 // synced to a second client once bookmark syncing is re-enabled.
-IN_PROC_BROWSER_TEST_P(TwoClientBookmarksSyncTestIncludingUssTests,
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
                        E2E_ENABLED(AddBookmarkWhileDisabled)) {
   ResetSyncForPrimaryAccount();
   ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
@@ -2286,8 +2245,4 @@
   ASSERT_EQ(initial_count + 2, CountAllBookmarks(1));
 }
 
-INSTANTIATE_TEST_SUITE_P(USS,
-                         TwoClientBookmarksSyncTestIncludingUssTests,
-                         ::testing::Values(false, true));
-
 }  // namespace
diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
index b88545d..58af62a 100644
--- a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
@@ -43,7 +43,7 @@
 #include "extensions/common/extension.h"
 #include "google_apis/drive/drive_api_parser.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
 
diff --git a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
index d38ecbe..44ab7a3 100644
--- a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
+++ b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
@@ -12,7 +12,7 @@
 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
 #include "chrome/browser/sync_file_system/sync_status_code.h"
 #include "google_apis/drive/drive_api_parser.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #define FPL(path) FILE_PATH_LITERAL(path)
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc
index 6988a21..2a2b793 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc
@@ -12,7 +12,7 @@
 #include "base/strings/string_util.h"
 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h"
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/env_chromium.h"
diff --git a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
index b5e52eb4..c3dfcf91 100644
--- a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
+++ b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
@@ -18,7 +18,7 @@
 #include "chrome/browser/sync_file_system/sync_callbacks.h"
 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
 #include "google_apis/drive/drive_api_error_codes.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace drive {
 class DriveServiceInterface;
diff --git a/chrome/browser/sync_file_system/fake_remote_change_processor.cc b/chrome/browser/sync_file_system/fake_remote_change_processor.cc
index 7da1a40e..7bf7208 100644
--- a/chrome/browser/sync_file_system/fake_remote_change_processor.cc
+++ b/chrome/browser/sync_file_system/fake_remote_change_processor.cc
@@ -14,7 +14,7 @@
 #include "chrome/browser/sync_file_system/file_change.h"
 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/sync_file_system/file_change.h b/chrome/browser/sync_file_system/file_change.h
index e2a9147..088e0254 100644
--- a/chrome/browser/sync_file_system/file_change.h
+++ b/chrome/browser/sync_file_system/file_change.h
@@ -12,7 +12,7 @@
 #include "base/containers/circular_deque.h"
 #include "base/files/file_path.h"
 #include "chrome/browser/sync_file_system/sync_file_type.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace sync_file_system {
 
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
index d0b6e6f4..a5c037b 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -26,11 +26,11 @@
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
 #include "storage/browser/blob/blob_storage_context.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/browser/test/mock_blob_util.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
index 16635ed..739fc39 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
@@ -19,8 +19,8 @@
 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
 #include "chrome/browser/sync_file_system/sync_status_code.h"
 #include "storage/browser/blob/blob_data_handle.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/quota/quota_callbacks.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker.cc b/chrome/browser/sync_file_system/local/local_file_change_tracker.cc
index b0f1cdb..e3eb6db3 100644
--- a/chrome/browser/sync_file_system/local/local_file_change_tracker.cc
+++ b/chrome/browser/sync_file_system/local/local_file_change_tracker.cc
@@ -17,9 +17,9 @@
 #include "base/stl_util.h"
 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/leveldatabase/env_chromium.h"
 #include "third_party/leveldatabase/src/include/leveldb/db.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker.h b/chrome/browser/sync_file_system/local/local_file_change_tracker.h
index 8064e19..5a86016 100644
--- a/chrome/browser/sync_file_system/local/local_file_change_tracker.h
+++ b/chrome/browser/sync_file_system/local/local_file_change_tracker.h
@@ -19,8 +19,8 @@
 #include "base/synchronization/lock.h"
 #include "chrome/browser/sync_file_system/file_change.h"
 #include "chrome/browser/sync_file_system/sync_status_code.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace base {
 class SequencedTaskRunner;
diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc b/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc
index 6294164..755c2ebe 100644
--- a/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc
@@ -23,7 +23,7 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_utils.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/browser/test/mock_blob_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.cc b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
index 77e9687..d4b2371 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
@@ -23,10 +23,10 @@
 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
 #include "storage/browser/blob/scoped_file.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using storage::FileSystemContext;
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
index f7755c3..a524dbc2 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
@@ -28,9 +28,9 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/browser_task_environment.h"
 #include "storage/browser/blob/scoped_file.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/test/mock_blob_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service.cc b/chrome/browser/sync_file_system/local/local_file_sync_service.cc
index ef7230f..b92816d42 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service.cc
@@ -27,8 +27,8 @@
 #include "extensions/browser/extension_util.h"
 #include "extensions/common/extension_set.h"
 #include "storage/browser/blob/scoped_file.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
index 37abb92..32fcd71 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
@@ -34,7 +34,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_utils.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_status.h b/chrome/browser/sync_file_system/local/local_file_sync_status.h
index d318c9b..6fb27844 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_status.h
+++ b/chrome/browser/sync_file_system/local/local_file_sync_status.h
@@ -15,7 +15,7 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/observer_list.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemURL;
diff --git a/chrome/browser/sync_file_system/local/root_delete_helper.cc b/chrome/browser/sync_file_system/local/root_delete_helper.cc
index 766d8d4..d4f05cc3 100644
--- a/chrome/browser/sync_file_system/local/root_delete_helper.cc
+++ b/chrome/browser/sync_file_system/local/root_delete_helper.cc
@@ -11,9 +11,9 @@
 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
 #include "chrome/browser/sync_file_system/logger.h"
 #include "chrome/browser/sync_file_system/sync_callbacks.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace sync_file_system {
diff --git a/chrome/browser/sync_file_system/local/root_delete_helper.h b/chrome/browser/sync_file_system/local/root_delete_helper.h
index ebb521d0..31ce33a 100644
--- a/chrome/browser/sync_file_system/local/root_delete_helper.h
+++ b/chrome/browser/sync_file_system/local/root_delete_helper.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 class GURL;
 
diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
index 7ec7ccf..0a4a16c 100644
--- a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
+++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
@@ -20,10 +20,10 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.h b/chrome/browser/sync_file_system/local/sync_file_system_backend.h
index 909a1bc..8c44c80e 100644
--- a/chrome/browser/sync_file_system/local/sync_file_system_backend.h
+++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.h
@@ -15,10 +15,10 @@
 #include "chrome/browser/sync_file_system/sync_status_code.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace sync_file_system {
 
diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h b/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
index cadbf89c..202f3ef 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
+++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
@@ -15,7 +15,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemURL;
diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
index 7bdb539..646b773d 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
@@ -27,8 +27,8 @@
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_utils.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/browser/test/mock_blob_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
index e6965a8..23fb1e9 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
@@ -16,11 +16,11 @@
 #include "content/public/browser/browser_thread.h"
 #include "net/url_request/url_request.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/file_writer_delegate.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/file_writer_delegate.h"
 
 using storage::FileSystemURL;
 
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.h b/chrome/browser/sync_file_system/local/syncable_file_system_operation.h
index 7b184710..b90fc66 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.h
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.h
@@ -14,8 +14,8 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemContext;
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
index 35935f1..3a2560a 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
@@ -13,9 +13,9 @@
 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/sandbox_file_system_test_helper.h"
diff --git a/chrome/browser/sync_file_system/mock_local_change_processor.cc b/chrome/browser/sync_file_system/mock_local_change_processor.cc
index f1be848..21c99be 100644
--- a/chrome/browser/sync_file_system/mock_local_change_processor.cc
+++ b/chrome/browser/sync_file_system/mock_local_change_processor.cc
@@ -10,7 +10,7 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "chrome/browser/sync_file_system/file_change.h"
 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 using ::testing::_;
 using ::testing::Invoke;
diff --git a/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc b/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc
index d76a25b..88f0bf2 100644
--- a/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/mock_remote_file_sync_service.cc
@@ -10,7 +10,7 @@
 #include "base/location.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 using ::testing::_;
diff --git a/chrome/browser/sync_file_system/remote_file_sync_service.h b/chrome/browser/sync_file_system/remote_file_sync_service.h
index bdde16e9..7743c31 100644
--- a/chrome/browser/sync_file_system/remote_file_sync_service.h
+++ b/chrome/browser/sync_file_system/remote_file_sync_service.h
@@ -17,7 +17,7 @@
 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h"
 #include "chrome/browser/sync_file_system/sync_callbacks.h"
 #include "chrome/browser/sync_file_system/sync_file_metadata.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 class BrowserContextKeyedServiceFactory;
 class GURL;
diff --git a/chrome/browser/sync_file_system/sync_callbacks.h b/chrome/browser/sync_file_system/sync_callbacks.h
index 6a747681..854a5f5 100644
--- a/chrome/browser/sync_file_system/sync_callbacks.h
+++ b/chrome/browser/sync_file_system/sync_callbacks.h
@@ -8,7 +8,7 @@
 #include "base/callback_forward.h"
 #include "chrome/browser/sync_file_system/sync_file_status.h"
 #include "chrome/browser/sync_file_system/sync_status_code.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemURL;
diff --git a/chrome/browser/sync_file_system/sync_file_metadata.h b/chrome/browser/sync_file_system/sync_file_metadata.h
index 730d0b75..8daf021e 100644
--- a/chrome/browser/sync_file_system/sync_file_metadata.h
+++ b/chrome/browser/sync_file_system/sync_file_metadata.h
@@ -9,7 +9,7 @@
 
 #include "base/time/time.h"
 #include "chrome/browser/sync_file_system/file_change.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace sync_file_system {
 
diff --git a/chrome/browser/sync_file_system/sync_file_system_service.cc b/chrome/browser/sync_file_system/sync_file_system_service.cc
index a76c8f6..ad567ed 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service.cc
@@ -41,7 +41,7 @@
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/manifest_constants.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "url/gurl.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc b/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc
index 9d430a9..e2a11599 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc
@@ -33,7 +33,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/browser_task_environment.h"
 #include "content/public/test/test_utils.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
 
diff --git a/chrome/browser/sync_file_system/syncable_file_system_util.cc b/chrome/browser/sync_file_system/syncable_file_system_util.cc
index ff321b6..6b17b173 100644
--- a/chrome/browser/sync_file_system/syncable_file_system_util.cc
+++ b/chrome/browser/sync_file_system/syncable_file_system_util.cc
@@ -11,9 +11,9 @@
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_util.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using storage::ExternalMountPoints;
diff --git a/chrome/browser/sync_file_system/syncable_file_system_util.h b/chrome/browser/sync_file_system/syncable_file_system_util.h
index 5ef80aa6..7f987ee6 100644
--- a/chrome/browser/sync_file_system/syncable_file_system_util.h
+++ b/chrome/browser/sync_file_system/syncable_file_system_util.h
@@ -9,7 +9,7 @@
 
 #include "base/callback_forward.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 class FileSystemContext;
diff --git a/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc b/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc
index f5d8e834..328241d5 100644
--- a/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc
+++ b/chrome/browser/sync_file_system/syncable_file_system_util_unittest.cc
@@ -8,7 +8,7 @@
 #include "base/logging.h"
 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h
index 92fc588..5fa6f61 100644
--- a/chrome/browser/ui/browser_dialogs.h
+++ b/chrome/browser/ui/browser_dialogs.h
@@ -252,6 +252,7 @@
   PHONE_CHOOSER = 98,
   QR_CODE_GENERATOR = 99,
   CROSTINI_FORCE_CLOSE = 100,
+  APP_UNINSTALL = 101,
   // Add values above this line with a corresponding label in
   // tools/metrics/histograms/enums.xml
   MAX_VALUE
diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc
index 7bad4c3f..941b31f 100644
--- a/chrome/browser/ui/tab_helpers.cc
+++ b/chrome/browser/ui/tab_helpers.cc
@@ -58,6 +58,7 @@
 #include "chrome/browser/subresource_filter/chrome_subresource_filter_client.h"
 #include "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h"
 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.h"
+#include "chrome/browser/sync/sync_encryption_keys_tab_helper.h"
 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
 #include "chrome/browser/tracing/navigation_tracing.h"
 #include "chrome/browser/translate/chrome_translate_client.h"
@@ -265,6 +266,7 @@
       web_contents,
       sync_sessions::SyncSessionsWebContentsRouterFactory::GetForProfile(
           profile));
+
   TabSpecificContentSettings::CreateForWebContents(web_contents);
   TabUIHelper::CreateForWebContents(web_contents);
   tasks::TaskTabHelper::CreateForWebContents(web_contents);
@@ -308,6 +310,9 @@
   SadTabHelper::CreateForWebContents(web_contents);
   safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(web_contents);
   SearchTabHelper::CreateForWebContents(web_contents);
+  if (base::FeatureList::IsEnabled(features::kSyncEncryptionKeysWebApi)) {
+    SyncEncryptionKeysTabHelper::CreateForWebContents(web_contents);
+  }
   TabDialogs::CreateForWebContents(web_contents);
   if (base::FeatureList::IsEnabled(features::kTabHoverCardImages) ||
       base::FeatureList::IsEnabled(features::kWebUITabStrip))
diff --git a/chrome/browser/ui/views/apps/app_uninstall_dialog_view.cc b/chrome/browser/ui/views/apps/app_uninstall_dialog_view.cc
index 75ee2a5..ca53a75e 100644
--- a/chrome/browser/ui/views/apps/app_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/apps/app_uninstall_dialog_view.cc
@@ -7,6 +7,7 @@
 #include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_dialogs.h"
 #include "chrome/browser/ui/views/chrome_layout_provider.h"
 #include "chrome/browser/ui/views/chrome_typography.h"
 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
@@ -35,9 +36,13 @@
     const std::string& app_id,
     const std::string& app_name,
     gfx::ImageSkia image,
+    gfx::NativeWindow parent_window,
     apps::UninstallDialog* uninstall_dialog) {
-  new AppUninstallDialogView(profile, app_type, app_id, app_name, image,
-                             uninstall_dialog);
+  constrained_window::CreateBrowserModalDialogViews(
+      (new AppUninstallDialogView(profile, app_type, app_id, app_name, image,
+                                  uninstall_dialog)),
+      parent_window)
+      ->Show();
 }
 
 AppUninstallDialogView::AppUninstallDialogView(
@@ -52,7 +57,8 @@
       app_type_(app_type),
       app_name_(app_name) {
   InitializeView(profile, app_id);
-  constrained_window::CreateBrowserModalDialogViews(this, nullptr)->Show();
+
+  chrome::RecordDialogCreation(chrome::DialogIdentifier::APP_UNINSTALL);
 }
 
 bool AppUninstallDialogView::Cancel() {
diff --git a/chrome/browser/ui/views/apps/app_uninstall_dialog_view.h b/chrome/browser/ui/views/apps/app_uninstall_dialog_view.h
index b13a086..d983ef8 100644
--- a/chrome/browser/ui/views/apps/app_uninstall_dialog_view.h
+++ b/chrome/browser/ui/views/apps/app_uninstall_dialog_view.h
@@ -42,7 +42,7 @@
 // 1. Add an interface to the uninstall, like what is done by
 // extension_uninstall_dialog_->ConfirmUninstallByExtension.
 class AppUninstallDialogView : public apps::UninstallDialog::UiBase,
-                               views::BubbleDialogDelegateView {
+                               public views::BubbleDialogDelegateView {
  public:
   AppUninstallDialogView(Profile* profile,
                          apps::mojom::AppType app_type,
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
index 735aacc..a4bce04 100644
--- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
+++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
@@ -11,7 +11,6 @@
 #include "base/feature_list.h"
 #include "base/macros.h"
 #include "base/metrics/histogram_functions.h"
-#include "base/metrics/user_metrics.h"
 #include "build/build_config.h"
 #include "chrome/app/vector_icons/vector_icons.h"
 #include "chrome/browser/profiles/profile.h"
@@ -575,8 +574,7 @@
 
 void ProfileMenuViewBase::OnClick(views::View* clickable_view) {
   DCHECK(!click_actions_[clickable_view].is_null());
-  base::RecordAction(
-      base::UserMetricsAction("ProfileMenu_ActionableItemClicked"));
+  signin_ui_util::RecordProfileMenuClick(browser()->profile());
   click_actions_[clickable_view].Run();
 }
 
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn b/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn
index 998e8618..78b1683 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/BUILD.gn
@@ -8,4 +8,8 @@
   sources = [
     "crostini_installer.mojom",
   ]
+
+  public_deps = [
+    "//chrome/browser/chromeos/crostini:crostini_installer_types_mojom",
+  ]
 }
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom
index 0091ecb..d67ac5a 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer.mojom
@@ -4,6 +4,8 @@
 
 module chromeos.crostini_installer.mojom;
 
+import "chrome/browser/chromeos/crostini/crostini_installer_types.mojom";
+
 // Lives in the browser process. A renderer uses this to create a page handler
 // for controlling Crostini installation.
 interface PageHandlerFactory {
@@ -31,4 +33,14 @@
 // Lives in the renderer process. The browser uses this to sends installation
 // updates to the web page in the render.
 interface Page {
+  // Callback to receive the install progress once the installation has
+  // started.
+  OnProgressUpdate(crostini.mojom.InstallerState install_state,
+                   double progress_fraction);
+  // This is called when the installation finished. |error| is kNone if the
+  // install succeeded.
+  OnInstallFinished(crostini.mojom.InstallerError error);
+  // After user cancels the installation, this is called when the cancellation
+  // finishes.
+  OnCanceled();
 };
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc
index 77020c7..8668add 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.cc
@@ -6,8 +6,14 @@
 
 #include "chrome/browser/chromeos/crostini/crostini_manager.h"
 #include "chrome/common/webui_url_constants.h"
+#include "ui/base/ui_base_types.h"
 
 namespace {
+// The dialog content area size. Note that the height is less than the design
+// spec to compensate for title bar height.
+constexpr int kDialogWidth = 768;
+constexpr int kDialogHeight = 608;
+
 GURL GetUrl() {
   return GURL{chrome::kChromeUICrostiniInstallerUrl};
 }
@@ -41,4 +47,28 @@
       false);
 }
 
+void CrostiniInstallerDialog::GetDialogSize(gfx::Size* size) const {
+  size->SetSize(::kDialogWidth, ::kDialogHeight);
+}
+
+bool CrostiniInstallerDialog::ShouldShowCloseButton() const {
+  return false;
+}
+
+bool CrostiniInstallerDialog::AcceleratorPressed(
+    const ui::Accelerator& accelerator) {
+  if (accelerator.key_code() == ui::VKEY_ESCAPE) {
+    // Prevent the dialog from being closed. The web page should control closing
+    // logic.
+    return true;
+  }
+
+  return SystemWebDialogDelegate::AcceleratorPressed(accelerator);
+}
+
+void CrostiniInstallerDialog::AdjustWidgetInitParams(
+    views::Widget::InitParams* params) {
+  params->z_order = ui::ZOrderLevel::kNormal;
+}
+
 }  // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h
index 5c56ffab..d85c206 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_dialog.h
@@ -19,6 +19,12 @@
   explicit CrostiniInstallerDialog(Profile* profile);
   ~CrostiniInstallerDialog() override;
 
+  // SystemWebDialogDelegate:
+  void GetDialogSize(gfx::Size* size) const override;
+  bool ShouldShowCloseButton() const override;
+  bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
+  void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
+
   Profile* profile_;
 };
 
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
index 8b97142..65151f6 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
@@ -49,16 +49,16 @@
 void CrostiniInstallerPageHandler::OnProgressUpdate(
     crostini::mojom::InstallerState installer_state,
     double progress_fraction) {
-  // TODO(lxj)
+  page_->OnProgressUpdate(installer_state, progress_fraction);
 }
 
 void CrostiniInstallerPageHandler::OnInstallFinished(
     crostini::mojom::InstallerError error) {
-  // TODO(lxj)
+  page_->OnInstallFinished(error);
 }
 
 void CrostiniInstallerPageHandler::OnCanceled() {
-  // TODO(lxj)
+  page_->OnCanceled();
 }
 
 }  // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc
index 02fe92c..a3d536e 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_ui.cc
@@ -7,16 +7,94 @@
 #include <utility>
 
 #include "base/bind.h"
+#include "base/strings/string16.h"
+#include "base/system/sys_info.h"
 #include "chrome/browser/chromeos/crostini/crostini_installer.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.h"
+#include "chrome/browser/ui/webui/localized_string.h"
+#include "chrome/common/url_constants.h"
 #include "chrome/common/webui_url_constants.h"
 #include "chrome/grit/browser_resources.h"
+#include "chrome/grit/chrome_unscaled_resources.h"
+#include "chrome/grit/generated_resources.h"
 #include "chromeos/constants/chromeos_features.h"
+#include "components/strings/grit/components_strings.h"
 #include "content/public/browser/web_ui_data_source.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/text/bytes_formatting.h"
+#include "ui/chromeos/devicetype_utils.h"
+#include "ui/resources/grit/webui_resources.h"
+#include "ui/strings/grit/ui_strings.h"
 #include "ui/web_dialogs/web_dialog_ui.h"
 #include "ui/webui/mojo_web_ui_controller.h"
 
+namespace {
+void AddStringResources(content::WebUIDataSource* source) {
+  static constexpr LocalizedString kStrings[] = {
+      {"install", IDS_CROSTINI_INSTALLER_INSTALL_BUTTON},
+      {"retry", IDS_CROSTINI_INSTALLER_RETRY_BUTTON},
+      {"close", IDS_APP_CLOSE},
+      {"cancel", IDS_APP_CANCEL},
+      {"learnMore", IDS_LEARN_MORE},
+
+      {"installingTitle", IDS_CROSTINI_INSTALLER_INSTALLING},
+      {"cancelingTitle", IDS_CROSTINI_INSTALLER_CANCELING_TITLE},
+      {"errorTitle", IDS_CROSTINI_INSTALLER_ERROR_TITLE},
+
+      {"loadTerminaError", IDS_CROSTINI_INSTALLER_LOAD_TERMINA_ERROR},
+      {"startConciergeError", IDS_CROSTINI_INSTALLER_START_CONCIERGE_ERROR},
+      {"createDiskImageError", IDS_CROSTINI_INSTALLER_CREATE_DISK_IMAGE_ERROR},
+      {"startTerminaVmError", IDS_CROSTINI_INSTALLER_START_TERMINA_VM_ERROR},
+      {"startContainerError", IDS_CROSTINI_INSTALLER_START_CONTAINER_ERROR},
+      {"fetchSshKeysError", IDS_CROSTINI_INSTALLER_FETCH_SSH_KEYS_ERROR},
+      {"mountContainerError", IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_ERROR},
+      {"setupContainerError", IDS_CROSTINI_INSTALLER_SETUP_CONTAINER_ERROR},
+
+      {"loadTerminaMessage", IDS_CROSTINI_INSTALLER_LOAD_TERMINA_MESSAGE},
+      {"startConciergeMessage", IDS_CROSTINI_INSTALLER_START_CONCIERGE_MESSAGE},
+      {"createDiskImageMessage",
+       IDS_CROSTINI_INSTALLER_CREATE_DISK_IMAGE_MESSAGE},
+      {"startTerminaVmMessage",
+       IDS_CROSTINI_INSTALLER_START_TERMINA_VM_MESSAGE},
+      {"startContainerMessage", IDS_CROSTINI_INSTALLER_START_CONTAINER_MESSAGE},
+      {"setupContainerMessage", IDS_CROSTINI_INSTALLER_SETUP_CONTAINER_MESSAGE},
+      {"fetchSshKeysMessage", IDS_CROSTINI_INSTALLER_FETCH_SSH_KEYS_MESSAGE},
+      {"mountContainerMessage", IDS_CROSTINI_INSTALLER_MOUNT_CONTAINER_MESSAGE},
+      {"cancelingMessage", IDS_CROSTINI_INSTALLER_CANCELING},
+  };
+  AddLocalizedStringsBulk(source, kStrings, base::size(kStrings));
+
+  base::string16 device_name = ui::GetChromeOSDeviceName();
+
+  source->AddString(
+      "promptTitle",
+      l10n_util::GetStringFUTF8(IDS_CROSTINI_INSTALLER_TITLE, device_name));
+  source->AddString(
+      "promptMessage",
+      l10n_util::GetStringFUTF8(
+          IDS_CROSTINI_INSTALLER_BODY,
+          ui::FormatBytesWithUnits(
+              crostini::CrostiniInstallerUIDelegate::kDownloadSizeInBytes,
+              ui::DATA_UNITS_MEBIBYTE, /*show_units=*/true)));
+  source->AddString("learnMoreUrl",
+                    std::string{chrome::kLinuxAppsLearnMoreURL} +
+                        "&b=" + base::SysInfo::GetLsbReleaseBoard());
+
+  source->AddString(
+      "insufficientDiskError",
+      l10n_util::GetStringFUTF8(
+          IDS_CROSTINI_INSTALLER_INSUFFICIENT_DISK,
+          ui::FormatBytesWithUnits(
+              crostini::CrostiniInstallerUIDelegate::kMinimumFreeDiskSpace,
+              ui::DATA_UNITS_GIBIBYTE,
+              /*show_units=*/true)));
+  source->AddString("offlineError",
+                    l10n_util::GetStringFUTF8(
+                        IDS_CROSTINI_INSTALLER_OFFLINE_ERROR, device_name));
+}
+}  // namespace
+
 namespace chromeos {
 
 bool CrostiniInstallerUI::IsEnabled() {
@@ -26,18 +104,27 @@
 
 CrostiniInstallerUI::CrostiniInstallerUI(content::WebUI* web_ui)
     : ui::MojoWebDialogUI{web_ui} {
-  // TODO(lxj): We might want to make sure there is only one instance of this
-  // class.
-
   content::WebUIDataSource* source =
       content::WebUIDataSource::Create(chrome::kChromeUICrostiniInstallerHost);
+  source->OverrideContentSecurityPolicyScriptSrc(
+      "script-src chrome://resources chrome://test 'self';");
+  AddStringResources(source);
 
   source->AddResourcePath("app.js", IDR_CROSTINI_INSTALLER_APP_JS);
   source->AddResourcePath("browser_proxy.js",
                           IDR_CROSTINI_INSTALLER_BROWSER_PROXY_JS);
   source->AddResourcePath("crostini_installer.mojom-lite.js",
                           IDR_CROSTINI_INSTALLER_MOJO_LITE_JS);
+  source->AddResourcePath("crostini_installer_types.mojom-lite.js",
+                          IDR_CROSTINI_INSTALLER_TYPES_MOJO_LITE_JS);
+  source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER);
+  source->AddResourcePath("test_loader.html", IDR_WEBUI_HTML_TEST_LOADER);
+  source->AddResourcePath("images/linux_illustration.png",
+                          IDR_LINUX_ILLUSTRATION);
   source->SetDefaultResource(IDR_CROSTINI_INSTALLER_INDEX_HTML);
+  source->UseStringsJs();
+  source->EnableReplaceI18nInJS();
+
   content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
 
   AddHandlerToRegistry(base::BindRepeating(
diff --git a/chrome/browser/web_applications/components/web_app_constants.h b/chrome/browser/web_applications/components/web_app_constants.h
index 8d4190e..48d2027 100644
--- a/chrome/browser/web_applications/components/web_app_constants.h
+++ b/chrome/browser/web_applications/components/web_app_constants.h
@@ -67,7 +67,9 @@
   kInstallURLRedirected = 13,
   // The network request for the install URL failed or timed out.
   kInstallURLLoadFailed = 14,
-  kMaxValue = kInstallURLLoadFailed
+  // The requested app_id check failed: actual resulting app_id doesn't match.
+  kExpectedAppIdCheckFailed = 15,
+  kMaxValue = kExpectedAppIdCheckFailed
 };
 
 // Checks if InstallResultCode is not a failure.
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc
index 9de044ea..86ab973 100644
--- a/chrome/browser/web_applications/web_app_database.cc
+++ b/chrome/browser/web_applications/web_app_database.cc
@@ -329,11 +329,11 @@
 blink::mojom::DisplayMode ToMojomDisplayMode(
     ::sync_pb::WebAppSpecifics::DisplayMode display_mode) {
   switch (display_mode) {
-    case ::sync_pb::WebAppSpecifics::kBrowser:
+    case ::sync_pb::WebAppSpecifics::BROWSER:
       return blink::mojom::DisplayMode::kBrowser;
-    case ::sync_pb::WebAppSpecifics::kMinimalUi:
+    case ::sync_pb::WebAppSpecifics::MINIMAL_UI:
       return blink::mojom::DisplayMode::kMinimalUi;
-    case ::sync_pb::WebAppSpecifics::kStandalone:
+    case ::sync_pb::WebAppSpecifics::STANDALONE:
       return blink::mojom::DisplayMode::kStandalone;
   }
 }
@@ -342,16 +342,16 @@
     blink::mojom::DisplayMode display_mode) {
   switch (display_mode) {
     case blink::mojom::DisplayMode::kBrowser:
-      return ::sync_pb::WebAppSpecifics::kBrowser;
+      return ::sync_pb::WebAppSpecifics::BROWSER;
     case blink::mojom::DisplayMode::kMinimalUi:
-      return ::sync_pb::WebAppSpecifics::kMinimalUi;
+      return ::sync_pb::WebAppSpecifics::MINIMAL_UI;
     case blink::mojom::DisplayMode::kUndefined:
       NOTREACHED();
       FALLTHROUGH;
     case blink::mojom::DisplayMode::kFullscreen:
     case blink::mojom::DisplayMode::kStandalone:
       // We do not persist kFullscreen - see crbug.com/850465.
-      return ::sync_pb::WebAppSpecifics::kStandalone;
+      return ::sync_pb::WebAppSpecifics::STANDALONE;
   }
 }
 
diff --git a/chrome/browser/web_applications/web_app_install_manager.cc b/chrome/browser/web_applications/web_app_install_manager.cc
index f6600eb..1b34f0c31 100644
--- a/chrome/browser/web_applications/web_app_install_manager.cc
+++ b/chrome/browser/web_applications/web_app_install_manager.cc
@@ -167,7 +167,8 @@
 
 void WebAppInstallManager::InstallWebAppsAfterSync(
     std::vector<WebApp*> web_apps) {
-  // TODO(crbug.com/860583): Implement sync-initiated app installs.
+  // TODO(crbug.com/860583): Implement sync-initiated app installs. Use
+  // WebAppInstallTask::ExpectAppId functionality here.
   NOTIMPLEMENTED();
 }
 
diff --git a/chrome/browser/web_applications/web_app_install_task.cc b/chrome/browser/web_applications/web_app_install_task.cc
index 6cf12de..b9e15987 100644
--- a/chrome/browser/web_applications/web_app_install_task.cc
+++ b/chrome/browser/web_applications/web_app_install_task.cc
@@ -71,6 +71,10 @@
 
 WebAppInstallTask::~WebAppInstallTask() = default;
 
+void WebAppInstallTask::ExpectAppId(const AppId& expected_app_id) {
+  expected_app_id_ = expected_app_id;
+}
+
 void WebAppInstallTask::InstallWebAppFromManifest(
     content::WebContents* contents,
     WebappInstallSource install_source,
@@ -297,6 +301,15 @@
   UpdateWebAppInfoFromManifest(manifest, web_app_info.get(),
                                for_installable_site);
 
+  AppId app_id = GenerateAppIdFromURL(web_app_info->app_url);
+
+  // Do the app_id expectation check if requested.
+  if (expected_app_id_.has_value() && *expected_app_id_ != app_id) {
+    CallInstallCallback(std::move(app_id),
+                        InstallResultCode::kExpectedAppIdCheckFailed);
+    return;
+  }
+
   std::vector<GURL> icon_urls =
       GetValidIconUrlsToDownload(*web_app_info, /*data=*/nullptr);
 
diff --git a/chrome/browser/web_applications/web_app_install_task.h b/chrome/browser/web_applications/web_app_install_task.h
index 276d5430..bee16c9 100644
--- a/chrome/browser/web_applications/web_app_install_task.h
+++ b/chrome/browser/web_applications/web_app_install_task.h
@@ -44,6 +44,11 @@
                     std::unique_ptr<WebAppDataRetriever> data_retriever);
   ~WebAppInstallTask() override;
 
+  // Request the app_id expectation check. Install fails with
+  // kExpectedAppIdCheckFailed if actual app_id doesn't match expected app_id.
+  // The actual resulting app_id is reported as a part of OnceInstallCallback.
+  void ExpectAppId(const AppId& expected_app_id);
+
   // Checks a WebApp installability, retrieves manifest and icons and
   // then performs the actual installation.
   void InstallWebAppFromManifest(
@@ -172,6 +177,7 @@
   InstallManager::WebAppInstallDialogCallback dialog_callback_;
   InstallManager::OnceInstallCallback install_callback_;
   base::Optional<InstallManager::InstallParams> install_params_;
+  base::Optional<AppId> expected_app_id_;
   bool background_installation_ = false;
 
   // The mechanism via which the app creation was triggered, will stay as
diff --git a/chrome/browser/web_applications/web_app_install_task_unittest.cc b/chrome/browser/web_applications/web_app_install_task_unittest.cc
index c43131a..85f46a9 100644
--- a/chrome/browser/web_applications/web_app_install_task_unittest.cc
+++ b/chrome/browser/web_applications/web_app_install_task_unittest.cc
@@ -20,6 +20,7 @@
 #include "chrome/browser/installable/installable_data.h"
 #include "chrome/browser/installable/installable_metrics.h"
 #include "chrome/browser/web_applications/components/web_app_constants.h"
+#include "chrome/browser/web_applications/components/web_app_helpers.h"
 #include "chrome/browser/web_applications/components/web_app_icon_generator.h"
 #include "chrome/browser/web_applications/components/web_app_utils.h"
 #include "chrome/browser/web_applications/test/test_app_shortcut_manager.h"
@@ -331,6 +332,7 @@
   }
 
  protected:
+  WebAppInstallTask& install_task() { return *install_task_; }
   TestWebAppRegistryController& controller() {
     return *test_registry_controller_;
   }
@@ -1166,4 +1168,28 @@
   }
 }
 
+TEST_F(WebAppInstallTaskTest, InstallWebAppFromManifest_ExpectAppId) {
+  const auto url1 = GURL("https://example.com/");
+  const auto url2 = GURL("https://example.org/");
+  const AppId app_id1 = GenerateAppIdFromURL(url1);
+  const AppId app_id2 = GenerateAppIdFromURL(url2);
+  ASSERT_NE(app_id1, app_id2);
+  {
+    CreateDefaultDataToRetrieve(url1);
+    install_task().ExpectAppId(app_id1);
+    InstallResult result = InstallWebAppFromManifestWithFallbackAndGetResults();
+    EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
+    EXPECT_EQ(app_id1, result.app_id);
+    EXPECT_TRUE(registrar().GetAppById(app_id1));
+  }
+  {
+    CreateDefaultDataToRetrieve(url2);
+    install_task().ExpectAppId(app_id1);
+    InstallResult result = InstallWebAppFromManifestWithFallbackAndGetResults();
+    EXPECT_EQ(InstallResultCode::kExpectedAppIdCheckFailed, result.code);
+    EXPECT_EQ(app_id2, result.app_id);
+    EXPECT_FALSE(registrar().GetAppById(app_id2));
+  }
+}
+
 }  // namespace web_app
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn
index 3cf0e1a7..23a41d5 100644
--- a/chrome/common/BUILD.gn
+++ b/chrome/common/BUILD.gn
@@ -747,6 +747,7 @@
     "plugin.mojom",
     "prerender.mojom",
     "renderer_configuration.mojom",
+    "sync_encryption_keys_extension.mojom",
   ]
 
   deps = []
diff --git a/chrome/common/extensions/docs/examples/api/printingMetrics/background.js b/chrome/common/extensions/docs/examples/api/printingMetrics/background.js
new file mode 100644
index 0000000..283a841
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/printingMetrics/background.js
@@ -0,0 +1,12 @@
+// Copyright 2019 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.
+
+chrome.printingMetrics.onPrintJobFinished.addListener(function(printJob) {
+  chrome.storage.local.get('printJobs', function(result) {
+    let printJobs = result.printJobs || 0;
+    printJobs++;
+    chrome.browserAction.setBadgeText({text: printJobs.toString()});
+    chrome.storage.local.set({printJobs: printJobs});
+  });
+});
diff --git a/chrome/common/extensions/docs/examples/api/printingMetrics/manifest.json b/chrome/common/extensions/docs/examples/api/printingMetrics/manifest.json
new file mode 100644
index 0000000..22e16f0
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/printingMetrics/manifest.json
@@ -0,0 +1,20 @@
+{
+  "name": "Print Job History",
+  "version": "1.0",
+  "description": "Reads your print history and displays the recent print jobs.",
+  "permissions": [
+    "printingMetrics",
+    "storage"
+  ],
+  "browser_action": {
+    "default_popup": "printJobs.html",
+    "default_icon": "print.png"
+  },
+  "background": {
+    "scripts": [
+      "background.js"
+    ],
+    "persistent": false
+  },
+  "manifest_version": 2
+}
diff --git a/chrome/common/extensions/docs/examples/api/printingMetrics/print.png b/chrome/common/extensions/docs/examples/api/printingMetrics/print.png
new file mode 100644
index 0000000..19057a5
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/printingMetrics/print.png
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.css b/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.css
new file mode 100644
index 0000000..fb9e350
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.css
@@ -0,0 +1,18 @@
+/**
+ * Copyright 2019 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.
+ */
+
+table, th, td, tr {
+  border: 1px solid black;
+}
+
+table {
+  width: 100%;
+  border-collapse: collapse;
+}
+
+div {
+  overflow: auto;
+}
diff --git a/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.html b/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.html
new file mode 100644
index 0000000..739e97f
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.html
@@ -0,0 +1,41 @@
+<!--
+ * Copyright 2019 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.
+-->
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <title>Recent print jobs</title>
+    <link href="printJobs.css" rel="stylesheet" type="text/css">
+    <script src="printJobs.js"></script>
+  </head>
+
+  <body>
+    <h2>Recent print jobs:</h2>
+    <div id="printJobs">
+      <table id="printJobsTable">
+        <thead>
+          <tr>
+            <th rowspan="2">Title</th>
+            <th rowspan="2">Status</th>
+            <th rowspan="2">Time</th>
+            <th rowspan="2">Number of pages</th>
+            <th colspan="3">Printer</th>
+            <th colspan="5">Settings</th>
+          </tr>
+          <tr>
+            <th>Name</th>
+            <th>URI</th>
+            <th>Source</th>
+            <th>Color</th>
+            <th>Duplex</th>
+            <th>Paper width</th>
+            <th>Paper height</th>
+            <th>Copies</th>
+          </tr>
+        </thead>
+      </table>
+    </div>
+  </body>
+</html>
diff --git a/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.js b/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.js
new file mode 100644
index 0000000..dee293a
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/printingMetrics/printJobs.js
@@ -0,0 +1,36 @@
+// Copyright 2019 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.
+
+function showPrintJobTable() {
+  chrome.printingMetrics.getPrintJobs(function(printJobs) {
+    const tbody = document.createElement('tbody');
+
+    for (let i = 0; i < printJobs.length; ++i) {
+      const columnValues = [
+        printJobs[i].title, printJobs[i].status,
+        new Date(printJobs[i].completionTime), printJobs[i].numberOfPages,
+        printJobs[i].printer.name, printJobs[i].printer.uri,
+        printJobs[i].printer.source, printJobs[i].settings.color,
+        printJobs[i].settings.duplex, printJobs[i].settings.mediaSize.width,
+        printJobs[i].settings.mediaSize.height, printJobs[i].settings.copies
+      ];
+
+      let tr = document.createElement('tr');
+      for (columnValue of columnValues) {
+        const td = document.createElement('td');
+        td.appendChild(document.createTextNode(columnValue));
+        td.setAttribute('align', 'center');
+        tr.appendChild(td);
+      }
+      tbody.appendChild(tr);
+    }
+
+    const table = document.getElementById('printJobsTable');
+    table.appendChild(tbody);
+  });
+}
+
+document.addEventListener('DOMContentLoaded', function() {
+  showPrintJobTable();
+});
diff --git a/chrome/common/extensions/docs/templates/intros/webRequest.html b/chrome/common/extensions/docs/templates/intros/webRequest.html
index 389b39d..14ab176 100644
--- a/chrome/common/extensions/docs/templates/intros/webRequest.html
+++ b/chrome/common/extensions/docs/templates/intros/webRequest.html
@@ -131,6 +131,15 @@
 </p>
 
 <p>
+<span class="availability">Starting from Chrome 79</span>, the webRequest API
+<strong>does not</strong> intercept CORS preflight requests and responses by
+default. A CORS preflight for a request URL is visible to an extension if there
+is a listener with <code>'extraHeaders'</code> specified in
+<code>opt_extraInfoSpec</code> for the request URL. <code>onBeforeRequest</code>
+can also take <code>'extraHeaders'</code> from Chrome 79.
+</p>
+
+<p>
 <span class="availability">Starting from Chrome 79</span>, the following request
 header is <strong>not provided</strong> and cannot be modified or removed
 without specifying <code>'extraHeaders'</code> in
diff --git a/chrome/common/sync_encryption_keys_extension.mojom b/chrome/common/sync_encryption_keys_extension.mojom
new file mode 100644
index 0000000..81f18394
--- /dev/null
+++ b/chrome/common/sync_encryption_keys_extension.mojom
@@ -0,0 +1,15 @@
+// Copyright 2019 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.
+
+module chrome.mojom;
+
+// API exposed by the browser process to the renderer process, such that the
+// renderer can interact with the encryption state of Sync. Exposed to allowed
+// origins only.
+interface SyncEncryptionKeysExtension {
+  // Provides sync encryption keys to the browser process. Returns true if no
+  // further encryption keys are needed (which includes the case, among others,
+  // of encryption keys not being needed even prior to this call).
+  SetEncryptionKeys(array<string> encryption_keys, string account_id) => ();
+};
diff --git a/chrome/credential_provider/gaiacp/associated_user_validator.cc b/chrome/credential_provider/gaiacp/associated_user_validator.cc
index 74926326..d4abd8ae 100644
--- a/chrome/credential_provider/gaiacp/associated_user_validator.cc
+++ b/chrome/credential_provider/gaiacp/associated_user_validator.cc
@@ -278,7 +278,7 @@
       continue;
 
     // Note that logon hours cannot be changed on domain joined AD user account.
-    if (!IsTokenHandleValidForUserInternal(sid) &&
+    if (GetAuthEnforceReason(sid) != EnforceAuthReason::NOT_ENFORCED &&
         !manager->IsUserDomainJoined(sid)) {
       LOGFN(INFO) << "Revoking access for sid=" << sid;
       HRESULT hr = ModifyUserAccess(policy, sid, false);
@@ -441,14 +441,15 @@
 bool AssociatedUserValidator::IsTokenHandleValidForUser(
     const base::string16& sid) {
   base::AutoLock locker(validator_lock_);
-  return IsTokenHandleValidForUserInternal(sid);
+  return GetAuthEnforceReason(sid) ==
+         AssociatedUserValidator::EnforceAuthReason::NOT_ENFORCED;
 }
 
-bool AssociatedUserValidator::IsTokenHandleValidForUserInternal(
-    const base::string16& sid) {
+AssociatedUserValidator::EnforceAuthReason
+AssociatedUserValidator::GetAuthEnforceReason(const base::string16& sid) {
   // All token handles are valid when no internet connection is available.
   if (!HasInternetConnection())
-    return true;
+    return AssociatedUserValidator::EnforceAuthReason::NOT_ENFORCED;
 
   // If at this point there is no token info entry for this user, assume the
   // user is not associated and does not need a token handle and is thus always
@@ -462,12 +463,12 @@
   auto validity_it = user_to_token_handle_info_.find(sid);
 
   if (validity_it == user_to_token_handle_info_.end())
-    return true;
+    return AssociatedUserValidator::EnforceAuthReason::NOT_ENFORCED;
 
   // If mdm enrollment is needed, then force a reauth for all users so
   // that they enroll.
   if (NeedsToEnrollWithMdm())
-    return false;
+    return AssociatedUserValidator::EnforceAuthReason::NOT_ENROLLED_WITH_MDM;
 
   if (MdmPasswordRecoveryEnabled()) {
     base::string16 store_key = GetUserPasswordLsaStoreKey(sid);
@@ -476,7 +477,8 @@
       LOGFN(INFO) << "Enforcing re-auth due to missing password lsa store "
                      "data for user "
                   << sid;
-      return false;
+      return AssociatedUserValidator::EnforceAuthReason::
+          MISSING_PASSWORD_RECOVERY_INFO;
     }
   }
 
@@ -519,7 +521,9 @@
                                            : now;
   }
 
-  return validity_it->second->is_valid;
+  return validity_it->second->is_valid
+             ? AssociatedUserValidator::EnforceAuthReason::NOT_ENFORCED
+             : AssociatedUserValidator::EnforceAuthReason::INVALID_TOKEN_HANDLE;
 }
 
 void AssociatedUserValidator::BlockDenyAccessUpdate() {
diff --git a/chrome/credential_provider/gaiacp/associated_user_validator.h b/chrome/credential_provider/gaiacp/associated_user_validator.h
index fc8ca9b8..c9a0f00 100644
--- a/chrome/credential_provider/gaiacp/associated_user_validator.h
+++ b/chrome/credential_provider/gaiacp/associated_user_validator.h
@@ -98,6 +98,18 @@
   // needs to complete before the function returns.
   bool IsTokenHandleValidForUser(const base::string16& sid);
 
+  enum EnforceAuthReason {
+    NOT_ENFORCED = 0,
+    NOT_ENROLLED_WITH_MDM,
+    MISSING_PASSWORD_RECOVERY_INFO,
+    INVALID_TOKEN_HANDLE
+  };
+
+  // Returns the reason for enforcing authentication for the provided |sid|.
+  // This function is blocking and may fire off a query for a token handle that
+  // needs to complete before the function returns.
+  EnforceAuthReason GetAuthEnforceReason(const base::string16& sid);
+
   // Checks if user access blocking is enforced given the usage scenario (and
   // other registry based checks).
   bool IsUserAccessBlockingEnforced(
@@ -148,8 +160,6 @@
   void ForceRefreshTokenHandlesForTesting();
 
  private:
-  bool IsTokenHandleValidForUserInternal(const base::string16& sid);
-
   void CheckTokenHandleValidity(
       const std::map<base::string16, base::string16>& handles_to_verify);
   void StartTokenValidityQuery(const base::string16& sid,
diff --git a/chrome/credential_provider/gaiacp/gaia_resources.grd b/chrome/credential_provider/gaiacp/gaia_resources.grd
index cc50aa2..f127a9b4 100644
--- a/chrome/credential_provider/gaiacp/gaia_resources.grd
+++ b/chrome/credential_provider/gaiacp/gaia_resources.grd
@@ -94,8 +94,14 @@
       <message name="IDS_REAUTH_FID_DESCRIPTION" desc="">
         Your session has expired. Sign in using your Google work account.
       </message>
+      <message name="IDS_REAUTH_NOT_ENROLLED_WITH_MDM_FID_DESCRIPTION" desc="">
+        Your device needs to enroll with device management. Sign in using your Google work account.
+      </message>
+      <message name="IDS_REAUTH_MISSING_PASSWORD_RECOVERY_INFO_FID_DESCRIPTION" desc="">
+        Your device is missing recovery info. Sign in using your Google work account.
+      </message>
       <message name="IDS_REAUTH_AD_NO_USER_FID_DESCRIPTION" desc="">
-        Sign in using your gsuite work account.
+        Sign in using your GSuite work account.
       </message>
       <message name="IDS_AUTH_FID_PROVIDER_LABEL" desc="">
         Add work account
@@ -146,7 +152,7 @@
         Password
       </message>
       <message name="IDS_EMPTY_ACCESS_TOKEN" desc="">
-        Only Gsuite Enterprise users are allowed to login.
+        Only GSuite Enterprise users are allowed to login.
       </message>
       <message name="IDS_INVALID_AD_UPN" desc="">
         No Domain user could be found for your account. Please contact your administrator.
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_MISSING_PASSWORD_RECOVERY_INFO_FID_DESCRIPTION.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_MISSING_PASSWORD_RECOVERY_INFO_FID_DESCRIPTION.png.sha1
new file mode 100644
index 0000000..17e4e03
--- /dev/null
+++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_MISSING_PASSWORD_RECOVERY_INFO_FID_DESCRIPTION.png.sha1
@@ -0,0 +1 @@
+d21dcedb7459aadd73b2f81d37f8d2f20ec9d295
\ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_NOT_ENROLLED_WITH_MDM_FID_DESCRIPTION.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_NOT_ENROLLED_WITH_MDM_FID_DESCRIPTION.png.sha1
new file mode 100644
index 0000000..dc30482
--- /dev/null
+++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_REAUTH_NOT_ENROLLED_WITH_MDM_FID_DESCRIPTION.png.sha1
@@ -0,0 +1 @@
+9ef03e999ebf4692ef9aa3d96fa739a1bd86e184
\ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/reauth_credential.cc b/chrome/credential_provider/gaiacp/reauth_credential.cc
index ca2f9b9..0d5e7e6 100644
--- a/chrome/credential_provider/gaiacp/reauth_credential.cc
+++ b/chrome/credential_provider/gaiacp/reauth_credential.cc
@@ -103,7 +103,22 @@
         OSUserManager::Get()->IsUserDomainJoined(sid)) {
       description_label_id = IDS_REAUTH_AD_NO_USER_FID_DESCRIPTION_BASE;
     } else {
-      description_label_id = IDS_REAUTH_FID_DESCRIPTION_BASE;
+      auto auth_enforce_reason =
+          AssociatedUserValidator::Get()->GetAuthEnforceReason(sid);
+      switch (auth_enforce_reason) {
+        case AssociatedUserValidator::EnforceAuthReason::NOT_ENROLLED_WITH_MDM:
+          description_label_id =
+              IDS_REAUTH_NOT_ENROLLED_WITH_MDM_FID_DESCRIPTION_BASE;
+          break;
+        case AssociatedUserValidator::EnforceAuthReason::
+            MISSING_PASSWORD_RECOVERY_INFO:
+          description_label_id =
+              IDS_REAUTH_MISSING_PASSWORD_RECOVERY_INFO_FID_DESCRIPTION_BASE;
+          break;
+        default:
+          description_label_id = IDS_REAUTH_FID_DESCRIPTION_BASE;
+          break;
+      }
     }
 
     base::string16 label(GetStringResource(description_label_id));
diff --git a/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc b/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc
index 7e4a767..4518adf3 100644
--- a/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc
+++ b/chrome/credential_provider/gaiacp/reauth_credential_unittests.cc
@@ -9,10 +9,12 @@
 #include "base/json/json_writer.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/test_reg_util_win.h"
+#include "build/branding_buildflags.h"
 #include "chrome/browser/ui/startup/credential_provider_signin_dialog_win_test_data.h"
 #include "chrome/credential_provider/common/gcp_strings.h"
 #include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h"
 #include "chrome/credential_provider/gaiacp/gaia_resources.h"
+#include "chrome/credential_provider/gaiacp/mdm_utils.h"
 #include "chrome/credential_provider/gaiacp/reauth_credential.h"
 #include "chrome/credential_provider/gaiacp/reg_utils.h"
 #include "chrome/credential_provider/test/com_fakes.h"
@@ -33,11 +35,14 @@
   void SetUp() override;
 
   registry_util::RegistryOverrideManager registry_override_;
+  FakeInternetAvailabilityChecker fake_internet_checker_;
   FakeOSUserManager fake_os_user_manager_;
   FakeScopedLsaPolicyFactory fake_scoped_lsa_policy_factory_;
 };
 
 void GcpReauthCredentialTest::SetUp() {
+  fake_internet_checker_.SetHasInternetConnection(
+      FakeInternetAvailabilityChecker::kHicForceYes);
   InitializeRegistryOverrideForTesting(&registry_override_);
 }
 
@@ -156,6 +161,110 @@
                                             ::testing::Bool(),
                                             ::testing::Bool()));
 
+// Tests the GetStringValue method specific to FID_DESCRIPTION label for reasons
+// to enforce GLS. Parameters are:
+// 1. Is enrolled with mdm.
+// 2. Is encrypted data missing in lsa store.
+class GcpReauthCredentialEnforceAuthReasonGetStringValueTest
+    : public GcpReauthCredentialTest,
+      public ::testing::WithParamInterface<std::tuple<bool, bool>> {
+ protected:
+  FakeAssociatedUserValidator* fake_associated_user_validator() {
+    return &fake_associated_user_validator_;
+  }
+
+ private:
+  FakeAssociatedUserValidator fake_associated_user_validator_;
+};
+
+TEST_P(GcpReauthCredentialEnforceAuthReasonGetStringValueTest, FidDescription) {
+  USES_CONVERSION;
+  // Enable standard escrow service features in non-Chrome builds so that
+  // the escrow service code can be tested by the build machines.
+#if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
+  GoogleMdmEscrowServiceEnablerForTesting escrow_service_enabler(true);
+#endif
+
+  CredentialProviderSigninDialogTestDataStorage test_data_storage;
+
+  const bool enrolled_mdm = std::get<0>(GetParam());
+  const bool store_encrypted_data = std::get<1>(GetParam());
+
+  ASSERT_EQ(S_OK, SetGlobalFlagForTesting(kRegMdmUrl, L"https://mdm.com"));
+  ASSERT_EQ(S_OK, SetGlobalFlagForTesting(kRegMdmEscrowServiceServerUrl,
+                                          L"https://escrow.com"));
+
+  GoogleMdmEnrolledStatusForTesting forced_enrolled_status(enrolled_mdm);
+
+  CComPtr<IReauthCredential> reauth;
+  ASSERT_EQ(S_OK, CComCreator<CComObject<CReauthCredential>>::CreateInstance(
+                      nullptr, IID_IReauthCredential, (void**)&reauth));
+  ASSERT_TRUE(!!reauth);
+
+  CComBSTR username = L"foo_bar";
+  CComBSTR full_name = A2COLE(test_data_storage.GetSuccessFullName().c_str());
+  CComBSTR password = A2COLE(test_data_storage.GetSuccessPassword().c_str());
+  CComBSTR email = A2COLE(test_data_storage.GetSuccessEmail().c_str());
+
+  // Create a fake user to reauth.
+  CComBSTR sid = nullptr;
+
+  ASSERT_EQ(S_OK,
+            fake_os_user_manager()->CreateTestOSUser(
+                OLE2CW(username), OLE2CW(password), OLE2CW(full_name),
+                L"comment", base::UTF8ToUTF16(test_data_storage.GetSuccessId()),
+                OLE2CW(email), &sid));
+
+  if (store_encrypted_data) {
+    base::string16 store_key = GetUserPasswordLsaStoreKey(OLE2W(sid));
+
+    auto policy = ScopedLsaPolicy::Create(POLICY_ALL_ACCESS);
+    EXPECT_TRUE(SUCCEEDED(
+        policy->StorePrivateData(store_key.c_str(), L"encrypted_data")));
+    EXPECT_TRUE(policy->PrivateDataExists(store_key.c_str()));
+  }
+
+  // Populate the associated users list. The created user's token handle
+  // should be valid so that no reauth credential is created.
+  fake_associated_user_validator()->StartRefreshingTokenHandleValidity();
+
+  ASSERT_EQ(S_OK, reauth->SetOSUserInfo(
+                      sid, CComBSTR(OSUserManager::GetLocalDomain().c_str()),
+                      CComBSTR(W2COLE(L"username"))));
+
+  ASSERT_EQ(S_OK, reauth->SetEmailForReauth(CComBSTR(email)));
+
+  CComPtr<ICredentialProviderCredential2> cpc2;
+  ASSERT_EQ(S_OK, reauth->QueryInterface(IID_ICredentialProviderCredential2,
+                                         reinterpret_cast<void**>(&cpc2)));
+  LPWSTR string_value = nullptr;
+  ASSERT_EQ(S_OK, cpc2->GetStringValue(FID_DESCRIPTION, &string_value));
+
+  if (!enrolled_mdm) {
+    ASSERT_STREQ(
+        string_value,
+        W2COLE(GetStringResource(
+                   IDS_REAUTH_NOT_ENROLLED_WITH_MDM_FID_DESCRIPTION_BASE)
+                   .c_str()));
+  } else if (!store_encrypted_data) {
+    ASSERT_STREQ(
+        string_value,
+        W2COLE(
+            GetStringResource(
+                IDS_REAUTH_MISSING_PASSWORD_RECOVERY_INFO_FID_DESCRIPTION_BASE)
+                .c_str()));
+  } else {
+    ASSERT_STREQ(
+        string_value,
+        W2COLE(GetStringResource(IDS_REAUTH_FID_DESCRIPTION_BASE).c_str()));
+  }
+}
+
+INSTANTIATE_TEST_SUITE_P(,
+                         GcpReauthCredentialEnforceAuthReasonGetStringValueTest,
+                         ::testing::Combine(::testing::Bool(),
+                                            ::testing::Bool()));
+
 class GcpReauthCredentialGlsRunnerTest : public GlsRunnerTestBase {};
 
 TEST_F(GcpReauthCredentialGlsRunnerTest, NoGaiaIdAvailable) {
diff --git a/chrome/renderer/autofill/fake_mojo_password_manager_driver.cc b/chrome/renderer/autofill/fake_mojo_password_manager_driver.cc
index 1bbe745..e0af736 100644
--- a/chrome/renderer/autofill/fake_mojo_password_manager_driver.cc
+++ b/chrome/renderer/autofill/fake_mojo_password_manager_driver.cc
@@ -51,16 +51,6 @@
       submission_indication_event;
 }
 
-void FakeMojoPasswordManagerDriver::ShowPasswordSuggestions(
-    base::i18n::TextDirection text_direction,
-    const base::string16& typed_username,
-    int options,
-    const gfx::RectF& bounds) {
-  called_show_pw_suggestions_ = true;
-  show_pw_suggestions_username_ = typed_username;
-  show_pw_suggestions_options_ = options;
-}
-
 void FakeMojoPasswordManagerDriver::RecordSavePasswordProgress(
     const std::string& log) {
   called_record_save_progress_ = true;
diff --git a/chrome/renderer/autofill/fake_mojo_password_manager_driver.h b/chrome/renderer/autofill/fake_mojo_password_manager_driver.h
index 2502b89..b827917 100644
--- a/chrome/renderer/autofill/fake_mojo_password_manager_driver.h
+++ b/chrome/renderer/autofill/fake_mojo_password_manager_driver.h
@@ -34,23 +34,11 @@
   // TODO(crbug.com/948062): Migrate the other methods to GMock as well.
   MOCK_METHOD0(ShowTouchToFill, void());
 
-  bool called_show_pw_suggestions() const {
-    return called_show_pw_suggestions_;
-  }
-
-  const base::Optional<base::string16>& show_pw_suggestions_username() const {
-    return show_pw_suggestions_username_;
-  }
-
-  int show_pw_suggestions_options() const {
-    return show_pw_suggestions_options_;
-  }
-
-  void reset_show_pw_suggestions() {
-    called_show_pw_suggestions_ = false;
-    show_pw_suggestions_username_ = base::nullopt;
-    show_pw_suggestions_options_ = -1;
-  }
+  MOCK_METHOD4(ShowPasswordSuggestions,
+               void(base::i18n::TextDirection,
+                    const base::string16&,
+                    int,
+                    const gfx::RectF&));
 
   bool called_show_not_secure_warning() const {
     return called_show_not_secure_warning_;
@@ -153,11 +141,6 @@
   void SameDocumentNavigation(autofill::mojom::SubmissionIndicatorEvent
                                   submission_indication_event) override;
 
-  void ShowPasswordSuggestions(base::i18n::TextDirection text_direction,
-                               const base::string16& typed_username,
-                               int options,
-                               const gfx::RectF& bounds) override;
-
   void RecordSavePasswordProgress(const std::string& log) override;
 
   void UserModifiedPasswordField() override;
@@ -176,11 +159,6 @@
   void LogFirstFillingResult(uint32_t form_renderer_id,
                              int32_t result) override {}
 
-  // Records whether ShowPasswordSuggestions() gets called.
-  bool called_show_pw_suggestions_ = false;
-  // Records data received via ShowPasswordSuggestions() call.
-  base::Optional<base::string16> show_pw_suggestions_username_;
-  int show_pw_suggestions_options_ = -1;
   // Records whether ShowNotSecureWarning() gets called.
   bool called_show_not_secure_warning_ = false;
   // Records whether PasswordFormSubmitted() gets called.
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
index ec3466f2..17bf99b 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -24,6 +24,7 @@
 #include "components/autofill/content/renderer/password_generation_agent.h"
 #include "components/autofill/content/renderer/test_password_autofill_agent.h"
 #include "components/autofill/core/common/autofill_constants.h"
+#include "components/autofill/core/common/autofill_features.h"
 #include "components/autofill/core/common/autofill_switches.h"
 #include "components/autofill/core/common/form_data.h"
 #include "components/autofill/core/common/form_field_data.h"
@@ -44,6 +45,10 @@
 #include "third_party/blink/public/web/web_widget.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 
+#if defined(OS_ANDROID)
+#include "components/autofill/core/common/autofill_features.h"
+#endif
+
 #if defined(OS_WIN)
 #include "third_party/blink/public/web/win/web_font_rendering.h"
 #endif
@@ -64,6 +69,9 @@
 using blink::WebLocalFrame;
 using blink::WebString;
 using testing::_;
+using testing::AtMost;
+using testing::Eq;
+using testing::Truly;
 
 namespace {
 
@@ -409,6 +417,13 @@
         password_manager::features::kFillOnAccountSelect);
   }
 
+#if defined(OS_ANDROID)
+  void EnableTouchToFillFeature() {
+    scoped_feature_list_.InitAndEnableFeature(
+        autofill::features::kTouchToFillAndroid);
+  }
+#endif
+
   void EnableShowAutofillSignatures() {
     base::CommandLine::ForCurrentProcess()->AppendSwitch(
         switches::kShowAutofillSignatures);
@@ -600,22 +615,14 @@
   // the expected flag for the PasswordAutofillManager, whether to show all
   // suggestions, or only those starting with |username|.
   void CheckSuggestions(const std::string& username, bool show_all) {
+    auto show_all_matches = [show_all](int options) {
+      return show_all == !!(options & autofill::SHOW_ALL);
+    };
+
+    EXPECT_CALL(fake_driver_,
+                ShowPasswordSuggestions(_, Eq(ASCIIToUTF16(username)),
+                                        Truly(show_all_matches), _));
     base::RunLoop().RunUntilIdle();
-
-    ASSERT_TRUE(fake_driver_.called_show_pw_suggestions());
-    ASSERT_TRUE(static_cast<bool>(fake_driver_.show_pw_suggestions_username()));
-    EXPECT_EQ(ASCIIToUTF16(username),
-              *(fake_driver_.show_pw_suggestions_username()));
-    EXPECT_EQ(show_all,
-              static_cast<bool>(fake_driver_.show_pw_suggestions_options() &
-                                autofill::SHOW_ALL));
-
-    fake_driver_.reset_show_pw_suggestions();
-  }
-
-  bool GetCalledShowPasswordSuggestions() {
-    base::RunLoop().RunUntilIdle();
-    return fake_driver_.called_show_pw_suggestions();
   }
 
   void ExpectFieldPropertiesMasks(
@@ -1737,6 +1744,16 @@
   base::RunLoop().RunUntilIdle();
 }
 
+#if defined(OS_ANDROID)
+TEST_F(PasswordAutofillAgentTest, TouchToFillSuppressesPopups) {
+  SimulateOnFillPasswordForm(fill_data_);
+  SimulateSuggestionChoice(username_element_);
+  EXPECT_CALL(fake_driver_, ShowTouchToFill);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions).Times(0);
+  base::RunLoop().RunUntilIdle();
+}
+#endif
+
 TEST_F(PasswordAutofillAgentTest, DontTryToShowTouchToFillReadonlyPassword) {
   SetElementReadOnly(password_element_, true);
   SimulateOnFillPasswordForm(fill_data_);
@@ -1745,6 +1762,19 @@
       password_autofill_agent_->TryToShowTouchToFill(password_element_));
 }
 
+TEST_F(PasswordAutofillAgentTest, DontShowTouchToFillOnSecurePageIfParamIsSet) {
+  base::test::ScopedFeatureList scoped_feature_list;
+  scoped_feature_list.InitAndEnableFeatureWithParameters(
+      features::kAutofillTouchToFill, {{"insecure-origins-only", "true"}});
+
+  // Reload the page with a secure origin.
+  LoadHTMLWithUrlOverride(kFormHTML, "https://example.com");
+  SimulateOnFillPasswordForm(fill_data_);
+
+  EXPECT_FALSE(
+      password_autofill_agent_->TryToShowTouchToFill(password_element_));
+}
+
 TEST_F(PasswordAutofillAgentTest, TouchToFillDismissed) {
   SimulateOnFillPasswordForm(fill_data_);
 
@@ -1911,6 +1941,9 @@
   ClearUsernameAndPasswordFields();
   SimulateOnFillPasswordForm(fill_data_);
   SimulateElementClick(kUsernameName);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
+
   SimulateSuggestionChoice(username_element_);
   CheckSuggestions(kAliceUsername, true);
 
@@ -1932,6 +1965,8 @@
   // Call SimulateElementClick() to produce a user gesture on the page so
   // autofill will actually fill.
   SimulateElementClick(kUsernameName);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 
   // Simulate a user clicking on the username element. This should produce a
   // message with all the usernames.
@@ -1941,7 +1976,9 @@
   // Now simulate a user typing in an unrecognized username and then
   // clicking on the username element. This should also produce a message with
   // all the usernames.
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions).Times(AtMost(3));
   SimulateUsernameTyping("baz");
+
   autofill_agent_->FormControlElementClicked(username_element_, true);
   CheckSuggestions("baz", true);
   ClearUsernameAndPasswordFields();
@@ -1959,12 +1996,14 @@
   // Call SimulateElementClick() to produce a user gesture on the page so
   // autofill will actually fill.
   SimulateElementClick(kUsernameName);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 
   // Simulate a user clicking on the password element. This should produce no
   // message.
-  fake_driver_.reset_show_pw_suggestions();
   autofill_agent_->FormControlElementClicked(password_element_, false);
-  EXPECT_TRUE(GetCalledShowPasswordSuggestions());
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 }
 
 // The user types in a username and a password, but then just before sending
@@ -2381,7 +2420,8 @@
 
   SimulateSuggestionChoiceOfUsernameAndPassword(
       password_element_, base::string16(), ASCIIToUTF16(kAlicePassword));
-  ASSERT_FALSE(GetCalledShowPasswordSuggestions());
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions).Times(0);
+  base::RunLoop().RunUntilIdle();
 }
 
 // Tests with fill-on-account-select enabled that if the username element is
@@ -2534,7 +2574,9 @@
   SimulateElementClick("new_password");
   base::RunLoop().RunUntilIdle();
   testing::Mock::VerifyAndClearExpectations(&fake_pw_client_);
-  EXPECT_FALSE(GetCalledShowPasswordSuggestions());
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions).Times(0);
+  base::RunLoop().RunUntilIdle();
+
   // On destruction the state is updated.
   EXPECT_CALL(fake_pw_client_, GenerationElementLostFocus())
       .Times(testing::AnyNumber());
@@ -3197,6 +3239,8 @@
   // Call SimulateElementClick() to produce a user gesture on the page so
   // autofill will actually fill.
   SimulateElementClick(kUsernameName);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 
   // Simulate a user clicking on the password element. This should produce a
   // dropdown with suggestion of all available usernames.
@@ -3218,6 +3262,8 @@
   // Call SimulateElementClick() to produce a user gesture on the page so
   // autofill will actually fill.
   SimulateElementClick(kUsernameName);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 
   // Simulate a user clicking on the password elements. This should produce
   // dropdowns with suggestion of all available usernames.
@@ -3237,10 +3283,10 @@
 
   // Simulate a user clicking on not autofilled password fields. This should
   // produce no suggestion dropdowns.
-  fake_driver_.reset_show_pw_suggestions();
   SimulateElementClick("newpassword");
   SimulateElementClick("confirmpassword");
-  EXPECT_FALSE(GetCalledShowPasswordSuggestions());
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions).Times(0);
+  base::RunLoop().RunUntilIdle();
 
   // But when the user clicks on the autofilled password field again it should
   // still produce a suggestion dropdown.
@@ -3283,6 +3329,8 @@
   // Call SimulateElementClick() to produce a user gesture on the page so
   // autofill will actually fill.
   SimulateElementClick(kUsernameName);
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 
   // Simulate a user clicking on the password element. This should produce a
   // dropdown with suggestion of all available usernames.
@@ -3510,9 +3558,9 @@
 TEST_F(PasswordAutofillAgentTest, SuggestLatestCredentials) {
   password_autofill_agent_->FillPasswordForm(fill_data_);
   SimulateElementClick(kPasswordName);
-  EXPECT_TRUE(GetCalledShowPasswordSuggestions());
+  EXPECT_CALL(fake_driver_, ShowPasswordSuggestions);
+  base::RunLoop().RunUntilIdle();
 
-  fake_driver_.reset_show_pw_suggestions();
   // Change fill data
   fill_data_.username_field.value = ASCIIToUTF16("a-changed-username");
 
diff --git a/chrome/renderer/media/OWNERS b/chrome/renderer/media/OWNERS
index eaa0adc..4ff3732 100644
--- a/chrome/renderer/media/OWNERS
+++ b/chrome/renderer/media/OWNERS
@@ -4,6 +4,7 @@
 
 # For Cast-related changes.
 per-file cast_*=miu@chromium.org
+per-file cast_*=mfoltz@chromium.org
 
 # FlashEmbedRewrite
 per-file flash_embed_rewrite*=mlamouri@chromium.org
diff --git a/chrome/renderer/sync_encryption_keys_extension.cc b/chrome/renderer/sync_encryption_keys_extension.cc
index e429fff..4ee6a3d 100644
--- a/chrome/renderer/sync_encryption_keys_extension.cc
+++ b/chrome/renderer/sync_encryption_keys_extension.cc
@@ -10,11 +10,13 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/no_destructor.h"
+#include "content/public/common/isolated_world_ids.h"
 #include "content/public/renderer/chrome_object_extensions_utils.h"
 #include "content/public/renderer/render_frame.h"
 #include "gin/arguments.h"
 #include "gin/function_template.h"
 #include "google_apis/gaia/gaia_urls.h"
+#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
 #include "third_party/blink/public/web/blink.h"
 #include "third_party/blink/public/web/web_local_frame.h"
 #include "url/origin.h"
@@ -45,13 +47,17 @@
   delete this;
 }
 
-void SyncEncryptionKeysExtension::DidClearWindowObject() {
+void SyncEncryptionKeysExtension::DidCreateScriptContext(
+    v8::Local<v8::Context> v8_context,
+    int32_t world_id) {
   if (!render_frame()) {
     return;
   }
 
   url::Origin origin = render_frame()->GetWebFrame()->GetSecurityOrigin();
-  if (origin == GetAllowedOrigin()) {
+  if (render_frame()->IsMainFrame() &&
+      world_id == content::ISOLATED_WORLD_ID_GLOBAL &&
+      origin == GetAllowedOrigin()) {
     Install();
   }
 }
@@ -63,8 +69,9 @@
   v8::HandleScope handle_scope(isolate);
   v8::Local<v8::Context> context =
       render_frame()->GetWebFrame()->MainWorldScriptContext();
-  if (context.IsEmpty())
+  if (context.IsEmpty()) {
     return;
+  }
 
   v8::Context::Scope context_scope(context);
 
@@ -118,16 +125,22 @@
   auto global_callback =
       std::make_unique<v8::Global<v8::Function>>(args->isolate(), callback);
 
-  // TODO(crbug.com/1000146): Pass along the encryption keys to the browser
-  // process.
-  NOTIMPLEMENTED();
-  RunCompletionCallback(std::move(global_callback));
+  if (!remote_.is_bound()) {
+    render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(&remote_);
+  }
+
+  remote_->SetEncryptionKeys(
+      encryption_keys, account_id,
+      base::BindOnce(&SyncEncryptionKeysExtension::RunCompletionCallback,
+                     weak_ptr_factory_.GetWeakPtr(),
+                     std::move(global_callback)));
 }
 
 void SyncEncryptionKeysExtension::RunCompletionCallback(
     std::unique_ptr<v8::Global<v8::Function>> callback) {
-  if (!render_frame())
+  if (!render_frame()) {
     return;
+  }
 
   v8::Isolate* isolate = blink::MainThreadIsolate();
   v8::HandleScope handle_scope(isolate);
diff --git a/chrome/renderer/sync_encryption_keys_extension.h b/chrome/renderer/sync_encryption_keys_extension.h
index bb30a55..9499f84 100644
--- a/chrome/renderer/sync_encryption_keys_extension.h
+++ b/chrome/renderer/sync_encryption_keys_extension.h
@@ -10,7 +10,9 @@
 
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
+#include "chrome/common/sync_encryption_keys_extension.mojom.h"
 #include "content/public/renderer/render_frame_observer.h"
+#include "mojo/public/cpp/bindings/associated_remote.h"
 #include "v8/include/v8.h"
 
 namespace gin {
@@ -26,7 +28,8 @@
 
   // content::RenderFrameObserver:
   void OnDestruct() override;
-  void DidClearWindowObject() override;
+  void DidCreateScriptContext(v8::Local<v8::Context> v8_context,
+                              int32_t world_id) override;
 
  private:
   explicit SyncEncryptionKeysExtension(content::RenderFrame* frame);
@@ -36,6 +39,7 @@
   void RunCompletionCallback(
       std::unique_ptr<v8::Global<v8::Function>> callback);
 
+  mojo::AssociatedRemote<chrome::mojom::SyncEncryptionKeysExtension> remote_;
   base::WeakPtrFactory<SyncEncryptionKeysExtension> weak_ptr_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(SyncEncryptionKeysExtension);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index dbd47e20..bdb00c4 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -544,7 +544,7 @@
       "$root_gen_dir/chrome/android/chrome_apk_paks/resources.pak",
       "$root_gen_dir/components/components_resources.pak",
       "$root_out_dir/browser_tests.pak",
-      "//components/test/data/payments",
+      "//components/test/data/payments/",
     ]
   }
 
@@ -3268,6 +3268,7 @@
     "../browser/sync/profile_sync_service_factory_unittest.cc",
     "../browser/sync/session_sync_service_factory_unittest.cc",
     "../browser/sync/sessions/sync_sessions_web_contents_router_unittest.cc",
+    "../browser/sync/sync_encryption_keys_tab_helper_unittest.cc",
     "../browser/sync/sync_startup_tracker_unittest.cc",
     "../browser/tracing/background_tracing_field_trial_unittest.cc",
     "../browser/tracing/background_tracing_metrics_provider_unittest.cc",
diff --git a/chrome/test/base/test_service_manager_listener.cc b/chrome/test/base/test_service_manager_listener.cc
index a19a7f7..7c1bea6 100644
--- a/chrome/test/base/test_service_manager_listener.cc
+++ b/chrome/test/base/test_service_manager_listener.cc
@@ -7,22 +7,25 @@
 #include "base/run_loop.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/system_connector.h"
+#include "mojo/public/cpp/bindings/remote.h"
 #include "services/service_manager/public/cpp/connector.h"
 
-TestServiceManagerListener::TestServiceManagerListener() : binding_(this) {}
+TestServiceManagerListener::TestServiceManagerListener() : receiver_(this) {}
 
 TestServiceManagerListener::~TestServiceManagerListener() {}
 
 void TestServiceManagerListener::Init() {
-  DCHECK(!binding_.is_bound());
+  DCHECK(!receiver_.is_bound());
   // Register a listener on the ServiceManager to track when services are
   // started.
-  mojo::InterfacePtr<service_manager::mojom::ServiceManager> service_manager;
-  content::GetSystemConnector()->BindInterface(
-      service_manager::mojom::kServiceName, &service_manager);
-  service_manager::mojom::ServiceManagerListenerPtr listener_ptr;
-  binding_.Bind(mojo::MakeRequest(&listener_ptr));
-  service_manager->AddListener(std::move(listener_ptr));
+  mojo::Remote<service_manager::mojom::ServiceManager> service_manager;
+  content::GetSystemConnector()->Connect(
+      service_manager::mojom::kServiceName,
+      service_manager.BindNewPipeAndPassReceiver());
+  mojo::PendingRemote<service_manager::mojom::ServiceManagerListener>
+      listener_remote;
+  receiver_.Bind(listener_remote.InitWithNewPipeAndPassReceiver());
+  service_manager->AddListener(std::move(listener_remote));
 }
 
 void TestServiceManagerListener::WaitUntilServiceStarted(
diff --git a/chrome/test/base/test_service_manager_listener.h b/chrome/test/base/test_service_manager_listener.h
index a62ed13a..6e1f7bd 100644
--- a/chrome/test/base/test_service_manager_listener.h
+++ b/chrome/test/base/test_service_manager_listener.h
@@ -12,7 +12,7 @@
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
 #include "services/service_manager/public/mojom/service_manager.mojom.h"
 
 namespace service_manager {
@@ -51,7 +51,7 @@
   std::string service_name_;
   std::map<std::string, uint32_t> service_start_counters_;
 
-  mojo::Binding<service_manager::mojom::ServiceManagerListener> binding_;
+  mojo::Receiver<service_manager::mojom::ServiceManagerListener> receiver_;
 
   DISALLOW_COPY_AND_ASSIGN(TestServiceManagerListener);
 };
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index b524cddd..42fcb2a 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -653,6 +653,23 @@
       this, base::BindRepeating(&BuildWebDataService));
 }
 
+void TestingProfile::BlockUntilHistoryBackendDestroyed() {
+  // Only get the history service if it actually exists since the caller of the
+  // test should explicitly call CreateHistoryService to build it.
+  history::HistoryService* history_service =
+      HistoryServiceFactory::GetForProfileWithoutCreating(this);
+
+  // Nothing to destroy
+  if (!history_service) {
+    return;
+  }
+
+  base::RunLoop run_loop;
+  history_service->SetOnBackendDestroyTask(run_loop.QuitClosure());
+  HistoryServiceFactory::ShutdownForProfile(this);
+  run_loop.Run();
+}
+
 void TestingProfile::BlockUntilHistoryIndexIsRefreshed() {
   // Only get the history service if it actually exists since the caller of the
   // test should explicitly call CreateHistoryService to build it.
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 3c127cc7..bcdcb2d4 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -250,6 +250,11 @@
   // This is NOT invoked from CreateHistoryService.
   void BlockUntilHistoryIndexIsRefreshed();
 
+  // Blocks until the HistoryBackend is completely destroyed. This is mostly
+  // useful to ensure the destruction tasks do not outlive this class on which
+  // they depend.
+  void BlockUntilHistoryBackendDestroyed();
+
   // Allow setting a profile as Guest after-the-fact to simplify some tests.
   void SetGuestSession(bool guest);
 
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json
index bf065e83..c2bf89d6 100644
--- a/chrome/test/data/policy/policy_test_cases.json
+++ b/chrome/test/data/policy/policy_test_cases.json
@@ -5006,6 +5006,16 @@
     ]
   },
 
+  "DeviceWebBasedAttestationAllowedUrls": {
+    "os": ["chromeos"],
+    "test_policy": { "DeviceWebBasedAttestationAllowedUrls": ["[*.]example.com"] },
+    "pref_mappings": [
+      {
+        "pref": "cros.device.web_based_attestation_allowed_urls"
+      }
+    ]
+  },
+
   "----- Chrome Frame policies -------------------------------------------": {},
 
   "ChromeFrameRendererSettings": {
diff --git a/chrome/test/data/sync/encryption_keys_retrieval.html b/chrome/test/data/sync/encryption_keys_retrieval.html
new file mode 100644
index 0000000..c9961b9
--- /dev/null
+++ b/chrome/test/data/sync/encryption_keys_retrieval.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<script>
+window.onload = function() {
+  if (typeof chrome.setSyncEncryptionKeys == "undefined") {
+    document.title = "UNDEFINED";
+  } else {
+    chrome.setSyncEncryptionKeys([location.hash.substring(1)],
+                                 location.search.substring(1),
+                                 () => { document.title = "OK"; });
+  }
+}
+</script>
+</head>
+</html>
diff --git a/chrome/test/data/webrtc/peerconnection_getstats.js b/chrome/test/data/webrtc/peerconnection_getstats.js
index 129d730..f109076 100644
--- a/chrome/test/data/webrtc/peerconnection_getstats.js
+++ b/chrome/test/data/webrtc/peerconnection_getstats.js
@@ -132,6 +132,7 @@
   firCount: 'number',
   pliCount: 'number',
   sliCount: 'number',
+  estimatedPlayoutTimestamp: 'number',
   fractionLost: 'number',  // Obsolete, moved to RTCRemoteInboundRtpStreamStats.
   decoderImplementation: 'string',
 });
diff --git a/chrome/test/data/webui/chromeos/crostini_installer_app_test.js b/chrome/test/data/webui/chromeos/crostini_installer_app_test.js
new file mode 100644
index 0000000..131d14a6
--- /dev/null
+++ b/chrome/test/data/webui/chromeos/crostini_installer_app_test.js
@@ -0,0 +1,165 @@
+// Copyright 2019 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.
+
+import 'chrome://crostini-installer/app.js';
+
+import {BrowserProxy} from 'chrome://crostini-installer/browser_proxy.js';
+import {TestBrowserProxy} from 'chrome://test/test_browser_proxy.m.js';
+import {flushTasks} from 'chrome://test/test_util.m.js';
+
+const InstallerState = crostini.mojom.InstallerState;
+const InstallerError = crostini.mojom.InstallerError;
+
+class FakePageHandler extends TestBrowserProxy {
+  constructor() {
+    super(['install', 'cancel', 'cancelBeforeStart', 'close']);
+  }
+
+  /** @override */
+  install() {
+    this.methodCalled('install');
+  }
+
+  /** @override */
+  cancel() {
+    this.methodCalled('cancel');
+  }
+
+  /** @override */
+  cancelBeforeStart() {
+    this.methodCalled('cancelBeforeStart');
+  }
+
+  /** @override */
+  close() {
+    this.methodCalled('close');
+  }
+}
+
+class FakeBrowserProxy {
+  constructor() {
+    this.handler = new FakePageHandler();
+    this.callbackRouter =
+        new chromeos.crostiniInstaller.mojom.PageCallbackRouter();
+    /** @type {appManagement.mojom.PageRemote} */
+    this.page = this.callbackRouter.$.bindNewPipeAndPassRemote();
+  }
+}
+
+suite('<crostini-installer-app>', () => {
+  let fakeBrowserProxy;
+  let app;
+
+  setup(async () => {
+    fakeBrowserProxy = new FakeBrowserProxy();
+    BrowserProxy.instance_ = fakeBrowserProxy;
+
+    app = document.createElement('crostini-installer-app');
+    PolymerTest.clearBody();
+    document.body.appendChild(app);
+
+    await flushTasks();
+  });
+
+  teardown(function() {
+    app.remove();
+  });
+
+  const clickButton = async (button) => {
+    assertFalse(button.hidden);
+    assertFalse(button.disabled);
+    button.click();
+    await flushTasks();
+  };
+
+  const getInstallButton = () => {
+    return app.$$('.action-button');
+  };
+
+  const getCancelButton = () => {
+    return app.$$('.cancel-button');
+  };
+
+  const clickInstall = async () => {
+    await clickButton(getInstallButton());
+  };
+
+  const clickCancel = async () => {
+    await clickButton(getCancelButton());
+  };
+
+  test('installFlow', async () => {
+    expectFalse(app.$$('#prompt-message').hidden);
+    expectEquals(fakeBrowserProxy.handler.getCallCount('install'), 0);
+
+    await clickInstall();
+    expectFalse(app.$$('#installing-message').hidden);
+    expectEquals(fakeBrowserProxy.handler.getCallCount('install'), 1);
+    expectTrue(getInstallButton().hidden);
+
+    fakeBrowserProxy.page.onProgressUpdate(InstallerState.kStartConcierge, 0.5);
+    await flushTasks();
+    expectTrue(
+        !!app.$$('#installing-message > div').textContent,
+        'progress message should be set');
+    expectEquals(
+        app.$$('#installing-message > paper-progress').getAttribute('value'),
+        '50');
+
+    expectEquals(fakeBrowserProxy.handler.getCallCount('close'), 0);
+    fakeBrowserProxy.page.onInstallFinished(InstallerError.kNone);
+    await flushTasks();
+    expectEquals(fakeBrowserProxy.handler.getCallCount('close'), 1);
+  });
+
+  test('errorCancel', async () => {
+    await clickInstall();
+    fakeBrowserProxy.page.onInstallFinished(InstallerError.kErrorOffline);
+    await flushTasks();
+    expectFalse(app.$$('#error-message').hidden);
+    expectTrue(
+        !!app.$$('#error-message > div').textContent,
+        'error message should be set');
+
+    await clickCancel();
+    expectEquals(fakeBrowserProxy.handler.getCallCount('close'), 1);
+    expectEquals(fakeBrowserProxy.handler.getCallCount('cancelBeforeStart'), 0);
+    expectEquals(fakeBrowserProxy.handler.getCallCount('cancel'), 0);
+  });
+
+  test('errorRetry', async () => {
+    await clickInstall();
+    fakeBrowserProxy.page.onInstallFinished(InstallerError.kErrorOffline);
+    await flushTasks();
+    expectFalse(app.$$('#error-message').hidden);
+    expectTrue(
+        !!app.$$('#error-message > div').textContent,
+        'error message should be set');
+
+    await clickInstall();
+    expectEquals(fakeBrowserProxy.handler.getCallCount('install'), 2);
+  });
+
+  test('cancelBeforeStart', async () => {
+    await clickCancel();
+    expectEquals(fakeBrowserProxy.handler.getCallCount('cancelBeforeStart'), 1);
+    expectEquals(fakeBrowserProxy.handler.getCallCount('close'), 1);
+    expectEquals(fakeBrowserProxy.handler.getCallCount('cancel'), 0);
+  });
+
+  test('cancelAfterStart', async () => {
+    await clickInstall();
+    await clickCancel();
+    expectEquals(fakeBrowserProxy.handler.getCallCount('cancel'), 1);
+    expectEquals(
+        fakeBrowserProxy.handler.getCallCount('close'), 0,
+        'should not close until onCanceled is called');
+    expectTrue(getInstallButton().hidden);
+    expectTrue(getCancelButton().disabled);
+
+    fakeBrowserProxy.page.onCanceled();
+    await flushTasks();
+    expectEquals(fakeBrowserProxy.handler.getCallCount('close'), 1);
+  });
+});
diff --git a/chrome/test/data/webui/chromeos/crostini_installer_browsertest.js b/chrome/test/data/webui/chromeos/crostini_installer_browsertest.js
index 5b60be8..0d3fb12e 100644
--- a/chrome/test/data/webui/chromeos/crostini_installer_browsertest.js
+++ b/chrome/test/data/webui/chromeos/crostini_installer_browsertest.js
@@ -2,30 +2,35 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-
 /**
  * @fileoverview Test suite for the Crostini Installer page.
  */
 GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']);
 GEN('#include "chromeos/constants/chromeos_features.h"');
+GEN('#include "services/network/public/cpp/features.h"');
 
 function CrostiniInstallerBrowserTest() {}
 
 CrostiniInstallerBrowserTest.prototype = {
   __proto__: PolymerTest.prototype,
 
-  browsePreload: 'chrome://crostini-installer',
+  browsePreload:
+      'chrome://crostini-installer/test_loader.html?module=chromeos/crostini_installer_app_test.js',
 
-  featureList: {enabled: ['chromeos::features::kCrostiniWebUIInstaller']},
+  extraLibraries: [
+    '//third_party/mocha/mocha.js',
+    '//chrome/test/data/webui/mocha_adapter.js',
+  ],
+
+  featureList: {
+    enabled: [
+      'chromeos::features::kCrostiniWebUIInstaller',
+      'network::features::kOutOfBlinkCors'
+    ]
+  },
 };
 
-TEST_F('CrostiniInstallerBrowserTest', 'All', function() {
-  suite('<crostini-installer-app>', () => {
-    test('install', done => {
-      // TODO(lxj)
-      done();
-    });
-  });
 
+TEST_F('CrostiniInstallerBrowserTest', 'All', function() {
   mocha.run();
 });
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM
index a8d9456..1ef6df3 100644
--- a/chromeos/CHROMEOS_LKGM
+++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@
-12612.0.0
\ No newline at end of file
+12613.0.0
\ No newline at end of file
diff --git a/chromeos/services/ime/OWNERS b/chromeos/services/ime/OWNERS
index 183e04bf..b27b9c7 100644
--- a/chromeos/services/ime/OWNERS
+++ b/chromeos/services/ime/OWNERS
@@ -1,4 +1,5 @@
 googleo@chromium.org
+keithlee@chromium.org
 shuchen@chromium.org
 
 per-file ime_sandbox_hook.*=file://sandbox/linux/OWNERS
diff --git a/chromeos/settings/cros_settings_names.cc b/chromeos/settings/cros_settings_names.cc
index 0b430905a..8b12fea0 100644
--- a/chromeos/settings/cros_settings_names.cc
+++ b/chromeos/settings/cros_settings_names.cc
@@ -396,4 +396,9 @@
 
 // A boolean pref specifying if the device is allowed to powerwash.
 const char kDevicePowerwashAllowed[] = "cros.device.device_powerwash_allowed";
+
+// A list pref storing URL patterns that are allowed for device attestation
+// during SAML authentication.
+extern const char kDeviceWebBasedAttestationAllowedUrls[] =
+    "cros.device.device_web_based_attestation_allowed_urls";
 }  // namespace chromeos
diff --git a/chromeos/settings/cros_settings_names.h b/chromeos/settings/cros_settings_names.h
index 4ae7792..5a09bfb 100644
--- a/chromeos/settings/cros_settings_names.h
+++ b/chromeos/settings/cros_settings_names.h
@@ -232,6 +232,9 @@
 COMPONENT_EXPORT(CHROMEOS_SETTINGS)
 extern const char kDevicePowerwashAllowed[];
 
+COMPONENT_EXPORT(CHROMEOS_SETTINGS)
+extern const char kDeviceWebBasedAttestationAllowedUrls[];
+
 }  // namespace chromeos
 
 #endif  // CHROMEOS_SETTINGS_CROS_SETTINGS_NAMES_H_
diff --git a/components/arc/DEPS b/components/arc/DEPS
index 6b7f118..3691b497 100644
--- a/components/arc/DEPS
+++ b/components/arc/DEPS
@@ -19,7 +19,7 @@
   "+media/base",
   "+media/video/video_encode_accelerator.h",
   "+mojo",
-  "+storage/browser/fileapi",
+  "+storage/browser/file_system",
   "+third_party/re2",
   "+third_party/skia",
   "+ui/base",
diff --git a/components/arc/file_system/file_system_mojom_traits.h b/components/arc/file_system/file_system_mojom_traits.h
index d69f407..3e37946 100644
--- a/components/arc/file_system/file_system_mojom_traits.h
+++ b/components/arc/file_system/file_system_mojom_traits.h
@@ -6,7 +6,7 @@
 #define COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_MOJOM_TRAITS_H_
 
 #include "components/arc/mojom/file_system.mojom.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace mojo {
 
diff --git a/components/arc/mojom/file_system.typemap b/components/arc/mojom/file_system.typemap
index 8ea6051..1a98444 100644
--- a/components/arc/mojom/file_system.typemap
+++ b/components/arc/mojom/file_system.typemap
@@ -3,7 +3,7 @@
 # found in the LICENSE file.
 
 mojom = "//components/arc/mojom/file_system.mojom"
-public_headers = [ "//storage/browser/fileapi/watcher_manager.h" ]
+public_headers = [ "//storage/browser/file_system/watcher_manager.h" ]
 public_deps = [
   "//storage/browser",
 ]
diff --git a/components/arc/test/fake_file_system_instance.h b/components/arc/test/fake_file_system_instance.h
index 47f64df..9031bb5 100644
--- a/components/arc/test/fake_file_system_instance.h
+++ b/components/arc/test/fake_file_system_instance.h
@@ -17,7 +17,7 @@
 #include "base/macros.h"
 #include "base/threading/thread_checker.h"
 #include "components/arc/mojom/file_system.mojom.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/watcher_manager.h"
 
 namespace arc {
 
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 731f598..ebd9f8fb 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -14,6 +14,7 @@
 
 #include "base/bind.h"
 #include "base/i18n/case_conversion.h"
+#include "base/metrics/field_trial_params.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/no_destructor.h"
 #include "base/numerics/safe_conversions.h"
@@ -29,6 +30,7 @@
 #include "components/autofill/content/renderer/prefilled_values_detector.h"
 #include "components/autofill/content/renderer/renderer_save_password_progress_logger.h"
 #include "components/autofill/core/common/autofill_constants.h"
+#include "components/autofill/core/common/autofill_features.h"
 #include "components/autofill/core/common/autofill_util.h"
 #include "components/autofill/core/common/form_field_data.h"
 #include "components/autofill/core/common/mojom/autofill_types.mojom.h"
@@ -781,6 +783,19 @@
 
 bool PasswordAutofillAgent::TryToShowTouchToFill(
     const WebFormControlElement& control_element) {
+  // Don't show Touch To Fill if it should only be enabled for insecure origins
+  // and we are currently on a potentially trustworthy origin.
+  if (base::GetFieldTrialParamByFeatureAsBool(features::kAutofillTouchToFill,
+                                              "insecure-origins-only",
+                                              /*default_value=*/false) &&
+      render_frame()
+          ->GetWebFrame()
+          ->GetDocument()
+          .GetSecurityOrigin()
+          .IsPotentiallyTrustworthy()) {
+    return false;
+  }
+
   if (touch_to_fill_state_ != TouchToFillState::kShouldShow)
     return false;
 
@@ -849,6 +864,13 @@
   if (generation_popup_showing)
     return false;
 
+  // Don't call ShowSuggestionPopup if Touch To Fill is currently showing. Since
+  // Touch To Fill in spirit is very similar to a suggestion pop-up, return true
+  // so that the AutofillAgent does not try to show other autofill suggestions
+  // instead.
+  if (touch_to_fill_state_ == TouchToFillState::kIsShowing)
+    return true;
+
   // Chrome should never show more than one account for a password element since
   // this implies that the username element cannot be modified. Thus even if
   // |show_all| is true, check if the element in question is a password element
diff --git a/components/autofill/core/common/autofill_features.cc b/components/autofill/core/common/autofill_features.cc
index a8d6cc4..d74bdca 100644
--- a/components/autofill/core/common/autofill_features.cc
+++ b/components/autofill/core/common/autofill_features.cc
@@ -174,6 +174,10 @@
 const base::Feature kAutofillTokenPrefixMatching{
     "AutofillTokenPrefixMatching", base::FEATURE_DISABLED_BY_DEFAULT};
 
+// Enables the touch to fill feature for Android.
+const base::Feature kAutofillTouchToFill = {"TouchToFillAndroid",
+                                            base::FEATURE_DISABLED_BY_DEFAULT};
+
 const base::Feature kAutofillUploadThrottling{"AutofillUploadThrottling",
                                               base::FEATURE_ENABLED_BY_DEFAULT};
 
@@ -197,10 +201,6 @@
 const base::Feature kAutofillRefreshStyleAndroid{
     "AutofillRefreshStyleAndroid", base::FEATURE_DISABLED_BY_DEFAULT};
 
-// Enables the touch to fill feature for Android.
-const base::Feature kTouchToFillAndroid = {"TouchToFillAndroid",
-                                           base::FEATURE_DISABLED_BY_DEFAULT};
-
 #endif  // OS_ANDROID
 
 #if defined(OS_ANDROID) || defined(OS_IOS)
diff --git a/components/autofill/core/common/autofill_features.h b/components/autofill/core/common/autofill_features.h
index 06ecdcf..98c4609 100644
--- a/components/autofill/core/common/autofill_features.h
+++ b/components/autofill/core/common/autofill_features.h
@@ -53,6 +53,7 @@
 extern const base::Feature kAutofillShowTypePredictions;
 extern const base::Feature kAutofillSkipComparingInferredLabels;
 extern const base::Feature kAutofillTokenPrefixMatching;
+extern const base::Feature kAutofillTouchToFill;
 extern const base::Feature kAutofillUploadThrottling;
 extern const base::Feature kAutofillUseApi;
 extern const base::Feature kAutofillUseImprovedLabelDisambiguation;
@@ -60,7 +61,6 @@
 #if defined(OS_ANDROID)
 extern const base::Feature kAutofillManualFallbackAndroid;
 extern const base::Feature kAutofillRefreshStyleAndroid;
-extern const base::Feature kTouchToFillAndroid;
 #endif  // OS_ANDROID
 
 #if defined(OS_ANDROID) || defined(OS_IOS)
diff --git a/components/autofill/core/common/autofill_util.cc b/components/autofill/core/common/autofill_util.cc
index 19ec781..36c3a17 100644
--- a/components/autofill/core/common/autofill_util.cc
+++ b/components/autofill/core/common/autofill_util.cc
@@ -72,7 +72,7 @@
 
 bool IsTouchToFillEnabled() {
 #if defined(OS_ANDROID)
-  return base::FeatureList::IsEnabled(features::kTouchToFillAndroid);
+  return base::FeatureList::IsEnabled(features::kAutofillTouchToFill);
 #else  // !defined(OS_ANDROID)
   return false;
 #endif
diff --git a/components/autofill_assistant/browser/actions/collect_user_data_action.cc b/components/autofill_assistant/browser/actions/collect_user_data_action.cc
index bab088bf..bfaa749 100644
--- a/components/autofill_assistant/browser/actions/collect_user_data_action.cc
+++ b/components/autofill_assistant/browser/actions/collect_user_data_action.cc
@@ -650,15 +650,27 @@
   if (collect_user_data.request_terms_and_conditions()) {
     collect_user_data_options->show_terms_as_checkbox =
         collect_user_data.show_terms_as_checkbox();
+
+    if (collect_user_data.accept_terms_and_conditions_text().empty()) {
+      return nullptr;
+    }
     collect_user_data_options->accept_terms_and_conditions_text =
         collect_user_data.accept_terms_and_conditions_text();
-    if (collect_user_data_options->accept_terms_and_conditions_text.empty()) {
-      collect_user_data_options->accept_terms_and_conditions_text =
-          l10n_util::GetStringUTF8(
-              IDS_AUTOFILL_ASSISTANT_3RD_PARTY_TERMS_ACCEPT);
+
+    if (!collect_user_data.show_terms_as_checkbox() &&
+        collect_user_data.terms_require_review_text().empty()) {
+      return nullptr;
     }
+    collect_user_data_options->terms_require_review_text =
+        collect_user_data.terms_require_review_text();
   }
 
+  if (collect_user_data.thirdparty_privacy_notice_text().empty()) {
+    return nullptr;
+  }
+  collect_user_data_options->thirdparty_privacy_notice_text =
+      collect_user_data.thirdparty_privacy_notice_text();
+
   collect_user_data_options->default_email =
       delegate_->GetAccountEmailAddress();
 
diff --git a/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc b/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc
index 2c36536..60985d3 100644
--- a/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc
+++ b/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc
@@ -59,6 +59,17 @@
 using ::testing::Property;
 using ::testing::Return;
 
+void SetRequiredTermsFields(CollectUserDataProto* data,
+                            bool request_terms_and_conditions = false) {
+  data->set_thirdparty_privacy_notice_text("privacy");
+
+  if (request_terms_and_conditions) {
+    data->set_accept_terms_and_conditions_text("terms and conditions");
+    data->set_terms_require_review_text("terms review");
+  }
+  data->set_request_terms_and_conditions(request_terms_and_conditions);
+}
+
 class CollectUserDataActionTest : public content::RenderViewHostTestHarness {
  public:
   void SetUp() override {
@@ -99,20 +110,158 @@
   ClientMemory client_memory_;
 };
 
+TEST_F(CollectUserDataActionTest, FailsForMissingPrivacyText) {
+  ActionProto action_proto;
+  action_proto.mutable_collect_user_data();
+
+  EXPECT_CALL(
+      callback_,
+      Run(Pointee(Property(&ProcessedActionProto::status, INVALID_ACTION))));
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
+  action.ProcessAction(callback_.Get());
+}
+
+TEST_F(CollectUserDataActionTest, SucceedsForPrivacyTextPresent) {
+  ActionProto action_proto;
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  collect_user_data_proto->set_thirdparty_privacy_notice_text("privacy");
+  collect_user_data_proto->set_request_terms_and_conditions(false);
+
+  ON_CALL(mock_action_delegate_, CollectUserData(_, _))
+      .WillByDefault(Invoke(
+          [](std::unique_ptr<CollectUserDataOptions> collect_user_data_options,
+             std::unique_ptr<UserData> user_data) {
+            user_data->succeed = true;
+            user_data->terms_and_conditions = ACCEPTED;
+            std::move(collect_user_data_options->confirm_callback)
+                .Run(std::move(user_data));
+          }));
+
+  EXPECT_CALL(
+      callback_,
+      Run(Pointee(AllOf(
+          Property(&ProcessedActionProto::status, ACTION_APPLIED),
+          Property(
+              &ProcessedActionProto::collect_user_data_result,
+              Property(
+                  &CollectUserDataResultProto::is_terms_and_conditions_accepted,
+                  true))))));
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
+  action.ProcessAction(callback_.Get());
+}
+
+TEST_F(CollectUserDataActionTest, FailsForMissingTermsAcceptTextIfRequired) {
+  ActionProto action_proto;
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  collect_user_data_proto->set_thirdparty_privacy_notice_text("privacy");
+  collect_user_data_proto->set_request_terms_and_conditions(true);
+  collect_user_data_proto->set_terms_require_review_text("terms review");
+
+  EXPECT_CALL(
+      callback_,
+      Run(Pointee(Property(&ProcessedActionProto::status, INVALID_ACTION))));
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
+  action.ProcessAction(callback_.Get());
+}
+
+TEST_F(CollectUserDataActionTest, FailsForMissingTermsReviewTextIfRequired) {
+  ActionProto action_proto;
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  collect_user_data_proto->set_thirdparty_privacy_notice_text("privacy");
+  collect_user_data_proto->set_request_terms_and_conditions(true);
+  collect_user_data_proto->set_accept_terms_and_conditions_text(
+      "terms and conditions");
+  collect_user_data_proto->set_show_terms_as_checkbox(false);
+
+  EXPECT_CALL(
+      callback_,
+      Run(Pointee(Property(&ProcessedActionProto::status, INVALID_ACTION))));
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
+  action.ProcessAction(callback_.Get());
+}
+
+TEST_F(CollectUserDataActionTest, SucceedsForCheckboxIfReviewTextMissing) {
+  ActionProto action_proto;
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  collect_user_data_proto->set_thirdparty_privacy_notice_text("privacy");
+  collect_user_data_proto->set_request_terms_and_conditions(true);
+  collect_user_data_proto->set_accept_terms_and_conditions_text(
+      "terms and conditions");
+  collect_user_data_proto->set_show_terms_as_checkbox(true);
+
+  ON_CALL(mock_action_delegate_, CollectUserData(_, _))
+      .WillByDefault(Invoke(
+          [](std::unique_ptr<CollectUserDataOptions> collect_user_data_options,
+             std::unique_ptr<UserData> user_data) {
+            user_data->succeed = true;
+            user_data->terms_and_conditions = ACCEPTED;
+            std::move(collect_user_data_options->confirm_callback)
+                .Run(std::move(user_data));
+          }));
+
+  EXPECT_CALL(
+      callback_,
+      Run(Pointee(AllOf(
+          Property(&ProcessedActionProto::status, ACTION_APPLIED),
+          Property(
+              &ProcessedActionProto::collect_user_data_result,
+              Property(
+                  &CollectUserDataResultProto::is_terms_and_conditions_accepted,
+                  true))))));
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
+  action.ProcessAction(callback_.Get());
+}
+
+TEST_F(CollectUserDataActionTest, SucceedsForAllTermsTextPresent) {
+  ActionProto action_proto;
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  collect_user_data_proto->set_thirdparty_privacy_notice_text("privacy");
+  collect_user_data_proto->set_request_terms_and_conditions(true);
+  collect_user_data_proto->set_accept_terms_and_conditions_text(
+      "terms and conditions");
+  collect_user_data_proto->set_show_terms_as_checkbox(false);
+  collect_user_data_proto->set_terms_require_review_text("terms review");
+
+  ON_CALL(mock_action_delegate_, CollectUserData(_, _))
+      .WillByDefault(Invoke(
+          [](std::unique_ptr<CollectUserDataOptions> collect_user_data_options,
+             std::unique_ptr<UserData> user_data) {
+            user_data->succeed = true;
+            user_data->terms_and_conditions = ACCEPTED;
+            std::move(collect_user_data_options->confirm_callback)
+                .Run(std::move(user_data));
+          }));
+
+  EXPECT_CALL(
+      callback_,
+      Run(Pointee(AllOf(
+          Property(&ProcessedActionProto::status, ACTION_APPLIED),
+          Property(
+              &ProcessedActionProto::collect_user_data_result,
+              Property(
+                  &CollectUserDataResultProto::is_terms_and_conditions_accepted,
+                  true))))));
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
+  action.ProcessAction(callback_.Get());
+}
+
 TEST_F(CollectUserDataActionTest, PromptIsShown) {
   const char kPrompt[] = "Some message.";
 
   ActionProto action_proto;
+  SetRequiredTermsFields(action_proto.mutable_collect_user_data());
   action_proto.mutable_collect_user_data()->set_prompt(kPrompt);
-  CollectUserDataAction action(&mock_action_delegate_, action_proto);
 
   EXPECT_CALL(mock_action_delegate_, SetStatusMessage(kPrompt));
   EXPECT_CALL(callback_, Run(_));
+
+  CollectUserDataAction action(&mock_action_delegate_, action_proto);
   action.ProcessAction(callback_.Get());
 }
 
 TEST_F(CollectUserDataActionTest, SelectLogin) {
   ActionProto action_proto;
+  SetRequiredTermsFields(action_proto.mutable_collect_user_data());
   auto* login_details =
       action_proto.mutable_collect_user_data()->mutable_login_details();
   auto* login_option = login_details->add_login_options();
@@ -148,9 +297,10 @@
 
 TEST_F(CollectUserDataActionTest, LoginChoiceAutomaticIfNoOtherOptions) {
   ActionProto action_proto;
-  auto* collect_user_data = action_proto.mutable_collect_user_data();
-  collect_user_data->set_request_terms_and_conditions(false);
-  auto* login_details = collect_user_data->mutable_login_details();
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
+  collect_user_data_proto->set_request_terms_and_conditions(false);
+  auto* login_details = collect_user_data_proto->mutable_login_details();
   auto* login_option = login_details->add_login_options();
   login_option->mutable_custom()->set_label("Guest Checkout");
   login_option->set_payload("guest");
@@ -176,8 +326,9 @@
 
 TEST_F(CollectUserDataActionTest, SelectLoginFailsIfNoOptionAvailable) {
   ActionProto action_proto;
-  auto* collect_user_data = action_proto.mutable_collect_user_data();
-  auto* login_details = collect_user_data->mutable_login_details();
+  auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
+  auto* login_details = collect_user_data_proto->mutable_login_details();
   auto* login_option = login_details->add_login_options();
   login_option->mutable_password_manager();
   login_option->set_payload("password_manager");
@@ -195,6 +346,7 @@
 TEST_F(CollectUserDataActionTest, SelectContactDetails) {
   ActionProto action_proto;
   auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
   collect_user_data_proto->set_request_terms_and_conditions(false);
   auto* contact_details_proto =
       collect_user_data_proto->mutable_contact_details();
@@ -250,6 +402,7 @@
 
 TEST_F(CollectUserDataActionTest, SelectPaymentMethod) {
   ActionProto action_proto;
+  SetRequiredTermsFields(action_proto.mutable_collect_user_data());
   action_proto.mutable_collect_user_data()->set_request_payment_method(true);
   action_proto.mutable_collect_user_data()->set_request_terms_and_conditions(
       false);
@@ -308,6 +461,7 @@
 TEST_F(CollectUserDataActionTest, ContactDetailsCanHandleUtf8) {
   ActionProto action_proto;
   auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
   collect_user_data_proto->set_request_terms_and_conditions(false);
   auto* contact_details_proto =
       collect_user_data_proto->mutable_contact_details();
@@ -492,6 +646,7 @@
 TEST_F(CollectUserDataActionTest, SelectDateTimeRange) {
   ActionProto action_proto;
   auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
   collect_user_data_proto->set_request_terms_and_conditions(false);
   auto* date_time_proto = collect_user_data_proto->mutable_date_time_range();
   SetDateTimeProto(date_time_proto->mutable_start(), 2019, 10, 21, 8, 0, 0);
@@ -534,6 +689,7 @@
 TEST_F(CollectUserDataActionTest, StaticSectionValid) {
   ActionProto action_proto;
   auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
   collect_user_data_proto->set_request_terms_and_conditions(false);
   ON_CALL(mock_action_delegate_, CollectUserData(_, _))
       .WillByDefault(Invoke(
@@ -576,6 +732,7 @@
 TEST_F(CollectUserDataActionTest, TextInputSectionValid) {
   ActionProto action_proto;
   auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
   collect_user_data_proto->set_request_terms_and_conditions(false);
   ON_CALL(mock_action_delegate_, CollectUserData(_, _))
       .WillByDefault(Invoke(
@@ -660,6 +817,7 @@
 TEST_F(CollectUserDataActionTest, TextInputSectionWritesToClientMemory) {
   ActionProto action_proto;
   auto* collect_user_data_proto = action_proto.mutable_collect_user_data();
+  SetRequiredTermsFields(collect_user_data_proto);
   collect_user_data_proto->set_request_terms_and_conditions(false);
   ON_CALL(mock_action_delegate_, CollectUserData(_, _))
       .WillByDefault(Invoke(
diff --git a/components/autofill_assistant/browser/protocol_utils.cc b/components/autofill_assistant/browser/protocol_utils.cc
index a4ed0d4d..fee2055 100644
--- a/components/autofill_assistant/browser/protocol_utils.cc
+++ b/components/autofill_assistant/browser/protocol_utils.cc
@@ -52,6 +52,9 @@
   if (trigger_context.is_cct()) {
     proto->set_is_cct(true);
   }
+  if (trigger_context.is_onboarding_shown()) {
+    proto->set_is_onboarding_shown(true);
+  }
   if (trigger_context.is_direct_action()) {
     proto->set_is_direct_action(true);
   }
diff --git a/components/autofill_assistant/browser/protocol_utils_unittest.cc b/components/autofill_assistant/browser/protocol_utils_unittest.cc
index 741be933..9441f61 100644
--- a/components/autofill_assistant/browser/protocol_utils_unittest.cc
+++ b/components/autofill_assistant/browser/protocol_utils_unittest.cc
@@ -98,6 +98,7 @@
   AssertClientContext(request.client_context());
   EXPECT_THAT(request.client_context().experiment_ids(), Eq("1,2,3"));
   EXPECT_TRUE(request.client_context().is_cct());
+  EXPECT_FALSE(request.client_context().is_onboarding_shown());
   EXPECT_FALSE(request.client_context().is_direct_action());
 
   const InitialScriptActionsRequestProto& initial = request.initial_request();
@@ -112,6 +113,41 @@
   EXPECT_EQ("script_payload", request.script_payload());
 }
 
+TEST(ProtocolUtilsTest, TestCreateInitialScriptActionsRequestFlags) {
+  std::map<std::string, std::string> parameters;
+
+  ScriptActionRequestProto request;
+
+  // With flags.
+  TriggerContextImpl trigger_context_flags(parameters, std::string());
+  trigger_context_flags.SetCCT(true);
+  trigger_context_flags.SetOnboardingShown(true);
+  trigger_context_flags.SetDirectAction(true);
+
+  EXPECT_TRUE(
+      request.ParseFromString(ProtocolUtils::CreateInitialScriptActionsRequest(
+          "script_path", GURL("http://example.com/"), trigger_context_flags,
+          "global_payload", "script_payload", CreateClientContextProto())));
+
+  AssertClientContext(request.client_context());
+  EXPECT_TRUE(request.client_context().is_cct());
+  EXPECT_TRUE(request.client_context().is_onboarding_shown());
+  EXPECT_TRUE(request.client_context().is_direct_action());
+
+  // Without flags.
+  TriggerContextImpl trigger_context_no_flags(parameters, std::string());
+
+  EXPECT_TRUE(
+      request.ParseFromString(ProtocolUtils::CreateInitialScriptActionsRequest(
+          "script_path", GURL("http://example.com/"), trigger_context_no_flags,
+          "global_payload", "script_payload", CreateClientContextProto())));
+
+  AssertClientContext(request.client_context());
+  EXPECT_FALSE(request.client_context().is_cct());
+  EXPECT_FALSE(request.client_context().is_onboarding_shown());
+  EXPECT_FALSE(request.client_context().is_direct_action());
+}
+
 TEST(ProtocolUtilsTest, CreateNextScriptActionsRequest) {
   std::map<std::string, std::string> parameters;
   parameters["a"] = "b";
@@ -131,6 +167,44 @@
   EXPECT_EQ(1, request.next_request().processed_actions().size());
 }
 
+TEST(ProtocolUtilsTest, TestCreateNextScriptActionsRequestFlags) {
+  std::map<std::string, std::string> parameters;
+
+  std::vector<ProcessedActionProto> processed_actions;
+  processed_actions.emplace_back(ProcessedActionProto());
+
+  ScriptActionRequestProto request;
+
+  // With flags.
+  TriggerContextImpl trigger_context_flags(parameters, std::string());
+  trigger_context_flags.SetCCT(true);
+  trigger_context_flags.SetOnboardingShown(true);
+  trigger_context_flags.SetDirectAction(true);
+
+  EXPECT_TRUE(
+      request.ParseFromString(ProtocolUtils::CreateNextScriptActionsRequest(
+          trigger_context_flags, "global_payload", "script_payload",
+          processed_actions, CreateClientContextProto())));
+
+  AssertClientContext(request.client_context());
+  EXPECT_TRUE(request.client_context().is_cct());
+  EXPECT_TRUE(request.client_context().is_onboarding_shown());
+  EXPECT_TRUE(request.client_context().is_direct_action());
+
+  // Without flags.
+  TriggerContextImpl trigger_context_no_flags(parameters, std::string());
+
+  EXPECT_TRUE(
+      request.ParseFromString(ProtocolUtils::CreateNextScriptActionsRequest(
+          trigger_context_no_flags, "global_payload", "script_payload",
+          processed_actions, CreateClientContextProto())));
+
+  AssertClientContext(request.client_context());
+  EXPECT_FALSE(request.client_context().is_cct());
+  EXPECT_FALSE(request.client_context().is_onboarding_shown());
+  EXPECT_FALSE(request.client_context().is_direct_action());
+}
+
 TEST(ProtocolUtilsTest, CreateGetScriptsRequest) {
   std::map<std::string, std::string> parameters;
   parameters["a"] = "b";
@@ -146,6 +220,7 @@
   AssertClientContext(request.client_context());
   EXPECT_THAT(request.client_context().experiment_ids(), Eq("1,2,3"));
   EXPECT_FALSE(request.client_context().is_cct());
+  EXPECT_FALSE(request.client_context().is_onboarding_shown());
   EXPECT_TRUE(request.client_context().is_direct_action());
 
   EXPECT_EQ("http://example.com/", request.url());
@@ -156,6 +231,38 @@
   EXPECT_EQ("d", request.script_parameters(1).value());
 }
 
+TEST(ProtocolUtilsTest, TestCreateGetScriptsRequestFlags) {
+  std::map<std::string, std::string> parameters;
+  SupportsScriptRequestProto request;
+
+  // With flags.
+  TriggerContextImpl trigger_context_flags(parameters, std::string());
+  trigger_context_flags.SetCCT(true);
+  trigger_context_flags.SetOnboardingShown(true);
+  trigger_context_flags.SetDirectAction(true);
+
+  EXPECT_TRUE(request.ParseFromString(ProtocolUtils::CreateGetScriptsRequest(
+      GURL("http://example.com/"), trigger_context_flags,
+      CreateClientContextProto())));
+
+  AssertClientContext(request.client_context());
+  EXPECT_TRUE(request.client_context().is_cct());
+  EXPECT_TRUE(request.client_context().is_onboarding_shown());
+  EXPECT_TRUE(request.client_context().is_direct_action());
+
+  // Without flags.
+  TriggerContextImpl trigger_context_no_flags(parameters, std::string());
+
+  EXPECT_TRUE(request.ParseFromString(ProtocolUtils::CreateGetScriptsRequest(
+      GURL("http://example.com/"), trigger_context_no_flags,
+      CreateClientContextProto())));
+
+  AssertClientContext(request.client_context());
+  EXPECT_FALSE(request.client_context().is_cct());
+  EXPECT_FALSE(request.client_context().is_onboarding_shown());
+  EXPECT_FALSE(request.client_context().is_direct_action());
+}
+
 TEST(ProtocolUtilsTest, AddScriptIgnoreInvalid) {
   SupportedScriptProto script_proto;
   std::vector<std::unique_ptr<Script>> scripts;
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto
index c4f91cb..998f935 100644
--- a/components/autofill_assistant/browser/service.proto
+++ b/components/autofill_assistant/browser/service.proto
@@ -42,6 +42,9 @@
   // Assistant.
   optional bool is_cct = 8;
 
+  // True if the onboarding screen was shown to the user.
+  optional bool is_onboarding_shown = 10;
+
   // True if the script was triggered by a direct action.
   optional bool is_direct_action = 9;
 }
@@ -1252,6 +1255,7 @@
 
 // Asks to provide the data used by UseAddressAction and
 // UseCreditCardAction.
+// Next: 22
 message CollectUserDataProto {
   enum TermsAndConditionsState {
     // No choice has been made yet.
@@ -1294,6 +1298,12 @@
   // that will finish this action and return the clicked link in the action
   // result.
   optional string accept_terms_and_conditions_text = 13;
+  // Message that indicates that the user wants to review the terms and
+  // conditions of a 3rd party's domain, e.g., 'example.com'.
+  optional string terms_require_review_text = 20;
+  // Privacy notice telling users that autofill assistant will send personal
+  // data to a third party’s website.
+  optional string thirdparty_privacy_notice_text = 21;
   // Optionally allows confiriming through the given direct actions.
   optional DirectActionProto confirm_direct_action = 10;
   // Additional actions available to the user. This can be used for instance to
diff --git a/components/autofill_assistant/browser/trigger_context.cc b/components/autofill_assistant/browser/trigger_context.cc
index c872b7e5..a2e13813 100644
--- a/components/autofill_assistant/browser/trigger_context.cc
+++ b/components/autofill_assistant/browser/trigger_context.cc
@@ -62,6 +62,10 @@
   return cct_;
 }
 
+bool TriggerContextImpl::is_onboarding_shown() const {
+  return onboarding_shown_;
+}
+
 bool TriggerContextImpl::is_direct_action() const {
   return direct_action_;
 }
@@ -112,6 +116,14 @@
   return false;
 }
 
+bool MergedTriggerContext::is_onboarding_shown() const {
+  for (const TriggerContext* context : contexts_) {
+    if (context->is_onboarding_shown())
+      return true;
+  }
+  return false;
+}
+
 bool MergedTriggerContext::is_direct_action() const {
   for (const TriggerContext* context : contexts_) {
     if (context->is_direct_action())
diff --git a/components/autofill_assistant/browser/trigger_context.h b/components/autofill_assistant/browser/trigger_context.h
index 9d887b7..11e78d1 100644
--- a/components/autofill_assistant/browser/trigger_context.h
+++ b/components/autofill_assistant/browser/trigger_context.h
@@ -53,6 +53,10 @@
   // Java.
   virtual bool is_cct() const = 0;
 
+  // Returns true if the onboarding was shown at the beginning when this
+  // autofill assistant flow got triggered.
+  virtual bool is_onboarding_shown() const = 0;
+
   // Returns true if the current action was triggered by a direct action.
   virtual bool is_direct_action() const = 0;
 };
@@ -76,10 +80,12 @@
       const std::string& name) const override;
 
   void SetCCT(bool value) { cct_ = value; }
+  void SetOnboardingShown(bool value) { onboarding_shown_ = value; }
   void SetDirectAction(bool value) { direct_action_ = value; }
 
   std::string experiment_ids() const override;
   bool is_cct() const override;
+  bool is_onboarding_shown() const override;
   bool is_direct_action() const override;
 
  private:
@@ -93,6 +99,8 @@
   bool cct_ = false;
 
   bool direct_action_ = false;
+
+  bool onboarding_shown_ = false;
 };
 
 // Merges several TriggerContexts together.
@@ -110,6 +118,7 @@
       const std::string& name) const override;
   std::string experiment_ids() const override;
   bool is_cct() const override;
+  bool is_onboarding_shown() const override;
   bool is_direct_action() const override;
 
  private:
diff --git a/components/autofill_assistant/browser/trigger_context_unittest.cc b/components/autofill_assistant/browser/trigger_context_unittest.cc
index d98b5115..890841d2d 100644
--- a/components/autofill_assistant/browser/trigger_context_unittest.cc
+++ b/components/autofill_assistant/browser/trigger_context_unittest.cc
@@ -102,6 +102,28 @@
   EXPECT_TRUE(one_with_cct->is_cct());
 }
 
+TEST(TriggerContextTest, OnboardingShown) {
+  TriggerContextImpl context;
+
+  EXPECT_FALSE(context.is_onboarding_shown());
+  context.SetOnboardingShown(true);
+  EXPECT_TRUE(context.is_onboarding_shown());
+}
+
+TEST(TriggerContextTest, MergeOnboardingShown) {
+  auto empty = TriggerContext::CreateEmpty();
+
+  auto all_empty = TriggerContext::Merge({empty.get(), empty.get()});
+  EXPECT_FALSE(all_empty->is_onboarding_shown());
+
+  TriggerContextImpl onboarding_context;
+  onboarding_context.SetOnboardingShown(true);
+  auto one_with_onboarding =
+      TriggerContext::Merge({empty.get(), &onboarding_context, empty.get()});
+
+  EXPECT_TRUE(one_with_onboarding->is_onboarding_shown());
+}
+
 TEST(TriggerContextText, DirectAction) {
   TriggerContextImpl context;
 
diff --git a/components/autofill_assistant/browser/user_data.h b/components/autofill_assistant/browser/user_data.h
index 1936bbaa..9337f3e 100644
--- a/components/autofill_assistant/browser/user_data.h
+++ b/components/autofill_assistant/browser/user_data.h
@@ -86,6 +86,8 @@
 
   // If empty, terms and conditions should not be shown.
   std::string accept_terms_and_conditions_text;
+  std::string terms_require_review_text;
+  std::string thirdparty_privacy_notice_text;
   bool show_terms_as_checkbox = false;
 
   std::vector<std::string> supported_basic_card_networks;
diff --git a/components/autofill_assistant_strings.grdp b/components/autofill_assistant_strings.grdp
index 3c096bd..f18b0a7 100644
--- a/components/autofill_assistant_strings.grdp
+++ b/components/autofill_assistant_strings.grdp
@@ -27,8 +27,5 @@
     <message name="IDS_AUTOFILL_ASSISTANT_STOPPED" desc="Text label that is shown when stopping the Autofill Assistant.">
       Google Assistant in Chrome stopping
     </message>
-    <message name="IDS_AUTOFILL_ASSISTANT_3RD_PARTY_TERMS_ACCEPT" desc="Message that indicates that the user agrees to the terms and conditions of a 3rd party's domain, e.g., 'odeon.co.uk'.">
-      I agree to the terms &amp; conditions, privacy policy, and right of withdrawal of <ph name="BEGIN_BOLD">&lt;b&gt;</ph><ph name="DOMAIN">%1$s<ex>google.com</ex></ph><ph name="END_BOLD">&lt;/b&gt;</ph>
-    </message>
   </if>
 </grit-part>
diff --git a/components/browser_sync/BUILD.gn b/components/browser_sync/BUILD.gn
index e4e68ef8..973d2d5 100644
--- a/components/browser_sync/BUILD.gn
+++ b/components/browser_sync/BUILD.gn
@@ -44,9 +44,7 @@
 source_set("unit_tests") {
   testonly = true
 
-  sources = [
-    "profile_sync_service_bookmark_unittest.cc",
-  ]
+  sources = []
 
   deps = [
     ":browser_sync",
diff --git a/components/browser_sync/profile_sync_components_factory_impl.cc b/components/browser_sync/profile_sync_components_factory_impl.cc
index 8c20b5cb..2c4d92be 100644
--- a/components/browser_sync/profile_sync_components_factory_impl.cc
+++ b/components/browser_sync/profile_sync_components_factory_impl.cc
@@ -38,9 +38,6 @@
 #include "components/sync/model/model_type_store_service.h"
 #include "components/sync/model_impl/forwarding_model_type_controller_delegate.h"
 #include "components/sync/model_impl/proxy_model_type_controller_delegate.h"
-#include "components/sync_bookmarks/bookmark_change_processor.h"
-#include "components/sync_bookmarks/bookmark_data_type_controller.h"
-#include "components/sync_bookmarks/bookmark_model_associator.h"
 #include "components/sync_bookmarks/bookmark_sync_service.h"
 #include "components/sync_device_info/device_info_sync_service.h"
 #include "components/sync_sessions/proxy_tabs_data_type_controller.h"
@@ -52,11 +49,6 @@
 #include "chromeos/constants/chromeos_features.h"
 #endif
 
-using base::FeatureList;
-using bookmarks::BookmarkModel;
-using sync_bookmarks::BookmarkChangeProcessor;
-using sync_bookmarks::BookmarkDataTypeController;
-using sync_bookmarks::BookmarkModelAssociator;
 using syncer::DataTypeController;
 using syncer::DataTypeManager;
 using syncer::DataTypeManagerImpl;
@@ -214,7 +206,6 @@
   // Bookmark sync is enabled by default.  Register unless explicitly
   // disabled.
   if (!disabled_types.Has(syncer::BOOKMARKS)) {
-    if (FeatureList::IsEnabled(switches::kSyncUSSBookmarks)) {
       controllers.push_back(std::make_unique<ModelTypeController>(
           syncer::BOOKMARKS,
           std::make_unique<syncer::ProxyModelTypeControllerDelegate>(
@@ -223,11 +214,6 @@
                                       GetBookmarkSyncControllerDelegate,
                                   base::Unretained(bookmark_sync_service_),
                                   sync_client_->GetFaviconService()))));
-    } else {
-      controllers.push_back(std::make_unique<BookmarkDataTypeController>(
-          dump_stack, sync_service, sync_client_->GetBookmarkModel(),
-          sync_client_->GetHistoryService(), this));
-    }
   }
 
   // These features are enabled only if history is not disabled.
@@ -429,30 +415,6 @@
       sync_client_->GetModelTypeStoreService()->GetSyncDataPath());
 }
 
-syncer::SyncApiComponentFactory::SyncComponents
-ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents(
-    std::unique_ptr<syncer::DataTypeErrorHandler> error_handler,
-    syncer::UserShare* user_share) {
-  BookmarkModel* bookmark_model = sync_client_->GetBookmarkModel();
-// TODO(akalin): We may want to propagate this switch up eventually.
-#if defined(OS_ANDROID) || defined(OS_IOS)
-  const bool kExpectMobileBookmarksFolder = true;
-#else
-  const bool kExpectMobileBookmarksFolder = false;
-#endif
-
-  auto model_associator = std::make_unique<BookmarkModelAssociator>(
-      bookmark_model, sync_client_->GetBookmarkUndoService(),
-      sync_client_->GetFaviconService(), user_share, error_handler->Copy(),
-      kExpectMobileBookmarksFolder);
-
-  SyncComponents components;
-  components.change_processor = std::make_unique<BookmarkChangeProcessor>(
-      model_associator.get(), std::move(error_handler));
-  components.model_associator = std::move(model_associator);
-  return components;
-}
-
 std::unique_ptr<syncer::ModelTypeControllerDelegate>
 ProfileSyncComponentsFactoryImpl::CreateForwardingControllerDelegate(
     syncer::ModelType type) {
diff --git a/components/browser_sync/profile_sync_components_factory_impl.h b/components/browser_sync/profile_sync_components_factory_impl.h
index f99db61..defee735 100644
--- a/components/browser_sync/profile_sync_components_factory_impl.h
+++ b/components/browser_sync/profile_sync_components_factory_impl.h
@@ -78,9 +78,6 @@
       const std::string& name,
       invalidation::InvalidationService* invalidator,
       const base::WeakPtr<syncer::SyncPrefs>& sync_prefs) override;
-  syncer::SyncApiComponentFactory::SyncComponents CreateBookmarkSyncComponents(
-      std::unique_ptr<syncer::DataTypeErrorHandler> error_handler,
-      syncer::UserShare* user_share) override;
 
  private:
   // Factory function for ModelTypeController instances for models living on
diff --git a/components/browser_sync/profile_sync_service_bookmark_unittest.cc b/components/browser_sync/profile_sync_service_bookmark_unittest.cc
deleted file mode 100644
index 1a84dd5..0000000
--- a/components/browser_sync/profile_sync_service_bookmark_unittest.cc
+++ /dev/null
@@ -1,2593 +0,0 @@
-// Copyright (c) 2012 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.
-
-// TODO(akalin): This file is basically just a unit test for
-// BookmarkChangeProcessor.  Write unit tests for
-// BookmarkModelAssociator separately.
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/containers/adapters.h"
-#include "base/containers/queue.h"
-#include "base/containers/stack.h"
-#include "base/files/file_util.h"
-#include "base/files/scoped_temp_dir.h"
-#include "base/guid.h"
-#include "base/location.h"
-#include "base/run_loop.h"
-#include "base/stl_util.h"
-#include "base/strings/string16.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/test/test_message_loop.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "base/time/time.h"
-#include "build/build_config.h"
-#include "components/bookmarks/browser/base_bookmark_model_observer.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/bookmarks/browser/bookmark_utils.h"
-#include "components/bookmarks/managed/managed_bookmark_service.h"
-#include "components/bookmarks/test/bookmark_test_helpers.h"
-#include "components/bookmarks/test/test_bookmark_client.h"
-#include "components/sync/engine/engine_util.h"
-#include "components/sync/model/data_type_error_handler.h"
-#include "components/sync/model/data_type_error_handler_mock.h"
-#include "components/sync/model/sync_error.h"
-#include "components/sync/model/sync_merge_result.h"
-#include "components/sync/syncable/change_record.h"
-#include "components/sync/syncable/mutable_entry.h"
-#include "components/sync/syncable/read_node.h"
-#include "components/sync/syncable/read_transaction.h"
-#include "components/sync/syncable/syncable_id.h"
-#include "components/sync/syncable/syncable_util.h"
-#include "components/sync/syncable/syncable_write_transaction.h"
-#include "components/sync/syncable/test_user_share.h"
-#include "components/sync/syncable/write_node.h"
-#include "components/sync/syncable/write_transaction.h"
-#include "components/sync_bookmarks/bookmark_change_processor.h"
-#include "components/sync_bookmarks/bookmark_model_associator.h"
-#include "components/sync_preferences/testing_pref_service_syncable.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using bookmarks::BookmarkModel;
-using bookmarks::BookmarkNode;
-using sync_bookmarks::BookmarkChangeProcessor;
-using sync_bookmarks::BookmarkModelAssociator;
-using syncer::BaseNode;
-using testing::_;
-using testing::Return;
-using testing::StrictMock;
-
-namespace browser_sync {
-
-namespace {
-
-#if defined(OS_ANDROID) || defined(OS_IOS)
-static const bool kExpectMobileBookmarks = true;
-#else
-static const bool kExpectMobileBookmarks = false;
-#endif  // defined(OS_ANDROID) || defined(OS_IOS)
-
-std::string ReturnEmptyString() {
-  return std::string();
-}
-
-void MakeServerUpdate(syncer::WriteTransaction* trans,
-                      syncer::WriteNode* node) {
-  syncer::syncable::ChangeEntryIDAndUpdateChildren(
-      trans->GetWrappedWriteTrans(), node->GetMutableEntryForTest(),
-      syncer::syncable::Id::CreateFromServerId(
-          base::NumberToString(node->GetId())));
-  node->GetMutableEntryForTest()->PutBaseVersion(10);
-  node->GetMutableEntryForTest()->PutIsUnappliedUpdate(true);
-}
-
-void MakeServerUpdate(syncer::WriteTransaction* trans, int64_t id) {
-  syncer::WriteNode node(trans);
-  EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-  MakeServerUpdate(trans, &node);
-}
-
-// FakeServerChange constructs a list of syncer::ChangeRecords while modifying
-// the sync model, and can pass the ChangeRecord list to a
-// syncer::SyncObserver (i.e., the ProfileSyncService) to test the client
-// change-application behavior.
-// Tests using FakeServerChange should be careful to avoid back-references,
-// since FakeServerChange will send the edits in the order specified.
-class FakeServerChange {
- public:
-  explicit FakeServerChange(syncer::WriteTransaction* trans) : trans_(trans) {}
-
-  // Pretend that the server told the syncer to add a bookmark object.
-  int64_t AddWithMetaInfo(const std::string& title,
-                          const std::string& url,
-                          const BookmarkNode::MetaInfoMap* meta_info_map,
-                          bool is_folder,
-                          int64_t parent_id,
-                          int64_t predecessor_id) {
-    syncer::ReadNode parent(trans_);
-    EXPECT_EQ(BaseNode::INIT_OK, parent.InitByIdLookup(parent_id));
-    syncer::WriteNode node(trans_);
-    if (predecessor_id == 0) {
-      EXPECT_TRUE(node.InitBookmarkByCreation(parent, nullptr));
-    } else {
-      syncer::ReadNode predecessor(trans_);
-      EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id));
-      EXPECT_EQ(predecessor.GetParentId(), parent.GetId());
-      EXPECT_TRUE(node.InitBookmarkByCreation(parent, &predecessor));
-    }
-    EXPECT_EQ(node.GetPredecessorId(), predecessor_id);
-    EXPECT_EQ(node.GetParentId(), parent_id);
-    node.SetIsFolder(is_folder);
-    node.SetTitle(title);
-
-    sync_pb::BookmarkSpecifics specifics(node.GetBookmarkSpecifics());
-    const base::Time creation_time(base::Time::Now());
-    specifics.set_creation_time_us(creation_time.ToInternalValue());
-    if (!is_folder)
-      specifics.set_url(url);
-    if (meta_info_map)
-      SetNodeMetaInfo(*meta_info_map, &specifics);
-    node.SetBookmarkSpecifics(specifics);
-
-    syncer::ChangeRecord record;
-    record.action = syncer::ChangeRecord::ACTION_ADD;
-    record.id = node.GetId();
-    changes_.push_back(record);
-    return node.GetId();
-  }
-
-  int64_t Add(const std::string& title,
-              const std::string& url,
-              bool is_folder,
-              int64_t parent_id,
-              int64_t predecessor_id) {
-    return AddWithMetaInfo(title, url, nullptr, is_folder, parent_id,
-                           predecessor_id);
-  }
-
-  // Add a bookmark folder.
-  int64_t AddFolder(const std::string& title,
-                    int64_t parent_id,
-                    int64_t predecessor_id) {
-    return Add(title, std::string(), true, parent_id, predecessor_id);
-  }
-  int64_t AddFolderWithMetaInfo(const std::string& title,
-                                const BookmarkNode::MetaInfoMap* meta_info_map,
-                                int64_t parent_id,
-                                int64_t predecessor_id) {
-    return AddWithMetaInfo(title, std::string(), meta_info_map, true, parent_id,
-                           predecessor_id);
-  }
-
-  // Add a bookmark.
-  int64_t AddURL(const std::string& title,
-                 const std::string& url,
-                 int64_t parent_id,
-                 int64_t predecessor_id) {
-    return Add(title, url, false, parent_id, predecessor_id);
-  }
-  int64_t AddURLWithMetaInfo(const std::string& title,
-                             const std::string& url,
-                             const BookmarkNode::MetaInfoMap* meta_info_map,
-                             int64_t parent_id,
-                             int64_t predecessor_id) {
-    return AddWithMetaInfo(title, url, meta_info_map, false, parent_id,
-                           predecessor_id);
-  }
-
-  // Pretend that the server told the syncer to delete an object.
-  void Delete(int64_t id) {
-    {
-      // Delete the sync node.
-      syncer::WriteNode node(trans_);
-      EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-      if (node.GetIsFolder())
-        EXPECT_FALSE(node.GetFirstChildId());
-      node.GetMutableEntryForTest()->PutServerIsDel(true);
-      node.Tombstone();
-    }
-    {
-      // Verify the deletion.
-      syncer::ReadNode node(trans_);
-      EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_IS_DEL, node.InitByIdLookup(id));
-    }
-
-    syncer::ChangeRecord record;
-    record.action = syncer::ChangeRecord::ACTION_DELETE;
-    record.id = id;
-    // Deletions are always first in the changelist, but we can't actually do
-    // WriteNode::Remove() on the node until its children are moved. So, as
-    // a practical matter, users of FakeServerChange must move or delete
-    // children before parents.  Thus, we must insert the deletion record
-    // at the front of the vector.
-    changes_.insert(changes_.begin(), record);
-  }
-
-  // Set a new title value, and return the old value.
-  std::string ModifyTitle(int64_t id, const std::string& new_title) {
-    syncer::WriteNode node(trans_);
-    EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-    std::string old_title = node.GetTitle();
-    node.SetTitle(new_title);
-    SetModified(id);
-    return old_title;
-  }
-
-  // Set a new parent and predecessor value.  Return the old parent id.
-  // We could return the old predecessor id, but it turns out not to be
-  // very useful for assertions.
-  int64_t ModifyPosition(int64_t id,
-                         int64_t parent_id,
-                         int64_t predecessor_id) {
-    syncer::ReadNode parent(trans_);
-    EXPECT_EQ(BaseNode::INIT_OK, parent.InitByIdLookup(parent_id));
-    syncer::WriteNode node(trans_);
-    EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-    int64_t old_parent_id = node.GetParentId();
-    if (predecessor_id == 0) {
-      EXPECT_TRUE(node.SetPosition(parent, nullptr));
-    } else {
-      syncer::ReadNode predecessor(trans_);
-      EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id));
-      EXPECT_EQ(predecessor.GetParentId(), parent.GetId());
-      EXPECT_TRUE(node.SetPosition(parent, &predecessor));
-    }
-    SetModified(id);
-    return old_parent_id;
-  }
-
-  void ModifyCreationTime(int64_t id, int64_t creation_time_us) {
-    syncer::WriteNode node(trans_);
-    ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-    sync_pb::BookmarkSpecifics specifics = node.GetBookmarkSpecifics();
-    specifics.set_creation_time_us(creation_time_us);
-    node.SetBookmarkSpecifics(specifics);
-    SetModified(id);
-  }
-
-  void ModifyMetaInfo(int64_t id,
-                      const BookmarkNode::MetaInfoMap& meta_info_map) {
-    syncer::WriteNode node(trans_);
-    ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-    sync_pb::BookmarkSpecifics specifics = node.GetBookmarkSpecifics();
-    SetNodeMetaInfo(meta_info_map, &specifics);
-    node.SetBookmarkSpecifics(specifics);
-    SetModified(id);
-  }
-
-  // Pass the fake change list to |service|.
-  void ApplyPendingChanges(syncer::ChangeProcessor* processor) {
-    processor->ApplyChangesFromSyncModel(
-        trans_, 0, syncer::ImmutableChangeRecordList(&changes_));
-  }
-
-  const syncer::ChangeRecordList& changes() { return changes_; }
-
- private:
-  // Helper function to push an ACTION_UPDATE record onto the back
-  // of the changelist.
-  void SetModified(int64_t id) {
-    // Coalesce multi-property edits.
-    if (!changes_.empty() && changes_.back().id == id &&
-        changes_.back().action == syncer::ChangeRecord::ACTION_UPDATE)
-      return;
-    syncer::ChangeRecord record;
-    record.action = syncer::ChangeRecord::ACTION_UPDATE;
-    record.id = id;
-    changes_.push_back(record);
-  }
-
-  void SetNodeMetaInfo(const BookmarkNode::MetaInfoMap& meta_info_map,
-                       sync_pb::BookmarkSpecifics* specifics) {
-    specifics->clear_meta_info();
-    // Deliberatly set MetaInfoMap entries in opposite order (compared
-    // to the implementation in BookmarkChangeProcessor) to ensure that
-    // (a) the implementation isn't sensitive to the order and
-    // (b) the original meta info isn't blindly overwritten by
-    //     BookmarkChangeProcessor unless there is a real change.
-    auto it = meta_info_map.end();
-    while (it != meta_info_map.begin()) {
-      --it;
-      sync_pb::MetaInfo* meta_info = specifics->add_meta_info();
-      meta_info->set_key(it->first);
-      meta_info->set_value(it->second);
-    }
-  }
-
-  // The transaction on which everything happens.
-  syncer::WriteTransaction* trans_;
-
-  // The change list we construct.
-  syncer::ChangeRecordList changes_;
-  DISALLOW_COPY_AND_ASSIGN(FakeServerChange);
-};
-
-class ExtensiveChangesBookmarkModelObserver
-    : public bookmarks::BaseBookmarkModelObserver {
- public:
-  ExtensiveChangesBookmarkModelObserver()
-      : started_count_(0),
-        completed_count_at_started_(0),
-        completed_count_(0) {}
-
-  void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override {
-    ++started_count_;
-    completed_count_at_started_ = completed_count_;
-  }
-
-  void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override {
-    ++completed_count_;
-  }
-
-  void BookmarkModelChanged() override {}
-
-  int get_started() const { return started_count_; }
-
-  int get_completed_count_at_started() const {
-    return completed_count_at_started_;
-  }
-
-  int get_completed() const { return completed_count_; }
-
- private:
-  int started_count_;
-  int completed_count_at_started_;
-  int completed_count_;
-
-  DISALLOW_COPY_AND_ASSIGN(ExtensiveChangesBookmarkModelObserver);
-};
-
-class ProfileSyncServiceBookmarkTest : public testing::Test {
- protected:
-  enum LoadOption { LOAD_FROM_STORAGE, DELETE_EXISTING_STORAGE };
-  enum SaveOption { SAVE_TO_STORAGE, DONT_SAVE_TO_STORAGE };
-
-  ProfileSyncServiceBookmarkTest()
-      : managed_bookmark_service_(new bookmarks::ManagedBookmarkService(
-            &pref_service_,
-            base::Bind(ReturnEmptyString))),
-        local_merge_result_(syncer::BOOKMARKS),
-        syncer_merge_result_(syncer::BOOKMARKS) {
-    EXPECT_TRUE(data_dir_.CreateUniqueTempDir());
-    bookmarks::RegisterProfilePrefs(pref_service_.registry());
-  }
-
-  ~ProfileSyncServiceBookmarkTest() override {
-    static_cast<KeyedService*>(managed_bookmark_service_.get())->Shutdown();
-    StopSync();
-  }
-
-  void SetUp() override { test_user_share_.SetUp(); }
-
-  void TearDown() override { test_user_share_.TearDown(); }
-
-  bool CanSyncNode(const BookmarkNode* node) {
-    return model_->client()->CanSyncNode(node);
-  }
-
-  // Inserts a folder directly to the share.
-  // Do not use this after model association is complete.
-  //
-  // This function differs from the AddFolder() function declared elsewhere in
-  // this file in that it only affects the sync model.  It would be invalid to
-  // change the sync model directly after ModelAssociation.  This function can
-  // be invoked prior to model association to set up first-time sync model
-  // association scenarios.
-  int64_t AddFolderToShare(syncer::WriteTransaction* trans,
-                           const std::string& title) {
-    EXPECT_FALSE(model_associator_);
-
-    // Be sure to call CreatePermanentBookmarkNodes(), otherwise this will fail.
-    syncer::ReadNode bookmark_bar(trans);
-    EXPECT_EQ(BaseNode::INIT_OK,
-              bookmark_bar.InitByTagLookupForBookmarks("bookmark_bar"));
-
-    syncer::WriteNode node(trans);
-    EXPECT_TRUE(node.InitBookmarkByCreation(bookmark_bar, nullptr));
-    node.SetIsFolder(true);
-    node.SetTitle(title);
-
-    return node.GetId();
-  }
-
-  // Inserts a bookmark directly to the share.
-  // Do not use this after model association is complete.
-  //
-  // This function differs from the AddURL() function declared elsewhere in this
-  // file in that it only affects the sync model.  It would be invalid to change
-  // the sync model directly after ModelAssociation.  This function can be
-  // invoked prior to model association to set up first-time sync model
-  // association scenarios.
-  int64_t AddBookmarkToShare(syncer::WriteTransaction* trans,
-                             int64_t parent_id,
-                             const std::string& title,
-                             const std::string& url) {
-    EXPECT_FALSE(model_associator_);
-
-    syncer::ReadNode parent(trans);
-    EXPECT_EQ(BaseNode::INIT_OK, parent.InitByIdLookup(parent_id));
-
-    sync_pb::BookmarkSpecifics specifics;
-    specifics.set_url(url);
-    specifics.set_title(title);
-
-    syncer::WriteNode node(trans);
-    EXPECT_TRUE(node.InitBookmarkByCreation(parent, nullptr));
-    node.SetIsFolder(false);
-    node.SetTitle(title);
-    node.SetBookmarkSpecifics(specifics);
-
-    return node.GetId();
-  }
-
-  // Create a BookmarkModel. If |delete_bookmarks| is true, the bookmarks file
-  // will be deleted before starting up the BookmarkModel.
-  std::unique_ptr<BookmarkModel> CreateBookmarkModel(bool delete_bookmarks) {
-    const base::FilePath& data_path = data_dir_.GetPath();
-    auto model = std::make_unique<BookmarkModel>(
-        std::make_unique<bookmarks::TestBookmarkClient>());
-    managed_bookmark_service_->BookmarkModelCreated(model.get());
-    int64_t next_id = 0;
-    static_cast<bookmarks::TestBookmarkClient*>(model->client())
-        ->SetManagedNodeToLoad(
-            managed_bookmark_service_->GetLoadManagedNodeCallback().Run(
-                &next_id));
-    if (delete_bookmarks) {
-      base::DeleteFile(data_path.Append(FILE_PATH_LITERAL("dummy_bookmarks")),
-                       false);
-    }
-
-    model->Load(&pref_service_, data_path, base::ThreadTaskRunnerHandle::Get(),
-                base::ThreadTaskRunnerHandle::Get());
-    bookmarks::test::WaitForBookmarkModelToLoad(model.get());
-    return model;
-  }
-
-  // Load (or re-load) the bookmark model.  |load| controls use of the
-  // bookmarks file on disk.  |save| controls whether the newly loaded
-  // bookmark model will write out a bookmark file as it goes.
-  void LoadBookmarkModel(LoadOption load, SaveOption save) {
-    bool delete_bookmarks = load == DELETE_EXISTING_STORAGE;
-    model_.reset();
-    model_ = CreateBookmarkModel(delete_bookmarks);
-    // This noticeably speeds up the unit tests that request it.
-    if (save == DONT_SAVE_TO_STORAGE)
-      model_->ClearStore();
-    base::RunLoop().RunUntilIdle();
-  }
-
-  int GetSyncBookmarkCount() {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
-    syncer::ReadNode node(&trans);
-    if (node.InitTypeRoot(syncer::BOOKMARKS) != BaseNode::INIT_OK)
-      return 0;
-    return node.GetTotalNodeCount();
-  }
-
-  // Creates the bookmark root node and the permanent nodes if they don't
-  // already exist.
-  bool CreatePermanentBookmarkNodes() {
-    bool root_exists = false;
-    syncer::ModelType type = syncer::BOOKMARKS;
-    {
-      syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
-      syncer::ReadNode uber_root(&trans);
-      uber_root.InitByRootLookup();
-
-      syncer::ReadNode root(&trans);
-      root_exists = (root.InitTypeRoot(type) == BaseNode::INIT_OK);
-    }
-
-    if (!root_exists) {
-      if (!syncer::TestUserShare::CreateRoot(type,
-                                             test_user_share_.user_share()))
-        return false;
-    }
-
-    const int kNumPermanentNodes = 3;
-    const std::string permanent_tags[kNumPermanentNodes] = {
-        "bookmark_bar", "other_bookmarks", "synced_bookmarks",
-    };
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
-    syncer::ReadNode root(&trans);
-    EXPECT_EQ(BaseNode::INIT_OK, root.InitTypeRoot(type));
-
-    // Loop through creating permanent nodes as necessary.
-    int64_t last_child_id = syncer::kInvalidId;
-    for (int i = 0; i < kNumPermanentNodes; ++i) {
-      // First check if the node already exists. This is for tests that involve
-      // persistence and set up sync more than once.
-      syncer::ReadNode lookup(&trans);
-      if (lookup.InitByTagLookupForBookmarks(permanent_tags[i]) ==
-          syncer::ReadNode::INIT_OK) {
-        last_child_id = lookup.GetId();
-        continue;
-      }
-
-      // If it doesn't exist, create the permanent node at the end of the
-      // ordering.
-      syncer::ReadNode predecessor_node(&trans);
-      syncer::ReadNode* predecessor = nullptr;
-      if (last_child_id != syncer::kInvalidId) {
-        EXPECT_EQ(BaseNode::INIT_OK,
-                  predecessor_node.InitByIdLookup(last_child_id));
-        predecessor = &predecessor_node;
-      }
-      syncer::WriteNode node(&trans);
-      if (!node.InitBookmarkByCreation(root, predecessor))
-        return false;
-      node.SetIsFolder(true);
-      node.GetMutableEntryForTest()->PutUniqueServerTag(permanent_tags[i]);
-      node.SetTitle(permanent_tags[i]);
-      node.SetExternalId(0);
-      last_child_id = node.GetId();
-    }
-    return true;
-  }
-
-  bool AssociateModels() {
-    EXPECT_TRUE(!model_associator_);
-
-    // Set up model associator.
-    model_associator_ = std::make_unique<BookmarkModelAssociator>(
-        model_.get(), /*bookmark_undo_service=*/nullptr,
-        /*favicon_service=*/nullptr, test_user_share_.user_share(),
-        std::make_unique<syncer::DataTypeErrorHandlerMock>(),
-        kExpectMobileBookmarks);
-
-    local_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS);
-    syncer_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS);
-    int local_count_before = model_->root_node()->GetTotalNodeCount();
-    int syncer_count_before = GetSyncBookmarkCount();
-
-    syncer::SyncError error = model_associator_->AssociateModels(
-        &local_merge_result_, &syncer_merge_result_);
-    if (error.IsSet())
-      return false;
-
-    base::RunLoop().RunUntilIdle();
-
-    // Verify the merge results were calculated properly.
-    EXPECT_EQ(local_count_before,
-              local_merge_result_.num_items_before_association());
-    EXPECT_EQ(syncer_count_before,
-              syncer_merge_result_.num_items_before_association());
-    EXPECT_EQ(local_merge_result_.num_items_after_association(),
-              local_merge_result_.num_items_before_association() +
-                  local_merge_result_.num_items_added() -
-                  local_merge_result_.num_items_deleted());
-    EXPECT_EQ(syncer_merge_result_.num_items_after_association(),
-              syncer_merge_result_.num_items_before_association() +
-                  syncer_merge_result_.num_items_added() -
-                  syncer_merge_result_.num_items_deleted());
-    EXPECT_EQ(model_->root_node()->GetTotalNodeCount(),
-              local_merge_result_.num_items_after_association());
-    EXPECT_EQ(GetSyncBookmarkCount(),
-              syncer_merge_result_.num_items_after_association());
-    return true;
-  }
-
-  void StartSync() {
-    test_user_share_.Reload();
-
-    ASSERT_TRUE(CreatePermanentBookmarkNodes());
-    ASSERT_TRUE(AssociateModels());
-
-    // Set up change processor.
-    ResetChangeProcessor();
-    change_processor_->Start(test_user_share_.user_share());
-  }
-
-  void StopSync() {
-    change_processor_.reset();
-    if (model_associator_) {
-      syncer::SyncError error = model_associator_->DisassociateModels();
-      EXPECT_FALSE(error.IsSet());
-    }
-    model_associator_.reset();
-
-    base::RunLoop().RunUntilIdle();
-
-    // TODO(akalin): Actually close the database and flush it to disk
-    // (and make StartSync reload from disk).  This would require
-    // refactoring TestUserShare.
-  }
-
-  bool InitSyncNodeFromChromeNode(const BookmarkNode* bnode,
-                                  BaseNode* sync_node) {
-    return model_associator_->InitSyncNodeFromChromeId(bnode->id(), sync_node);
-  }
-
-  void ExpectSyncerNodeMatching(syncer::BaseTransaction* trans,
-                                const BookmarkNode* bnode) {
-    std::string truncated_title = base::UTF16ToUTF8(bnode->GetTitle());
-    syncer::SyncAPINameToServerName(truncated_title, &truncated_title);
-    base::TruncateUTF8ToByteSize(truncated_title, 255, &truncated_title);
-    syncer::ServerNameToSyncAPIName(truncated_title, &truncated_title);
-
-    syncer::ReadNode gnode(trans);
-    ASSERT_TRUE(InitSyncNodeFromChromeNode(bnode, &gnode));
-    // Non-root node titles and parents must match.
-    if (!model_->is_permanent_node(bnode)) {
-      EXPECT_EQ(truncated_title, gnode.GetTitle());
-      EXPECT_EQ(model_associator_->GetChromeNodeFromSyncId(gnode.GetParentId()),
-                bnode->parent());
-    }
-    EXPECT_EQ(bnode->is_folder(), gnode.GetIsFolder());
-    if (bnode->is_url())
-      EXPECT_EQ(bnode->url(), GURL(gnode.GetBookmarkSpecifics().url()));
-
-    // Check that meta info matches.
-    const BookmarkNode::MetaInfoMap* meta_info_map = bnode->GetMetaInfoMap();
-    sync_pb::BookmarkSpecifics specifics = gnode.GetBookmarkSpecifics();
-    if (!meta_info_map) {
-      EXPECT_EQ(0, specifics.meta_info_size());
-    } else {
-      EXPECT_EQ(meta_info_map->size(),
-                static_cast<size_t>(specifics.meta_info_size()));
-      for (int i = 0; i < specifics.meta_info_size(); i++) {
-        auto it = meta_info_map->find(specifics.meta_info(i).key());
-        EXPECT_TRUE(it != meta_info_map->end());
-        EXPECT_EQ(it->second, specifics.meta_info(i).value());
-      }
-    }
-
-    // Check for position matches.
-    size_t browser_index = size_t{bnode->parent()->GetIndexOf(bnode)};
-    if (browser_index == 0) {
-      EXPECT_EQ(gnode.GetPredecessorId(), 0);
-    } else {
-      const BookmarkNode* bprev =
-          bnode->parent()->children()[browser_index - 1].get();
-      syncer::ReadNode gprev(trans);
-      ASSERT_TRUE(InitSyncNodeFromChromeNode(bprev, &gprev));
-      EXPECT_EQ(gnode.GetPredecessorId(), gprev.GetId());
-      EXPECT_EQ(gnode.GetParentId(), gprev.GetParentId());
-    }
-    // Note: the managed node is the last child of the root_node but isn't
-    // synced; if CanSyncNode() is false then there is no next node to sync.
-    const BookmarkNode* bnext = nullptr;
-    if (browser_index + 1 < bnode->parent()->children().size())
-      bnext = bnode->parent()->children()[browser_index + 1].get();
-    if (!bnext || !CanSyncNode(bnext)) {
-      EXPECT_EQ(gnode.GetSuccessorId(), 0);
-    } else {
-      syncer::ReadNode gnext(trans);
-      ASSERT_TRUE(InitSyncNodeFromChromeNode(bnext, &gnext));
-      EXPECT_EQ(gnode.GetSuccessorId(), gnext.GetId());
-      EXPECT_EQ(gnode.GetParentId(), gnext.GetParentId());
-    }
-    if (!bnode->children().empty())
-      EXPECT_TRUE(gnode.GetFirstChildId());
-  }
-
-  void ExpectSyncerNodeMatching(const BookmarkNode* bnode) {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
-    ExpectSyncerNodeMatching(&trans, bnode);
-  }
-
-  void ExpectBrowserNodeMatching(syncer::BaseTransaction* trans,
-                                 int64_t sync_id) {
-    EXPECT_TRUE(sync_id);
-    const BookmarkNode* bnode =
-        model_associator_->GetChromeNodeFromSyncId(sync_id);
-    ASSERT_TRUE(bnode);
-    ASSERT_TRUE(CanSyncNode(bnode));
-
-    int64_t id = model_associator_->GetSyncIdFromChromeId(bnode->id());
-    EXPECT_EQ(id, sync_id);
-    ExpectSyncerNodeMatching(trans, bnode);
-  }
-
-  void ExpectBrowserNodeUnknown(int64_t sync_id) {
-    EXPECT_FALSE(model_associator_->GetChromeNodeFromSyncId(sync_id));
-  }
-
-  void ExpectBrowserNodeKnown(int64_t sync_id) {
-    EXPECT_TRUE(model_associator_->GetChromeNodeFromSyncId(sync_id));
-  }
-
-  void ExpectSyncerNodeKnown(const BookmarkNode* node) {
-    int64_t sync_id = model_associator_->GetSyncIdFromChromeId(node->id());
-    EXPECT_NE(sync_id, syncer::kInvalidId);
-  }
-
-  void ExpectSyncerNodeUnknown(const BookmarkNode* node) {
-    int64_t sync_id = model_associator_->GetSyncIdFromChromeId(node->id());
-    EXPECT_EQ(sync_id, syncer::kInvalidId);
-  }
-
-  void ExpectBrowserNodeTitle(int64_t sync_id, const std::string& title) {
-    const BookmarkNode* bnode =
-        model_associator_->GetChromeNodeFromSyncId(sync_id);
-    ASSERT_TRUE(bnode);
-    EXPECT_EQ(bnode->GetTitle(), base::UTF8ToUTF16(title));
-  }
-
-  void ExpectBrowserNodeURL(int64_t sync_id, const std::string& url) {
-    const BookmarkNode* bnode =
-        model_associator_->GetChromeNodeFromSyncId(sync_id);
-    ASSERT_TRUE(bnode);
-    EXPECT_EQ(GURL(url), bnode->url());
-  }
-
-  void ExpectBrowserNodeParent(int64_t sync_id, int64_t parent_sync_id) {
-    const BookmarkNode* node =
-        model_associator_->GetChromeNodeFromSyncId(sync_id);
-    ASSERT_TRUE(node);
-    const BookmarkNode* parent =
-        model_associator_->GetChromeNodeFromSyncId(parent_sync_id);
-    EXPECT_TRUE(parent);
-    EXPECT_EQ(node->parent(), parent);
-  }
-
-  void ExpectModelMatch(syncer::BaseTransaction* trans) {
-    const BookmarkNode* root = model_->root_node();
-    EXPECT_EQ(root->GetIndexOf(model_->bookmark_bar_node()), 0);
-    EXPECT_EQ(root->GetIndexOf(model_->other_node()), 1);
-    EXPECT_EQ(root->GetIndexOf(model_->mobile_node()), 2);
-
-    base::stack<int64_t> stack;
-    stack.push(bookmark_bar_id());
-    while (!stack.empty()) {
-      int64_t id = stack.top();
-      stack.pop();
-      if (!id)
-        continue;
-
-      ExpectBrowserNodeMatching(trans, id);
-
-      syncer::ReadNode gnode(trans);
-      ASSERT_EQ(BaseNode::INIT_OK, gnode.InitByIdLookup(id));
-      stack.push(gnode.GetSuccessorId());
-      if (gnode.GetIsFolder())
-        stack.push(gnode.GetFirstChildId());
-    }
-  }
-
-  void ExpectModelMatch() {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
-    ExpectModelMatch(&trans);
-  }
-
-  int64_t mobile_bookmarks_id() {
-    return model_associator_->GetSyncIdFromChromeId(
-        model_->mobile_node()->id());
-  }
-
-  int64_t other_bookmarks_id() {
-    return model_associator_->GetSyncIdFromChromeId(model_->other_node()->id());
-  }
-
-  int64_t bookmark_bar_id() {
-    return model_associator_->GetSyncIdFromChromeId(
-        model_->bookmark_bar_node()->id());
-  }
-
-  BookmarkModel* model() { return model_.get(); }
-
-  syncer::TestUserShare* test_user_share() { return &test_user_share_; }
-
-  BookmarkChangeProcessor* change_processor() {
-    return change_processor_.get();
-  }
-
-  void delete_change_processor() { change_processor_.reset(); }
-
-  void ResetChangeProcessor() {
-    std::unique_ptr<syncer::DataTypeErrorHandlerMock> error_handler =
-        std::make_unique<syncer::DataTypeErrorHandlerMock>();
-    mock_error_handler_ = error_handler.get();
-    change_processor_ = std::make_unique<BookmarkChangeProcessor>(
-        model_associator_.get(), std::move(error_handler));
-  }
-
-  syncer::DataTypeErrorHandlerMock* mock_error_handler() {
-    return mock_error_handler_;
-  }
-
-  void delete_model_associator() { model_associator_.reset(); }
-
-  BookmarkModelAssociator* model_associator() {
-    return model_associator_.get();
-  }
-
-  bookmarks::ManagedBookmarkService* managed_bookmark_service() {
-    return managed_bookmark_service_.get();
-  }
-
- private:
-  base::TestMessageLoop message_loop_;
-  base::ScopedTempDir data_dir_;
-  sync_preferences::TestingPrefServiceSyncable pref_service_;
-  std::unique_ptr<BookmarkModel> model_;
-  syncer::TestUserShare test_user_share_;
-  std::unique_ptr<BookmarkChangeProcessor> change_processor_;
-  syncer::DataTypeErrorHandlerMock* mock_error_handler_;
-  std::unique_ptr<BookmarkModelAssociator> model_associator_;
-  std::unique_ptr<bookmarks::ManagedBookmarkService> managed_bookmark_service_;
-
-  syncer::SyncMergeResult local_merge_result_;
-  syncer::SyncMergeResult syncer_merge_result_;
-
-  DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceBookmarkTest);
-};
-
-TEST_F(ProfileSyncServiceBookmarkTest, InitialState) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  EXPECT_TRUE(other_bookmarks_id());
-  EXPECT_TRUE(bookmark_bar_id());
-  EXPECT_TRUE(mobile_bookmarks_id());
-
-  ExpectModelMatch();
-}
-
-// Populate the sync database then start model association.  Sync's bookmarks
-// should end up being copied into the native model, resulting in a successful
-// "ExpectModelMatch()".
-//
-// This code has some use for verifying correctness.  It's also a very useful
-// for profiling bookmark ModelAssociation, an important part of some first-time
-// sync scenarios.  Simply increase the kNumFolders and kNumBookmarksPerFolder
-// as desired, then run the test under a profiler to find hot spots in the model
-// association code.
-TEST_F(ProfileSyncServiceBookmarkTest, InitialModelAssociate) {
-  const int kNumBookmarksPerFolder = 10;
-  const int kNumFolders = 10;
-
-  CreatePermanentBookmarkNodes();
-
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    for (int i = 0; i < kNumFolders; ++i) {
-      int64_t folder_id =
-          AddFolderToShare(&trans, base::StringPrintf("folder%05d", i));
-      for (int j = 0; j < kNumBookmarksPerFolder; ++j) {
-        AddBookmarkToShare(
-            &trans, folder_id, base::StringPrintf("bookmark%05d", j),
-            base::StringPrintf("http://www.google.com/search?q=%05d", j));
-      }
-    }
-  }
-
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  ExpectModelMatch();
-}
-
-// Tests bookmark association when nodes exists in the native model only.
-// These entries should be copied to Sync directory during association process.
-TEST_F(ProfileSyncServiceBookmarkTest,
-       InitialModelAssociateWithBookmarkModelNodes) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  const BookmarkNode* folder = model()->AddFolder(model()->other_node(), 0,
-                                                  base::ASCIIToUTF16("foobar"));
-  model()->AddFolder(folder, 0, base::ASCIIToUTF16("nested"));
-  model()->AddURL(folder, 0, base::ASCIIToUTF16("Internets #1 Pies Site"),
-                  GURL("http://www.easypie.com/"));
-  model()->AddURL(folder, 1, base::ASCIIToUTF16("Airplanes"),
-                  GURL("http://www.easyjet.com/"));
-
-  StartSync();
-  ExpectModelMatch();
-}
-
-// Tests bookmark association case when there is an entry in the delete journal
-// that matches one of native bookmarks.
-TEST_F(ProfileSyncServiceBookmarkTest, InitialModelAssociateWithDeleteJournal) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  const BookmarkNode* folder = model()->AddFolder(
-      model()->bookmark_bar_node(), 0, base::ASCIIToUTF16("foobar"));
-  const BookmarkNode* bookmark =
-      model()->AddURL(folder, 0, base::ASCIIToUTF16("Airplanes"),
-                      GURL("http://www.easyjet.com/"));
-
-  CreatePermanentBookmarkNodes();
-
-  // Create entries matching the folder and the bookmark above.
-  int64_t folder_id, bookmark_id;
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    folder_id = AddFolderToShare(&trans, "foobar");
-    bookmark_id = AddBookmarkToShare(&trans, folder_id, "Airplanes",
-                                     "http://www.easyjet.com/");
-  }
-
-  // Associate the bookmark sync node with the native model one and make
-  // it look like it was deleted by a server update.
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    syncer::WriteNode node(&trans);
-    EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(bookmark_id));
-
-    node.GetMutableEntryForTest()->PutLocalExternalId(bookmark->id());
-
-    MakeServerUpdate(&trans, &node);
-    node.GetMutableEntryForTest()->PutServerIsDel(true);
-    node.GetMutableEntryForTest()->PutIsDel(true);
-  }
-
-  ASSERT_TRUE(AssociateModels());
-  ExpectModelMatch();
-
-  // The bookmark node should be deleted.
-  EXPECT_TRUE(folder->children().empty());
-}
-
-// Tests that the external ID is used to match the right folder amoung
-// multiple folders with the same name during the native model traversal.
-// Also tests that the external ID is used to match the right bookmark
-// among multiple identical bookmarks when dealing with the delete journal.
-TEST_F(ProfileSyncServiceBookmarkTest,
-       InitialModelAssociateVerifyExternalIdMatch) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  constexpr size_t kNumFolders = 10;
-  constexpr size_t kNumBookmarks = 10;
-  constexpr size_t kFolderToIncludeBookmarks = 7;
-  constexpr size_t kBookmarkToDelete = 4;
-
-  int64_t folder_ids[kNumFolders];
-  int64_t bookmark_ids[kNumBookmarks];
-
-  // Create native folders and bookmarks with identical names. Only
-  // one of the folders contains bookmarks and others are empty. Here is the
-  // expected tree shape:
-  // Bookmarks bar
-  // +- folder (#0)
-  // +- folder (#1)
-  // ...
-  // +- folder (#7) <-- Only this folder contains bookmarks.
-  //    +- bookmark (#0)
-  //    +- bookmark (#1)
-  //    ...
-  //    +- bookmark (#4) <-- Only this one bookmark should be removed later.
-  //    ...
-  //    +- bookmark (#9)
-  // ...
-  // +- folder (#9)
-
-  const BookmarkNode* parent_folder = nullptr;
-  for (size_t i = 0; i < kNumFolders; i++) {
-    const BookmarkNode* folder = model()->AddFolder(
-        model()->bookmark_bar_node(), i, base::ASCIIToUTF16("folder"));
-    folder_ids[i] = folder->id();
-    if (i == kFolderToIncludeBookmarks)
-      parent_folder = folder;
-  }
-
-  for (size_t i = 0; i < kNumBookmarks; i++) {
-    const BookmarkNode* bookmark =
-        model()->AddURL(parent_folder, i, base::ASCIIToUTF16("bookmark"),
-                        GURL("http://www.google.com/"));
-    bookmark_ids[i] = bookmark->id();
-  }
-
-  // Number of nodes in bookmark bar before association.
-  int total_node_count = model()->bookmark_bar_node()->GetTotalNodeCount();
-
-  CreatePermanentBookmarkNodes();
-
-  int64_t sync_bookmark_id_to_delete = 0;
-  {
-    // Create sync folders matching native folders above.
-    int64_t parent_id = 0;
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    // Create in reverse order because AddFolderToShare passes null for
-    // |predecessor| argument.
-    for (auto folder_id : base::Reversed(folder_ids)) {
-      int64_t id = AddFolderToShare(&trans, "folder");
-
-      // Pre-map sync folders to native folders by setting
-      // external ID. This will verify that the association algorithm picks
-      // the right ones despite all of them having identical names.
-      // More specifically this will help to avoid cloning bookmarks from
-      // a wrong folder.
-      syncer::WriteNode node(&trans);
-      EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-      node.GetMutableEntryForTest()->PutLocalExternalId(folder_id);
-
-      if (folder_id == parent_folder->id())
-        parent_id = id;
-    }
-
-    // Create sync bookmark matching native bookmarks above in reverse order
-    // because AddBookmarkToShare passes null for |predecessor| argument.
-    for (auto bookmark_id : base::Reversed(bookmark_ids)) {
-      int id = AddBookmarkToShare(&trans, parent_id, "bookmark",
-                                  "http://www.google.com/");
-
-      // Pre-map sync bookmarks to native bookmarks by setting
-      // external ID. This will verify that the association algorithm picks
-      // the right ones despite all of them having identical names and URLs.
-      syncer::WriteNode node(&trans);
-      EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id));
-      node.GetMutableEntryForTest()->PutLocalExternalId(bookmark_id);
-
-      if (bookmark_id == bookmark_ids[kBookmarkToDelete])
-        sync_bookmark_id_to_delete = id;
-    }
-  }
-
-  // Make one bookmark deleted.
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    syncer::WriteNode node(&trans);
-    EXPECT_EQ(BaseNode::INIT_OK,
-              node.InitByIdLookup(sync_bookmark_id_to_delete));
-
-    MakeServerUpdate(&trans, &node);
-    node.GetMutableEntryForTest()->PutServerIsDel(true);
-    node.GetMutableEntryForTest()->PutIsDel(true);
-  }
-
-  // Perform association.
-  ASSERT_TRUE(AssociateModels());
-  ExpectModelMatch();
-
-  // Only one native node should have been deleted and no nodes cloned due to
-  // matching folder names.
-  EXPECT_EQ(kNumFolders, model()->bookmark_bar_node()->children().size());
-  EXPECT_EQ(kNumBookmarks - 1, parent_folder->children().size());
-  EXPECT_EQ(total_node_count - 1,
-            model()->bookmark_bar_node()->GetTotalNodeCount());
-
-  // Verify that the right bookmark got deleted and no bookmarks reordered.
-  for (size_t i = 0; i < parent_folder->children().size(); i++) {
-    size_t index_in_bookmark_ids = (i < kBookmarkToDelete) ? i : i + 1;
-    EXPECT_EQ(bookmark_ids[index_in_bookmark_ids],
-              parent_folder->children()[i]->id());
-  }
-}
-
-// Verifies that the bookmark association skips sync nodes with invalid URLs.
-TEST_F(ProfileSyncServiceBookmarkTest, InitialModelAssociateWithInvalidUrl) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  // On the local side create a folder and two nodes.
-  const BookmarkNode* folder = model()->AddFolder(
-      model()->bookmark_bar_node(), 0, base::ASCIIToUTF16("folder"));
-  model()->AddURL(folder, 0, base::ASCIIToUTF16("node1"),
-                  GURL("http://www.node1.com/"));
-  model()->AddURL(folder, 1, base::ASCIIToUTF16("node2"),
-                  GURL("http://www.node2.com/"));
-
-  // On the sync side create a matching folder, one matching node, one
-  // unmatching node, and one node with an invalid URL.
-  CreatePermanentBookmarkNodes();
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    int64_t folder_id = AddFolderToShare(&trans, "folder");
-    // Please note that each AddBookmarkToShare inserts the node at the front
-    // so the actual order of children in the directory will be opposite.
-    AddBookmarkToShare(&trans, folder_id, "node2", "http://www.node2.com/");
-    AddBookmarkToShare(&trans, folder_id, "node3", "");
-    AddBookmarkToShare(&trans, folder_id, "node4", "http://www.node4.com/");
-  }
-
-  // Perform association.
-  StartSync();
-
-  // Concatenate resulting titles of native nodes.
-  std::string native_titles;
-  for (const auto& child : folder->children()) {
-    if (!native_titles.empty())
-      native_titles += ",";
-    native_titles += base::UTF16ToUTF8(child->GetTitle());
-  }
-
-  // Expect the order of nodes to follow the sync order (see note above), the
-  // node with the invalid URL to be skipped, and the managed native node to be
-  // at the end.
-  EXPECT_EQ("node4,node2,node1", native_titles);
-}
-
-TEST_F(ProfileSyncServiceBookmarkTest, BookmarkModelOperations) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  // Test addition.
-  const BookmarkNode* folder = model()->AddFolder(model()->other_node(), 0,
-                                                  base::ASCIIToUTF16("foobar"));
-  ExpectSyncerNodeMatching(folder);
-  ExpectModelMatch();
-  const BookmarkNode* folder2 =
-      model()->AddFolder(folder, 0, base::ASCIIToUTF16("nested"));
-  ExpectSyncerNodeMatching(folder2);
-  ExpectModelMatch();
-  const BookmarkNode* url1 =
-      model()->AddURL(folder, 0, base::ASCIIToUTF16("Internets #1 Pies Site"),
-                      GURL("http://www.easypie.com/"));
-  ExpectSyncerNodeMatching(url1);
-  ExpectModelMatch();
-  const BookmarkNode* url2 =
-      model()->AddURL(folder, 1, base::ASCIIToUTF16("Airplanes"),
-                      GURL("http://www.easyjet.com/"));
-  ExpectSyncerNodeMatching(url2);
-  ExpectModelMatch();
-  // Test addition.
-  const BookmarkNode* mobile_folder =
-      model()->AddFolder(model()->mobile_node(), 0, base::ASCIIToUTF16("pie"));
-  ExpectSyncerNodeMatching(mobile_folder);
-  ExpectModelMatch();
-
-  // Test modification.
-  model()->SetTitle(url2, base::ASCIIToUTF16("EasyJet"));
-  ExpectModelMatch();
-  model()->Move(url1, folder2, 0);
-  ExpectModelMatch();
-  model()->Move(folder2, model()->bookmark_bar_node(), 0);
-  ExpectModelMatch();
-  model()->SetTitle(folder2, base::ASCIIToUTF16("Not Nested"));
-  ExpectModelMatch();
-  model()->Move(folder, folder2, 0);
-  ExpectModelMatch();
-  model()->SetTitle(folder, base::ASCIIToUTF16("who's nested now?"));
-  ExpectModelMatch();
-  model()->Copy(url2, model()->bookmark_bar_node(), 0);
-  ExpectModelMatch();
-  model()->SetTitle(mobile_folder, base::ASCIIToUTF16("strawberry"));
-  ExpectModelMatch();
-
-  // Test deletion.
-  // Delete a single item.
-  model()->Remove(url2);
-  ExpectModelMatch();
-  // Delete an item with several children.
-  model()->Remove(folder2);
-  ExpectModelMatch();
-  model()->Remove(model()->mobile_node()->children().front().get());
-  ExpectModelMatch();
-}
-
-TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeProcessing) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-
-  FakeServerChange adds(&trans);
-  int64_t f1 = adds.AddFolder("Server Folder B", bookmark_bar_id(), 0);
-  int64_t f2 = adds.AddFolder("Server Folder A", bookmark_bar_id(), f1);
-  int64_t u1 = adds.AddURL("Some old site", "ftp://nifty.andrew.cmu.edu/",
-                           bookmark_bar_id(), f2);
-  int64_t u2 = adds.AddURL("Nifty", "ftp://nifty.andrew.cmu.edu/", f1, 0);
-  // u3 is a duplicate URL
-  int64_t u3 = adds.AddURL("Nifty2", "ftp://nifty.andrew.cmu.edu/", f1, u2);
-  // u4 is a duplicate title, different URL.
-  adds.AddURL("Some old site", "http://slog.thestranger.com/",
-              bookmark_bar_id(), u1);
-  // u5 tests an empty-string title.
-  std::string javascript_url(
-      "javascript:(function(){var w=window.open("
-      "'about:blank','gnotesWin','location=0,menubar=0,"
-      "scrollbars=0,status=0,toolbar=0,width=300,"
-      "height=300,resizable');});");
-  adds.AddURL(std::string(), javascript_url, other_bookmarks_id(), 0);
-  int64_t u6 = adds.AddURL("Sync1", "http://www.syncable.edu/",
-                           mobile_bookmarks_id(), 0);
-
-  syncer::ChangeRecordList::const_iterator it;
-  // The bookmark model shouldn't yet have seen any of the nodes of |adds|.
-  for (it = adds.changes().begin(); it != adds.changes().end(); ++it)
-    ExpectBrowserNodeUnknown(it->id);
-
-  adds.ApplyPendingChanges(change_processor());
-
-  // Make sure the bookmark model received all of the nodes in |adds|.
-  for (it = adds.changes().begin(); it != adds.changes().end(); ++it)
-    ExpectBrowserNodeMatching(&trans, it->id);
-  ExpectModelMatch(&trans);
-
-  // Part two: test modifications.
-  FakeServerChange mods(&trans);
-  // Mess with u2, and move it into empty folder f2
-  // TODO(ncarter): Determine if we allow ModifyURL ops or not.
-  /* std::string u2_old_url = mods.ModifyURL(u2, "http://www.google.com"); */
-  std::string u2_old_title = mods.ModifyTitle(u2, "The Google");
-  int64_t u2_old_parent = mods.ModifyPosition(u2, f2, 0);
-
-  // Now move f1 after u2.
-  std::string f1_old_title = mods.ModifyTitle(f1, "Server Folder C");
-  int64_t f1_old_parent = mods.ModifyPosition(f1, f2, u2);
-
-  // Then add u3 after f1.
-  int64_t u3_old_parent = mods.ModifyPosition(u3, f2, f1);
-
-  std::string u6_old_title = mods.ModifyTitle(u6, "Mobile Folder A");
-
-  // Test that the property changes have not yet taken effect.
-  ExpectBrowserNodeTitle(u2, u2_old_title);
-  /* ExpectBrowserNodeURL(u2, u2_old_url); */
-  ExpectBrowserNodeParent(u2, u2_old_parent);
-
-  ExpectBrowserNodeTitle(f1, f1_old_title);
-  ExpectBrowserNodeParent(f1, f1_old_parent);
-
-  ExpectBrowserNodeParent(u3, u3_old_parent);
-
-  ExpectBrowserNodeTitle(u6, u6_old_title);
-
-  // Apply the changes.
-  mods.ApplyPendingChanges(change_processor());
-
-  // Check for successful application.
-  for (it = mods.changes().begin(); it != mods.changes().end(); ++it)
-    ExpectBrowserNodeMatching(&trans, it->id);
-  ExpectModelMatch(&trans);
-
-  // Part 3: Test URL deletion.
-  FakeServerChange dels(&trans);
-  dels.Delete(u2);
-  dels.Delete(u3);
-  dels.Delete(u6);
-
-  ExpectBrowserNodeKnown(u2);
-  ExpectBrowserNodeKnown(u3);
-
-  dels.ApplyPendingChanges(change_processor());
-
-  ExpectBrowserNodeUnknown(u2);
-  ExpectBrowserNodeUnknown(u3);
-  ExpectBrowserNodeUnknown(u6);
-  ExpectModelMatch(&trans);
-}
-
-// Tests a specific case in ApplyModelChanges where we move the
-// children out from under a parent, and then delete the parent
-// in the same changelist.  The delete shows up first in the changelist,
-// requiring the children to be moved to a temporary location.
-TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeRequiringFosterParent) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-
-  // Stress the immediate children of other_node because that's where
-  // ApplyModelChanges puts a temporary foster parent node.
-  std::string url("http://dev.chromium.org/");
-  FakeServerChange adds(&trans);
-  int64_t f0 = other_bookmarks_id();            // + other_node
-  int64_t f1 = adds.AddFolder("f1", f0, 0);     //   + f1
-  int64_t f2 = adds.AddFolder("f2", f1, 0);     //     + f2
-  int64_t u3 = adds.AddURL("u3", url, f2, 0);   //       + u3    NOLINT
-  int64_t u4 = adds.AddURL("u4", url, f2, u3);  //       + u4    NOLINT
-  int64_t u5 = adds.AddURL("u5", url, f1, f2);  //     + u5      NOLINT
-  int64_t f6 = adds.AddFolder("f6", f1, u5);    //     + f6
-  int64_t u7 = adds.AddURL("u7", url, f0, f1);  //   + u7        NOLINT
-
-  syncer::ChangeRecordList::const_iterator it;
-  // The bookmark model shouldn't yet have seen any of the nodes of |adds|.
-  for (it = adds.changes().begin(); it != adds.changes().end(); ++it)
-    ExpectBrowserNodeUnknown(it->id);
-
-  adds.ApplyPendingChanges(change_processor());
-
-  // Make sure the bookmark model received all of the nodes in |adds|.
-  for (it = adds.changes().begin(); it != adds.changes().end(); ++it)
-    ExpectBrowserNodeMatching(&trans, it->id);
-  ExpectModelMatch(&trans);
-
-  // We have to do the moves before the deletions, but FakeServerChange will
-  // put the deletion at the front of the changelist.
-  FakeServerChange ops(&trans);
-  ops.ModifyPosition(f6, other_bookmarks_id(), 0);
-  ops.ModifyPosition(u3, other_bookmarks_id(), f1);  // Prev == f1 is OK here.
-  ops.ModifyPosition(f2, other_bookmarks_id(), u7);
-  ops.ModifyPosition(u7, f2, 0);
-  ops.ModifyPosition(u4, other_bookmarks_id(), f2);
-  ops.ModifyPosition(u5, f6, 0);
-  ops.Delete(f1);
-
-  ops.ApplyPendingChanges(change_processor());
-
-  ExpectModelMatch(&trans);
-}
-
-// Simulate a server change record containing a valid but non-canonical URL.
-TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeWithNonCanonicalURL) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-
-    FakeServerChange adds(&trans);
-    std::string url("http://dev.chromium.org");
-    EXPECT_NE(GURL(url).spec(), url);
-    adds.AddURL("u1", url, other_bookmarks_id(), 0);
-
-    adds.ApplyPendingChanges(change_processor());
-
-    EXPECT_EQ(1u, model()->other_node()->children().size());
-    ExpectModelMatch(&trans);
-  }
-
-  // Now reboot the sync service, forcing a merge step.
-  StopSync();
-  LoadBookmarkModel(LOAD_FROM_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  // There should still be just the one bookmark.
-  EXPECT_EQ(1u, model()->other_node()->children().size());
-  ExpectModelMatch();
-}
-
-// Simulate a server change record containing an invalid URL (per GURL).
-// TODO(ncarter): Disabled due to crashes.  Fix bug 1677563.
-TEST_F(ProfileSyncServiceBookmarkTest, DISABLED_ServerChangeWithInvalidURL) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  size_t child_count = 0;
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-
-    FakeServerChange adds(&trans);
-    std::string url("x");
-    EXPECT_FALSE(GURL(url).is_valid());
-    adds.AddURL("u1", url, other_bookmarks_id(), 0);
-
-    adds.ApplyPendingChanges(change_processor());
-
-    // We're lenient about what should happen -- the model could wind up with
-    // the node or without it; but things should be consistent, and we
-    // shouldn't crash.
-    child_count = model()->other_node()->children().size();
-    EXPECT_TRUE(child_count == 0 || child_count == 1);
-    ExpectModelMatch(&trans);
-  }
-
-  // Now reboot the sync service, forcing a merge step.
-  StopSync();
-  LoadBookmarkModel(LOAD_FROM_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  // Things ought not to have changed.
-  EXPECT_EQ(model()->other_node()->children().size(), child_count);
-  ExpectModelMatch();
-}
-
-// Test strings that might pose a problem if the titles ever became used as
-// file names in the sync backend.
-TEST_F(ProfileSyncServiceBookmarkTest, CornerCaseNames) {
-  // TODO(ncarter): Bug 1570238 explains the failure of this test.
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  const char* names[] = {
-      // The empty string.
-      "",
-      // Illegal Windows filenames.
-      "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5",
-      "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5",
-      "LPT6", "LPT7", "LPT8", "LPT9",
-      // Current/parent directory markers.
-      ".", "..", "...",
-      // Files created automatically by the Windows shell.
-      "Thumbs.db", ".DS_Store",
-      // Names including Win32-illegal characters, and path separators.
-      "foo/bar", "foo\\bar", "foo?bar", "foo:bar", "foo|bar", "foo\"bar",
-      "foo'bar", "foo<bar", "foo>bar", "foo%bar", "foo*bar", "foo]bar",
-      "foo[bar",
-      // A name with title > 255 characters
-      "012345678901234567890123456789012345678901234567890123456789012345678901"
-      "234567890123456789012345678901234567890123456789012345678901234567890123"
-      "456789012345678901234567890123456789012345678901234567890123456789012345"
-      "678901234567890123456789012345678901234567890123456789012345678901234567"
-      "890123456789"};
-  // Create both folders and bookmarks using each name.
-  GURL url("http://www.doublemint.com");
-  for (size_t i = 0; i < base::size(names); ++i) {
-    model()->AddFolder(model()->other_node(), 0, base::ASCIIToUTF16(names[i]));
-    model()->AddURL(model()->other_node(), 0, base::ASCIIToUTF16(names[i]),
-                    url);
-  }
-
-  // Verify that the browser model matches the sync model.
-  EXPECT_EQ(model()->other_node()->children().size(), 2 * base::size(names));
-  ExpectModelMatch();
-
-  // Restart and re-associate. Verify things still match.
-  StopSync();
-  LoadBookmarkModel(LOAD_FROM_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-  EXPECT_EQ(model()->other_node()->children().size(), 2 * base::size(names));
-  ExpectModelMatch();
-}
-
-// Stress the internal representation of position by sparse numbers. We want
-// to repeatedly bisect the range of available positions, to force the
-// syncer code to renumber its ranges.  Pick a number big enough so that it
-// would exhaust 32bits of room between items a couple of times.
-TEST_F(ProfileSyncServiceBookmarkTest, RepeatedMiddleInsertion) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  static const int kTimesToInsert = 256;
-
-  // Create two book-end nodes to insert between.
-  model()->AddFolder(model()->other_node(), 0, base::ASCIIToUTF16("Alpha"));
-  model()->AddFolder(model()->other_node(), 1, base::ASCIIToUTF16("Omega"));
-  size_t count = 2;
-
-  // Test insertion in first half of range by repeatedly inserting in second
-  // position.
-  for (int i = 0; i < kTimesToInsert; ++i) {
-    base::string16 title =
-        base::ASCIIToUTF16("Pre-insertion ") + base::NumberToString16(i);
-    model()->AddFolder(model()->other_node(), 1, title);
-    count++;
-  }
-
-  // Test insertion in second half of range by repeatedly inserting in
-  // second-to-last position.
-  for (int i = 0; i < kTimesToInsert; ++i) {
-    base::string16 title =
-        base::ASCIIToUTF16("Post-insertion ") + base::NumberToString16(i);
-    model()->AddFolder(model()->other_node(), count - 1, title);
-    count++;
-  }
-
-  // Verify that the browser model matches the sync model.
-  EXPECT_EQ(model()->other_node()->children().size(), count);
-  ExpectModelMatch();
-}
-
-// Introduce a consistency violation into the model, and see that it
-// puts itself into a lame, error state.
-TEST_F(ProfileSyncServiceBookmarkTest, UnrecoverableErrorSuspendsService) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  // Add a node which will be the target of the consistency violation.
-  const BookmarkNode* node =
-      model()->AddFolder(model()->other_node(), 0, base::ASCIIToUTF16("node"));
-  ExpectSyncerNodeMatching(node);
-
-  // Now destroy the syncer node as if we were the ProfileSyncService without
-  // updating the ProfileSyncService state.  This should introduce
-  // inconsistency between the two models.
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    syncer::WriteNode sync_node(&trans);
-    ASSERT_TRUE(InitSyncNodeFromChromeNode(node, &sync_node));
-    sync_node.Tombstone();
-  }
-  // The models don't match at this point, but the ProfileSyncService
-  // doesn't know it yet.
-  ExpectSyncerNodeKnown(node);
-
-  mock_error_handler()->ExpectError(syncer::SyncError::DATATYPE_ERROR);
-
-  // Add a child to the inconsistent node.  This should cause detection of the
-  // problem and the syncer should stop processing changes.
-  model()->AddFolder(node, 0, base::ASCIIToUTF16("nested"));
-}
-
-// See what happens if we run model association when there are two exact URL
-// duplicate bookmarks.  The BookmarkModelAssociator should not fall over when
-// this happens.
-TEST_F(ProfileSyncServiceBookmarkTest, MergeDuplicates) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  model()->AddURL(model()->other_node(), 0, base::ASCIIToUTF16("Dup"),
-                  GURL("http://dup.com/"));
-  model()->AddURL(model()->other_node(), 0, base::ASCIIToUTF16("Dup"),
-                  GURL("http://dup.com/"));
-
-  EXPECT_EQ(2u, model()->other_node()->children().size());
-
-  // Restart the sync service to trigger model association.
-  StopSync();
-  StartSync();
-
-  EXPECT_EQ(2u, model()->other_node()->children().size());
-  ExpectModelMatch();
-}
-
-TEST_F(ProfileSyncServiceBookmarkTest, ApplySyncDeletesFromJournal) {
-  // Initialize sync model and bookmark model as:
-  // URL 0
-  // Folder 1
-  //   |-- URL 1
-  //   +-- Folder 2
-  //         +-- URL 2
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  int64_t u0 = 0;
-  int64_t f1 = 0;
-  int64_t u1 = 0;
-  int64_t f2 = 0;
-  int64_t u2 = 0;
-  StartSync();
-  int fixed_sync_bk_count = GetSyncBookmarkCount();
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    FakeServerChange adds(&trans);
-    u0 = adds.AddURL("URL 0", "http://plus.google.com/", bookmark_bar_id(), 0);
-    f1 = adds.AddFolder("Folder 1", bookmark_bar_id(), u0);
-    u1 = adds.AddURL("URL 1", "http://www.google.com/", f1, 0);
-    f2 = adds.AddFolder("Folder 2", f1, u1);
-    u2 = adds.AddURL("URL 2", "http://mail.google.com/", f2, 0);
-    adds.ApplyPendingChanges(change_processor());
-  }
-  StopSync();
-
-  // Reload bookmark model and disable model saving to make sync changes not
-  // persisted.
-  LoadBookmarkModel(LOAD_FROM_STORAGE, DONT_SAVE_TO_STORAGE);
-  EXPECT_EQ(6, model()->bookmark_bar_node()->GetTotalNodeCount());
-  EXPECT_EQ(fixed_sync_bk_count + 5, GetSyncBookmarkCount());
-  StartSync();
-  {
-    // Remove all folders/bookmarks except u3 added above.
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    MakeServerUpdate(&trans, f1);
-    MakeServerUpdate(&trans, u1);
-    MakeServerUpdate(&trans, f2);
-    MakeServerUpdate(&trans, u2);
-    FakeServerChange dels(&trans);
-    dels.Delete(u2);
-    dels.Delete(f2);
-    dels.Delete(u1);
-    dels.Delete(f1);
-    dels.ApplyPendingChanges(change_processor());
-  }
-  StopSync();
-  // Bookmark bar itself and u0 remain.
-  EXPECT_EQ(2, model()->bookmark_bar_node()->GetTotalNodeCount());
-
-  // Reload bookmarks including ones deleted in sync model from storage.
-  LoadBookmarkModel(LOAD_FROM_STORAGE, DONT_SAVE_TO_STORAGE);
-  EXPECT_EQ(6, model()->bookmark_bar_node()->GetTotalNodeCount());
-  // Add a bookmark under f1 when sync is off so that f1 will not be
-  // deleted even when f1 matches delete journal because it's not empty.
-  model()->AddURL(model()->bookmark_bar_node()->children()[1].get(), 0,
-                  base::UTF8ToUTF16("local"), GURL("http://www.youtube.com"));
-  // Sync model has fixed bookmarks nodes and u3.
-  EXPECT_EQ(fixed_sync_bk_count + 1, GetSyncBookmarkCount());
-  StartSync();
-  // Expect 4 bookmarks after model association because u2, f2, u1 are removed
-  // by delete journal, f1 is not removed by delete journal because it's
-  // not empty due to www.youtube.com added above.
-  EXPECT_EQ(4, model()->bookmark_bar_node()->GetTotalNodeCount());
-  EXPECT_EQ(base::UTF8ToUTF16("URL 0"),
-            model()->bookmark_bar_node()->children()[0]->GetTitle());
-  EXPECT_EQ(base::UTF8ToUTF16("Folder 1"),
-            model()->bookmark_bar_node()->children()[1]->GetTitle());
-  EXPECT_EQ(
-      base::UTF8ToUTF16("local"),
-      model()->bookmark_bar_node()->children()[1]->children()[0]->GetTitle());
-  StopSync();
-
-  // Verify purging of delete journals.
-  // Delete journals for u2, f2, u1 remains because they are used in last
-  // association.
-  EXPECT_EQ(3u, test_user_share()->GetDeleteJournalSize());
-  StartSync();
-  StopSync();
-  // Reload again and all delete journals should be gone because none is used
-  // in last association.
-  ASSERT_TRUE(test_user_share()->Reload());
-  EXPECT_EQ(0u, test_user_share()->GetDeleteJournalSize());
-}
-
-struct TestData {
-  const char* title;
-  const char* url;
-};
-
-// Map from bookmark node ID to its version.
-using BookmarkNodeVersionMap = std::map<int64_t, int64_t>;
-
-// TODO(ncarter): Integrate the existing TestNode/PopulateNodeFromString code
-// in the bookmark model unittest, to make it simpler to set up test data
-// here (and reduce the amount of duplication among tests), and to reduce the
-// duplication.
-class ProfileSyncServiceBookmarkTestWithData
-    : public ProfileSyncServiceBookmarkTest {
- public:
-  ProfileSyncServiceBookmarkTestWithData();
-
- protected:
-  // Populates or compares children of the given bookmark node from/with the
-  // given test data array with the given size. |running_count| is updated as
-  // urls are added. It is used to set the creation date (or test the creation
-  // date for CompareWithTestData()).
-  void PopulateFromTestData(const BookmarkNode* node,
-                            const TestData* data,
-                            size_t size,
-                            int* running_count);
-  void CompareWithTestData(const BookmarkNode* node,
-                           const TestData* data,
-                           size_t size,
-                           int* running_count);
-
-  void ExpectBookmarkModelMatchesTestData();
-  void WriteTestDataToBookmarkModel();
-
-  // Output transaction versions of |node| and nodes under it to
-  // |node_versions|.
-  void GetTransactionVersions(const BookmarkNode* root,
-                              BookmarkNodeVersionMap* node_versions);
-
-  // Verify transaction versions of bookmark nodes and sync nodes are equal
-  // recursively. If node is in |version_expected|, versions should match
-  // there, too.
-  void ExpectTransactionVersionMatch(
-      const BookmarkNode* node,
-      const BookmarkNodeVersionMap& version_expected);
-
- private:
-  const base::Time start_time_;
-
-  DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceBookmarkTestWithData);
-};
-
-namespace {
-
-// Constants for bookmark model that looks like:
-// |-- Bookmark bar
-// |   |-- u2, http://www.u2.com/
-// |   |-- f1
-// |   |   |-- f1u4, http://www.f1u4.com/
-// |   |   |-- f1u2, http://www.f1u2.com/
-// |   |   |-- f1u3, http://www.f1u3.com/
-// |   |   +-- f1u1, http://www.f1u1.com/
-// |   |-- u1, http://www.u1.com/
-// |   +-- f2
-// |       |-- f2u2, http://www.f2u2.com/
-// |       |-- f2u4, http://www.f2u4.com/
-// |       |-- f2u3, http://www.f2u3.com/
-// |       +-- f2u1, http://www.f2u1.com/
-// +-- Other bookmarks
-// |   |-- f3
-// |   |   |-- f3u4, http://www.f3u4.com/
-// |   |   |-- f3u2, http://www.f3u2.com/
-// |   |   |-- f3u3, http://www.f3u3.com/
-// |   |   +-- f3u1, http://www.f3u1.com/
-// |   |-- u4, http://www.u4.com/
-// |   |-- u3, http://www.u3.com/
-// |   --- f4
-// |   |   |-- f4u1, http://www.f4u1.com/
-// |   |   |-- f4u2, http://www.f4u2.com/
-// |   |   |-- f4u3, http://www.f4u3.com/
-// |   |   +-- f4u4, http://www.f4u4.com/
-// |   |-- dup
-// |   |   +-- dupu1, http://www.dupu1.com/
-// |   +-- dup
-// |   |   +-- dupu2, http://www.dupu1.com/
-// |   +--   ls  , http://www.ls.com/
-// |
-// +-- Mobile bookmarks
-//     |-- f5
-//     |   |-- f5u1, http://www.f5u1.com/
-//     |-- f6
-//     |   |-- f6u1, http://www.f6u1.com/
-//     |   |-- f6u2, http://www.f6u2.com/
-//     +-- u5, http://www.u5.com/
-
-static TestData kBookmarkBarChildren[] = {
-    {"u2", "http://www.u2.com/"},
-    {"f1", nullptr},
-    {"u1", "http://www.u1.com/"},
-    {"f2", nullptr},
-};
-static TestData kF1Children[] = {
-    {"f1u4", "http://www.f1u4.com/"},
-    {"f1u2", "http://www.f1u2.com/"},
-    {"f1u3", "http://www.f1u3.com/"},
-    {"f1u1", "http://www.f1u1.com/"},
-};
-static TestData kF2Children[] = {
-    {"f2u2", "http://www.f2u2.com/"},
-    {"f2u4", "http://www.f2u4.com/"},
-    {"f2u3", "http://www.f2u3.com/"},
-    {"f2u1", "http://www.f2u1.com/"},
-};
-
-static TestData kOtherBookmarkChildren[] = {{"f3", nullptr},
-                                            {"u4", "http://www.u4.com/"},
-                                            {"u3", "http://www.u3.com/"},
-                                            {"f4", nullptr},
-                                            {"dup", nullptr},
-                                            {"dup", nullptr},
-                                            {"  ls  ", "http://www.ls.com/"}};
-static TestData kF3Children[] = {
-    {"f3u4", "http://www.f3u4.com/"},
-    {"f3u2", "http://www.f3u2.com/"},
-    {"f3u3", "http://www.f3u3.com/"},
-    {"f3u1", "http://www.f3u1.com/"},
-};
-static TestData kF4Children[] = {
-    {"f4u1", "http://www.f4u1.com/"},
-    {"f4u2", "http://www.f4u2.com/"},
-    {"f4u3", "http://www.f4u3.com/"},
-    {"f4u4", "http://www.f4u4.com/"},
-};
-static TestData kDup1Children[] = {
-    {"dupu1", "http://www.dupu1.com/"},
-};
-static TestData kDup2Children[] = {
-    {"dupu2", "http://www.dupu2.com/"},
-};
-
-static TestData kMobileBookmarkChildren[] = {
-    {"f5", nullptr},
-    {"f6", nullptr},
-    {"u5", "http://www.u5.com/"},
-};
-static TestData kF5Children[] = {
-    {"f5u1", "http://www.f5u1.com/"},
-    {"f5u2", "http://www.f5u2.com/"},
-};
-static TestData kF6Children[] = {
-    {"f6u1", "http://www.f6u1.com/"},
-    {"f6u2", "http://www.f6u2.com/"},
-};
-
-}  // anonymous namespace.
-
-ProfileSyncServiceBookmarkTestWithData::ProfileSyncServiceBookmarkTestWithData()
-    : start_time_(base::Time::Now()) {}
-
-void ProfileSyncServiceBookmarkTestWithData::PopulateFromTestData(
-    const BookmarkNode* node,
-    const TestData* data,
-    size_t size,
-    int* running_count) {
-  ASSERT_TRUE(node);
-  ASSERT_TRUE(data);
-  ASSERT_TRUE(node->is_folder());
-  for (size_t i = 0; i < size; ++i) {
-    const TestData& item = data[i];
-    if (item.url) {
-      const base::Time add_time =
-          start_time_ + base::TimeDelta::FromMinutes(*running_count);
-      model()->AddURL(node, i, base::UTF8ToUTF16(item.title), GURL(item.url),
-                      nullptr, add_time);
-    } else {
-      model()->AddFolder(node, i, base::UTF8ToUTF16(item.title));
-    }
-    (*running_count)++;
-  }
-}
-
-void ProfileSyncServiceBookmarkTestWithData::CompareWithTestData(
-    const BookmarkNode* node,
-    const TestData* data,
-    size_t size,
-    int* running_count) {
-  ASSERT_TRUE(node);
-  ASSERT_TRUE(data);
-  ASSERT_TRUE(node->is_folder());
-  ASSERT_EQ(size, node->children().size());
-  for (size_t i = 0; i < size; ++i) {
-    const BookmarkNode* child_node = node->children()[i].get();
-    const TestData& item = data[i];
-    GURL url = GURL(item.url == nullptr ? "" : item.url);
-    BookmarkNode test_node(/*id=*/0, base::GenerateGUID(), url);
-    test_node.SetTitle(base::UTF8ToUTF16(item.title));
-    EXPECT_EQ(child_node->GetTitle(), test_node.GetTitle());
-    if (item.url) {
-      EXPECT_FALSE(child_node->is_folder());
-      EXPECT_TRUE(child_node->is_url());
-      EXPECT_EQ(child_node->url(), test_node.url());
-      const base::Time expected_time =
-          start_time_ + base::TimeDelta::FromMinutes(*running_count);
-      EXPECT_EQ(expected_time.ToInternalValue(),
-                child_node->date_added().ToInternalValue());
-    } else {
-      EXPECT_TRUE(child_node->is_folder());
-      EXPECT_FALSE(child_node->is_url());
-    }
-    (*running_count)++;
-  }
-}
-
-// TODO(munjal): We should implement some way of generating random data and can
-// use the same seed to generate the same sequence.
-void ProfileSyncServiceBookmarkTestWithData::WriteTestDataToBookmarkModel() {
-  const BookmarkNode* bookmarks_bar_node = model()->bookmark_bar_node();
-  int count = 0;
-  PopulateFromTestData(bookmarks_bar_node, kBookmarkBarChildren,
-                       base::size(kBookmarkBarChildren), &count);
-
-  ASSERT_GE(bookmarks_bar_node->children().size(), 4u);
-  const BookmarkNode* f1_node = bookmarks_bar_node->children()[1].get();
-  PopulateFromTestData(f1_node, kF1Children, base::size(kF1Children), &count);
-  const BookmarkNode* f2_node = bookmarks_bar_node->children()[3].get();
-  PopulateFromTestData(f2_node, kF2Children, base::size(kF2Children), &count);
-
-  const BookmarkNode* other_bookmarks_node = model()->other_node();
-  PopulateFromTestData(other_bookmarks_node, kOtherBookmarkChildren,
-                       base::size(kOtherBookmarkChildren), &count);
-
-  ASSERT_GE(other_bookmarks_node->children().size(), 6u);
-  const BookmarkNode* f3_node = other_bookmarks_node->children()[0].get();
-  PopulateFromTestData(f3_node, kF3Children, base::size(kF3Children), &count);
-  const BookmarkNode* f4_node = other_bookmarks_node->children()[3].get();
-  PopulateFromTestData(f4_node, kF4Children, base::size(kF4Children), &count);
-  const BookmarkNode* dup_node = other_bookmarks_node->children()[4].get();
-  PopulateFromTestData(dup_node, kDup1Children, base::size(kDup1Children),
-                       &count);
-  dup_node = other_bookmarks_node->children()[5].get();
-  PopulateFromTestData(dup_node, kDup2Children, base::size(kDup2Children),
-                       &count);
-
-  const BookmarkNode* mobile_bookmarks_node = model()->mobile_node();
-  PopulateFromTestData(mobile_bookmarks_node, kMobileBookmarkChildren,
-                       base::size(kMobileBookmarkChildren), &count);
-
-  ASSERT_GE(mobile_bookmarks_node->children().size(), 3u);
-  const BookmarkNode* f5_node = mobile_bookmarks_node->children()[0].get();
-  PopulateFromTestData(f5_node, kF5Children, base::size(kF5Children), &count);
-  const BookmarkNode* f6_node = mobile_bookmarks_node->children()[1].get();
-  PopulateFromTestData(f6_node, kF6Children, base::size(kF6Children), &count);
-
-  ExpectBookmarkModelMatchesTestData();
-}
-
-void ProfileSyncServiceBookmarkTestWithData::
-    ExpectBookmarkModelMatchesTestData() {
-  const BookmarkNode* bookmark_bar_node = model()->bookmark_bar_node();
-  int count = 0;
-  CompareWithTestData(bookmark_bar_node, kBookmarkBarChildren,
-                      base::size(kBookmarkBarChildren), &count);
-
-  ASSERT_GE(bookmark_bar_node->children().size(), 4u);
-  const BookmarkNode* f1_node = bookmark_bar_node->children()[1].get();
-  CompareWithTestData(f1_node, kF1Children, base::size(kF1Children), &count);
-  const BookmarkNode* f2_node = bookmark_bar_node->children()[3].get();
-  CompareWithTestData(f2_node, kF2Children, base::size(kF2Children), &count);
-
-  const BookmarkNode* other_bookmarks_node = model()->other_node();
-  CompareWithTestData(other_bookmarks_node, kOtherBookmarkChildren,
-                      base::size(kOtherBookmarkChildren), &count);
-
-  ASSERT_GE(other_bookmarks_node->children().size(), 6u);
-  const BookmarkNode* f3_node = other_bookmarks_node->children()[0].get();
-  CompareWithTestData(f3_node, kF3Children, base::size(kF3Children), &count);
-  const BookmarkNode* f4_node = other_bookmarks_node->children()[3].get();
-  CompareWithTestData(f4_node, kF4Children, base::size(kF4Children), &count);
-  const BookmarkNode* dup_node = other_bookmarks_node->children()[4].get();
-  CompareWithTestData(dup_node, kDup1Children, base::size(kDup1Children),
-                      &count);
-  dup_node = other_bookmarks_node->children()[5].get();
-  CompareWithTestData(dup_node, kDup2Children, base::size(kDup2Children),
-                      &count);
-
-  const BookmarkNode* mobile_bookmarks_node = model()->mobile_node();
-  CompareWithTestData(mobile_bookmarks_node, kMobileBookmarkChildren,
-                      base::size(kMobileBookmarkChildren), &count);
-
-  ASSERT_GE(mobile_bookmarks_node->children().size(), 3u);
-  const BookmarkNode* f5_node = mobile_bookmarks_node->children()[0].get();
-  CompareWithTestData(f5_node, kF5Children, base::size(kF5Children), &count);
-  const BookmarkNode* f6_node = mobile_bookmarks_node->children()[1].get();
-  CompareWithTestData(f6_node, kF6Children, base::size(kF6Children), &count);
-}
-
-// Tests persistence of the profile sync service by unloading the
-// database and then reloading it from disk.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, Persistence) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  WriteTestDataToBookmarkModel();
-
-  ExpectModelMatch();
-
-  // Force both models to discard their data and reload from disk.  This
-  // simulates what would happen if the browser were to shutdown normally,
-  // and then relaunch.
-  StopSync();
-  LoadBookmarkModel(LOAD_FROM_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  ExpectBookmarkModelMatchesTestData();
-
-  // With the BookmarkModel contents verified, ExpectModelMatch will
-  // verify the contents of the sync model.
-  ExpectModelMatch();
-}
-
-// Tests the merge case when the BookmarkModel is non-empty but the
-// sync model is empty.  This corresponds to uploading browser
-// bookmarks to an initially empty, new account.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeWithEmptySyncModel) {
-  // Don't start the sync service until we've populated the bookmark model.
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-
-  WriteTestDataToBookmarkModel();
-
-  // Restart sync.  This should trigger a merge step during
-  // initialization -- we expect the browser bookmarks to be written
-  // to the sync service during this call.
-  StartSync();
-
-  // Verify that the bookmark model hasn't changed, and that the sync model
-  // matches it exactly.
-  ExpectBookmarkModelMatchesTestData();
-  ExpectModelMatch();
-}
-
-// Tests the merge case when the BookmarkModel is empty but the sync model is
-// non-empty.  This corresponds (somewhat) to a clean install of the browser,
-// with no bookmarks, connecting to a sync account that has some bookmarks.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeWithEmptyBookmarkModel) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  WriteTestDataToBookmarkModel();
-
-  ExpectModelMatch();
-
-  // Force the databse to unload and write itself to disk.
-  StopSync();
-
-  // Blow away the bookmark model -- it should be empty afterwards.
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  EXPECT_TRUE(model()->bookmark_bar_node()->children().empty());
-  EXPECT_TRUE(model()->other_node()->children().empty());
-  EXPECT_TRUE(model()->mobile_node()->children().empty());
-
-  // Now restart the sync service.  Starting it should populate the bookmark
-  // model -- test for consistency.
-  StartSync();
-  ExpectBookmarkModelMatchesTestData();
-  ExpectModelMatch();
-}
-
-// Tests the merge cases when both the models are expected to be identical
-// after the merge.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeExpectedIdenticalModels) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-  WriteTestDataToBookmarkModel();
-  ExpectModelMatch();
-  StopSync();
-
-  // At this point both the bookmark model and the server should have the
-  // exact same data and it should match the test data.
-  LoadBookmarkModel(LOAD_FROM_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-  ExpectBookmarkModelMatchesTestData();
-  ExpectModelMatch();
-  StopSync();
-
-  // Now reorder some bookmarks in the bookmark model and then merge. Make
-  // sure we get the order of the server after merge.
-  LoadBookmarkModel(LOAD_FROM_STORAGE, DONT_SAVE_TO_STORAGE);
-  ExpectBookmarkModelMatchesTestData();
-  const BookmarkNode* bookmark_bar = model()->bookmark_bar_node();
-  ASSERT_TRUE(bookmark_bar);
-  ASSERT_GT(bookmark_bar->children().size(), 1u);
-  model()->Move(bookmark_bar->children().front().get(), bookmark_bar, 1);
-  StartSync();
-  ExpectModelMatch();
-  ExpectBookmarkModelMatchesTestData();
-}
-
-// Tests the merge cases when both the models are expected to be identical
-// after the merge.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeModelsWithSomeExtras) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  ExpectBookmarkModelMatchesTestData();
-
-  // Remove some nodes and reorder some nodes.
-  const BookmarkNode* bookmark_bar_node = model()->bookmark_bar_node();
-  size_t remove_index = 2;
-  ASSERT_GT(bookmark_bar_node->children().size(), remove_index);
-  const BookmarkNode* child_node =
-      bookmark_bar_node->children()[remove_index].get();
-  ASSERT_TRUE(child_node);
-  ASSERT_TRUE(child_node->is_url());
-  model()->Remove(bookmark_bar_node->children()[remove_index].get());
-  ASSERT_GT(bookmark_bar_node->children().size(), remove_index);
-  child_node = bookmark_bar_node->children()[remove_index].get();
-  ASSERT_TRUE(child_node);
-  ASSERT_TRUE(child_node->is_folder());
-  model()->Remove(bookmark_bar_node->children()[remove_index].get());
-
-  const BookmarkNode* other_node = model()->other_node();
-  ASSERT_GE(other_node->children().size(), 1u);
-  const BookmarkNode* f3_node = other_node->children().front().get();
-  ASSERT_TRUE(f3_node);
-  ASSERT_TRUE(f3_node->is_folder());
-  remove_index = 2;
-  ASSERT_GT(f3_node->children().size(), remove_index);
-  model()->Remove(f3_node->children()[remove_index].get());
-  ASSERT_GT(f3_node->children().size(), remove_index);
-  model()->Remove(f3_node->children()[remove_index].get());
-
-  StartSync();
-  ExpectModelMatch();
-  StopSync();
-
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  ExpectBookmarkModelMatchesTestData();
-
-  // Remove some nodes and reorder some nodes.
-  bookmark_bar_node = model()->bookmark_bar_node();
-  remove_index = 0;
-  ASSERT_GT(bookmark_bar_node->children().size(), remove_index);
-  child_node = bookmark_bar_node->children()[remove_index].get();
-  ASSERT_TRUE(child_node);
-  ASSERT_TRUE(child_node->is_url());
-  model()->Remove(bookmark_bar_node->children()[remove_index].get());
-  ASSERT_GT(bookmark_bar_node->children().size(), remove_index);
-  child_node = bookmark_bar_node->children()[remove_index].get();
-  ASSERT_TRUE(child_node);
-  ASSERT_TRUE(child_node->is_folder());
-  model()->Remove(bookmark_bar_node->children()[remove_index].get());
-
-  ASSERT_GE(bookmark_bar_node->children().size(), 2u);
-  model()->Move(bookmark_bar_node->children()[0].get(), bookmark_bar_node, 1);
-
-  other_node = model()->other_node();
-  ASSERT_GE(other_node->children().size(), 1u);
-  f3_node = other_node->children()[0].get();
-  ASSERT_TRUE(f3_node);
-  ASSERT_TRUE(f3_node->is_folder());
-  remove_index = 0;
-  ASSERT_GT(f3_node->children().size(), remove_index);
-  model()->Remove(f3_node->children()[remove_index].get());
-  ASSERT_GT(f3_node->children().size(), remove_index);
-  model()->Remove(f3_node->children()[remove_index].get());
-
-  ASSERT_GE(other_node->children().size(), 4u);
-  model()->Move(other_node->children()[0].get(), other_node, 1);
-  model()->Move(other_node->children()[2].get(), other_node, 3);
-
-  StartSync();
-  ExpectModelMatch();
-
-  // After the merge, the model should match the test data.
-  ExpectBookmarkModelMatchesTestData();
-}
-
-// Tests that when persisted model associations are used, things work fine.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, ModelAssociationPersistence) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  StartSync();
-  ExpectModelMatch();
-  // Force sync to shut down and write itself to disk.
-  StopSync();
-  // Now restart sync. This time it should use the persistent
-  // associations.
-  StartSync();
-  ExpectModelMatch();
-}
-
-// Tests that when persisted model associations are used, things work fine.
-TEST_F(ProfileSyncServiceBookmarkTestWithData,
-       ModelAssociationInvalidPersistence) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  StartSync();
-  ExpectModelMatch();
-  // Force sync to shut down and write itself to disk.
-  StopSync();
-  // Change the bookmark model before restarting sync service to simulate
-  // the situation where bookmark model is different from sync model and
-  // make sure model associator correctly rebuilds associations.
-  const BookmarkNode* bookmark_bar_node = model()->bookmark_bar_node();
-  model()->AddURL(bookmark_bar_node, 0, base::ASCIIToUTF16("xtra"),
-                  GURL("http://www.xtra.com"));
-  // Now restart sync. This time it will try to use the persistent
-  // associations and realize that they are invalid and hence will rebuild
-  // associations.
-  StartSync();
-  ExpectModelMatch();
-}
-
-TEST_F(ProfileSyncServiceBookmarkTestWithData, SortChildren) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  // Write test data to bookmark model and verify that the models match.
-  WriteTestDataToBookmarkModel();
-  const BookmarkNode* folder_added =
-      model()->other_node()->children().front().get();
-  ASSERT_TRUE(folder_added);
-  ASSERT_TRUE(folder_added->is_folder());
-
-  ExpectModelMatch();
-
-  // Sort the other-bookmarks children and expect that the models match.
-  model()->SortChildren(folder_added);
-  ExpectModelMatch();
-}
-
-// See what happens if we enable sync but then delete the "Sync Data"
-// folder.
-TEST_F(ProfileSyncServiceBookmarkTestWithData,
-       RecoverAfterDeletingSyncDataDirectory) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
-  StartSync();
-
-  WriteTestDataToBookmarkModel();
-
-  StopSync();
-
-  // Nuke the sync DB and reload.
-  TearDown();
-  SetUp();
-
-  // First attempt fails due to a persistence error.
-  EXPECT_TRUE(CreatePermanentBookmarkNodes());
-  EXPECT_FALSE(AssociateModels());
-
-  // Second attempt succeeds due to the previous error resetting the native
-  // transaction version.
-  delete_model_associator();
-  EXPECT_TRUE(CreatePermanentBookmarkNodes());
-  EXPECT_TRUE(AssociateModels());
-
-  // Make sure we're back in sync.  In real life, the user would need
-  // to reauthenticate before this happens, but in the test, authentication
-  // is sidestepped.
-  ExpectBookmarkModelMatchesTestData();
-  ExpectModelMatch();
-}
-
-// Verify that the bookmark model is updated about whether the
-// associator is currently running.
-TEST_F(ProfileSyncServiceBookmarkTest, AssociationState) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-
-  ExtensiveChangesBookmarkModelObserver observer;
-  model()->AddObserver(&observer);
-
-  StartSync();
-
-  EXPECT_EQ(1, observer.get_started());
-  EXPECT_EQ(0, observer.get_completed_count_at_started());
-  EXPECT_EQ(1, observer.get_completed());
-
-  model()->RemoveObserver(&observer);
-}
-
-// Verify that the creation_time_us changes are applied in the local model at
-// association time and update time.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateDateAdded) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-
-  // Start and stop sync in order to create bookmark nodes in the sync db.
-  StartSync();
-  StopSync();
-
-  // Modify the date_added field of a bookmark so it doesn't match with
-  // the sync data.
-  const BookmarkNode* bookmark_bar_node = model()->bookmark_bar_node();
-  size_t modified_index = 2;
-  ASSERT_GT(bookmark_bar_node->children().size(), modified_index);
-  const BookmarkNode* child_node =
-      bookmark_bar_node->children()[modified_index].get();
-  ASSERT_TRUE(child_node);
-  EXPECT_TRUE(child_node->is_url());
-  model()->SetDateAdded(child_node, base::Time::FromInternalValue(10));
-
-  StartSync();
-  StopSync();
-
-  // Verify that transaction versions are in sync between the native model
-  // and Sync.
-  {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share()->user_share());
-    int64_t sync_version = trans.GetModelVersion(syncer::BOOKMARKS);
-    int64_t native_version = model()->root_node()->sync_transaction_version();
-    EXPECT_EQ(native_version, sync_version);
-  }
-
-  // Since the version is in sync the association above should have skipped
-  // updating the native node above. That is expected optimization (see
-  // crbug/464907.
-  EXPECT_EQ(child_node->date_added(), base::Time::FromInternalValue(10));
-
-  // Reset transaction version on the native model to trigger updating data
-  // for all bookmark nodes.
-  model()->SetNodeSyncTransactionVersion(
-      model()->root_node(), syncer::syncable::kInvalidTransactionVersion);
-
-  StartSync();
-
-  // Everything should be back in sync after model association.
-  ExpectBookmarkModelMatchesTestData();
-  ExpectModelMatch();
-
-  // Now trigger a change while syncing. We add a new bookmark, sync it, then
-  // updates it's creation time.
-  syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-  FakeServerChange adds(&trans);
-  const std::string kTitle = "Some site";
-  const std::string kUrl = "http://www.whatwhat.yeah/";
-  const int kCreationTime = 30;
-  int64_t id = adds.AddURL(kTitle, kUrl, bookmark_bar_id(), 0);
-  adds.ApplyPendingChanges(change_processor());
-  FakeServerChange updates(&trans);
-  updates.ModifyCreationTime(id, kCreationTime);
-  updates.ApplyPendingChanges(change_processor());
-
-  const BookmarkNode* node =
-      model()->bookmark_bar_node()->children().front().get();
-  ASSERT_TRUE(node);
-  EXPECT_TRUE(node->is_url());
-  EXPECT_EQ(base::UTF8ToUTF16(kTitle), node->GetTitle());
-  EXPECT_EQ(kUrl, node->url().possibly_invalid_spec());
-  EXPECT_EQ(node->date_added(), base::Time::FromInternalValue(30));
-}
-
-// Verifies that the transaction version in the native bookmark model gets
-// updated and synced with the sync transaction version even when the
-// association doesn't modify any sync nodes. This is necessary to ensure
-// that the native transaction doesn't get stuck at "unset" version and skips
-// any further consistency checks.
-TEST_F(ProfileSyncServiceBookmarkTestWithData,
-       NativeTransactionVersionUpdated) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-
-  // Start sync in order to create bookmark nodes in the sync db.
-  StartSync();
-  StopSync();
-
-  // Reset transaction version on the native mode to "unset".
-  model()->SetNodeSyncTransactionVersion(
-      model()->root_node(), syncer::syncable::kInvalidTransactionVersion);
-
-  // Restart sync.
-  StartSync();
-  StopSync();
-
-  // Verify that the native transaction version has been updated and is now
-  // in sync with the sync version.
-  {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share()->user_share());
-    int64_t sync_version = trans.GetModelVersion(syncer::BOOKMARKS);
-    int64_t native_version = model()->root_node()->sync_transaction_version();
-    EXPECT_EQ(native_version, sync_version);
-  }
-}
-
-// Tests that changes to the sync nodes meta info gets reflected in the local
-// bookmark model.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateMetaInfoFromSync) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  StartSync();
-
-  // Create bookmark nodes containing meta info.
-  syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-  FakeServerChange adds(&trans);
-  BookmarkNode::MetaInfoMap folder_meta_info;
-  folder_meta_info["folder"] = "foldervalue";
-  int64_t folder_id = adds.AddFolderWithMetaInfo(
-      "folder title", &folder_meta_info, bookmark_bar_id(), 0);
-  BookmarkNode::MetaInfoMap node_meta_info;
-  node_meta_info["node"] = "nodevalue";
-  node_meta_info["other"] = "othervalue";
-  int64_t id = adds.AddURLWithMetaInfo("node title", "http://www.foo.com",
-                                       &node_meta_info, folder_id, 0);
-  adds.ApplyPendingChanges(change_processor());
-
-  // Verify that the nodes are created with the correct meta info.
-  ASSERT_GT(model()->bookmark_bar_node()->children().size(), 0u);
-  const BookmarkNode* folder_node =
-      model()->bookmark_bar_node()->children().front().get();
-  ASSERT_TRUE(folder_node->GetMetaInfoMap());
-  EXPECT_EQ(folder_meta_info, *folder_node->GetMetaInfoMap());
-  ASSERT_GT(folder_node->children().size(), 0u);
-  const BookmarkNode* node = folder_node->children().front().get();
-  ASSERT_TRUE(node->GetMetaInfoMap());
-  EXPECT_EQ(node_meta_info, *node->GetMetaInfoMap());
-
-  // Update meta info on nodes on server
-  FakeServerChange updates(&trans);
-  folder_meta_info.erase("folder");
-  updates.ModifyMetaInfo(folder_id, folder_meta_info);
-  node_meta_info["node"] = "changednodevalue";
-  node_meta_info.erase("other");
-  node_meta_info["newkey"] = "newkeyvalue";
-  updates.ModifyMetaInfo(id, node_meta_info);
-  updates.ApplyPendingChanges(change_processor());
-
-  // Confirm that the updated values are reflected in the bookmark nodes.
-  EXPECT_FALSE(folder_node->GetMetaInfoMap());
-  ASSERT_TRUE(node->GetMetaInfoMap());
-  EXPECT_EQ(node_meta_info, *node->GetMetaInfoMap());
-}
-
-// Tests that changes to the local bookmark nodes meta info gets reflected in
-// the sync nodes.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateMetaInfoFromModel) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  StartSync();
-  ExpectBookmarkModelMatchesTestData();
-
-  const BookmarkNode* folder_node = model()->AddFolder(
-      model()->bookmark_bar_node(), 0, base::ASCIIToUTF16("folder title"));
-  const BookmarkNode* node =
-      model()->AddURL(folder_node, 0, base::ASCIIToUTF16("node title"),
-                      GURL("http://www.foo.com"));
-  ExpectModelMatch();
-
-  // Add some meta info and verify sync model matches the changes.
-  model()->SetNodeMetaInfo(folder_node, "folder", "foldervalue");
-  model()->SetNodeMetaInfo(node, "node", "nodevalue");
-  model()->SetNodeMetaInfo(node, "other", "othervalue");
-  ExpectModelMatch();
-
-  // Change/delete existing meta info and verify.
-  model()->DeleteNodeMetaInfo(folder_node, "folder");
-  model()->SetNodeMetaInfo(node, "node", "changednodevalue");
-  model()->DeleteNodeMetaInfo(node, "other");
-  model()->SetNodeMetaInfo(node, "newkey", "newkeyvalue");
-  ExpectModelMatch();
-}
-
-// Tests that node's specifics doesn't get unnecessarily overwritten (causing
-// a subsequent commit) when BookmarkChangeProcessor handles a notification
-// (such as BookmarkMetaInfoChanged) without an actual data change.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, MetaInfoPreservedOnNonChange) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  WriteTestDataToBookmarkModel();
-  StartSync();
-
-  std::string orig_specifics;
-  int64_t sync_id;
-  const BookmarkNode* bookmark;
-
-  // Create bookmark folder node containing meta info.
-  {
-    syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share());
-    FakeServerChange adds(&trans);
-
-    int64_t folder_id = adds.AddFolder("folder title", bookmark_bar_id(), 0);
-
-    BookmarkNode::MetaInfoMap node_meta_info;
-    node_meta_info["one"] = "1";
-    node_meta_info["two"] = "2";
-    node_meta_info["three"] = "3";
-
-    sync_id = adds.AddURLWithMetaInfo("node title", "http://www.foo.com/",
-                                      &node_meta_info, folder_id, 0);
-
-    // Verify that the node propagates to the bookmark model
-    adds.ApplyPendingChanges(change_processor());
-
-    const auto& first_child = model()->bookmark_bar_node()->children().front();
-    bookmark = first_child->children().front().get();
-    EXPECT_EQ(node_meta_info, *bookmark->GetMetaInfoMap());
-
-    syncer::ReadNode sync_node(&trans);
-    EXPECT_EQ(BaseNode::INIT_OK, sync_node.InitByIdLookup(sync_id));
-    orig_specifics = sync_node.GetBookmarkSpecifics().SerializeAsString();
-  }
-
-  // Force change processor to update the sync node.
-  change_processor()->BookmarkMetaInfoChanged(model(), bookmark);
-
-  // Read bookmark specifics again and verify that there is no change.
-  {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share()->user_share());
-    syncer::ReadNode sync_node(&trans);
-    EXPECT_EQ(BaseNode::INIT_OK, sync_node.InitByIdLookup(sync_id));
-    std::string new_specifics =
-        sync_node.GetBookmarkSpecifics().SerializeAsString();
-    ASSERT_EQ(orig_specifics, new_specifics);
-  }
-}
-
-void ProfileSyncServiceBookmarkTestWithData::GetTransactionVersions(
-    const BookmarkNode* root,
-    BookmarkNodeVersionMap* node_versions) {
-  node_versions->clear();
-  base::queue<const BookmarkNode*> nodes;
-  nodes.push(root);
-  while (!nodes.empty()) {
-    const BookmarkNode* n = nodes.front();
-    nodes.pop();
-
-    int64_t version = n->sync_transaction_version();
-    EXPECT_NE(BookmarkNode::kInvalidSyncTransactionVersion, version);
-
-    (*node_versions)[n->id()] = version;
-    for (const auto& child : n->children()) {
-      if (CanSyncNode(child.get()))
-        nodes.push(child.get());
-    }
-  }
-}
-
-void ProfileSyncServiceBookmarkTestWithData::ExpectTransactionVersionMatch(
-    const BookmarkNode* node,
-    const BookmarkNodeVersionMap& version_expected) {
-  syncer::ReadTransaction trans(FROM_HERE, test_user_share()->user_share());
-
-  BookmarkNodeVersionMap bnodes_versions;
-  GetTransactionVersions(node, &bnodes_versions);
-  for (BookmarkNodeVersionMap::const_iterator it = bnodes_versions.begin();
-       it != bnodes_versions.end(); ++it) {
-    syncer::ReadNode sync_node(&trans);
-    ASSERT_TRUE(
-        model_associator()->InitSyncNodeFromChromeId(it->first, &sync_node));
-    EXPECT_EQ(sync_node.GetTransactionVersion(), it->second);
-    auto expected_ver_it = version_expected.find(it->first);
-    if (expected_ver_it != version_expected.end())
-      EXPECT_EQ(expected_ver_it->second, it->second);
-  }
-}
-
-// Test transaction versions of model and nodes are incremented after changes
-// are applied.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateTransactionVersion) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-  WriteTestDataToBookmarkModel();
-  base::RunLoop().RunUntilIdle();
-
-  BookmarkNodeVersionMap initial_versions;
-
-  // Verify transaction versions in sync model and bookmark model (saved as
-  // transaction version of root node) are equal after
-  // WriteTestDataToBookmarkModel() created bookmarks.
-  {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share()->user_share());
-    EXPECT_GT(trans.GetModelVersion(syncer::BOOKMARKS), 0);
-    GetTransactionVersions(model()->root_node(), &initial_versions);
-    EXPECT_EQ(trans.GetModelVersion(syncer::BOOKMARKS),
-              initial_versions[model()->root_node()->id()]);
-  }
-  ExpectTransactionVersionMatch(model()->bookmark_bar_node(),
-                                BookmarkNodeVersionMap());
-  ExpectTransactionVersionMatch(model()->other_node(),
-                                BookmarkNodeVersionMap());
-  ExpectTransactionVersionMatch(model()->mobile_node(),
-                                BookmarkNodeVersionMap());
-
-  // Verify model version is incremented and bookmark node versions remain
-  // the same.
-  const BookmarkNode* bookmark_bar = model()->bookmark_bar_node();
-  model()->Remove(bookmark_bar->children().front().get());
-  base::RunLoop().RunUntilIdle();
-  BookmarkNodeVersionMap new_versions;
-  GetTransactionVersions(model()->root_node(), &new_versions);
-  EXPECT_EQ(initial_versions[model()->root_node()->id()] + 1,
-            new_versions[model()->root_node()->id()]);
-  ExpectTransactionVersionMatch(model()->bookmark_bar_node(), initial_versions);
-  ExpectTransactionVersionMatch(model()->other_node(), initial_versions);
-  ExpectTransactionVersionMatch(model()->mobile_node(), initial_versions);
-
-  // Verify model version and version of changed bookmark are incremented and
-  // versions of others remain same.
-  const BookmarkNode* changed_bookmark =
-      model()->bookmark_bar_node()->children().front().get();
-  model()->SetTitle(changed_bookmark, base::ASCIIToUTF16("test"));
-  base::RunLoop().RunUntilIdle();
-  GetTransactionVersions(model()->root_node(), &new_versions);
-  EXPECT_EQ(initial_versions[model()->root_node()->id()] + 2,
-            new_versions[model()->root_node()->id()]);
-  EXPECT_LT(initial_versions[changed_bookmark->id()],
-            new_versions[changed_bookmark->id()]);
-  initial_versions.erase(changed_bookmark->id());
-  ExpectTransactionVersionMatch(model()->bookmark_bar_node(), initial_versions);
-  ExpectTransactionVersionMatch(model()->other_node(), initial_versions);
-  ExpectTransactionVersionMatch(model()->mobile_node(), initial_versions);
-}
-
-// Test that sync persistence errors are detected and trigger a failed
-// association.
-TEST_F(ProfileSyncServiceBookmarkTestWithData, PersistenceError) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-  WriteTestDataToBookmarkModel();
-  base::RunLoop().RunUntilIdle();
-
-  BookmarkNodeVersionMap initial_versions;
-
-  // Verify transaction versions in sync model and bookmark model (saved as
-  // transaction version of root node) are equal after
-  // WriteTestDataToBookmarkModel() created bookmarks.
-  {
-    syncer::ReadTransaction trans(FROM_HERE, test_user_share()->user_share());
-    EXPECT_GT(trans.GetModelVersion(syncer::BOOKMARKS), 0);
-    GetTransactionVersions(model()->root_node(), &initial_versions);
-    EXPECT_EQ(trans.GetModelVersion(syncer::BOOKMARKS),
-              initial_versions[model()->root_node()->id()]);
-  }
-  ExpectTransactionVersionMatch(model()->bookmark_bar_node(),
-                                BookmarkNodeVersionMap());
-  ExpectTransactionVersionMatch(model()->other_node(),
-                                BookmarkNodeVersionMap());
-  ExpectTransactionVersionMatch(model()->mobile_node(),
-                                BookmarkNodeVersionMap());
-
-  // Now shut down sync and artificially increment the native model's version.
-  StopSync();
-  int64_t root_version = initial_versions[model()->root_node()->id()];
-  model()->SetNodeSyncTransactionVersion(model()->root_node(),
-                                         root_version + 1);
-
-  // Upon association, bookmarks should fail to associate.
-  EXPECT_FALSE(AssociateModels());
-}
-
-// It's possible for update/add calls from the bookmark model to be out of
-// order, or asynchronous. Handle that without triggering an error.
-TEST_F(ProfileSyncServiceBookmarkTest, UpdateThenAdd) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  EXPECT_TRUE(other_bookmarks_id());
-  EXPECT_TRUE(bookmark_bar_id());
-  EXPECT_TRUE(mobile_bookmarks_id());
-
-  ExpectModelMatch();
-
-  // Now destroy the change processor then add a bookmark, to simulate
-  // missing the Update call.
-  delete_change_processor();
-  const BookmarkNode* node =
-      model()->AddURL(model()->bookmark_bar_node(), 0,
-                      base::ASCIIToUTF16("title"), GURL("http://www.url.com"));
-
-  // Recreate the change processor then update that bookmark. Sync should
-  // receive the update call and gracefully treat that as if it were an add.
-  ResetChangeProcessor();
-  change_processor()->Start(test_user_share()->user_share());
-  model()->SetTitle(node, base::ASCIIToUTF16("title2"));
-  ExpectModelMatch();
-
-  // Then simulate the add call arriving late.
-  change_processor()->BookmarkNodeAdded(model(), model()->bookmark_bar_node(),
-                                        0);
-  ExpectModelMatch();
-}
-
-// Verify operations on native nodes that shouldn't be propagated to Sync.
-TEST_F(ProfileSyncServiceBookmarkTest, TestUnsupportedNodes) {
-  LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE);
-  StartSync();
-
-  // Initial number of bookmarks on the sync side.
-  int sync_bookmark_count = GetSyncBookmarkCount();
-
-  // Create a bookmark under managed_node() permanent folder.
-  const BookmarkNode* folder = managed_bookmark_service()->managed_node();
-  const BookmarkNode* node = model()->AddURL(
-      folder, 0, base::ASCIIToUTF16("node"), GURL("http://www.node.com/"));
-
-  // Verify that these changes are ignored by Sync.
-  EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount());
-  int64_t sync_id = model_associator()->GetSyncIdFromChromeId(node->id());
-  EXPECT_EQ(syncer::kInvalidId, sync_id);
-
-  // Verify that Sync ignores deleting this node.
-  model()->Remove(node);
-  EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount());
-}
-
-}  // namespace
-
-}  // namespace browser_sync
diff --git a/components/embedder_support/android/BUILD.gn b/components/embedder_support/android/BUILD.gn
index ff4b9bb..b9997d9 100644
--- a/components/embedder_support/android/BUILD.gn
+++ b/components/embedder_support/android/BUILD.gn
@@ -8,7 +8,10 @@
   deps = [
     "//base:base_java",
   ]
-  java_files = [ "java/src/org/chromium/components/embedder_support/application/FontPreloadingWorkaround.java" ]
+  java_files = [
+    "java/src/org/chromium/components/embedder_support/application/ClassLoaderContextWrapperFactory.java",
+    "java/src/org/chromium/components/embedder_support/application/FontPreloadingWorkaround.java",
+  ]
 }
 
 static_library("view") {
diff --git a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/application/ClassLoaderContextWrapperFactory.java b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/application/ClassLoaderContextWrapperFactory.java
new file mode 100644
index 0000000..d62ef8ae
--- /dev/null
+++ b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/application/ClassLoaderContextWrapperFactory.java
@@ -0,0 +1,124 @@
+// Copyright 2014 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.
+
+package org.chromium.components.embedder_support.application;
+
+import android.content.ComponentCallbacks;
+import android.content.Context;
+import android.content.ContextWrapper;
+import android.content.Intent;
+import android.view.LayoutInflater;
+
+import org.chromium.base.ContextUtils;
+
+import java.lang.ref.WeakReference;
+import java.util.WeakHashMap;
+
+/**
+ * This class allows us to wrap the application context so that a Chromium implementation loaded
+ * from a separate APK can correctly reference both org.chromium.* and application classes which is
+ * necessary to properly inflate UI.
+ */
+public class ClassLoaderContextWrapperFactory {
+    private ClassLoaderContextWrapperFactory() {}
+
+    // Note WeakHashMap only guarantees that keys are weakly held, and ContextWrapper holds a strong
+    // reference to the wrapped context. So need a WeakReference here to ensure the Context does not
+    // leak.
+    private static final WeakHashMap<Context, WeakReference<ClassLoaderContextWrapper>>
+            sCtxToWrapper = new WeakHashMap<>();
+    private static final Object sLock = new Object();
+
+    public static Context get(Context ctx) {
+        // Avoid double-wrapping a context.
+        if (ctx instanceof ClassLoaderContextWrapper) {
+            return ctx;
+        }
+        ClassLoaderContextWrapper wrapper = null;
+        synchronized (sLock) {
+            WeakReference<ClassLoaderContextWrapper> ref = sCtxToWrapper.get(ctx);
+            wrapper = (ref == null) ? null : ref.get();
+            if (wrapper == null) {
+                wrapper = new ClassLoaderContextWrapper(ctx);
+                sCtxToWrapper.put(ctx, new WeakReference<>(wrapper));
+            }
+        }
+        return wrapper;
+    }
+
+    private static class ClassLoaderContextWrapper extends ContextWrapper {
+        private Context mApplicationContext;
+
+        public ClassLoaderContextWrapper(Context base) {
+            super(base);
+        }
+
+        @Override
+        public ClassLoader getClassLoader() {
+            final ClassLoader appCl = getBaseContext().getClassLoader();
+            final ClassLoader chromiumCl = ClassLoaderContextWrapper.class.getClassLoader();
+            return new ClassLoader() {
+                @Override
+                protected Class<?> findClass(String name) throws ClassNotFoundException {
+                    // First look in the Chromium class loader.
+                    try {
+                        return chromiumCl.loadClass(name);
+                    } catch (ClassNotFoundException e) {
+                        // Look in the app class loader; allowing it to throw
+                        // ClassNotFoundException.
+                        return appCl.loadClass(name);
+                    }
+                }
+            };
+        }
+
+        @Override
+        public Object getSystemService(String name) {
+            if (Context.LAYOUT_INFLATER_SERVICE.equals(name)) {
+                LayoutInflater i = (LayoutInflater) getBaseContext().getSystemService(name);
+                return i.cloneInContext(this);
+            } else {
+                return getBaseContext().getSystemService(name);
+            }
+        }
+
+        @Override
+        @SuppressWarnings("NoContextGetApplicationContext")
+        public Context getApplicationContext() {
+            if (mApplicationContext == null) {
+                Context appCtx = getBaseContext().getApplicationContext();
+                if (appCtx == getBaseContext()) {
+                    mApplicationContext = this;
+                } else {
+                    mApplicationContext = get(appCtx);
+                }
+            }
+            return mApplicationContext;
+        }
+
+        @Override
+        public void registerComponentCallbacks(ComponentCallbacks callback) {
+            // We have to override registerComponentCallbacks and unregisterComponentCallbacks
+            // since they call getApplicationContext().[un]registerComponentCallbacks()
+            // which causes us to go into a loop.
+            getBaseContext().registerComponentCallbacks(callback);
+        }
+
+        @Override
+        public void unregisterComponentCallbacks(ComponentCallbacks callback) {
+            getBaseContext().unregisterComponentCallbacks(callback);
+        }
+
+        @Override
+        public void startActivity(Intent intent) {
+            if (ContextUtils.activityFromContext(this) == null) {
+                // FLAG_ACTIVITY_NEW_TASK is needed to start activities from a non-activity
+                // context.
+                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            }
+
+            super.startActivity(intent);
+        }
+    }
+}
diff --git a/components/mirroring/OWNERS b/components/mirroring/OWNERS
index b44d282f..c0d2923c 100644
--- a/components/mirroring/OWNERS
+++ b/components/mirroring/OWNERS
@@ -1,3 +1,4 @@
 miu@chromium.org
+mfoltz@chromium.org
 
 # COMPONENT: Internals>Cast>Streaming
diff --git a/components/password_manager/core/browser/credential_manager_password_form_manager.cc b/components/password_manager/core/browser/credential_manager_password_form_manager.cc
index 678424eb..27884dd 100644
--- a/components/password_manager/core/browser/credential_manager_password_form_manager.cc
+++ b/components/password_manager/core/browser/credential_manager_password_form_manager.cc
@@ -42,15 +42,7 @@
   PasswordFormManager::OnFetchCompleted();
 
   CreatePendingCredentials();
-
-  // Notify the delegate. This might result in deleting |this|, while
-  // OnFetchCompleted is being called from FormFetcherImpl, owned by |this|. If
-  // done directly, once OnFetchCompleted returns, the FormFetcherImpl will be
-  // used after free. Therefore the call is posted to a separate task.
-  base::SequencedTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE,
-      base::BindOnce(&CredentialManagerPasswordFormManager::NotifyDelegate,
-                     weak_factory_.GetWeakPtr()));
+  NotifyDelegate();
 }
 
 metrics_util::CredentialSourceType
diff --git a/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc b/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc
index 7b0df36..fb2c200 100644
--- a/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/credential_manager_password_form_manager_unittest.cc
@@ -106,34 +106,6 @@
   DISALLOW_COPY_AND_ASSIGN(CredentialManagerPasswordFormManagerTest);
 };
 
-// Test that aborting early does not cause use after free.
-TEST_F(CredentialManagerPasswordFormManagerTest, AbortEarly) {
-  auto saved_form = std::make_unique<PasswordForm>();
-  saved_form->password_value = base::ASCIIToUTF16("password");
-  MockDelegate delegate;
-  auto form_manager = std::make_unique<CredentialManagerPasswordFormManager>(
-      &client_, std::move(saved_form), &delegate,
-      std::make_unique<StubFormSaver>(), std::make_unique<FakeFormFetcher>());
-
-  auto deleter = [&form_manager]() { form_manager.reset(); };
-
-  // Simulate that the PasswordStore responded to the FormFetcher. As a result,
-  // |form_manager| should call the delegate's OnProvisionalSaveComplete, which
-  // in turn should delete |form_fetcher|.
-  EXPECT_CALL(delegate, OnProvisionalSaveComplete()).WillOnce(Invoke(deleter));
-  static_cast<FakeFormFetcher*>(form_manager->GetFormFetcher())
-      ->NotifyFetchCompleted();
-  // Check that |form_manager| was not deleted yet; doing so would have caused
-  // use after free during NotifyFetchCompleted.
-  EXPECT_TRUE(form_manager);
-
-  base::RunLoop().RunUntilIdle();
-
-  // Ultimately, |form_fetcher| should have been deleted. It just should happen
-  // after it finishes executing.
-  EXPECT_FALSE(form_manager);
-}
-
 // Ensure that GetCredentialSource is actually overriden and returns the proper
 // value.
 TEST_F(CredentialManagerPasswordFormManagerTest, GetCredentialSource) {
diff --git a/components/password_manager/core/browser/fake_form_fetcher.cc b/components/password_manager/core/browser/fake_form_fetcher.cc
index 838e29b..a096fd6 100644
--- a/components/password_manager/core/browser/fake_form_fetcher.cc
+++ b/components/password_manager/core/browser/fake_form_fetcher.cc
@@ -19,11 +19,11 @@
 FakeFormFetcher::~FakeFormFetcher() = default;
 
 void FakeFormFetcher::AddConsumer(Consumer* consumer) {
-  consumers_.insert(consumer);
+  consumers_.AddObserver(consumer);
 }
 
 void FakeFormFetcher::RemoveConsumer(Consumer* consumer) {
-  consumers_.erase(consumer);
+  consumers_.RemoveObserver(consumer);
 }
 
 FormFetcher::State FakeFormFetcher::GetState() const {
@@ -77,8 +77,8 @@
 
 void FakeFormFetcher::NotifyFetchCompleted() {
   state_ = State::NOT_WAITING;
-  for (Consumer* consumer : consumers_)
-    consumer->OnFetchCompleted();
+  for (Consumer& consumer : consumers_)
+    consumer.OnFetchCompleted();
 }
 
 void FakeFormFetcher::Fetch() {
diff --git a/components/password_manager/core/browser/fake_form_fetcher.h b/components/password_manager/core/browser/fake_form_fetcher.h
index 3ba5a27..bae0e3e 100644
--- a/components/password_manager/core/browser/fake_form_fetcher.h
+++ b/components/password_manager/core/browser/fake_form_fetcher.h
@@ -5,10 +5,10 @@
 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FAKE_FORM_FETCHER_H_
 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_FAKE_FORM_FETCHER_H_
 
-#include <set>
 #include <vector>
 
 #include "base/macros.h"
+#include "base/observer_list.h"
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/form_fetcher.h"
 #include "components/password_manager/core/browser/statistics_table.h"
@@ -87,7 +87,7 @@
   std::unique_ptr<FormFetcher> Clone() override;
 
  private:
-  std::set<Consumer*> consumers_;
+  base::ObserverList<Consumer> consumers_;
   State state_ = State::NOT_WAITING;
   autofill::PasswordForm::Scheme scheme_ =
       autofill::PasswordForm::Scheme::kHtml;
diff --git a/components/password_manager/core/browser/form_fetcher.h b/components/password_manager/core/browser/form_fetcher.h
index 40460b0..682ab53 100644
--- a/components/password_manager/core/browser/form_fetcher.h
+++ b/components/password_manager/core/browser/form_fetcher.h
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "base/observer_list_types.h"
 #include "base/strings/string16.h"
 
 namespace autofill {
@@ -33,10 +34,8 @@
   enum class State { WAITING, NOT_WAITING };
 
   // API to be implemented by classes which want the results from FormFetcher.
-  class Consumer {
+  class Consumer : public base::CheckedObserver {
    public:
-    virtual ~Consumer() = default;
-
     // FormFetcher calls this method every time the state changes from WAITING
     // to NOT_WAITING. It is now safe for consumers to call the accessor
     // functions for matches.
diff --git a/components/password_manager/core/browser/form_fetcher_impl.cc b/components/password_manager/core/browser/form_fetcher_impl.cc
index d3131c2..09a0ede 100644
--- a/components/password_manager/core/browser/form_fetcher_impl.cc
+++ b/components/password_manager/core/browser/form_fetcher_impl.cc
@@ -79,14 +79,14 @@
 
 void FormFetcherImpl::AddConsumer(FormFetcher::Consumer* consumer) {
   DCHECK(consumer);
-  consumers_.insert(consumer);
+  consumers_.AddObserver(consumer);
   if (state_ == State::NOT_WAITING)
     consumer->OnFetchCompleted();
 }
 
 void FormFetcherImpl::RemoveConsumer(FormFetcher::Consumer* consumer) {
-  size_t removed_consumers = consumers_.erase(consumer);
-  DCHECK_EQ(1u, removed_consumers);
+  DCHECK(consumers_.HasObserver(consumer));
+  consumers_.RemoveObserver(consumer);
 }
 
 FormFetcherImpl::State FormFetcherImpl::GetState() const {
@@ -239,8 +239,8 @@
       sort_matches_by_date_last_used_, &non_federated_same_scheme_,
       &best_matches_, &preferred_match_);
 
-  for (auto* consumer : consumers_)
-    consumer->OnFetchCompleted();
+  for (auto& consumer : consumers_)
+    consumer.OnFetchCompleted();
 }
 
 void FormFetcherImpl::SplitResults(
diff --git a/components/password_manager/core/browser/form_fetcher_impl.h b/components/password_manager/core/browser/form_fetcher_impl.h
index 51d88e9..c1d5c995 100644
--- a/components/password_manager/core/browser/form_fetcher_impl.h
+++ b/components/password_manager/core/browser/form_fetcher_impl.h
@@ -10,6 +10,7 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "base/observer_list.h"
 #include "components/password_manager/core/browser/form_fetcher.h"
 #include "components/password_manager/core/browser/http_password_store_migrator.h"
 #include "components/password_manager/core/browser/password_store.h"
@@ -128,8 +129,9 @@
   // Statistics for the current domain.
   std::vector<InteractionsStats> interactions_stats_;
 
-  // Consumers of the fetcher, all are assumed to outlive |this|.
-  std::set<FormFetcher::Consumer*> consumers_;
+  // Consumers of the fetcher, all are assumed to either outlive |this| or
+  // remove themselves from the list during their destruction.
+  base::ObserverList<FormFetcher::Consumer> consumers_;
 
   // Indicates whether HTTP passwords should be migrated to HTTPS.
   const bool should_migrate_http_passwords_;
diff --git a/components/password_manager/core/browser/form_fetcher_impl_unittest.cc b/components/password_manager/core/browser/form_fetcher_impl_unittest.cc
index 5da4ebf2..d0199fe 100644
--- a/components/password_manager/core/browser/form_fetcher_impl_unittest.cc
+++ b/components/password_manager/core/browser/form_fetcher_impl_unittest.cc
@@ -60,6 +60,18 @@
   MOCK_METHOD0(OnFetchCompleted, void());
 };
 
+// MockConsumer that takes ownership of the FormFetcher itself.
+class MockOwningConsumer : public FormFetcher::Consumer {
+ public:
+  explicit MockOwningConsumer(std::unique_ptr<FormFetcher> form_fetcher)
+      : form_fetcher_(std::move(form_fetcher)) {}
+
+  MOCK_METHOD0(OnFetchCompleted, void());
+
+ private:
+  std::unique_ptr<FormFetcher> form_fetcher_;
+};
+
 class NameFilter : public StubCredentialsFilter {
  public:
   // This class filters out all credentials which have |name| as
@@ -704,6 +716,29 @@
       std::vector<std::unique_ptr<PasswordForm>>());
 }
 
+// Check that destroying the fetcher while notifying its consumers is handled
+// gracefully.
+TEST_P(FormFetcherImplTest, DestroyFetcherFromConsumer) {
+  Fetch();
+
+  // Construct an owning consumer and register it and a regular consumer.
+  auto* form_fetcher = form_fetcher_.get();
+  auto owning_consumer =
+      std::make_unique<MockOwningConsumer>(std::move(form_fetcher_));
+  form_fetcher->AddConsumer(owning_consumer.get());
+  form_fetcher->AddConsumer(&consumer_);
+
+  // Destroy the form fetcher when notifying the owning consumer. Make sure the
+  // second consumer does not get notified anymore.
+  EXPECT_CALL(*owning_consumer, OnFetchCompleted).WillOnce([&owning_consumer] {
+    owning_consumer.reset();
+  });
+
+  EXPECT_CALL(consumer_, OnFetchCompleted).Times(0);
+  form_fetcher->OnGetPasswordStoreResults(
+      std::vector<std::unique_ptr<PasswordForm>>());
+}
+
 INSTANTIATE_TEST_SUITE_P(, FormFetcherImplTest, testing::Values(false, true));
 
 }  // namespace password_manager
diff --git a/components/password_manager/core/browser/password_form_filling_unittest.cc b/components/password_manager/core/browser/password_form_filling_unittest.cc
index 16421bd0..a13c1df 100644
--- a/components/password_manager/core/browser/password_form_filling_unittest.cc
+++ b/components/password_manager/core/browser/password_form_filling_unittest.cc
@@ -264,7 +264,7 @@
     SCOPED_TRACE(testing::Message() << "Enable Touch To Fill: "
                                     << std::boolalpha << enable_touch_to_fill);
     base::test::ScopedFeatureList features;
-    features.InitWithFeatureState(autofill::features::kTouchToFillAndroid,
+    features.InitWithFeatureState(autofill::features::kAutofillTouchToFill,
                                   enable_touch_to_fill);
 
     LikelyFormFilling likely_form_filling = SendFillInformationToRenderer(
diff --git a/components/performance_manager/performance_manager_tab_helper_unittest.cc b/components/performance_manager/performance_manager_tab_helper_unittest.cc
index 055ad1c..4c05c66f 100644
--- a/components/performance_manager/performance_manager_tab_helper_unittest.cc
+++ b/components/performance_manager/performance_manager_tab_helper_unittest.cc
@@ -9,7 +9,6 @@
 #include "base/run_loop.h"
 #include "base/stl_util.h"
 #include "base/test/bind_test_util.h"
-#include "build/build_config.h"
 #include "components/performance_manager/graph/frame_node_impl.h"
 #include "components/performance_manager/graph/graph_impl_operations.h"
 #include "components/performance_manager/graph/page_node_impl.h"
@@ -219,13 +218,7 @@
 
 }  // namespace
 
-// This test is flaky on windows. See https://1012601
-#if defined(OS_WIN)
-#define MAYBE_PageIsAudible DISABLED_PageIsAudible
-#else
-#define MAYBE_PageIsAudible PageIsAudible
-#endif
-TEST_F(PerformanceManagerTabHelperTest, MAYBE_PageIsAudible) {
+TEST_F(PerformanceManagerTabHelperTest, PageIsAudible) {
   SetContents(CreateTestWebContents());
 
   ExpectPageIsAudible(false);
diff --git a/components/policy/proto/chrome_device_policy.proto b/components/policy/proto/chrome_device_policy.proto
index e131b43..a344b58d 100644
--- a/components/policy/proto/chrome_device_policy.proto
+++ b/components/policy/proto/chrome_device_policy.proto
@@ -1627,4 +1627,5 @@
   optional DeviceLoginScreenWebUsbAllowDevicesForUrlsProto
       device_login_screen_webusb_allow_devices_for_urls = 92;
   optional BooleanPolicyProto device_login_screen_system_info_enforced = 93;
+  optional StringListPolicyProto device_web_based_attestation_allowed_urls = 94;
 }
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json
index 8ca3a7e..5c5563b 100644
--- a/components/policy/resources/policy_templates.json
+++ b/components/policy/resources/policy_templates.json
@@ -671,6 +671,7 @@
         'AttestationEnabledForUser',
         'AttestationExtensionWhitelist',
         'AttestationForContentProtectionEnabled',
+        'DeviceWebBasedAttestationAllowedUrls',
       ],
     },
     {
@@ -1482,6 +1483,10 @@
           'name': 'Forced',
           'value': 2,
           'caption': '''Incognito mode forced''',
+          'supported_on': [
+            'chrome.*:14-',
+            'chrome_os:14-',
+          ],
         },
       ],
       'supported_on': [
@@ -1503,7 +1508,7 @@
 
       If 'Disabled' is selected, pages may not be opened in Incognito mode.
 
-      If 'Forced' is selected, pages may be opened ONLY in Incognito mode.''',
+      If 'Forced' is selected, pages may be opened ONLY in Incognito mode. Note that 'Forced' does not work for Android-on-Chrome''',
     },
     {
       'name': 'SavingBrowserHistoryDisabled',
@@ -9056,7 +9061,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9086,7 +9092,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9116,7 +9123,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9148,7 +9156,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:27-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:27-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9178,7 +9187,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9206,7 +9216,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9236,7 +9247,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9266,7 +9278,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9298,7 +9311,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:27-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:27-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9328,7 +9342,8 @@
         'type': 'integer',
         'minimum': 0
       },
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9378,7 +9393,8 @@
           'caption': '''Do nothing''',
         },
       ],
-      'supported_on': ['chrome_os:26-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:26-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9424,7 +9440,8 @@
           'caption': '''Do nothing''',
         },
       ],
-      'supported_on': ['chrome_os:30-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:30-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -9472,7 +9489,8 @@
           'caption': '''Do nothing''',
         },
       ],
-      'supported_on': ['chrome_os:30-81'],
+      # TODO(https://crbug.com/1016253): Remove this policy in M82.
+      'supported_on': ['chrome_os:30-'],
       'features': {
         'dynamic_refresh': True,
         'per_profile': False,
@@ -18439,10 +18457,10 @@
       'id': 627,
       'caption': '''Allow the audio sandbox to run''',
       'tags': ['system-security'],
-      'desc': '''This policy controls the audio process sandboxed.
+      'desc': '''This policy controls the audio process sandbox.
       If this policy is enabled, the audio process will run sandboxed.
       If this policy is disabled, the audio process will run unsandboxed and the WebRTC audio-processing module will run in the renderer process.
-      This leaves users open to security risks related to running the audio stack unsandboxed.
+      This leaves users open to security risks related to running the audio subsystem unsandboxed.
       If this policy is not set, the default configuration for the audio sandbox will be used, which may differ per platform.
       This policy is intended to give enterprises flexibility to disable the audio sandbox if they use security software setups that interfere with the sandbox.'''
     },
@@ -18620,7 +18638,31 @@
       'desc': '''Allows you to set a list of url patterns that specify sites which are not allowed to display blockable (i.e. active) mixed content (i.e. HTTP content on HTTPS sites).
 
           If this policy is left not set blockable mixed content will be blocked, but users will be allowed to set exceptions to allow it for specific sites.''',
-    }
+    },
+    {
+      'name': 'DeviceWebBasedAttestationAllowedUrls',
+      'owners': ['miersh@google.com', 'pmarko@chromium.com', 'file://chrome/browser/chromeos/login/OWNERS'],
+      'device_only': True,
+      'type': 'list',
+      'schema': {
+        'type': 'array',
+        'items': { 'type': 'string' },
+      },
+      'supported_on': ['chrome_os:80-'],
+      'features': {
+        'dynamic_refresh': True,
+        'per_profile': False,
+      },
+      'example_value': ['https://www.example.com/', 'https://[*.]example.edu/'],
+      'id': 636,
+      'caption': '''URLs that will be granted access to perform the device attestation during SAML authentication''',
+      'tags': [],
+      'desc': '''This policy configures which URLs will be granted access to use remote attestation of device identity during the SAML flow on the sign-in screen.
+
+      Specifically, if a URL matches one of the patterns provided through this policy, it will be allowed to receive a HTTP header containing a response to a remote attestation challenge, attesting device identity and device state.
+
+      If this policy is not set or is set to an empty list, no URL is allowed to use remote attestation on the sign-in screen.'''
+    },
   ],
 
   'messages': {
@@ -18991,7 +19033,8 @@
     'DeviceBatteryChargeCustomStopCharging': 'device_battery_charge_mode.custom_charge_stop',
     'DeviceScheduledUpdateCheck': 'device_scheduled_update_check.device_scheduled_update_check_settings',
     'DevicePowerwashAllowed': 'device_powerwash_allowed.device_powerwash_allowed',
-    'DeviceLoginScreenWebUsbAllowDevicesForUrls': 'device_login_screen_webusb_allow_devices_for_urls.device_login_screen_webusb_allow_devices_for_urls'
+    'DeviceLoginScreenWebUsbAllowDevicesForUrls': 'device_login_screen_webusb_allow_devices_for_urls.device_login_screen_webusb_allow_devices_for_urls',
+    'DeviceWebBasedAttestationAllowedUrls': 'device_web_based_attestation_allowed_urls.value',
   },
   'policy_atomic_group_definitions': [
     {
@@ -19442,6 +19485,6 @@
   ],
   'placeholders': [],
   'deleted_policy_ids': [412, 546, 562, 569],
-  'highest_id_currently_used': 635,
+  'highest_id_currently_used': 636,
   'highest_atomic_group_id_currently_used': 38
 }
diff --git a/components/policy/tools/template_writers/policy_template_generator.py b/components/policy/tools/template_writers/policy_template_generator.py
index d3462f3..123d337 100755
--- a/components/policy/tools/template_writers/policy_template_generator.py
+++ b/components/policy/tools/template_writers/policy_template_generator.py
@@ -148,6 +148,8 @@
       # Iterate through all the items of an enum-type policy, and add captions.
       for item in policy['items']:
         item['caption'] = self._ImportMessage(item['caption'])
+      if 'supported_on' in item:
+        item['supported_on'] = self._ProcessSupportedOn(item['supported_on'])
     if not IsGroupOrAtomicGroup(policy):
       if not 'label' in policy:
         # If 'label' is not specified, then it defaults to 'caption':
diff --git a/components/policy/tools/template_writers/policy_template_generator_unittest.py b/components/policy/tools/template_writers/policy_template_generator_unittest.py
index b6570eb..0c3cfdab 100755
--- a/components/policy/tools/template_writers/policy_template_generator_unittest.py
+++ b/components/policy/tools/template_writers/policy_template_generator_unittest.py
@@ -412,7 +412,8 @@
                 'name': 'item1',
                 'value': 'one',
                 'caption': 'string1',
-                'desc': ''
+                'desc': '',
+                'supported_on': ['chrome.win7:2-'],
             },]
         }]
     }
@@ -422,6 +423,8 @@
       def WritePolicy(self, policy):
         self.tester.assertEquals(policy['supported_on'][0]['platforms'],
                                  ['win7'])
+        self.tester.assertEquals(
+            policy['items'][0]['supported_on'][0]['platforms'], ['win7'])
 
     self.do_test(policy_data_mock, LocalMockWriter())
 
diff --git a/components/policy/tools/template_writers/writers/android_policy_writer.py b/components/policy/tools/template_writers/writers/android_policy_writer.py
index 5507afc7..be9d0a2 100755
--- a/components/policy/tools/template_writers/writers/android_policy_writer.py
+++ b/components/policy/tools/template_writers/writers/android_policy_writer.py
@@ -73,6 +73,11 @@
 
     items = policy.get('items')
     if items is not None:
+      items = [
+          item for item in items
+          if ('supported_on' not in item or
+              self.IsPolicyOrItemSupportedOnPlatform(item, 'android'))
+      ]
       entries = [item['caption'] for item in items]
       values = [item['value'] for item in items]
       self.AddStringArrayResource(name + 'Entries', entries)
diff --git a/components/policy/tools/template_writers/writers/android_policy_writer_unittest.py b/components/policy/tools/template_writers/writers/android_policy_writer_unittest.py
index 836f0b4..fd49310 100755
--- a/components/policy/tools/template_writers/writers/android_policy_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/android_policy_writer_unittest.py
@@ -56,6 +56,20 @@
         }, {
             'caption': '_caption2',
             'value': '_value2',
+        },
+        {
+            'caption': '_caption3',
+            'value': '_value3',
+            'supported_on': [{
+                'platforms': ['win', 'win7']
+            }]
+        },
+        {
+            'caption': '_caption4',
+            'value': '_value4',
+            'supported_on': [{
+                'platforms': ['android', 'win7']
+            }]
         }]
     }
     writer = android_policy_writer.GetWriter({})
@@ -70,10 +84,12 @@
         '<string-array name="_policy_nameEntries">'
         '<item>_caption1</item>'
         '<item>_caption2</item>'
+        '<item>_caption4</item>'
         '</string-array>'
         '<string-array name="_policy_nameValues">'
         '<item>_value1</item>'
         '<item>_value2</item>'
+        '<item>_value4</item>'
         '</string-array>'
         '</resources>')
 
diff --git a/components/policy/tools/template_writers/writers/doc_writer.py b/components/policy/tools/template_writers/writers/doc_writer.py
index b852743e..869652e 100755
--- a/components/policy/tools/template_writers/writers/doc_writer.py
+++ b/components/policy/tools/template_writers/writers/doc_writer.py
@@ -273,13 +273,13 @@
     examples = self._AddStyledElement(parent, 'dl', ['dd dl'])
     if self.IsPolicySupportedOnWindows(policy):
       self._AddListExampleWindowsChromeOS(examples, policy, True)
-    if self.IsPolicySupportedOnPlatform(
+    if self.IsPolicyOrItemSupportedOnPlatform(
         policy, 'chrome_os', management='active_directory'):
       self._AddListExampleWindowsChromeOS(examples, policy, False)
-    if (self.IsPolicySupportedOnPlatform(policy, 'android') or
-        self.IsPolicySupportedOnPlatform(policy, 'linux')):
+    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') or
+        self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux')):
       self._AddListExampleAndroidLinux(examples, policy)
-    if self.IsPolicySupportedOnPlatform(policy, 'mac'):
+    if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
       self._AddListExampleMac(examples, policy)
 
   def _PythonObjectToPlist(self, obj, indent=''):
@@ -396,13 +396,13 @@
     examples = self._AddStyledElement(parent, 'dl', ['dd dl'])
     if self.IsPolicySupportedOnWindows(policy):
       self._AddDictionaryExampleWindowsChromeOS(examples, policy, True)
-    if self.IsPolicySupportedOnPlatform(
+    if self.IsPolicyOrItemSupportedOnPlatform(
         policy, 'chrome_os', management='active_directory'):
       self._AddDictionaryExampleWindowsChromeOS(examples, policy, False)
-    if (self.IsPolicySupportedOnPlatform(policy, 'android') or
-        self.IsPolicySupportedOnPlatform(policy, 'linux')):
+    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') or
+        self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux')):
       self._AddDictionaryExampleAndroidLinux(examples, policy)
-    if self.IsPolicySupportedOnPlatform(policy, 'mac'):
+    if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
       self._AddDictionaryExampleMac(examples, policy)
 
   def _AddIntuneExample(self, parent, policy):
@@ -465,17 +465,17 @@
     if policy_type == 'main':
       pieces = []
       if self.IsPolicySupportedOnWindows(policy) or \
-         self.IsPolicySupportedOnPlatform(policy, 'chrome_os',
+         self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
                                           management='active_directory'):
         value = '0x00000001' if example_value else '0x00000000'
         pieces.append(value + ' (Windows)')
-      if self.IsPolicySupportedOnPlatform(policy, 'linux'):
+      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux'):
         value = 'true' if example_value else 'false'
         pieces.append(value + ' (Linux)')
-      if self.IsPolicySupportedOnPlatform(policy, 'android'):
+      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'android'):
         value = 'true' if example_value else 'false'
         pieces.append(value + ' (Android)')
-      if self.IsPolicySupportedOnPlatform(policy, 'mac'):
+      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
         value = '<true />' if example_value else '<false />'
         pieces.append(value + ' (Mac)')
       self.AddText(parent, ', '.join(pieces))
@@ -484,14 +484,14 @@
     elif policy_type in ('int', 'int-enum'):
       pieces = []
       if self.IsPolicySupportedOnWindows(policy) or \
-         self.IsPolicySupportedOnPlatform(policy, 'chrome_os',
+         self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
                                           management='active_directory'):
         pieces.append('0x%08x (Windows)' % example_value)
-      if self.IsPolicySupportedOnPlatform(policy, 'linux'):
+      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux'):
         pieces.append('%d (Linux)' % example_value)
-      if self.IsPolicySupportedOnPlatform(policy, 'android'):
+      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'android'):
         pieces.append('%d (Android)' % example_value)
-      if self.IsPolicySupportedOnPlatform(policy, 'mac'):
+      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
         pieces.append('%d (Mac)' % example_value)
       self.AddText(parent, ', '.join(pieces))
     elif policy_type == 'string-enum':
@@ -591,14 +591,14 @@
     data_type = [self._TYPE_MAP[policy['type']]]
     qualified_types = []
     is_complex_policy = False
-    if (self.IsPolicySupportedOnPlatform(policy, 'android') and
+    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') and
         self._RESTRICTION_TYPE_MAP.get(policy['type'], None)):
       qualified_types.append(
           'Android:%s' % self._RESTRICTION_TYPE_MAP[policy['type']])
       if policy['type'] in ('dict', 'external', 'list'):
         is_complex_policy = True
     if ((self.IsPolicySupportedOnWindows(policy) or
-         self.IsPolicySupportedOnPlatform(
+         self.IsPolicyOrItemSupportedOnPlatform(
              policy, 'chrome_os', management='active_directory')) and
         self._REG_TYPE_MAP.get(policy['type'], None)):
       qualified_types.append('Windows:%s' % self._REG_TYPE_MAP[policy['type']])
@@ -618,19 +618,21 @@
       self._AddPolicyAttribute(dl, 'oma_uri', self._GetOmaUriPath(policy),
                                ['.monospace'])
 
-    if self.IsPolicySupportedOnPlatform(
+    if self.IsPolicyOrItemSupportedOnPlatform(
         policy, 'chrome_os', management='active_directory'):
       key_name = self._GetRegistryKeyName(policy, False)
       self._AddPolicyAttribute(dl, 'chrome_os_reg_loc',
                                key_name + '\\' + policy['name'], ['.monospace'])
-    if (self.IsPolicySupportedOnPlatform(policy, 'linux') or
-        self.IsPolicySupportedOnPlatform(policy, 'mac')):
+    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux') or
+        self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac')):
       self._AddPolicyAttribute(dl, 'mac_linux_pref_name', policy['name'],
                                ['.monospace'])
-    if self.IsPolicySupportedOnPlatform(policy, 'android', product='chrome'):
+    if self.IsPolicyOrItemSupportedOnPlatform(
+        policy, 'android', product='chrome'):
       self._AddPolicyAttribute(dl, 'android_restriction_name', policy['name'],
                                ['.monospace'])
-    if self.IsPolicySupportedOnPlatform(policy, 'android', product='webview'):
+    if self.IsPolicyOrItemSupportedOnPlatform(
+        policy, 'android', product='webview'):
       restriction_prefix = self.config['android_webview_restriction_prefix']
       self._AddPolicyAttribute(dl, 'android_webview_restriction_name',
                                restriction_prefix + policy['name'],
@@ -658,10 +660,10 @@
       dd = self._AddPolicyAttribute(dl, 'url_schema')
       self._AddTextWithLinks(dd, policy['url_schema'])
     if (self.IsPolicySupportedOnWindows(policy) or
-        self.IsPolicySupportedOnPlatform(policy, 'linux') or
-        self.IsPolicySupportedOnPlatform(policy, 'android') or
-        self.IsPolicySupportedOnPlatform(policy, 'mac') or
-        self.IsPolicySupportedOnPlatform(
+        self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux') or
+        self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') or
+        self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac') or
+        self.IsPolicyOrItemSupportedOnPlatform(
             policy, 'chrome_os', management='active_directory')):
       # Don't add an example for Google cloud managed ChromeOS policies.
       dd = self._AddPolicyAttribute(dl, 'example_value')
diff --git a/components/policy/tools/template_writers/writers/doc_writer_unittest.py b/components/policy/tools/template_writers/writers/doc_writer_unittest.py
index 85e7ee96..369cc1e6 100755
--- a/components/policy/tools/template_writers/writers/doc_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/doc_writer_unittest.py
@@ -1396,7 +1396,8 @@
             123
     }
     self.writer._AddPolicySection(self.doc_root, policy)
-    self.assertTrue(self.writer.IsPolicySupportedOnPlatform(policy, 'android'))
+    self.assertTrue(
+        self.writer.IsPolicyOrItemSupportedOnPlatform(policy, 'android'))
     self.assertEquals(
         self.doc_root.toxml(), '<root>'
         '<div style="margin-left: 0px">'
diff --git a/components/policy/tools/template_writers/writers/template_writer.py b/components/policy/tools/template_writers/writers/template_writer.py
index 390eb27..76d3cff 100755
--- a/components/policy/tools/template_writers/writers/template_writer.py
+++ b/components/policy/tools/template_writers/writers/template_writer.py
@@ -86,18 +86,18 @@
     '''Checks if the given policy can be mandatory.'''
     return policy.get('features', {}).get('can_be_mandatory', True)
 
-  def IsPolicySupportedOnPlatform(self,
-                                  policy,
-                                  platform,
-                                  product=None,
-                                  management=None):
-    '''Checks if |policy| is supported on |product| for |platform|. If
+  def IsPolicyOrItemSupportedOnPlatform(self,
+                                        item,
+                                        platform,
+                                        product=None,
+                                        management=None):
+    '''Checks if |item| is supported on |product| for |platform|. If
     |product| is not specified, only the platform support is checked.
     If |management| is specified, also checks for support for Chrome OS
     management type.
 
     Args:
-      policy: The dictionary of the policy.
+      item: The dictionary of the policy or item.
       platform: The platform to check; one of
         'win', 'mac', 'linux', 'chrome_os', 'android'.
       product: Optional product to check; one of
@@ -105,13 +105,13 @@
       management: Optional Chrome OS management type to check; one of
         'active_directory', 'google_cloud'.
     '''
-    if management and not self.IsCrOSManagementSupported(policy, management):
+    if management and not self.IsCrOSManagementSupported(item, management):
       return False
 
-    for supported_on in policy['supported_on']:
+    for supported_on in item['supported_on']:
       if (platform in supported_on['platforms'] and
           (not product or product in supported_on['product']) and
-          self.IsVersionSupported(policy, supported_on)):
+          self.IsVersionSupported(item, supported_on)):
         return True
     return False
 
@@ -123,8 +123,8 @@
       product: Optional product to check; one of
         'chrome', 'chrome_frame', 'chrome_os', 'webview'
     '''
-    return (self.IsPolicySupportedOnPlatform(policy, 'win', product) or
-            self.IsPolicySupportedOnPlatform(policy, 'win7', product))
+    return (self.IsPolicyOrItemSupportedOnPlatform(policy, 'win', product) or
+            self.IsPolicyOrItemSupportedOnPlatform(policy, 'win7', product))
 
   def IsCrOSManagementSupported(self, policy, management):
     '''Checks whether |policy| supports the Chrome OS |management| type.
diff --git a/components/policy/tools/template_writers/writers/template_writer_unittest.py b/components/policy/tools/template_writers/writers/template_writer_unittest.py
index fd051d1..db95abf 100755
--- a/components/policy/tools/template_writers/writers/template_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/template_writer_unittest.py
@@ -135,7 +135,7 @@
     if platform != '*':
       self.assertEqual(
           tw.IsPolicySupported(policy),
-          tw.IsPolicySupportedOnPlatform(policy, platform))
+          tw.IsPolicyOrItemSupportedOnPlatform(policy, platform))
     return tw.IsPolicySupported(policy)
 
   def testSortingGroupsFirst(self):
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn
index 549c5a1..acb4a9278 100644
--- a/components/sync/BUILD.gn
+++ b/components/sync/BUILD.gn
@@ -584,7 +584,6 @@
     "driver/async_directory_type_controller_unittest.cc",
     "driver/backend_migrator_unittest.cc",
     "driver/data_type_manager_impl_unittest.cc",
-    "driver/frontend_data_type_controller_unittest.cc",
     "driver/generic_change_processor_unittest.cc",
     "driver/glue/sync_engine_impl_unittest.cc",
     "driver/model_association_manager_unittest.cc",
@@ -651,6 +650,7 @@
     "model_impl/processor_entity_unittest.cc",
     "model_impl/syncable_service_based_bridge_unittest.cc",
     "nigori/cryptographer_impl_unittest.cc",
+    "nigori/keystore_keys_cryptographer_unittest.cc",
     "nigori/nigori_key_bag_unittest.cc",
     "nigori/nigori_model_type_processor_unittest.cc",
     "nigori/nigori_state_unittest.cc",
diff --git a/components/sync/driver/BUILD.gn b/components/sync/driver/BUILD.gn
index 58eff10..0e7e5b7 100644
--- a/components/sync/driver/BUILD.gn
+++ b/components/sync/driver/BUILD.gn
@@ -33,8 +33,6 @@
     "data_type_status_table.h",
     "directory_data_type_controller.cc",
     "directory_data_type_controller.h",
-    "frontend_data_type_controller.cc",
-    "frontend_data_type_controller.h",
     "generic_change_processor.cc",
     "generic_change_processor.h",
     "generic_change_processor_factory.cc",
@@ -45,7 +43,6 @@
     "glue/sync_engine_impl.h",
     "model_association_manager.cc",
     "model_association_manager.h",
-    "model_associator.h",
     "model_type_controller.cc",
     "model_type_controller.h",
     "non_ui_syncable_service_based_model_type_controller.cc",
@@ -58,7 +55,6 @@
     "shared_change_processor_ref.h",
     "startup_controller.cc",
     "startup_controller.h",
-    "sync_api_component_factory.cc",
     "sync_api_component_factory.h",
     "sync_auth_manager.cc",
     "sync_auth_manager.h",
@@ -171,12 +167,8 @@
     "fake_generic_change_processor.h",
     "fake_sync_service.cc",
     "fake_sync_service.h",
-    "frontend_data_type_controller_mock.cc",
-    "frontend_data_type_controller_mock.h",
     "mock_sync_service.cc",
     "mock_sync_service.h",
-    "model_associator_mock.cc",
-    "model_associator_mock.h",
     "profile_sync_service_bundle.cc",
     "profile_sync_service_bundle.h",
     "sync_api_component_factory_mock.cc",
diff --git a/components/sync/driver/frontend_data_type_controller.cc b/components/sync/driver/frontend_data_type_controller.cc
deleted file mode 100644
index 48f789f66..0000000
--- a/components/sync/driver/frontend_data_type_controller.cc
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (c) 2012 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 "components/sync/driver/frontend_data_type_controller.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/threading/sequenced_task_runner_handle.h"
-#include "components/sync/base/data_type_histogram.h"
-#include "components/sync/base/model_type.h"
-#include "components/sync/driver/configure_context.h"
-#include "components/sync/driver/model_associator.h"
-#include "components/sync/model/change_processor.h"
-#include "components/sync/model/data_type_error_handler_impl.h"
-#include "components/sync/model/sync_error.h"
-#include "components/sync/model/sync_merge_result.h"
-
-namespace syncer {
-
-FrontendDataTypeController::FrontendDataTypeController(
-    ModelType type,
-    const base::Closure& dump_stack,
-    SyncService* sync_service)
-    : DirectoryDataTypeController(type, dump_stack, sync_service, GROUP_UI),
-      state_(NOT_RUNNING) {}
-
-void FrontendDataTypeController::LoadModels(
-    const ConfigureContext& configure_context,
-    const ModelLoadCallback& model_load_callback) {
-  DCHECK(CalledOnValidThread());
-  DCHECK_EQ(configure_context.sync_mode, SyncMode::kFull);
-
-  model_load_callback_ = model_load_callback;
-
-  if (state_ != NOT_RUNNING) {
-    model_load_callback_.Run(type(),
-                             SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
-                                       "Model already running", type()));
-    return;
-  }
-
-  state_ = MODEL_STARTING;
-  if (!StartModels()) {
-    // If we are waiting for some external service to load before associating
-    // or we failed to start the models, we exit early. state_ will control
-    // what we perform next.
-    DCHECK(state_ == NOT_RUNNING || state_ == MODEL_STARTING);
-    return;
-  }
-
-  OnModelLoaded();
-}
-
-void FrontendDataTypeController::OnModelLoaded() {
-  DCHECK(CalledOnValidThread());
-  DCHECK_EQ(state_, MODEL_STARTING);
-
-  state_ = MODEL_LOADED;
-  model_load_callback_.Run(type(), SyncError());
-}
-
-void FrontendDataTypeController::StartAssociating(
-    StartCallback start_callback) {
-  DCHECK(CalledOnValidThread());
-  DCHECK(start_callback);
-  DCHECK_EQ(state_, MODEL_LOADED);
-
-  start_callback_ = std::move(start_callback);
-  state_ = ASSOCIATING;
-
-  base::SequencedTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::BindOnce(&FrontendDataTypeController::Associate,
-                                base::AsWeakPtr(this)));
-}
-
-void FrontendDataTypeController::Stop(ShutdownReason shutdown_reason) {
-  DCHECK(CalledOnValidThread());
-
-  if (state_ == NOT_RUNNING)
-    return;
-
-  State prev_state = state_;
-  state_ = STOPPING;
-
-  // If Stop() is called while Start() is waiting for the datatype model to
-  // load, abort the start.
-  if (prev_state == MODEL_STARTING) {
-    AbortModelLoad();
-    // We can just return here since we haven't performed association if we're
-    // still in MODEL_STARTING.
-    return;
-  }
-
-  CleanUpState();
-
-  if (model_associator()) {
-    SyncError error;  // Not used.
-    error = model_associator()->DisassociateModels();
-  }
-
-  set_model_associator(nullptr);
-  change_processor_.reset();
-
-  state_ = NOT_RUNNING;
-}
-
-DataTypeController::State FrontendDataTypeController::state() const {
-  return state_;
-}
-
-FrontendDataTypeController::FrontendDataTypeController()
-    : DirectoryDataTypeController(UNSPECIFIED,
-                                  base::Closure(),
-                                  nullptr,
-                                  GROUP_UI),
-      state_(NOT_RUNNING) {}
-
-FrontendDataTypeController::~FrontendDataTypeController() {}
-
-bool FrontendDataTypeController::StartModels() {
-  DCHECK(CalledOnValidThread());
-  DCHECK_EQ(state_, MODEL_STARTING);
-  // By default, no additional services need to be started before we can proceed
-  // with model association.
-  return true;
-}
-
-void FrontendDataTypeController::Associate() {
-  DCHECK(CalledOnValidThread());
-  if (state_ != ASSOCIATING) {
-    // Stop() must have been called while Associate() task have been waiting.
-    DCHECK_EQ(state_, NOT_RUNNING);
-    return;
-  }
-
-  SyncMergeResult local_merge_result(type());
-  SyncMergeResult syncer_merge_result(type());
-  CreateSyncComponents();
-  if (!model_associator()->CryptoReadyIfNecessary()) {
-    StartDone(NEEDS_CRYPTO, local_merge_result, syncer_merge_result);
-    return;
-  }
-
-  bool sync_has_nodes = false;
-  if (!model_associator()->SyncModelHasUserCreatedNodes(&sync_has_nodes)) {
-    SyncError error(FROM_HERE, SyncError::UNRECOVERABLE_ERROR,
-                    "Failed to load sync nodes", type());
-    local_merge_result.set_error(error);
-    StartDone(UNRECOVERABLE_ERROR, local_merge_result, syncer_merge_result);
-    return;
-  }
-
-  // TODO(zea): Have AssociateModels fill the local and syncer merge results.
-  base::TimeTicks start_time = base::TimeTicks::Now();
-  SyncError error;
-  error = model_associator()->AssociateModels(&local_merge_result,
-                                              &syncer_merge_result);
-  // TODO(lipalani): crbug.com/122690 - handle abort.
-  RecordAssociationTime(base::TimeTicks::Now() - start_time);
-  if (error.IsSet()) {
-    local_merge_result.set_error(error);
-    StartDone(ASSOCIATION_FAILED, local_merge_result, syncer_merge_result);
-    return;
-  }
-
-  state_ = RUNNING;
-  // FinishStart() invokes the DataTypeManager callback, which can lead to a
-  // call to Stop() if one of the other data types being started generates an
-  // error.
-  StartDone(!sync_has_nodes ? OK_FIRST_RUN : OK, local_merge_result,
-            syncer_merge_result);
-}
-
-void FrontendDataTypeController::CleanUpState() {
-  // Do nothing by default.
-}
-
-void FrontendDataTypeController::CleanUp() {
-  CleanUpState();
-  set_model_associator(nullptr);
-  change_processor_.reset();
-}
-
-void FrontendDataTypeController::AbortModelLoad() {
-  DCHECK(CalledOnValidThread());
-  CleanUp();
-  state_ = NOT_RUNNING;
-}
-
-void FrontendDataTypeController::StartDone(
-    ConfigureResult start_result,
-    const SyncMergeResult& local_merge_result,
-    const SyncMergeResult& syncer_merge_result) {
-  DCHECK(CalledOnValidThread());
-  if (!IsSuccessfulResult(start_result)) {
-    CleanUp();
-    if (start_result == ASSOCIATION_FAILED) {
-      state_ = FAILED;
-    } else {
-      state_ = NOT_RUNNING;
-    }
-    RecordStartFailure(start_result);
-  }
-
-  std::move(start_callback_)
-      .Run(start_result, local_merge_result, syncer_merge_result);
-}
-
-std::unique_ptr<DataTypeErrorHandler>
-FrontendDataTypeController::CreateErrorHandler() {
-  return std::make_unique<DataTypeErrorHandlerImpl>(
-      base::SequencedTaskRunnerHandle::Get(), dump_stack_,
-      base::Bind(&FrontendDataTypeController::OnUnrecoverableError,
-                 base::AsWeakPtr(this)));
-}
-
-void FrontendDataTypeController::OnUnrecoverableError(const SyncError& error) {
-  DCHECK(CalledOnValidThread());
-  DCHECK_EQ(type(), error.model_type());
-  if (model_load_callback_) {
-    model_load_callback_.Run(type(), error);
-  }
-}
-
-void FrontendDataTypeController::RecordAssociationTime(base::TimeDelta time) {
-  DCHECK(CalledOnValidThread());
-#define PER_DATA_TYPE_MACRO(type_str) \
-  UMA_HISTOGRAM_TIMES("Sync." type_str "AssociationTime", time);
-  SYNC_DATA_TYPE_HISTOGRAM(type());
-#undef PER_DATA_TYPE_MACRO
-}
-
-void FrontendDataTypeController::RecordStartFailure(ConfigureResult result) {
-  DCHECK(CalledOnValidThread());
-  UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeStartFailures2",
-                            ModelTypeHistogramValue(type()));
-#define PER_DATA_TYPE_MACRO(type_str)                                    \
-  UMA_HISTOGRAM_ENUMERATION("Sync." type_str "ConfigureFailure", result, \
-                            MAX_CONFIGURE_RESULT);
-  SYNC_DATA_TYPE_HISTOGRAM(type());
-#undef PER_DATA_TYPE_MACRO
-}
-
-AssociatorInterface* FrontendDataTypeController::model_associator() const {
-  return model_associator_.get();
-}
-
-void FrontendDataTypeController::set_model_associator(
-    std::unique_ptr<AssociatorInterface> model_associator) {
-  model_associator_ = std::move(model_associator);
-}
-
-ChangeProcessor* FrontendDataTypeController::GetChangeProcessor() const {
-  return change_processor_.get();
-}
-
-void FrontendDataTypeController::set_change_processor(
-    std::unique_ptr<ChangeProcessor> change_processor) {
-  change_processor_ = std::move(change_processor);
-}
-
-}  // namespace syncer
diff --git a/components/sync/driver/frontend_data_type_controller.h b/components/sync/driver/frontend_data_type_controller.h
deleted file mode 100644
index 6039b3f..0000000
--- a/components/sync/driver/frontend_data_type_controller.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2012 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 COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_H__
-#define COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_H__
-
-#include <memory>
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "components/sync/driver/directory_data_type_controller.h"
-#include "components/sync/model/data_type_error_handler.h"
-
-namespace base {
-class TimeDelta;
-}  // namespace base
-
-namespace syncer {
-
-class AssociatorInterface;
-class ChangeProcessor;
-class SyncError;
-class SyncService;
-
-// Implementation for datatypes that reside on the frontend thread
-// (UI thread). This is the same thread we perform initialization on, so we
-// don't have to worry about thread safety. The main start/stop funtionality is
-// implemented by default.
-// Derived classes must implement (at least):
-//    ModelType type() const
-//    void CreateSyncComponents();
-// NOTE: This class is deprecated! New sync datatypes should be using the
-// SyncableService API and the UIDataTypeController instead.
-// TODO(zea): Delete this once all types are on the new API.
-class FrontendDataTypeController : public DirectoryDataTypeController {
- public:
-  // |dump_stack| is called when an unrecoverable error occurs.
-  FrontendDataTypeController(ModelType type,
-                             const base::Closure& dump_stack,
-                             SyncService* sync_service);
-  ~FrontendDataTypeController() override;
-
-  // DataTypeController interface.
-  void LoadModels(const ConfigureContext& configure_context,
-                  const ModelLoadCallback& model_load_callback) override;
-  void StartAssociating(StartCallback start_callback) override;
-  void Stop(ShutdownReason shutdown_reason) override;
-  State state() const override;
-
- protected:
-  friend class FrontendDataTypeControllerMock;
-
-  // For testing only.
-  FrontendDataTypeController();
-
-  // Kick off any dependent services that need to be running before we can
-  // associate models. The default implementation is a no-op.
-  // Return value:
-  //   True - if models are ready and association can proceed.
-  //   False - if models are not ready. Associate() should be called when the
-  //           models are ready. Refer to Start(_) implementation.
-  virtual bool StartModels();
-
-  // Datatype specific creation of sync components.
-  virtual void CreateSyncComponents() = 0;
-
-  // Perform any DataType controller specific state cleanup before stopping
-  // the datatype controller. The default implementation is a no-op.
-  virtual void CleanUpState();
-
-  // Helper method for cleaning up state and running the start callback.
-  virtual void StartDone(ConfigureResult start_result,
-                         const SyncMergeResult& local_merge_result,
-                         const SyncMergeResult& syncer_merge_result);
-
-  // Record association time.
-  virtual void RecordAssociationTime(base::TimeDelta time);
-  // Record causes of start failure.
-  virtual void RecordStartFailure(ConfigureResult result);
-
-  virtual AssociatorInterface* model_associator() const;
-  virtual void set_model_associator(
-      std::unique_ptr<AssociatorInterface> associator);
-  ChangeProcessor* GetChangeProcessor() const override;
-  virtual void set_change_processor(std::unique_ptr<ChangeProcessor> processor);
-
-  // If the DTC is waiting for models to load, once the models are
-  // loaded the datatype service will call this function on DTC to let
-  // us know that it is safe to start associating.
-  void OnModelLoaded();
-
-  std::unique_ptr<DataTypeErrorHandler> CreateErrorHandler() override;
-
-  State state_;
-
-  StartCallback start_callback_;
-  ModelLoadCallback model_load_callback_;
-
-  // TODO(sync): transition all datatypes to SyncableService and deprecate
-  // AssociatorInterface.
-  std::unique_ptr<AssociatorInterface> model_associator_;
-  std::unique_ptr<ChangeProcessor> change_processor_;
-
- private:
-  // Build sync components and associate models.
-  virtual void Associate();
-
-  void AbortModelLoad();
-
-  // Clean up our state and state variables. Called in response
-  // to a failure or abort or stop.
-  void CleanUp();
-
-  // Handle an unrecoverable error.
-  void OnUnrecoverableError(const SyncError& error);
-
-  DISALLOW_COPY_AND_ASSIGN(FrontendDataTypeController);
-};
-
-}  // namespace syncer
-
-#endif  // COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_H__
diff --git a/components/sync/driver/frontend_data_type_controller_mock.cc b/components/sync/driver/frontend_data_type_controller_mock.cc
deleted file mode 100644
index b841a16..0000000
--- a/components/sync/driver/frontend_data_type_controller_mock.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2011 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 "components/sync/driver/frontend_data_type_controller_mock.h"
-
-#include "components/sync/driver/configure_context.h"
-
-namespace syncer {
-
-FrontendDataTypeControllerMock::FrontendDataTypeControllerMock() {}
-
-FrontendDataTypeControllerMock::~FrontendDataTypeControllerMock() {}
-
-}  // namespace syncer
diff --git a/components/sync/driver/frontend_data_type_controller_mock.h b/components/sync/driver/frontend_data_type_controller_mock.h
deleted file mode 100644
index 21c84e8..0000000
--- a/components/sync/driver/frontend_data_type_controller_mock.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 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 COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_MOCK_H__
-#define COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_MOCK_H__
-
-#include <memory>
-#include <string>
-
-#include "components/sync/driver/frontend_data_type_controller.h"
-#include "components/sync/driver/model_associator.h"
-#include "components/sync/model/change_processor.h"
-#include "components/sync/model/sync_error.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-namespace syncer {
-
-class FrontendDataTypeControllerMock : public FrontendDataTypeController {
- public:
-  FrontendDataTypeControllerMock();
-  ~FrontendDataTypeControllerMock() override;
-
-  // DataTypeController mocks.
-  MOCK_METHOD1(StartAssociating, void(StartCallback start_callback));
-  MOCK_METHOD2(LoadModels,
-               void(const ConfigureContext& configure_context,
-                    const ModelLoadCallback& model_load_callback));
-  MOCK_METHOD1(Stop, void(ShutdownReason));
-  MOCK_CONST_METHOD0(type, ModelType());
-  MOCK_CONST_METHOD0(name, std::string());
-  MOCK_CONST_METHOD0(state, State());
-
-  // FrontendDataTypeController mocks.
-  MOCK_METHOD0(StartModels, bool());
-  MOCK_METHOD0(Associate, void());
-  MOCK_METHOD0(CreateSyncComponents, void());
-  MOCK_METHOD0(CleanUpState, void());
-  MOCK_CONST_METHOD0(model_associator, AssociatorInterface*());
-  MOCK_METHOD1(set_model_associator,
-               void(std::unique_ptr<AssociatorInterface> associator));
-  MOCK_CONST_METHOD0(change_processor, ChangeProcessor*());
-  MOCK_METHOD1(set_change_processor,
-               void(std::unique_ptr<ChangeProcessor> processor));
-  MOCK_METHOD1(RecordAssociationTime, void(base::TimeDelta time));
-  MOCK_METHOD1(RecordStartFailure, void(ConfigureResult result));
-};
-
-}  // namespace syncer
-
-#endif  // COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_MOCK_H__
diff --git a/components/sync/driver/frontend_data_type_controller_unittest.cc b/components/sync/driver/frontend_data_type_controller_unittest.cc
deleted file mode 100644
index 6c67311..0000000
--- a/components/sync/driver/frontend_data_type_controller_unittest.cc
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (c) 2012 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 "components/sync/driver/frontend_data_type_controller.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback.h"
-#include "base/location.h"
-#include "base/run_loop.h"
-#include "base/sequenced_task_runner.h"
-#include "base/test/task_environment.h"
-#include "base/threading/sequenced_task_runner_handle.h"
-#include "components/sync/driver/configure_context.h"
-#include "components/sync/driver/data_type_controller_mock.h"
-#include "components/sync/driver/fake_sync_service.h"
-#include "components/sync/driver/frontend_data_type_controller_mock.h"
-#include "components/sync/driver/model_associator_mock.h"
-#include "components/sync/driver/sync_api_component_factory_mock.h"
-#include "components/sync/model/change_processor_mock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using testing::_;
-using testing::DoAll;
-using testing::InvokeWithoutArgs;
-using testing::NiceMock;
-using testing::Return;
-using testing::SetArgPointee;
-using testing::StrictMock;
-
-namespace syncer {
-
-class FrontendDataTypeControllerFake : public FrontendDataTypeController {
- public:
-  FrontendDataTypeControllerFake(SyncService* sync_service,
-                                 SyncApiComponentFactory* component_factory,
-                                 FrontendDataTypeControllerMock* mock)
-      : FrontendDataTypeController(BOOKMARKS, base::DoNothing(), sync_service),
-        sync_service_(sync_service),
-        component_factory_(component_factory),
-        mock_(mock) {}
-  ~FrontendDataTypeControllerFake() override {}
-
- private:
-  void CreateSyncComponents() override {
-    SyncApiComponentFactory::SyncComponents sync_components =
-        component_factory_->CreateBookmarkSyncComponents(
-            CreateErrorHandler(), sync_service_->GetUserShare());
-    model_associator_ = std::move(sync_components.model_associator);
-    change_processor_ = std::move(sync_components.change_processor);
-  }
-
-  // We mock the following methods because their default implementations do
-  // nothing, but we still want to make sure they're called appropriately.
-  bool StartModels() override { return mock_->StartModels(); }
-  void CleanUpState() override { mock_->CleanUpState(); }
-  void RecordAssociationTime(base::TimeDelta time) override {
-    mock_->RecordAssociationTime(time);
-  }
-  void RecordStartFailure(DataTypeController::ConfigureResult result) override {
-    mock_->RecordStartFailure(result);
-  }
-
-  SyncService* sync_service_;
-  SyncApiComponentFactory* component_factory_;
-  FrontendDataTypeControllerMock* mock_;
-};
-
-class SyncFrontendDataTypeControllerTest : public testing::Test {
- public:
-  SyncFrontendDataTypeControllerTest() {
-    model_associator_deleter_ =
-        std::make_unique<NiceMock<ModelAssociatorMock>>();
-    change_processor_deleter_ =
-        std::make_unique<NiceMock<ChangeProcessorMock>>();
-    model_associator_ = model_associator_deleter_.get();
-    change_processor_ = change_processor_deleter_.get();
-
-    ON_CALL(components_factory_, CreateBookmarkSyncComponents(_, _))
-        .WillByDefault(testing::InvokeWithoutArgs([=]() {
-          SyncApiComponentFactory::SyncComponents components;
-          components.model_associator = std::move(model_associator_deleter_);
-          components.change_processor = std::move(change_processor_deleter_);
-          return components;
-        }));
-  }
-
-  void SetUp() override {
-    dtc_mock_ = std::make_unique<StrictMock<FrontendDataTypeControllerMock>>();
-    frontend_dtc_ = std::make_unique<FrontendDataTypeControllerFake>(
-        &sync_service_, &components_factory_, dtc_mock_.get());
-  }
-
- protected:
-  void SetStartExpectations() {
-    EXPECT_CALL(*dtc_mock_, StartModels()).WillOnce(Return(true));
-    EXPECT_CALL(model_load_callback_, Run(_, _));
-  }
-
-  void SetAssociateExpectations() {
-    EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary())
-        .WillOnce(Return(true));
-    EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-        .WillOnce(DoAll(SetArgPointee<0>(true), Return(true)));
-    EXPECT_CALL(*model_associator_, AssociateModels(_, _))
-        .WillOnce(Return(SyncError()));
-    EXPECT_CALL(*dtc_mock_, RecordAssociationTime(_));
-  }
-
-  void SetActivateExpectations(DataTypeController::ConfigureResult result) {
-    EXPECT_CALL(start_callback_, Run(result, _, _));
-  }
-
-  void SetStopExpectations() {
-    EXPECT_CALL(*dtc_mock_, CleanUpState());
-    EXPECT_CALL(*model_associator_, DisassociateModels())
-        .WillOnce(Return(SyncError()));
-  }
-
-  void SetStartFailExpectations(DataTypeController::ConfigureResult result) {
-    EXPECT_CALL(*dtc_mock_, CleanUpState());
-    EXPECT_CALL(*dtc_mock_, RecordStartFailure(result));
-    EXPECT_CALL(start_callback_, Run(result, _, _));
-  }
-
-  void Start() {
-    frontend_dtc_->LoadModels(
-        ConfigureContext(),
-        base::Bind(&ModelLoadCallbackMock::Run,
-                   base::Unretained(&model_load_callback_)));
-    frontend_dtc_->StartAssociating(base::Bind(
-        &StartCallbackMock::Run, base::Unretained(&start_callback_)));
-    PumpLoop();
-  }
-
-  void PumpLoop() { base::RunLoop().RunUntilIdle(); }
-
-  base::test::SingleThreadTaskEnvironment task_environment_;
-  ModelAssociatorMock* model_associator_;
-  ChangeProcessorMock* change_processor_;
-  std::unique_ptr<ModelAssociatorMock> model_associator_deleter_;
-  std::unique_ptr<ChangeProcessorMock> change_processor_deleter_;
-  NiceMock<SyncApiComponentFactoryMock> components_factory_;
-  FakeSyncService sync_service_;
-  std::unique_ptr<FrontendDataTypeControllerFake> frontend_dtc_;
-  std::unique_ptr<FrontendDataTypeControllerMock> dtc_mock_;
-  StartCallbackMock start_callback_;
-  ModelLoadCallbackMock model_load_callback_;
-};
-
-TEST_F(SyncFrontendDataTypeControllerTest, StartOk) {
-  SetStartExpectations();
-  SetAssociateExpectations();
-  SetActivateExpectations(DataTypeController::OK);
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  Start();
-  EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest, StartFirstRun) {
-  SetStartExpectations();
-  EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary())
-      .WillOnce(Return(true));
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillOnce(DoAll(SetArgPointee<0>(false), Return(true)));
-  EXPECT_CALL(*model_associator_, AssociateModels(_, _))
-      .WillOnce(Return(SyncError()));
-  EXPECT_CALL(*dtc_mock_, RecordAssociationTime(_));
-  SetActivateExpectations(DataTypeController::OK_FIRST_RUN);
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  Start();
-  EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest, StartStopBeforeAssociation) {
-  EXPECT_CALL(*dtc_mock_, StartModels()).WillOnce(Return(true));
-  EXPECT_CALL(*dtc_mock_, CleanUpState());
-  EXPECT_CALL(model_load_callback_, Run(_, _));
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  base::SequencedTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE,
-      base::BindOnce(&FrontendDataTypeController::Stop,
-                     base::AsWeakPtr(frontend_dtc_.get()), STOP_SYNC));
-  Start();
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest, AbortDuringStartModels) {
-  EXPECT_CALL(*dtc_mock_, StartModels()).WillOnce(Return(false));
-  EXPECT_CALL(*dtc_mock_, CleanUpState());
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  frontend_dtc_->LoadModels(
-      ConfigureContext(), base::Bind(&ModelLoadCallbackMock::Run,
-                                     base::Unretained(&model_load_callback_)));
-  EXPECT_EQ(DataTypeController::MODEL_STARTING, frontend_dtc_->state());
-  frontend_dtc_->Stop(STOP_SYNC);
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest, StartAssociationFailed) {
-  SetStartExpectations();
-  EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary())
-      .WillOnce(Return(true));
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillOnce(DoAll(SetArgPointee<0>(true), Return(true)));
-  EXPECT_CALL(*model_associator_, AssociateModels(_, _))
-      .WillOnce(Return(
-          SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, "error", BOOKMARKS)));
-
-  EXPECT_CALL(*dtc_mock_, RecordAssociationTime(_));
-  SetStartFailExpectations(DataTypeController::ASSOCIATION_FAILED);
-  // Set up association to fail with an association failed error.
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  Start();
-  EXPECT_EQ(DataTypeController::FAILED, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest,
-       StartAssociationTriggersUnrecoverableError) {
-  SetStartExpectations();
-  SetStartFailExpectations(DataTypeController::UNRECOVERABLE_ERROR);
-  // Set up association to fail with an unrecoverable error.
-  EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary())
-      .WillRepeatedly(Return(true));
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillRepeatedly(DoAll(SetArgPointee<0>(false), Return(false)));
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  Start();
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest, StartAssociationCryptoNotReady) {
-  SetStartExpectations();
-  SetStartFailExpectations(DataTypeController::NEEDS_CRYPTO);
-  // Set up association to fail with a NEEDS_CRYPTO error.
-  EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary())
-      .WillRepeatedly(Return(false));
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  Start();
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-}
-
-TEST_F(SyncFrontendDataTypeControllerTest, Stop) {
-  SetStartExpectations();
-  SetAssociateExpectations();
-  SetActivateExpectations(DataTypeController::OK);
-  SetStopExpectations();
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-  Start();
-  EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state());
-  frontend_dtc_->Stop(STOP_SYNC);
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state());
-}
-
-}  // namespace syncer
diff --git a/components/sync/driver/glue/sync_engine_backend.cc b/components/sync/driver/glue/sync_engine_backend.cc
index c3ddaf2..c58e366 100644
--- a/components/sync/driver/glue/sync_engine_backend.cc
+++ b/components/sync/driver/glue/sync_engine_backend.cc
@@ -80,8 +80,7 @@
   // effect (only clients, which have feature-flag checked participate in the
   // study). Otherwise, we will have different amount of clients in control and
   // experiment groups.
-  return base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks) &&
-         base::FeatureList::IsEnabled(switches::kSyncUSSPasswords) &&
+  return base::FeatureList::IsEnabled(switches::kSyncUSSPasswords) &&
          base::FeatureList::IsEnabled(switches::kSyncUSSNigori);
 }
 
diff --git a/components/sync/driver/model_associator.h b/components/sync/driver/model_associator.h
deleted file mode 100644
index 71cf3189..0000000
--- a/components/sync/driver/model_associator.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2014 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 COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_
-#define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_
-
-#include <stdint.h>
-
-#include "base/synchronization/lock.h"
-#include "components/sync/base/model_type.h"
-#include "components/sync/model/sync_error.h"
-
-namespace syncer {
-
-class SyncMergeResult;
-
-// This represents the fundamental operations used for model association that
-// are common to all ModelAssociators and do not depend on types of the models
-// being associated.
-class AssociatorInterface {
- public:
-  virtual ~AssociatorInterface() {}
-
-  // Iterates through both the sync and the chrome model looking for
-  // matched pairs of items. After successful completion, the models
-  // should be identical and corresponding. Returns true on
-  // success. On failure of this step, we should abort the sync
-  // operation and report an error to the user.
-  virtual SyncError AssociateModels(SyncMergeResult* local_merge_result,
-                                    SyncMergeResult* syncer_merge_result) = 0;
-
-  // Clears all the associations between the chrome and sync models.
-  virtual SyncError DisassociateModels() = 0;
-
-  // The has_nodes out parameter is set to true if the sync model has
-  // nodes other than the permanent tagged nodes.  The method may
-  // return false if an error occurred.
-  virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) = 0;
-
-  // Calling this method while AssociateModels() is in progress will
-  // cause the method to exit early with a "false" return value.  This
-  // is useful for aborting model associations for shutdown.  This
-  // method is only implemented for model associators that are invoked
-  // off the main thread.
-  virtual void AbortAssociation() = 0;
-
-  // Returns whether the datatype is ready for encryption/decryption if the
-  // sync service requires it.
-  // TODO(zea): This should be implemented automatically for each datatype, see
-  // http://crbug.com/76232.
-  virtual bool CryptoReadyIfNecessary() = 0;
-};
-
-}  // namespace syncer
-
-#endif  // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_
diff --git a/components/sync/driver/model_associator_mock.cc b/components/sync/driver/model_associator_mock.cc
deleted file mode 100644
index 32ce7456..0000000
--- a/components/sync/driver/model_associator_mock.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2014 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 "components/sync/driver/model_associator_mock.h"
-
-namespace syncer {
-
-ModelAssociatorMock::ModelAssociatorMock() {}
-
-ModelAssociatorMock::~ModelAssociatorMock() {}
-
-}  // namespace syncer
diff --git a/components/sync/driver/model_associator_mock.h b/components/sync/driver/model_associator_mock.h
deleted file mode 100644
index 1542f35..0000000
--- a/components/sync/driver/model_associator_mock.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 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 COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_MOCK_H__
-#define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_MOCK_H__
-
-#include "base/location.h"
-#include "components/sync/driver/model_associator.h"
-#include "components/sync/model/sync_error.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-namespace syncer {
-
-ACTION_P(SetSyncError, type) {
-  arg0->Reset(FROM_HERE, "test", type);
-}
-
-class ModelAssociatorMock : public AssociatorInterface {
- public:
-  ModelAssociatorMock();
-  ~ModelAssociatorMock() override;
-
-  MOCK_METHOD2(AssociateModels, SyncError(SyncMergeResult*, SyncMergeResult*));
-  MOCK_METHOD0(DisassociateModels, SyncError());
-  MOCK_METHOD1(SyncModelHasUserCreatedNodes, bool(bool* has_nodes));
-  MOCK_METHOD0(AbortAssociation, void());
-  MOCK_METHOD0(CryptoReadyIfNecessary, bool());
-};
-
-}  // namespace syncer
-
-#endif  // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_MOCK_H__
diff --git a/components/sync/driver/sync_api_component_factory.cc b/components/sync/driver/sync_api_component_factory.cc
deleted file mode 100644
index 6c30588..0000000
--- a/components/sync/driver/sync_api_component_factory.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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 "components/sync/driver/sync_api_component_factory.h"
-
-#include "components/sync/driver/model_associator.h"
-#include "components/sync/model/change_processor.h"
-
-namespace syncer {
-
-SyncApiComponentFactory::SyncComponents::SyncComponents() = default;
-
-SyncApiComponentFactory::SyncComponents::SyncComponents(SyncComponents&&) =
-    default;
-
-SyncApiComponentFactory::SyncComponents::~SyncComponents() = default;
-
-}  // namespace syncer
diff --git a/components/sync/driver/sync_api_component_factory.h b/components/sync/driver/sync_api_component_factory.h
index c2f62bb..b0bfa73 100644
--- a/components/sync/driver/sync_api_component_factory.h
+++ b/components/sync/driver/sync_api_component_factory.h
@@ -10,9 +10,8 @@
 
 #include "base/memory/weak_ptr.h"
 #include "components/sync/base/model_type.h"
+#include "components/sync/base/weak_handle.h"
 #include "components/sync/driver/data_type_controller.h"
-#include "components/sync/model/data_type_error_handler.h"
-#include "components/sync/model/syncable_service.h"
 
 namespace invalidation {
 class InvalidationService;
@@ -20,15 +19,12 @@
 
 namespace syncer {
 
-class AssociatorInterface;
-class ChangeProcessor;
 class DataTypeDebugInfoListener;
 class DataTypeEncryptionHandler;
 class DataTypeManager;
 class DataTypeManagerObserver;
 class SyncEngine;
 class SyncPrefs;
-struct UserShare;
 
 // This factory provides sync driver code with the model type specific sync/api
 // service (like SyncableService) implementations.
@@ -36,25 +32,6 @@
  public:
   virtual ~SyncApiComponentFactory() {}
 
-  // The various factory methods for the data type model associators
-  // and change processors all return this struct.  This is needed
-  // because the change processors typically require a type-specific
-  // model associator at construction time.
-  //
-  // Note: This interface is deprecated in favor of the SyncableService API.
-  // New datatypes that do not live on the UI thread should directly return a
-  // weak pointer to a SyncableService. All others continue to return
-  // SyncComponents. It is safe to assume that the factory methods below are
-  // called on the same thread in which the datatype resides.
-  struct SyncComponents {
-    SyncComponents();
-    SyncComponents(SyncComponents&&);
-    ~SyncComponents();
-
-    std::unique_ptr<AssociatorInterface> model_associator;
-    std::unique_ptr<ChangeProcessor> change_processor;
-  };
-
   virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager(
       ModelTypeSet initial_types,
       const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
@@ -68,11 +45,6 @@
       const std::string& name,
       invalidation::InvalidationService* invalidator,
       const base::WeakPtr<SyncPrefs>& sync_prefs) = 0;
-
-  // Legacy datatypes that need to be converted to the SyncableService API.
-  virtual SyncComponents CreateBookmarkSyncComponents(
-      std::unique_ptr<DataTypeErrorHandler> error_handler,
-      UserShare* user_share) = 0;
 };
 
 }  // namespace syncer
diff --git a/components/sync/driver/sync_api_component_factory_mock.h b/components/sync/driver/sync_api_component_factory_mock.h
index ce83228..dc0108d0 100644
--- a/components/sync/driver/sync_api_component_factory_mock.h
+++ b/components/sync/driver/sync_api_component_factory_mock.h
@@ -11,11 +11,8 @@
 #include "components/sync/base/model_type.h"
 #include "components/sync/driver/data_type_controller.h"
 #include "components/sync/driver/data_type_manager.h"
-#include "components/sync/driver/model_associator.h"
 #include "components/sync/driver/sync_api_component_factory.h"
 #include "components/sync/engine/sync_engine.h"
-#include "components/sync/model/change_processor.h"
-#include "components/sync/model/data_type_error_handler.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 namespace syncer {
@@ -40,10 +37,6 @@
                    const std::string& name,
                    invalidation::InvalidationService* invalidator,
                    const base::WeakPtr<SyncPrefs>& sync_prefs));
-  MOCK_METHOD2(
-      CreateBookmarkSyncComponents,
-      SyncComponents(std::unique_ptr<DataTypeErrorHandler> error_handler,
-                     UserShare* user_share));
 };
 
 }  // namespace syncer
diff --git a/components/sync/driver/sync_driver_switches.cc b/components/sync/driver/sync_driver_switches.cc
index fa7c865..6ecf8b45 100644
--- a/components/sync/driver/sync_driver_switches.cc
+++ b/components/sync/driver/sync_driver_switches.cc
@@ -53,10 +53,6 @@
 const base::Feature kStopSyncInPausedState{"StopSyncInPausedState",
                                            base::FEATURE_DISABLED_BY_DEFAULT};
 
-// Enable USS implementation of Bookmarks datatype.
-const base::Feature kSyncUSSBookmarks{"SyncUSSBookmarks",
-                                      base::FEATURE_ENABLED_BY_DEFAULT};
-
 // Enable USS implementation of Passwords datatype.
 const base::Feature kSyncUSSPasswords{"SyncUSSPasswords",
                                       base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/sync/driver/sync_driver_switches.h b/components/sync/driver/sync_driver_switches.h
index 8707b6f..114f876 100644
--- a/components/sync/driver/sync_driver_switches.h
+++ b/components/sync/driver/sync_driver_switches.h
@@ -29,7 +29,6 @@
 extern const base::Feature kStopSyncInPausedState;
 extern const base::Feature
     kSyncAllowWalletDataInTransportModeWithCustomPassphrase;
-extern const base::Feature kSyncUSSBookmarks;
 extern const base::Feature kSyncUSSPasswords;
 extern const base::Feature kSyncUSSNigori;
 extern const base::Feature kSyncWifiConfigurations;
diff --git a/components/sync/engine_impl/sync_encryption_handler_impl.cc b/components/sync/engine_impl/sync_encryption_handler_impl.cc
index 4e9f226..09fd0020 100644
--- a/components/sync/engine_impl/sync_encryption_handler_impl.cc
+++ b/components/sync/engine_impl/sync_encryption_handler_impl.cc
@@ -73,19 +73,6 @@
   MIGRATION_STATE_SIZE,
 };
 
-// Enumeration of possible values for a key derivation method (including a
-// special value of "not set"). Used in UMA metrics. Do not re-order or delete
-// these entries; they are used in a UMA histogram.  Please edit
-// SyncCustomPassphraseKeyDerivationMethodState in enums.xml if a value is
-// added.
-enum class KeyDerivationMethodStateForMetrics {
-  NOT_SET = 0,
-  UNSUPPORTED = 1,
-  PBKDF2_HMAC_SHA1_1003 = 2,
-  SCRYPT_8192_8_11 = 3,
-  kMaxValue = SCRYPT_8192_8_11
-};
-
 // The new passphrase state is sufficient to determine whether a nigori node
 // is migrated to support keystore encryption. In addition though, we also
 // want to verify the conditions for proper keystore encryption functionality.
diff --git a/components/sync/nigori/cryptographer_impl.cc b/components/sync/nigori/cryptographer_impl.cc
index 0894b38..d6d16db 100644
--- a/components/sync/nigori/cryptographer_impl.cc
+++ b/components/sync/nigori/cryptographer_impl.cc
@@ -83,8 +83,8 @@
   default_encryption_key_name_.clear();
 }
 
-bool CryptographerImpl::HasKey(const sync_pb::NigoriKey& key) const {
-  return key_bag_.HasKey(key);
+bool CryptographerImpl::HasKey(const std::string& key_name) const {
+  return key_bag_.HasKey(key_name);
 }
 
 sync_pb::NigoriKey CryptographerImpl::ExportDefaultKey() const {
diff --git a/components/sync/nigori/cryptographer_impl.h b/components/sync/nigori/cryptographer_impl.h
index 3fb58d7..5f5e96a 100644
--- a/components/sync/nigori/cryptographer_impl.h
+++ b/components/sync/nigori/cryptographer_impl.h
@@ -65,8 +65,8 @@
   // false.
   void ClearDefaultEncryptionKey();
 
-  // Determines whether |key| is already known.
-  bool HasKey(const sync_pb::NigoriKey& key) const;
+  // Determines whether |key_name| represents a known key.
+  bool HasKey(const std::string& key_name) const;
 
   // Returns a proto representation of the default encryption key. |*this| must
   // have a default encryption key set, as reflected by CanEncrypt().
diff --git a/components/sync/nigori/keystore_keys_cryptographer.cc b/components/sync/nigori/keystore_keys_cryptographer.cc
index 5c773db..2b54650 100644
--- a/components/sync/nigori/keystore_keys_cryptographer.cc
+++ b/components/sync/nigori/keystore_keys_cryptographer.cc
@@ -13,18 +13,27 @@
 
 namespace syncer {
 
-namespace {
+// static
+std::unique_ptr<KeystoreKeysCryptographer>
+KeystoreKeysCryptographer::CreateEmpty() {
+  return base::WrapUnique(new KeystoreKeysCryptographer(
+      CryptographerImpl::CreateEmpty(),
+      /*keystore_keys=*/std::vector<std::string>()));
+}
 
-std::unique_ptr<CryptographerImpl> CreateCryptographerFromKeystoreKeys(
+// static
+std::unique_ptr<KeystoreKeysCryptographer>
+KeystoreKeysCryptographer::FromKeystoreKeys(
     const std::vector<std::string>& keystore_keys) {
+  if (keystore_keys.empty()) {
+    return CreateEmpty();
+  }
+
   std::unique_ptr<CryptographerImpl> cryptographer =
       CryptographerImpl::CreateEmpty();
 
-  if (keystore_keys.empty()) {
-    return cryptographer;
-  }
-
   std::string last_key_name;
+
   for (const std::string& key : keystore_keys) {
     last_key_name =
         cryptographer->EmplaceKey(key, KeyDerivationParams::CreateForPbkdf2());
@@ -40,28 +49,6 @@
   DCHECK(!last_key_name.empty());
   cryptographer->SelectDefaultEncryptionKey(last_key_name);
 
-  return cryptographer;
-}
-
-}  // namespace
-
-// static
-std::unique_ptr<KeystoreKeysCryptographer>
-KeystoreKeysCryptographer::CreateEmpty() {
-  return base::WrapUnique(new KeystoreKeysCryptographer(
-      CryptographerImpl::CreateEmpty(),
-      /*keystore_keys=*/std::vector<std::string>()));
-}
-
-// static
-std::unique_ptr<KeystoreKeysCryptographer>
-KeystoreKeysCryptographer::FromKeystoreKeys(
-    const std::vector<std::string>& keystore_keys) {
-  std::unique_ptr<CryptographerImpl> cryptographer =
-      CreateCryptographerFromKeystoreKeys(keystore_keys);
-  if (!cryptographer) {
-    return nullptr;
-  }
   return base::WrapUnique(
       new KeystoreKeysCryptographer(std::move(cryptographer), keystore_keys));
 }
@@ -75,6 +62,10 @@
 
 KeystoreKeysCryptographer::~KeystoreKeysCryptographer() = default;
 
+std::string KeystoreKeysCryptographer::GetLastKeystoreKeyName() const {
+  return cryptographer_->GetDefaultEncryptionKeyName();
+}
+
 bool KeystoreKeysCryptographer::IsEmpty() const {
   return keystore_keys_.empty();
 }
diff --git a/components/sync/nigori/keystore_keys_cryptographer.h b/components/sync/nigori/keystore_keys_cryptographer.h
index ac850bc..05ad78d 100644
--- a/components/sync/nigori/keystore_keys_cryptographer.h
+++ b/components/sync/nigori/keystore_keys_cryptographer.h
@@ -38,6 +38,10 @@
     return keystore_keys_;
   }
 
+  // Returns name of Nigori key derived from last keystore key if !IsEmpty()
+  // and empty string otherwise.
+  std::string GetLastKeystoreKeyName() const;
+
   bool IsEmpty() const;
 
   std::unique_ptr<KeystoreKeysCryptographer> Clone() const;
diff --git a/components/sync/nigori/keystore_keys_cryptographer_unittest.cc b/components/sync/nigori/keystore_keys_cryptographer_unittest.cc
new file mode 100644
index 0000000..4d9c0ec
--- /dev/null
+++ b/components/sync/nigori/keystore_keys_cryptographer_unittest.cc
@@ -0,0 +1,66 @@
+// Copyright 2019 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 "components/sync/nigori/keystore_keys_cryptographer.h"
+
+#include "components/sync/nigori/cryptographer_impl.h"
+#include "components/sync/nigori/nigori.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace syncer {
+
+namespace {
+
+using testing::Eq;
+using testing::NotNull;
+
+std::string ComputeKeystoreKeyName(const std::string& keystore_key) {
+  std::string key_name;
+  Nigori::CreateByDerivation(KeyDerivationParams::CreateForPbkdf2(),
+                             keystore_key)
+      ->Permute(Nigori::Password, kNigoriKeyName, &key_name);
+  return key_name;
+}
+
+TEST(KeystoreKeysCryptographerTest, ShouldCreateEmpty) {
+  std::unique_ptr<KeystoreKeysCryptographer> keystore_keys_cryptographer =
+      KeystoreKeysCryptographer::CreateEmpty();
+
+  EXPECT_TRUE(keystore_keys_cryptographer->IsEmpty());
+  EXPECT_TRUE(keystore_keys_cryptographer->keystore_keys().empty());
+  EXPECT_TRUE(keystore_keys_cryptographer->GetLastKeystoreKeyName().empty());
+
+  std::unique_ptr<CryptographerImpl> underlying_cryptographer =
+      keystore_keys_cryptographer->ToCryptographerImpl();
+  ASSERT_THAT(underlying_cryptographer, NotNull());
+  EXPECT_FALSE(underlying_cryptographer->CanEncrypt());
+}
+
+TEST(KeystoreKeysCryptographerTest, ShouldCreateNonEmpty) {
+  const std::vector<std::string> kKeystoreKeys = {"key1", "key2"};
+  const std::string keystore_key_name1 =
+      ComputeKeystoreKeyName(kKeystoreKeys[0]);
+  const std::string keystore_key_name2 =
+      ComputeKeystoreKeyName(kKeystoreKeys[1]);
+  std::unique_ptr<KeystoreKeysCryptographer> keystore_keys_cryptographer =
+      KeystoreKeysCryptographer::FromKeystoreKeys(kKeystoreKeys);
+
+  EXPECT_FALSE(keystore_keys_cryptographer->IsEmpty());
+  EXPECT_THAT(keystore_keys_cryptographer->keystore_keys(), Eq(kKeystoreKeys));
+  EXPECT_THAT(keystore_keys_cryptographer->GetLastKeystoreKeyName(),
+              Eq(keystore_key_name2));
+
+  std::unique_ptr<CryptographerImpl> underlying_cryptographer =
+      keystore_keys_cryptographer->ToCryptographerImpl();
+  ASSERT_THAT(underlying_cryptographer, NotNull());
+  EXPECT_TRUE(underlying_cryptographer->CanEncrypt());
+  EXPECT_TRUE(underlying_cryptographer->HasKey(keystore_key_name1));
+  EXPECT_THAT(underlying_cryptographer->GetDefaultEncryptionKeyName(),
+              Eq(keystore_key_name2));
+}
+
+}  // namespace
+
+}  // namespace syncer
diff --git a/components/sync/nigori/nigori.h b/components/sync/nigori/nigori.h
index b8ff669..b9152bd 100644
--- a/components/sync/nigori/nigori.h
+++ b/components/sync/nigori/nigori.h
@@ -48,6 +48,19 @@
   std::string scrypt_salt_;
 };
 
+// Enumeration of possible values for a key derivation method (including a
+// special value of "not set"). Used in UMA metrics. Do not re-order or delete
+// these entries; they are used in a UMA histogram.  Please edit
+// SyncCustomPassphraseKeyDerivationMethodState in enums.xml if a value is
+// added.
+enum class KeyDerivationMethodStateForMetrics {
+  NOT_SET = 0,
+  UNSUPPORTED = 1,
+  PBKDF2_HMAC_SHA1_1003 = 2,
+  SCRYPT_8192_8_11 = 3,
+  kMaxValue = SCRYPT_8192_8_11
+};
+
 // A (partial) implementation of Nigori, a protocol to securely store secrets in
 // the cloud. This implementation does not support server authentication or
 // assisted key derivation.
diff --git a/components/sync/nigori/nigori_key_bag.cc b/components/sync/nigori/nigori_key_bag.cc
index 5e969f6..30d972a 100644
--- a/components/sync/nigori/nigori_key_bag.cc
+++ b/components/sync/nigori/nigori_key_bag.cc
@@ -96,12 +96,6 @@
   return nigori_map_.count(key_name) != 0;
 }
 
-bool NigoriKeyBag::HasKey(const sync_pb::NigoriKey& key) const {
-  std::unique_ptr<Nigori> nigori = Nigori::CreateByImport(
-      key.deprecated_user_key(), key.encryption_key(), key.mac_key());
-  return HasKey(ComputeNigoriName(*nigori));
-}
-
 sync_pb::NigoriKey NigoriKeyBag::ExportKey(const std::string& key_name) const {
   DCHECK(HasKey(key_name));
   sync_pb::NigoriKey key =
diff --git a/components/sync/nigori/nigori_key_bag.h b/components/sync/nigori/nigori_key_bag.h
index 4b4846da..c11991d 100644
--- a/components/sync/nigori/nigori_key_bag.h
+++ b/components/sync/nigori/nigori_key_bag.h
@@ -40,7 +40,6 @@
 
   size_t size() const;
   bool HasKey(const std::string& key_name) const;
-  bool HasKey(const sync_pb::NigoriKey& key) const;
 
   // |key_name| must exist in this keybag.
   sync_pb::NigoriKey ExportKey(const std::string& key_name) const;
diff --git a/components/sync/nigori/nigori_state.cc b/components/sync/nigori/nigori_state.cc
index 10aa727..a5fd52bb 100644
--- a/components/sync/nigori/nigori_state.cc
+++ b/components/sync/nigori/nigori_state.cc
@@ -16,13 +16,6 @@
 
 namespace {
 
-std::string ComputePbkdf2KeyName(const std::string& password) {
-  std::string key_name;
-  Nigori::CreateByDerivation(KeyDerivationParams::CreateForPbkdf2(), password)
-      ->Permute(Nigori::Password, kNigoriKeyName, &key_name);
-  return key_name;
-}
-
 sync_pb::CustomPassphraseKeyDerivationParams
 CustomPassphraseKeyDerivationParamsToProto(const KeyDerivationParams& params) {
   sync_pb::CustomPassphraseKeyDerivationParams output;
@@ -181,11 +174,9 @@
   if (pending_keys.has_value()) {
     *proto.mutable_pending_keys() = *pending_keys;
   }
-  const std::vector<std::string>& keystore_keys =
-      keystore_keys_cryptographer->keystore_keys();
-  if (!keystore_keys.empty()) {
+  if (!keystore_keys_cryptographer->IsEmpty()) {
     proto.set_current_keystore_key_name(
-        ComputePbkdf2KeyName(keystore_keys.back()));
+        keystore_keys_cryptographer->GetLastKeystoreKeyName());
   }
   proto.set_passphrase_type(passphrase_type);
   if (!keystore_migration_time.is_null()) {
@@ -212,7 +203,8 @@
   // allow rollback of USS Nigori. Having keybag with all keystore keys and
   // |current_keystore_key_name| is enough to support all logic. We should
   // remove them few milestones after USS migration completed.
-  for (const std::string& keystore_key : keystore_keys) {
+  for (const std::string& keystore_key :
+       keystore_keys_cryptographer->keystore_keys()) {
     proto.add_keystore_key(keystore_key);
   }
   if (pending_keystore_decryptor_token.has_value()) {
@@ -290,15 +282,11 @@
 }
 
 bool NigoriState::NeedsKeystoreKeyRotation() const {
-  if (keystore_keys_cryptographer->IsEmpty() ||
-      passphrase_type != sync_pb::NigoriSpecifics::KEYSTORE_PASSPHRASE ||
-      pending_keys.has_value()) {
-    return false;
-  }
-
-  const sync_pb::NigoriKey rotated_default_key =
-      keystore_keys_cryptographer->ToCryptographerImpl()->ExportDefaultKey();
-  return !cryptographer->HasKey(rotated_default_key);
+  return !keystore_keys_cryptographer->IsEmpty() &&
+         passphrase_type == sync_pb::NigoriSpecifics::KEYSTORE_PASSPHRASE &&
+         !pending_keys.has_value() &&
+         !cryptographer->HasKey(
+             keystore_keys_cryptographer->GetLastKeystoreKeyName());
 }
 
 }  // namespace syncer
diff --git a/components/sync/nigori/nigori_sync_bridge_impl.cc b/components/sync/nigori/nigori_sync_bridge_impl.cc
index 8722caf..25f8571 100644
--- a/components/sync/nigori/nigori_sync_bridge_impl.cc
+++ b/components/sync/nigori/nigori_sync_bridge_impl.cc
@@ -33,6 +33,24 @@
 
 const char kNigoriNonUniqueName[] = "Nigori";
 
+KeyDerivationMethodStateForMetrics GetKeyDerivationMethodStateForMetrics(
+    const base::Optional<KeyDerivationParams>& key_derivation_params) {
+  if (!key_derivation_params.has_value()) {
+    return KeyDerivationMethodStateForMetrics::NOT_SET;
+  }
+  switch (key_derivation_params.value().method()) {
+    case KeyDerivationMethod::PBKDF2_HMAC_SHA1_1003:
+      return KeyDerivationMethodStateForMetrics::PBKDF2_HMAC_SHA1_1003;
+    case KeyDerivationMethod::SCRYPT_8192_8_11:
+      return KeyDerivationMethodStateForMetrics::SCRYPT_8192_8_11;
+    case KeyDerivationMethod::UNSUPPORTED:
+      return KeyDerivationMethodStateForMetrics::UNSUPPORTED;
+  }
+
+  NOTREACHED();
+  return KeyDerivationMethodStateForMetrics::UNSUPPORTED;
+}
+
 KeyDerivationMethod GetKeyDerivationMethodFromSpecifics(
     const sync_pb::NigoriSpecifics& specifics) {
   KeyDerivationMethod key_derivation_method = ProtoKeyDerivationMethodToEnum(
@@ -459,6 +477,12 @@
         enum_passphrase_type, GetExplicitPassphraseTime());
     UMA_HISTOGRAM_ENUMERATION("Sync.PassphraseType", enum_passphrase_type);
   }
+  if (state_.passphrase_type == NigoriSpecifics::CUSTOM_PASSPHRASE) {
+    UMA_HISTOGRAM_ENUMERATION(
+        "Sync.Crypto.CustomPassphraseKeyDerivationMethodStateOnStartup",
+        GetKeyDerivationMethodStateForMetrics(
+            state_.custom_passphrase_key_derivation_params));
+  }
   UMA_HISTOGRAM_BOOLEAN("Sync.CryptographerReady",
                         state_.cryptographer->CanEncrypt());
   UMA_HISTOGRAM_BOOLEAN("Sync.CryptographerPendingKeys",
@@ -479,6 +503,12 @@
     const std::string& passphrase) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
 
+  UMA_HISTOGRAM_ENUMERATION(
+      "Sync.Crypto.CustomPassphraseKeyDerivationMethodOnNewPassphrase",
+      GetKeyDerivationMethodStateForMetrics(
+          CreateKeyDerivationParamsForCustomPassphrase(
+              random_salt_generator_)));
+
   QueuePendingLocalCommit(PendingLocalNigoriCommit::ForSetCustomPassphrase(
       passphrase, random_salt_generator_));
 }
@@ -514,6 +544,15 @@
     return;
   }
 
+  if (state_.passphrase_type == NigoriSpecifics::CUSTOM_PASSPHRASE) {
+    DCHECK(state_.custom_passphrase_key_derivation_params.has_value());
+    UMA_HISTOGRAM_ENUMERATION(
+        "Sync.Crypto."
+        "CustomPassphraseKeyDerivationMethodOnSuccessfulDecryption",
+        GetKeyDerivationMethodStateForMetrics(
+            state_.custom_passphrase_key_derivation_params));
+  }
+
   DCHECK_EQ(state_.cryptographer->GetDefaultEncryptionKeyName(), new_key_name);
   storage_->StoreData(SerializeAsNigoriLocalData());
   broadcasting_observer_->OnCryptographerStateChanged(
@@ -999,6 +1038,14 @@
   return state_.pending_keys.has_value();
 }
 
+KeyDerivationParams
+NigoriSyncBridgeImpl::GetCustomPassphraseKeyDerivationParamsForTesting() const {
+  if (!state_.custom_passphrase_key_derivation_params) {
+    return KeyDerivationParams::CreateForPbkdf2();
+  }
+  return *state_.custom_passphrase_key_derivation_params;
+}
+
 std::string NigoriSyncBridgeImpl::PackExplicitPassphraseKeyForTesting(
     const Encryptor& encryptor,
     const CryptographerImpl& cryptographer) {
diff --git a/components/sync/nigori/nigori_sync_bridge_impl.h b/components/sync/nigori/nigori_sync_bridge_impl.h
index 97c583a..5c2a810d 100644
--- a/components/sync/nigori/nigori_sync_bridge_impl.h
+++ b/components/sync/nigori/nigori_sync_bridge_impl.h
@@ -32,6 +32,7 @@
 namespace syncer {
 
 class Encryptor;
+class KeyDerivationParams;
 class NigoriStorage;
 class PendingLocalNigoriCommit;
 
@@ -89,6 +90,7 @@
   sync_pb::NigoriSpecifics::PassphraseType GetPassphraseTypeForTesting() const;
   ModelTypeSet GetEncryptedTypesForTesting() const;
   bool HasPendingKeysForTesting() const;
+  KeyDerivationParams GetCustomPassphraseKeyDerivationParamsForTesting() const;
 
   static std::string PackExplicitPassphraseKeyForTesting(
       const Encryptor& encryptor,
diff --git a/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc b/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc
index 17de4ad..4613f92 100644
--- a/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc
+++ b/components/sync/nigori/nigori_sync_bridge_impl_unittest.cc
@@ -968,8 +968,12 @@
   EXPECT_THAT(bridge()->ApplySyncChanges(base::nullopt), Eq(base::nullopt));
   EXPECT_THAT(bridge()->GetData(), HasCustomPassphraseNigori());
 
-  // TODO(crbug.com/922900): find a good way to get key derivation method and
-  // salt to check expectations about cryptographer state.
+  const KeyParams passphrase_key_params = {
+      bridge()->GetCustomPassphraseKeyDerivationParamsForTesting(),
+      kCustomPassphrase};
+  const Cryptographer& cryptographer = bridge()->GetCryptographerForTesting();
+  EXPECT_THAT(cryptographer, CanDecryptWith(passphrase_key_params));
+  EXPECT_THAT(cryptographer, HasDefaultKeyDerivedFrom(passphrase_key_params));
 }
 
 // Tests that pending local change with setting custom passphrase is applied,
@@ -1027,11 +1031,14 @@
   EXPECT_THAT(bridge()->ApplySyncChanges(base::nullopt), Eq(base::nullopt));
   EXPECT_THAT(bridge()->GetData(), HasCustomPassphraseNigori());
 
+  const KeyParams passphrase_key_params = {
+      bridge()->GetCustomPassphraseKeyDerivationParamsForTesting(),
+      kCustomPassphrase};
   const Cryptographer& cryptographer = bridge()->GetCryptographerForTesting();
   EXPECT_THAT(cryptographer, CanDecryptWith(kKeystoreKeyParams1));
   EXPECT_THAT(cryptographer, CanDecryptWith(kKeystoreKeyParams2));
-  // TODO(crbug.com/922900): find a good way to get key derivation method and
-  // salt to check expectations about cryptographer state.
+  EXPECT_THAT(cryptographer, CanDecryptWith(passphrase_key_params));
+  EXPECT_THAT(cryptographer, HasDefaultKeyDerivedFrom(passphrase_key_params));
 }
 
 // Tests that SetEncryptionPassphrase() call doesn't lead to custom passphrase
diff --git a/components/sync/nigori/pending_local_nigori_commit.cc b/components/sync/nigori/pending_local_nigori_commit.cc
index 674879a00..de7cb3e 100644
--- a/components/sync/nigori/pending_local_nigori_commit.cc
+++ b/components/sync/nigori/pending_local_nigori_commit.cc
@@ -32,23 +32,6 @@
   return KeyDerivationMethod::PBKDF2_HMAC_SHA1_1003;
 }
 
-KeyDerivationParams CreateKeyDerivationParamsForCustomPassphrase(
-    const base::RepeatingCallback<std::string()>& random_salt_generator) {
-  KeyDerivationMethod method =
-      GetDefaultKeyDerivationMethodForCustomPassphrase();
-  switch (method) {
-    case KeyDerivationMethod::PBKDF2_HMAC_SHA1_1003:
-      return KeyDerivationParams::CreateForPbkdf2();
-    case KeyDerivationMethod::SCRYPT_8192_8_11:
-      return KeyDerivationParams::CreateForScrypt(random_salt_generator.Run());
-    case KeyDerivationMethod::UNSUPPORTED:
-      break;
-  }
-
-  NOTREACHED();
-  return KeyDerivationParams::CreateWithUnsupportedMethod();
-}
-
 class CustomPassphraseSetter : public PendingLocalNigoriCommit {
  public:
   CustomPassphraseSetter(
@@ -195,6 +178,23 @@
 
 }  // namespace
 
+KeyDerivationParams CreateKeyDerivationParamsForCustomPassphrase(
+    const base::RepeatingCallback<std::string()>& random_salt_generator) {
+  KeyDerivationMethod method =
+      GetDefaultKeyDerivationMethodForCustomPassphrase();
+  switch (method) {
+    case KeyDerivationMethod::PBKDF2_HMAC_SHA1_1003:
+      return KeyDerivationParams::CreateForPbkdf2();
+    case KeyDerivationMethod::SCRYPT_8192_8_11:
+      return KeyDerivationParams::CreateForScrypt(random_salt_generator.Run());
+    case KeyDerivationMethod::UNSUPPORTED:
+      break;
+  }
+
+  NOTREACHED();
+  return KeyDerivationParams::CreateWithUnsupportedMethod();
+}
+
 // static
 std::unique_ptr<PendingLocalNigoriCommit>
 PendingLocalNigoriCommit::ForSetCustomPassphrase(
diff --git a/components/sync/nigori/pending_local_nigori_commit.h b/components/sync/nigori/pending_local_nigori_commit.h
index 3a5c23c..2d6d3532 100644
--- a/components/sync/nigori/pending_local_nigori_commit.h
+++ b/components/sync/nigori/pending_local_nigori_commit.h
@@ -14,8 +14,12 @@
 
 namespace syncer {
 
+class KeyDerivationParams;
 struct NigoriState;
 
+KeyDerivationParams CreateKeyDerivationParamsForCustomPassphrase(
+    const base::RepeatingCallback<std::string()>& random_salt_generator);
+
 // Interface representing an intended local change to the Nigori state that
 // is pending a commit to the sync server.
 class PendingLocalNigoriCommit {
diff --git a/components/sync/protocol/proto_enum_conversions.cc b/components/sync/protocol/proto_enum_conversions.cc
index c08a080c..6a35c8e 100644
--- a/components/sync/protocol/proto_enum_conversions.cc
+++ b/components/sync/protocol/proto_enum_conversions.cc
@@ -541,12 +541,12 @@
 
 const char* ProtoEnumToString(
     sync_pb::WebAppSpecifics::DisplayMode display_mode) {
-  ASSERT_ENUM_BOUNDS(sync_pb::WebAppSpecifics, DisplayMode, kBrowser,
-                     kStandalone);
+  ASSERT_ENUM_BOUNDS(sync_pb::WebAppSpecifics, DisplayMode, BROWSER,
+                     STANDALONE);
   switch (display_mode) {
-    ENUM_CASE(sync_pb::WebAppSpecifics, kBrowser);
-    ENUM_CASE(sync_pb::WebAppSpecifics, kMinimalUi);
-    ENUM_CASE(sync_pb::WebAppSpecifics, kStandalone);
+    ENUM_CASE(sync_pb::WebAppSpecifics, BROWSER);
+    ENUM_CASE(sync_pb::WebAppSpecifics, MINIMAL_UI);
+    ENUM_CASE(sync_pb::WebAppSpecifics, STANDALONE);
   }
   NOTREACHED();
   return "";
diff --git a/components/sync/protocol/web_app_specifics.proto b/components/sync/protocol/web_app_specifics.proto
index fd77894..d7ac84d5 100644
--- a/components/sync/protocol/web_app_specifics.proto
+++ b/components/sync/protocol/web_app_specifics.proto
@@ -17,11 +17,11 @@
   // This enum should be synced with
   // third_party/blink/public/mojom/manifest/display_mode.mojom
   enum DisplayMode {
-    // kUndefined is never serialized.
-    kBrowser = 1;
-    kMinimalUi = 2;
-    kStandalone = 3;
-    // kFullscreen is never serialized.
+    // UNDEFINED is never serialized.
+    BROWSER = 1;
+    MINIMAL_UI = 2;
+    STANDALONE= 3;
+    // FULLSCREEN is never serialized.
   }
 
   optional string launch_url = 1;
diff --git a/components/sync_bookmarks/BUILD.gn b/components/sync_bookmarks/BUILD.gn
index 40ee9b5d..6a7af6b0 100644
--- a/components/sync_bookmarks/BUILD.gn
+++ b/components/sync_bookmarks/BUILD.gn
@@ -6,14 +6,8 @@
 
 static_library("sync_bookmarks") {
   sources = [
-    "bookmark_change_processor.cc",
-    "bookmark_change_processor.h",
-    "bookmark_data_type_controller.cc",
-    "bookmark_data_type_controller.h",
     "bookmark_local_changes_builder.cc",
     "bookmark_local_changes_builder.h",
-    "bookmark_model_associator.cc",
-    "bookmark_model_associator.h",
     "bookmark_model_merger.cc",
     "bookmark_model_merger.h",
     "bookmark_model_observer_impl.cc",
@@ -47,7 +41,6 @@
   testonly = true
 
   sources = [
-    "bookmark_data_type_controller_unittest.cc",
     "bookmark_model_merger_unittest.cc",
     "bookmark_model_observer_impl_unittest.cc",
     "bookmark_model_type_processor_unittest.cc",
diff --git a/components/sync_bookmarks/bookmark_change_processor.cc b/components/sync_bookmarks/bookmark_change_processor.cc
deleted file mode 100644
index 4c50233..0000000
--- a/components/sync_bookmarks/bookmark_change_processor.cc
+++ /dev/null
@@ -1,987 +0,0 @@
-// Copyright 2012 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 "components/sync_bookmarks/bookmark_change_processor.h"
-
-#include <stddef.h>
-
-#include <map>
-#include <string>
-#include <utility>
-
-#include "base/containers/stack.h"
-#include "base/location.h"
-#include "base/strings/string16.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "components/bookmarks/browser/bookmark_client.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/bookmarks/browser/bookmark_utils.h"
-#include "components/favicon/core/favicon_service.h"
-#include "components/sync/syncable/change_record.h"
-#include "components/sync/syncable/entry.h"  // TODO(tim): Investigating bug 121587.
-#include "components/sync/syncable/read_node.h"
-#include "components/sync/syncable/syncable_write_transaction.h"
-#include "components/sync/syncable/write_node.h"
-#include "components/sync/syncable/write_transaction.h"
-#include "components/undo/bookmark_undo_service.h"
-#include "components/undo/bookmark_undo_utils.h"
-#include "ui/gfx/favicon_size.h"
-#include "ui/gfx/image/image_util.h"
-
-using bookmarks::BookmarkModel;
-using bookmarks::BookmarkNode;
-using syncer::ChangeRecord;
-using syncer::ChangeRecordList;
-
-namespace sync_bookmarks {
-
-static const char kMobileBookmarksTag[] = "synced_bookmarks";
-
-BookmarkChangeProcessor::BookmarkChangeProcessor(
-    BookmarkModelAssociator* model_associator,
-    std::unique_ptr<syncer::DataTypeErrorHandler> err_handler)
-    : syncer::ChangeProcessor(std::move(err_handler)),
-      bookmark_model_(nullptr),
-      model_associator_(model_associator) {
-  DCHECK(model_associator);
-  DCHECK(error_handler());
-}
-
-BookmarkChangeProcessor::~BookmarkChangeProcessor() {
-  if (bookmark_model_)
-    bookmark_model_->RemoveObserver(this);
-}
-
-void BookmarkChangeProcessor::StartImpl() {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
-  DCHECK(!bookmark_model_);
-  bookmark_model_ = model_associator_->GetBookmarkModel();
-  DCHECK(bookmark_model_->loaded());
-  bookmark_model_->AddObserver(this);
-}
-
-void BookmarkChangeProcessor::UpdateSyncNodeProperties(
-    const BookmarkNode* src,
-    BookmarkModel* model,
-    syncer::WriteNode* dst,
-    syncer::DataTypeErrorHandler* error_handler) {
-  // Set the properties of the item.
-  dst->SetIsFolder(src->is_folder());
-  dst->SetTitle(base::UTF16ToUTF8(src->GetTitle()));
-  sync_pb::BookmarkSpecifics bookmark_specifics(dst->GetBookmarkSpecifics());
-  if (!src->is_folder()) {
-    if (!src->url().is_valid()) {
-      // Report the invalid URL and continue.
-      // TODO(stanisc): crbug/482155: Revisit this once the root cause for
-      // invalid URLs is understood.
-      error_handler->CreateAndUploadError(
-          FROM_HERE, "Creating sync bookmark with invalid url " +
-                         src->url().possibly_invalid_spec(),
-          syncer::BOOKMARKS);
-    }
-    bookmark_specifics.set_url(src->url().spec());
-  }
-  bookmark_specifics.set_creation_time_us(src->date_added().ToInternalValue());
-  dst->SetBookmarkSpecifics(bookmark_specifics);
-  SetSyncNodeFavicon(src, model, dst);
-  SetSyncNodeMetaInfo(src, dst);
-}
-
-// static
-void BookmarkChangeProcessor::EncodeFavicon(
-    const BookmarkNode* src,
-    BookmarkModel* model,
-    scoped_refptr<base::RefCountedMemory>* dst) {
-  const gfx::Image& favicon = model->GetFavicon(src);
-
-  // Check for empty images.  This can happen if the favicon is
-  // still being loaded.  Also avoid syncing touch icons.
-  if (favicon.IsEmpty() ||
-      model->GetFaviconType(src) != favicon_base::IconType::kFavicon)
-    return;
-
-  // Re-encode the BookmarkNode's favicon as a PNG, and pass the data to the
-  // sync subsystem.
-  *dst = favicon.As1xPNGBytes();
-}
-
-// static
-int BookmarkChangeProcessor::RemoveSyncNodeHierarchy(
-    syncer::WriteTransaction* trans,
-    syncer::WriteNode* sync_node,
-    BookmarkModelAssociator* associator) {
-  // Remove children.
-  int num_removed = RemoveAllChildNodes(trans, sync_node->GetId(), associator);
-  // Remove the node itself.
-  RemoveOneSyncNode(sync_node, associator);
-  return num_removed + 1;
-}
-
-void BookmarkChangeProcessor::RemoveSyncNodeHierarchy(
-    const BookmarkNode* topmost) {
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  {
-    syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version);
-    syncer::WriteNode topmost_sync_node(&trans);
-    if (!model_associator_->InitSyncNodeFromChromeId(topmost->id(),
-                                                     &topmost_sync_node)) {
-      syncer::SyncError error(FROM_HERE,
-                              syncer::SyncError::DATATYPE_ERROR,
-                              "Failed to init sync node from chrome node",
-                              syncer::BOOKMARKS);
-      error_handler()->OnUnrecoverableError(error);
-      return;
-    }
-    RemoveSyncNodeHierarchy(&trans, &topmost_sync_node, model_associator_);
-  }
-
-  // Don't need to update versions of deleted nodes.
-  UpdateTransactionVersion(new_version, bookmark_model_,
-                           std::vector<const BookmarkNode*>());
-}
-
-void BookmarkChangeProcessor::RemoveAllSyncNodes() {
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  {
-    syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version);
-
-    int64_t bookmark_bar_node_sync_id =
-        model_associator_->GetSyncIdFromChromeId(
-            bookmark_model_->bookmark_bar_node()->id());
-    DCHECK_NE(syncer::kInvalidId, bookmark_bar_node_sync_id);
-    RemoveAllChildNodes(&trans, bookmark_bar_node_sync_id, model_associator_);
-
-    int64_t other_node_sync_id = model_associator_->GetSyncIdFromChromeId(
-        bookmark_model_->other_node()->id());
-    DCHECK_NE(syncer::kInvalidId, other_node_sync_id);
-    RemoveAllChildNodes(&trans, other_node_sync_id, model_associator_);
-
-    // Remove mobile bookmarks node only if it is present.
-    int64_t mobile_node_sync_id = model_associator_->GetSyncIdFromChromeId(
-        bookmark_model_->mobile_node()->id());
-    if (mobile_node_sync_id != syncer::kInvalidId) {
-      RemoveAllChildNodes(&trans, mobile_node_sync_id, model_associator_);
-    }
-
-    // Note: the root node may have additional extra nodes. Currently none of
-    // them are meant to sync.
-  }
-
-  // Don't need to update versions of deleted nodes.
-  UpdateTransactionVersion(new_version, bookmark_model_,
-                           std::vector<const BookmarkNode*>());
-}
-
-// static
-int BookmarkChangeProcessor::RemoveAllChildNodes(
-    syncer::WriteTransaction* trans,
-    int64_t topmost_sync_id,
-    BookmarkModelAssociator* associator) {
-  // Do a DFS and delete all the child sync nodes, use sync id instead of
-  // bookmark node ids since the bookmark nodes may already be deleted.
-  // The equivalent recursive version of this iterative DFS:
-  // remove_all_children(node_id, topmost_node_id):
-  //    node.initByIdLookup(node_id)
-  //    while(node.GetFirstChildId() != syncer::kInvalidId)
-  //      remove_all_children(node.GetFirstChildId(), topmost_node_id)
-  //    if(node_id != topmost_node_id)
-  //      delete node
-
-  int num_removed = 0;
-  base::stack<int64_t> dfs_sync_id_stack;
-  // Push the topmost node.
-  dfs_sync_id_stack.push(topmost_sync_id);
-  while (!dfs_sync_id_stack.empty()) {
-    const int64_t sync_node_id = dfs_sync_id_stack.top();
-    syncer::WriteNode node(trans);
-    node.InitByIdLookup(sync_node_id);
-    if (!node.GetIsFolder() || node.GetFirstChildId() == syncer::kInvalidId) {
-      // All children of the node has been processed, delete the node and
-      // pop it off the stack.
-      dfs_sync_id_stack.pop();
-      // Do not delete the topmost node.
-      if (sync_node_id != topmost_sync_id) {
-        RemoveOneSyncNode(&node, associator);
-        num_removed++;
-      } else {
-        // if we are processing topmost node, all other nodes must be processed
-        // the stack should be empty.
-        DCHECK(dfs_sync_id_stack.empty());
-      }
-    } else {
-      int64_t child_id = node.GetFirstChildId();
-      if (child_id != syncer::kInvalidId) {
-        dfs_sync_id_stack.push(child_id);
-      }
-    }
-  }
-  return num_removed;
-}
-
-// static
-void BookmarkChangeProcessor::RemoveOneSyncNode(
-    syncer::WriteNode* sync_node,
-    BookmarkModelAssociator* associator) {
-  // This node should have no children.
-  DCHECK(!sync_node->HasChildren());
-  // Remove association and delete the sync node.
-  associator->Disassociate(sync_node->GetId());
-  sync_node->Tombstone();
-}
-
-void BookmarkChangeProcessor::CreateOrUpdateSyncNode(const BookmarkNode* node) {
-  if (!CanSyncNode(node)) {
-    NOTREACHED();
-    return;
-  }
-
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  int64_t sync_id = syncer::kInvalidId;
-  {
-    // Acquire a scoped write lock via a transaction.
-    syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version);
-    sync_id = model_associator_->GetSyncIdFromChromeId(node->id());
-    if (sync_id != syncer::kInvalidId) {
-      UpdateSyncNode(
-          node, bookmark_model_, &trans, model_associator_, error_handler());
-    } else {
-      const BookmarkNode* parent = node->parent();
-      int index = parent->GetIndexOf(node);
-      DCHECK_NE(-1, index);
-      sync_id = CreateSyncNode(parent, bookmark_model_, size_t{index}, &trans,
-                               model_associator_, error_handler());
-    }
-  }
-
-  if (syncer::kInvalidId != sync_id) {
-    // Siblings of added node in sync DB will also be updated to reflect new
-    // PREV_ID/NEXT_ID and thus get a new version. But we only update version
-    // of added node here. After switching to ordinals for positioning,
-    // PREV_ID/NEXT_ID will be deprecated and siblings will not be updated.
-    UpdateTransactionVersion(new_version, bookmark_model_,
-                             std::vector<const BookmarkNode*>(1, node));
-  }
-}
-
-void BookmarkChangeProcessor::BookmarkModelLoaded(BookmarkModel* model,
-                                                  bool ids_reassigned) {
-  NOTREACHED();
-}
-
-void BookmarkChangeProcessor::BookmarkModelBeingDeleted(BookmarkModel* model) {
-  NOTREACHED();
-  bookmark_model_ = nullptr;
-}
-
-void BookmarkChangeProcessor::BookmarkNodeAdded(BookmarkModel* model,
-                                                const BookmarkNode* parent,
-                                                size_t index) {
-  DCHECK(share_handle());
-  const BookmarkNode* node = parent->children()[index].get();
-  if (CanSyncNode(node))
-    CreateOrUpdateSyncNode(node);
-}
-
-// static
-int64_t BookmarkChangeProcessor::CreateSyncNode(
-    const BookmarkNode* parent,
-    BookmarkModel* model,
-    size_t index,
-    syncer::WriteTransaction* trans,
-    BookmarkModelAssociator* associator,
-    syncer::DataTypeErrorHandler* error_handler) {
-  const BookmarkNode* child = parent->children()[index].get();
-  DCHECK(child);
-
-  // Create a WriteNode container to hold the new node.
-  syncer::WriteNode sync_child(trans);
-
-  // Actually create the node with the appropriate initial position.
-  if (!PlaceSyncNode(CREATE, parent, index, trans, &sync_child, associator)) {
-    syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
-                            "Failed to create sync node.", syncer::BOOKMARKS);
-    error_handler->OnUnrecoverableError(error);
-    return syncer::kInvalidId;
-  }
-
-  UpdateSyncNodeProperties(child, model, &sync_child, error_handler);
-
-  // Associate the ID from the sync domain with the bookmark node, so that we
-  // can refer back to this item later.
-  associator->Associate(child, sync_child);
-
-  return sync_child.GetId();
-}
-
-void BookmarkChangeProcessor::OnWillRemoveBookmarks(BookmarkModel* model,
-                                                    const BookmarkNode* parent,
-                                                    size_t old_index,
-                                                    const BookmarkNode* node) {
-  if (CanSyncNode(node))
-    RemoveSyncNodeHierarchy(node);
-}
-
-void BookmarkChangeProcessor::BookmarkNodeRemoved(
-    BookmarkModel* model,
-    const BookmarkNode* parent,
-    size_t old_index,
-    const BookmarkNode* node,
-    const std::set<GURL>& no_longer_bookmarked) {
-  // All the work should have already been done in OnWillRemoveBookmarks.
-  DCHECK_EQ(syncer::kInvalidId,
-            model_associator_->GetSyncIdFromChromeId(node->id()));
-}
-
-void BookmarkChangeProcessor::BookmarkAllUserNodesRemoved(
-    BookmarkModel* model,
-    const std::set<GURL>& removed_urls) {
-  RemoveAllSyncNodes();
-}
-
-void BookmarkChangeProcessor::BookmarkNodeChanged(BookmarkModel* model,
-                                                  const BookmarkNode* node) {
-  if (!CanSyncNode(node))
-    return;
-  // We shouldn't see changes to the top-level nodes.
-  if (model->is_permanent_node(node)) {
-    NOTREACHED() << "Saw update to permanent node!";
-    return;
-  }
-  CreateOrUpdateSyncNode(node);
-}
-
-// Static.
-int64_t BookmarkChangeProcessor::UpdateSyncNode(
-    const BookmarkNode* node,
-    BookmarkModel* model,
-    syncer::WriteTransaction* trans,
-    BookmarkModelAssociator* associator,
-    syncer::DataTypeErrorHandler* error_handler) {
-  // Lookup the sync node that's associated with |node|.
-  syncer::WriteNode sync_node(trans);
-  if (!associator->InitSyncNodeFromChromeId(node->id(), &sync_node)) {
-    syncer::SyncError error(FROM_HERE,
-                            syncer::SyncError::DATATYPE_ERROR,
-                            "Failed to init sync node from chrome node",
-                            syncer::BOOKMARKS);
-    error_handler->OnUnrecoverableError(error);
-    return syncer::kInvalidId;
-  }
-  UpdateSyncNodeProperties(node, model, &sync_node, error_handler);
-  DCHECK_EQ(sync_node.GetIsFolder(), node->is_folder());
-  DCHECK_EQ(associator->GetChromeNodeFromSyncId(sync_node.GetParentId()),
-            node->parent());
-  DCHECK_EQ(node->parent()->GetIndexOf(node), sync_node.GetPositionIndex());
-  return sync_node.GetId();
-}
-
-void BookmarkChangeProcessor::BookmarkMetaInfoChanged(
-    BookmarkModel* model, const BookmarkNode* node) {
-  BookmarkNodeChanged(model, node);
-}
-
-void BookmarkChangeProcessor::BookmarkNodeMoved(BookmarkModel* model,
-                                                const BookmarkNode* old_parent,
-                                                size_t old_index,
-                                                const BookmarkNode* new_parent,
-                                                size_t new_index) {
-  const BookmarkNode* child = new_parent->children()[new_index].get();
-
-  if (!CanSyncNode(child))
-    return;
-
-  // We shouldn't see changes to the top-level nodes.
-  if (model->is_permanent_node(child)) {
-    NOTREACHED() << "Saw update to permanent node!";
-    return;
-  }
-
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  {
-    // Acquire a scoped write lock via a transaction.
-    syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version);
-
-    // Lookup the sync node that's associated with |child|.
-    syncer::WriteNode sync_node(&trans);
-    if (!model_associator_->InitSyncNodeFromChromeId(child->id(), &sync_node)) {
-      syncer::SyncError error(FROM_HERE,
-                              syncer::SyncError::DATATYPE_ERROR,
-                              "Failed to init sync node from chrome node",
-                              syncer::BOOKMARKS);
-      error_handler()->OnUnrecoverableError(error);
-      return;
-    }
-
-    if (!PlaceSyncNode(MOVE, new_parent, new_index, &trans, &sync_node,
-                       model_associator_)) {
-      syncer::SyncError error(FROM_HERE,
-                              syncer::SyncError::DATATYPE_ERROR,
-                              "Failed to place sync node",
-                              syncer::BOOKMARKS);
-      error_handler()->OnUnrecoverableError(error);
-      return;
-    }
-  }
-
-  UpdateTransactionVersion(new_version, model,
-                           std::vector<const BookmarkNode*>(1, child));
-}
-
-void BookmarkChangeProcessor::BookmarkNodeFaviconChanged(
-    BookmarkModel* model,
-    const BookmarkNode* node) {
-  if (!CanSyncNode(node)) {
-    return;
-  }
-
-  // We shouldn't see changes to the top-level nodes.
-  if (model->is_permanent_node(node)) {
-    NOTREACHED() << "Saw Favicon update to permanent node!";
-    return;
-  }
-
-  // Ignore favicons that are being loaded.
-  if (!node->is_favicon_loaded()) {
-    // Sutble way to trigger a load of the favicon.
-    model->GetFavicon(node);
-    return;
-  }
-
-  // Ignore updates to favicon if model associator doesn't know about this
-  // bookmark node.
-  if (model_associator_->GetSyncIdFromChromeId(node->id()) ==
-      syncer::kInvalidId) {
-    return;
-  }
-
-  CreateOrUpdateSyncNode(node);
-}
-
-void BookmarkChangeProcessor::BookmarkNodeChildrenReordered(
-    BookmarkModel* model, const BookmarkNode* node) {
-  if (!CanSyncNode(node))
-    return;
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  std::vector<const BookmarkNode*> children;
-  {
-    // Acquire a scoped write lock via a transaction.
-    syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version);
-
-    // The given node's children got reordered. We need to reorder all the
-    // children of the corresponding sync node.
-    for (size_t i = 0; i < node->children().size(); ++i) {
-      const BookmarkNode* child = node->children()[i].get();
-      children.push_back(child);
-
-      syncer::WriteNode sync_child(&trans);
-      if (!model_associator_->InitSyncNodeFromChromeId(child->id(),
-                                                       &sync_child)) {
-        syncer::SyncError error(FROM_HERE,
-                                syncer::SyncError::DATATYPE_ERROR,
-                                "Failed to init sync node from chrome node",
-                                syncer::BOOKMARKS);
-        error_handler()->OnUnrecoverableError(error);
-        return;
-      }
-      DCHECK_EQ(sync_child.GetParentId(),
-                model_associator_->GetSyncIdFromChromeId(node->id()));
-
-      if (!PlaceSyncNode(MOVE, node, i, &trans, &sync_child,
-                         model_associator_)) {
-        syncer::SyncError error(FROM_HERE,
-                                syncer::SyncError::DATATYPE_ERROR,
-                                "Failed to place sync node",
-                                syncer::BOOKMARKS);
-        error_handler()->OnUnrecoverableError(error);
-        return;
-      }
-    }
-  }
-
-  // TODO(haitaol): Filter out children that didn't actually change.
-  UpdateTransactionVersion(new_version, model, children);
-}
-
-// static
-bool BookmarkChangeProcessor::PlaceSyncNode(
-    MoveOrCreate operation,
-    const BookmarkNode* parent,
-    size_t index,
-    syncer::WriteTransaction* trans,
-    syncer::WriteNode* dst,
-    BookmarkModelAssociator* associator) {
-  syncer::ReadNode sync_parent(trans);
-  if (!associator->InitSyncNodeFromChromeId(parent->id(), &sync_parent)) {
-    LOG(WARNING) << "Parent lookup failed";
-    return false;
-  }
-
-  bool success = false;
-  if (index == 0) {
-    // Insert into first position.
-    success = (operation == CREATE)
-                  ? dst->InitBookmarkByCreation(sync_parent, nullptr)
-                  : dst->SetPosition(sync_parent, nullptr);
-    if (success) {
-      DCHECK_EQ(dst->GetParentId(), sync_parent.GetId());
-      DCHECK_EQ(dst->GetId(), sync_parent.GetFirstChildId());
-      DCHECK_EQ(dst->GetPredecessorId(), syncer::kInvalidId);
-    }
-  } else {
-    // Find the bookmark model predecessor, and insert after it.
-    const BookmarkNode* prev = parent->children()[index - 1].get();
-    syncer::ReadNode sync_prev(trans);
-    if (!associator->InitSyncNodeFromChromeId(prev->id(), &sync_prev)) {
-      LOG(WARNING) << "Predecessor lookup failed";
-      return false;
-    }
-    success = (operation == CREATE) ?
-        dst->InitBookmarkByCreation(sync_parent, &sync_prev) :
-        dst->SetPosition(sync_parent, &sync_prev);
-    if (success) {
-      DCHECK_EQ(dst->GetParentId(), sync_parent.GetId());
-      DCHECK_EQ(dst->GetPredecessorId(), sync_prev.GetId());
-      DCHECK_EQ(dst->GetId(), sync_prev.GetSuccessorId());
-    }
-  }
-  return success;
-}
-
-// ApplyModelChanges is called by the sync backend after changes have been made
-// to the sync engine's model.  Apply these changes to the browser bookmark
-// model.
-void BookmarkChangeProcessor::ApplyChangesFromSyncModel(
-    const syncer::BaseTransaction* trans,
-    int64_t model_version,
-    const syncer::ImmutableChangeRecordList& changes) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
-  // A note about ordering.  Sync backend is responsible for ordering the change
-  // records in the following order:
-  //
-  // 1. Deletions, from leaves up to parents.
-  // 2. Existing items with synced parents & predecessors.
-  // 3. New items with synced parents & predecessors.
-  // 4. Items with parents & predecessors in the list.
-  // 5. Repeat #4 until all items are in the list.
-  //
-  // "Predecessor" here means the previous item within a given folder; an item
-  // in the first position is always said to have a synced predecessor.
-  // For the most part, applying these changes in the order given will yield
-  // the correct result.  There is one exception, however: for items that are
-  // moved away from a folder that is being deleted, we will process the delete
-  // before the move.  Since deletions in the bookmark model propagate from
-  // parent to child, we must move them to a temporary location.
-  BookmarkModel* model = bookmark_model_;
-
-  // We are going to make changes to the bookmarks model, but don't want to end
-  // up in a feedback loop, so remove ourselves as an observer while applying
-  // changes.
-  model->RemoveObserver(this);
-
-  // Changes made to the bookmark model due to sync should not be undoable.
-  ScopedSuspendBookmarkUndo suspend_undo(
-      model_associator_->GetBookmarkUndoService());
-
-  // Notify UI intensive observers of BookmarkModel that we are about to make
-  // potentially significant changes to it, so the updates may be batched. For
-  // example, on Mac, the bookmarks bar displays animations when bookmark items
-  // are added or deleted.
-  model->BeginExtensiveChanges();
-
-  // A parent to hold nodes temporarily orphaned by parent deletion.  It is
-  // created only if it is needed.
-  const BookmarkNode* foster_parent = nullptr;
-
-  // Iterate over the deletions, which are always at the front of the list.
-  ChangeRecordList::const_iterator it;
-  for (it = changes.Get().begin();
-       it != changes.Get().end() && it->action == ChangeRecord::ACTION_DELETE;
-       ++it) {
-    const BookmarkNode* dst =
-        model_associator_->GetChromeNodeFromSyncId(it->id);
-
-    // Ignore changes to the permanent top-level nodes.  We only care about
-    // their children.
-    if (model->is_permanent_node(dst))
-      continue;
-
-    // Can't do anything if we can't find the chrome node.
-    if (!dst)
-      continue;
-
-    // Children of a deleted node should not be deleted; they may be
-    // reparented by a later change record.  Move them to a temporary place.
-    if (!dst->children().empty()) {
-      if (!foster_parent) {
-        foster_parent = model->AddFolder(model->other_node(),
-                                         model->other_node()->children().size(),
-                                         base::string16());
-        if (!foster_parent) {
-          syncer::SyncError error(FROM_HERE,
-                                  syncer::SyncError::DATATYPE_ERROR,
-                                  "Failed to create foster parent",
-                                  syncer::BOOKMARKS);
-          error_handler()->OnUnrecoverableError(error);
-          return;
-        }
-      }
-      while (!dst->children().empty()) {
-        model->Move(dst->children().back().get(), foster_parent,
-                    foster_parent->children().size());
-      }
-    }
-
-    model_associator_->Disassociate(it->id);
-
-    const BookmarkNode* parent = dst->parent();
-    int index = parent->GetIndexOf(dst);
-    if (index > -1)
-      model->Remove(parent->children()[size_t{index}].get());
-  }
-
-  // A map to keep track of some reordering work we defer until later.
-  std::multimap<int, const BookmarkNode*> to_reposition;
-
-  syncer::ReadNode synced_bookmarks(trans);
-  int64_t synced_bookmarks_id = syncer::kInvalidId;
-  if (synced_bookmarks.InitByTagLookupForBookmarks(kMobileBookmarksTag) ==
-      syncer::BaseNode::INIT_OK) {
-    synced_bookmarks_id = synced_bookmarks.GetId();
-  }
-
-  // Continue iterating where the previous loop left off.
-  for ( ; it != changes.Get().end(); ++it) {
-    const BookmarkNode* dst =
-        model_associator_->GetChromeNodeFromSyncId(it->id);
-
-    // Ignore changes to the permanent top-level nodes.  We only care about
-    // their children.
-    if (model->is_permanent_node(dst))
-      continue;
-
-    // Because the Synced Bookmarks node can be created server side, it's
-    // possible it'll arrive at the client as an update. In that case it won't
-    // have been associated at startup, the GetChromeNodeFromSyncId call above
-    // will return null, and we won't detect it as a permanent node, resulting
-    // in us trying to create it here (which will fail). Therefore, we add
-    // special logic here just to detect the Synced Bookmarks folder.
-    if (synced_bookmarks_id != syncer::kInvalidId &&
-        it->id == synced_bookmarks_id) {
-      // This is a newly created Synced Bookmarks node. Associate it.
-      model_associator_->Associate(model->mobile_node(), synced_bookmarks);
-      continue;
-    }
-
-    DCHECK_NE(it->action, ChangeRecord::ACTION_DELETE)
-        << "We should have passed all deletes by this point.";
-
-    syncer::ReadNode src(trans);
-    if (src.InitByIdLookup(it->id) != syncer::BaseNode::INIT_OK) {
-      syncer::SyncError error(FROM_HERE,
-                              syncer::SyncError::DATATYPE_ERROR,
-                              "Failed to load sync node",
-                              syncer::BOOKMARKS);
-      error_handler()->OnUnrecoverableError(error);
-      return;
-    }
-
-    const BookmarkNode* parent =
-        model_associator_->GetChromeNodeFromSyncId(src.GetParentId());
-    if (!parent) {
-      LOG(ERROR) << "Could not find parent of node being added/updated."
-        << " Node title: " << src.GetTitle()
-        << ", parent id = " << src.GetParentId();
-      continue;
-    }
-
-    if (dst) {
-      DCHECK(it->action == ChangeRecord::ACTION_UPDATE)
-          << "ACTION_UPDATE should be seen if and only if the node is known.";
-      UpdateBookmarkWithSyncData(src, model, dst,
-                                 model_associator_->GetFaviconService());
-
-      // Move all modified entries to the right.  We'll fix it later.
-      model->Move(dst, parent, parent->children().size());
-    } else {
-      DCHECK(it->action == ChangeRecord::ACTION_ADD)
-          << "ACTION_ADD should be seen if and only if the node is unknown.";
-
-      dst = CreateBookmarkNode(&src, parent, model,
-                               model_associator_->GetFaviconService(),
-                               parent->children().size());
-      if (!dst) {
-        // We ignore bookmarks we can't add. Chances are this is caused by
-        // a bookmark that was not fully associated.
-        LOG(ERROR) << "Failed to create bookmark node with title "
-                   << src.GetTitle() + " and url "
-                   << src.GetBookmarkSpecifics().url();
-        continue;
-      }
-      model_associator_->Associate(dst, src);
-    }
-
-    to_reposition.insert(std::make_pair(src.GetPositionIndex(), dst));
-    bookmark_model_->SetNodeSyncTransactionVersion(dst, model_version);
-  }
-
-  // When we added or updated bookmarks in the previous loop, we placed them to
-  // the far right position.  Now we iterate over all these modified items in
-  // sync order, left to right, moving them into their proper positions.
-  for (auto it = to_reposition.begin(); it != to_reposition.end(); ++it) {
-    const BookmarkNode* parent = it->second->parent();
-    model->Move(it->second, parent, size_t{it->first});
-  }
-
-  // Clean up the temporary node.
-  if (foster_parent) {
-    // There should be no nodes left under the foster parent.
-    DCHECK(foster_parent->children().empty());
-    model->Remove(foster_parent);
-    foster_parent = nullptr;
-  }
-
-  // Notify UI intensive observers of BookmarkModel that all updates have been
-  // applied, and that they may now be consumed. This prevents issues like the
-  // one described in crbug.com/281562, where old and new items on the bookmarks
-  // bar would overlap.
-  model->EndExtensiveChanges();
-
-  // We are now ready to hear about bookmarks changes again.
-  model->AddObserver(this);
-
-  // All changes are applied in bookmark model. Set transaction version on
-  // bookmark model to mark as synced.
-  model->SetNodeSyncTransactionVersion(model->root_node(), model_version);
-}
-
-// Static.
-// Update a bookmark node with specified sync data.
-void BookmarkChangeProcessor::UpdateBookmarkWithSyncData(
-    const syncer::BaseNode& sync_node,
-    BookmarkModel* model,
-    const BookmarkNode* node,
-    favicon::FaviconService* favicon_service) {
-  DCHECK_EQ(sync_node.GetIsFolder(), node->is_folder());
-  const sync_pb::BookmarkSpecifics& specifics =
-      sync_node.GetBookmarkSpecifics();
-  if (!sync_node.GetIsFolder())
-    model->SetURL(node, GURL(specifics.url()));
-  model->SetTitle(node, base::UTF8ToUTF16(sync_node.GetTitle()));
-  if (specifics.has_creation_time_us()) {
-    model->SetDateAdded(
-        node,
-        base::Time::FromInternalValue(specifics.creation_time_us()));
-  }
-  SetBookmarkFavicon(&sync_node, node, favicon_service);
-  model->SetNodeMetaInfoMap(node, *GetBookmarkMetaInfo(&sync_node));
-}
-
-// static
-void BookmarkChangeProcessor::UpdateTransactionVersion(
-    int64_t new_version,
-    BookmarkModel* model,
-    const std::vector<const BookmarkNode*>& nodes) {
-  if (new_version != syncer::syncable::kInvalidTransactionVersion) {
-    model->SetNodeSyncTransactionVersion(model->root_node(), new_version);
-    for (size_t i = 0; i < nodes.size(); ++i) {
-      model->SetNodeSyncTransactionVersion(nodes[i], new_version);
-    }
-  }
-}
-
-// static
-// Creates a bookmark node under the given parent node from the given sync
-// node. Returns the newly created node.
-const BookmarkNode* BookmarkChangeProcessor::CreateBookmarkNode(
-    const syncer::BaseNode* sync_node,
-    const BookmarkNode* parent,
-    BookmarkModel* model,
-    favicon::FaviconService* favicon_service,
-    size_t index) {
-  return CreateBookmarkNode(base::UTF8ToUTF16(sync_node->GetTitle()),
-                            GURL(sync_node->GetBookmarkSpecifics().url()),
-                            sync_node, parent, model, favicon_service, index);
-}
-
-// static
-// Creates a bookmark node under the given parent node from the given sync
-// node. Returns the newly created node.
-const BookmarkNode* BookmarkChangeProcessor::CreateBookmarkNode(
-    const base::string16& title,
-    const GURL& url,
-    const syncer::BaseNode* sync_node,
-    const BookmarkNode* parent,
-    BookmarkModel* model,
-    favicon::FaviconService* favicon_service,
-    size_t index) {
-  DCHECK(parent);
-
-  const BookmarkNode* node;
-  if (sync_node->GetIsFolder()) {
-    node = model->AddFolder(parent, index, title,
-                            GetBookmarkMetaInfo(sync_node).get());
-  } else {
-    // 'creation_time_us' was added in m24. Assume a time of 0 means now.
-    const sync_pb::BookmarkSpecifics& specifics =
-        sync_node->GetBookmarkSpecifics();
-    const int64_t create_time_internal = specifics.creation_time_us();
-    base::Time create_time = (create_time_internal == 0) ?
-        base::Time::Now() : base::Time::FromInternalValue(create_time_internal);
-    node = model->AddURL(parent, index, title, url,
-                         GetBookmarkMetaInfo(sync_node).get(), create_time);
-    if (node)
-      SetBookmarkFavicon(sync_node, node, favicon_service);
-  }
-
-  return node;
-}
-
-// static
-// Sets the favicon of the given bookmark node from the given sync node.
-void BookmarkChangeProcessor::SetBookmarkFavicon(
-    const syncer::BaseNode* sync_node,
-    const BookmarkNode* bookmark_node,
-    favicon::FaviconService* favicon_service) {
-  const sync_pb::BookmarkSpecifics& specifics =
-      sync_node->GetBookmarkSpecifics();
-  const std::string& icon_bytes_str = specifics.favicon();
-  scoped_refptr<base::RefCountedString> icon_bytes(
-      new base::RefCountedString());
-  icon_bytes->data().assign(icon_bytes_str);
-
-  ApplyBookmarkFavicon(bookmark_node, favicon_service,
-                       GURL(specifics.icon_url()), icon_bytes);
-}
-
-// static
-std::unique_ptr<BookmarkNode::MetaInfoMap>
-BookmarkChangeProcessor::GetBookmarkMetaInfo(
-    const syncer::BaseNode* sync_node) {
-  const sync_pb::BookmarkSpecifics& specifics =
-      sync_node->GetBookmarkSpecifics();
-  std::unique_ptr<BookmarkNode::MetaInfoMap> meta_info_map(
-      new BookmarkNode::MetaInfoMap);
-  for (int i = 0; i < specifics.meta_info_size(); ++i) {
-    (*meta_info_map)[specifics.meta_info(i).key()] =
-        specifics.meta_info(i).value();
-  }
-  // Verifies that all entries had unique keys.
-  DCHECK_EQ(static_cast<size_t>(specifics.meta_info_size()),
-            meta_info_map->size());
-  return meta_info_map;
-}
-
-// static
-void BookmarkChangeProcessor::SetSyncNodeMetaInfo(
-    const BookmarkNode* node,
-    syncer::WriteNode* sync_node) {
-  sync_pb::BookmarkSpecifics specifics = sync_node->GetBookmarkSpecifics();
-  const BookmarkNode::MetaInfoMap* meta_info_map = node->GetMetaInfoMap();
-
-  // Compare specifics meta info to node meta info before making the change.
-  // Please note that the original specifics meta info is unordered while
-  //  meta_info_map is ordered by key. Setting the meta info blindly into
-  // the specifics might cause an unnecessary change.
-  size_t size = meta_info_map ? meta_info_map->size() : 0;
-  if (static_cast<size_t>(specifics.meta_info_size()) == size) {
-    size_t index = 0;
-    for (; index < size; index++) {
-      const sync_pb::MetaInfo& meta_info = specifics.meta_info(index);
-      auto it = meta_info_map->find(meta_info.key());
-      if (it == meta_info_map->end() || it->second != meta_info.value()) {
-        // One of original meta info entries is missing in |meta_info_map| or
-        // different.
-        break;
-      }
-    }
-    if (index == size) {
-      // The original meta info from the sync model is already equivalent to
-      // |meta_info_map|.
-      return;
-    }
-  }
-
-  // Clear and reset meta info in bookmark specifics.
-  specifics.clear_meta_info();
-  if (meta_info_map) {
-    for (auto it = meta_info_map->begin(); it != meta_info_map->end(); ++it) {
-      sync_pb::MetaInfo* meta_info = specifics.add_meta_info();
-      meta_info->set_key(it->first);
-      meta_info->set_value(it->second);
-    }
-  }
-
-  sync_node->SetBookmarkSpecifics(specifics);
-}
-
-// static
-void BookmarkChangeProcessor::ApplyBookmarkFavicon(
-    const BookmarkNode* bookmark_node,
-    favicon::FaviconService* favicon_service,
-    const GURL& icon_url,
-    const scoped_refptr<base::RefCountedMemory>& bitmap_data) {
-  // Some tests use no services.
-  if (favicon_service == nullptr)
-    return;
-
-  favicon_service->AddPageNoVisitForBookmark(bookmark_node->url(),
-                                             bookmark_node->GetTitle());
-
-  GURL icon_url_to_use = icon_url;
-
-  if (icon_url.is_empty()) {
-    if (bitmap_data->size() == 0) {
-      // Empty icon URL and no bitmap data means no icon mapping.
-      favicon_service->DeleteFaviconMappings({bookmark_node->url()},
-                                             favicon_base::IconType::kFavicon);
-      return;
-    } else {
-      // Ancient clients (prior to M25) may not be syncing the favicon URL. If
-      // the icon URL is not synced, use the page URL as a fake icon URL as it
-      // is guaranteed to be unique.
-      icon_url_to_use = bookmark_node->url();
-    }
-  }
-
-  // The client may have cached the favicon at 2x. Use MergeFavicon() as not to
-  // overwrite the cached 2x favicon bitmap. Sync favicons are always
-  // gfx::kFaviconSize in width and height. Store the favicon into history
-  // as such.
-  gfx::Size pixel_size(gfx::kFaviconSize, gfx::kFaviconSize);
-  favicon_service->MergeFavicon(bookmark_node->url(), icon_url_to_use,
-                                favicon_base::IconType::kFavicon, bitmap_data,
-                                pixel_size);
-}
-
-// static
-void BookmarkChangeProcessor::SetSyncNodeFavicon(
-    const BookmarkNode* bookmark_node,
-    BookmarkModel* model,
-    syncer::WriteNode* sync_node) {
-  scoped_refptr<base::RefCountedMemory> favicon_bytes(nullptr);
-  EncodeFavicon(bookmark_node, model, &favicon_bytes);
-  sync_pb::BookmarkSpecifics updated_specifics(
-      sync_node->GetBookmarkSpecifics());
-
-  if (favicon_bytes.get() && favicon_bytes->size()) {
-    updated_specifics.set_favicon(favicon_bytes->front(),
-                                  favicon_bytes->size());
-    updated_specifics.set_icon_url(bookmark_node->icon_url()
-                                       ? bookmark_node->icon_url()->spec()
-                                       : std::string());
-  } else {
-    updated_specifics.clear_favicon();
-    updated_specifics.clear_icon_url();
-  }
-
-  sync_node->SetBookmarkSpecifics(updated_specifics);
-}
-
-bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) {
-  return bookmark_model_->client()->CanSyncNode(node);
-}
-
-}  // namespace sync_bookmarks
diff --git a/components/sync_bookmarks/bookmark_change_processor.h b/components/sync_bookmarks/bookmark_change_processor.h
deleted file mode 100644
index ab33d10..0000000
--- a/components/sync_bookmarks/bookmark_change_processor.h
+++ /dev/null
@@ -1,255 +0,0 @@
-// Copyright (c) 2012 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 COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_
-#define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <set>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "base/sequence_checker.h"
-#include "components/bookmarks/browser/bookmark_model_observer.h"
-#include "components/bookmarks/browser/bookmark_node.h"
-#include "components/sync/model/change_processor.h"
-#include "components/sync/model/data_type_error_handler.h"
-#include "components/sync_bookmarks/bookmark_model_associator.h"
-
-namespace base {
-class RefCountedMemory;
-}  // namespace base
-
-namespace syncer {
-class WriteNode;
-class WriteTransaction;
-}  // namespace syncer
-
-namespace favicon {
-class FaviconService;
-}  // namespace favicon
-
-namespace sync_bookmarks {
-
-// This class is responsible for taking changes from the BookmarkModel
-// and applying them to the sync API 'syncable' model, and vice versa.
-// All operations and use of this class are from the UI thread.
-// This is currently bookmarks specific.
-class BookmarkChangeProcessor : public bookmarks::BookmarkModelObserver,
-                                public syncer::ChangeProcessor {
- public:
-  BookmarkChangeProcessor(
-      BookmarkModelAssociator* model_associator,
-      std::unique_ptr<syncer::DataTypeErrorHandler> error_handler);
-  ~BookmarkChangeProcessor() override;
-
-  // bookmarks::BookmarkModelObserver:
-  // BookmarkModel -> sync API model change application.
-  void BookmarkModelLoaded(bookmarks::BookmarkModel* model,
-                           bool ids_reassigned) override;
-  void BookmarkModelBeingDeleted(bookmarks::BookmarkModel* model) override;
-  void BookmarkNodeMoved(bookmarks::BookmarkModel* model,
-                         const bookmarks::BookmarkNode* old_parent,
-                         size_t old_index,
-                         const bookmarks::BookmarkNode* new_parent,
-                         size_t new_index) override;
-  void BookmarkNodeAdded(bookmarks::BookmarkModel* model,
-                         const bookmarks::BookmarkNode* parent,
-                         size_t index) override;
-  void OnWillRemoveBookmarks(bookmarks::BookmarkModel* model,
-                             const bookmarks::BookmarkNode* parent,
-                             size_t old_index,
-                             const bookmarks::BookmarkNode* node) override;
-  void BookmarkNodeRemoved(bookmarks::BookmarkModel* model,
-                           const bookmarks::BookmarkNode* parent,
-                           size_t old_index,
-                           const bookmarks::BookmarkNode* node,
-                           const std::set<GURL>& no_longer_bookmarked) override;
-  void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model,
-                                   const std::set<GURL>& removed_urls) override;
-  void BookmarkNodeChanged(bookmarks::BookmarkModel* model,
-                           const bookmarks::BookmarkNode* node) override;
-  void BookmarkMetaInfoChanged(bookmarks::BookmarkModel* model,
-                               const bookmarks::BookmarkNode* node) override;
-  void BookmarkNodeFaviconChanged(bookmarks::BookmarkModel* model,
-                                  const bookmarks::BookmarkNode* node) override;
-  void BookmarkNodeChildrenReordered(
-      bookmarks::BookmarkModel* model,
-      const bookmarks::BookmarkNode* node) override;
-
-  // The change processor implementation, responsible for applying changes from
-  // the sync model to the bookmarks model.
-  void ApplyChangesFromSyncModel(
-      const syncer::BaseTransaction* trans,
-      int64_t model_version,
-      const syncer::ImmutableChangeRecordList& changes) override;
-
-  // The following methods are static and hence may be invoked at any time, and
-  // do not depend on having a running ChangeProcessor.
-  // TODO(stanisc): considier refactoring these methods out of this class.
-
-  // Updates the title, URL, creation time and favicon of the bookmark |node|
-  // with data taken from the |sync_node| sync node.
-  static void UpdateBookmarkWithSyncData(
-      const syncer::BaseNode& sync_node,
-      bookmarks::BookmarkModel* model,
-      const bookmarks::BookmarkNode* node,
-      favicon::FaviconService* favicon_service);
-
-  // Creates a bookmark node under the given parent node from the given sync
-  // node. Returns the newly created node.  The created node is placed at the
-  // specified index among the parent's children.
-  static const bookmarks::BookmarkNode* CreateBookmarkNode(
-      const syncer::BaseNode* sync_node,
-      const bookmarks::BookmarkNode* parent,
-      bookmarks::BookmarkModel* model,
-      favicon::FaviconService* favicon_service,
-      size_t index);
-
-  // Overload of CreateBookmarkNode function above that helps to avoid
-  // converting / parsing the bookmark title and URL multiple times.
-  static const bookmarks::BookmarkNode* CreateBookmarkNode(
-      const base::string16& title,
-      const GURL& url,
-      const syncer::BaseNode* sync_node,
-      const bookmarks::BookmarkNode* parent,
-      bookmarks::BookmarkModel* model,
-      favicon::FaviconService* favicon_service,
-      size_t index);
-
-  // Sets the favicon of the given bookmark node from the given sync node.
-  static void SetBookmarkFavicon(const syncer::BaseNode* sync_node,
-                                 const bookmarks::BookmarkNode* bookmark_node,
-                                 favicon::FaviconService* favicon_service);
-
-  // Applies the 1x favicon |bitmap_data| and |icon_url| to |bookmark_node|.
-  // |profile| is the profile that contains the HistoryService and BookmarkModel
-  // for the bookmark in question.
-  static void ApplyBookmarkFavicon(
-      const bookmarks::BookmarkNode* bookmark_node,
-      favicon::FaviconService* favicon_service,
-      const GURL& icon_url,
-      const scoped_refptr<base::RefCountedMemory>& bitmap_data);
-
-  // Sets the favicon of the given sync node from the given bookmark node.
-  static void SetSyncNodeFavicon(const bookmarks::BookmarkNode* bookmark_node,
-                                 bookmarks::BookmarkModel* model,
-                                 syncer::WriteNode* sync_node);
-
-  // Treat the |index|th child of |parent| as a newly added node, and create a
-  // corresponding node in the sync domain using |trans|.  All properties
-  // will be transferred to the new node.  A node corresponding to |parent|
-  // must already exist and be associated for this call to succeed.  Returns
-  // the ID of the just-created node, or if creation fails, kInvalidID.
-  static int64_t CreateSyncNode(const bookmarks::BookmarkNode* parent,
-                                bookmarks::BookmarkModel* model,
-                                size_t index,
-                                syncer::WriteTransaction* trans,
-                                BookmarkModelAssociator* associator,
-                                syncer::DataTypeErrorHandler* error_handler);
-
-  // Update |bookmark_node|'s sync node.
-  static int64_t UpdateSyncNode(const bookmarks::BookmarkNode* bookmark_node,
-                                bookmarks::BookmarkModel* model,
-                                syncer::WriteTransaction* trans,
-                                BookmarkModelAssociator* associator,
-                                syncer::DataTypeErrorHandler* error_handler);
-
-  // Tombstone |topmost_sync_node| node and all its children in the sync domain
-  // using transaction |trans|. Returns the number of removed nodes.
-  static int RemoveSyncNodeHierarchy(syncer::WriteTransaction* trans,
-                                     syncer::WriteNode* topmost_sync_node,
-                                     BookmarkModelAssociator* associator);
-
-  // Update transaction version of |model| and |nodes| to |new_version| if
-  // it's valid.
-  static void UpdateTransactionVersion(
-      int64_t new_version,
-      bookmarks::BookmarkModel* model,
-      const std::vector<const bookmarks::BookmarkNode*>& nodes);
-
- protected:
-  void StartImpl() override;
-
- private:
-  enum MoveOrCreate {
-    MOVE,
-    CREATE,
-  };
-
-  // Retrieves the meta info from the given sync node.
-  static std::unique_ptr<bookmarks::BookmarkNode::MetaInfoMap>
-  GetBookmarkMetaInfo(const syncer::BaseNode* sync_node);
-
-  // Sets the meta info of the given sync node from the given bookmark node.
-  static void SetSyncNodeMetaInfo(const bookmarks::BookmarkNode* node,
-                                  syncer::WriteNode* sync_node);
-
-  // Helper function used to fix the position of a sync node so that it matches
-  // the position of a corresponding bookmark model node. |parent| and
-  // |index| identify the bookmark model position.  |dst| is the node whose
-  // position is to be fixed.  If |operation| is CREATE, treat |dst| as an
-  // uncreated node and set its position via InitByCreation(); otherwise,
-  // |dst| is treated as an existing node, and its position will be set via
-  // SetPosition().  |trans| is the transaction to which |dst| belongs. Returns
-  // false on failure.
-  static bool PlaceSyncNode(MoveOrCreate operation,
-                            const bookmarks::BookmarkNode* parent,
-                            size_t index,
-                            syncer::WriteTransaction* trans,
-                            syncer::WriteNode* dst,
-                            BookmarkModelAssociator* associator);
-
-  // Copy properties (but not position) from |src| to |dst|.
-  static void UpdateSyncNodeProperties(
-      const bookmarks::BookmarkNode* src,
-      bookmarks::BookmarkModel* model,
-      syncer::WriteNode* dst,
-      syncer::DataTypeErrorHandler* error_handler);
-
-  // Helper function to encode a bookmark's favicon into raw PNG data.
-  static void EncodeFavicon(const bookmarks::BookmarkNode* src,
-                            bookmarks::BookmarkModel* model,
-                            scoped_refptr<base::RefCountedMemory>* dst);
-
-  // Remove all sync nodes, except the permanent nodes.
-  void RemoveAllSyncNodes();
-
-  // Remove all the sync nodes associated with |node| and its children.
-  void RemoveSyncNodeHierarchy(const bookmarks::BookmarkNode* node);
-
-  // Remove all children of |sync_node|. Returns the number of removed
-  // children.
-  static int RemoveAllChildNodes(syncer::WriteTransaction* trans,
-                                 int64_t sync_id,
-                                 BookmarkModelAssociator* associator);
-
-  // Remove |sync_node|. It should not have any children.
-  static void RemoveOneSyncNode(syncer::WriteNode* sync_node,
-                                BookmarkModelAssociator* associator);
-
-  // Creates or updates a sync node associated with |node|.
-  void CreateOrUpdateSyncNode(const bookmarks::BookmarkNode* node);
-
-  // Returns false if |node| should not be synced.
-  bool CanSyncNode(const bookmarks::BookmarkNode* node);
-
-  SEQUENCE_CHECKER(sequence_checker_);
-
-  // The bookmark model we are processing changes from.  Non-null when
-  // |running_| is true.
-  bookmarks::BookmarkModel* bookmark_model_;
-
-  // The two models should be associated according to this ModelAssociator.
-  BookmarkModelAssociator* model_associator_;
-
-  DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor);
-};
-
-}  // namespace sync_bookmarks
-
-#endif  // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_
diff --git a/components/sync_bookmarks/bookmark_data_type_controller.cc b/components/sync_bookmarks/bookmark_data_type_controller.cc
deleted file mode 100644
index bac2613..0000000
--- a/components/sync_bookmarks/bookmark_data_type_controller.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2012 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 "components/sync_bookmarks/bookmark_data_type_controller.h"
-
-#include <utility>
-
-#include "base/metrics/histogram.h"
-#include "components/sync/driver/model_associator.h"
-#include "components/sync/driver/sync_api_component_factory.h"
-#include "components/sync/driver/sync_service.h"
-#include "components/sync/model/change_processor.h"
-
-using bookmarks::BookmarkModel;
-
-namespace sync_bookmarks {
-
-BookmarkDataTypeController::BookmarkDataTypeController(
-    const base::RepeatingClosure& dump_stack,
-    syncer::SyncService* sync_service,
-    bookmarks::BookmarkModel* bookmark_model,
-    history::HistoryService* history_service,
-    syncer::SyncApiComponentFactory* component_factory)
-    : syncer::FrontendDataTypeController(syncer::BOOKMARKS,
-                                         dump_stack,
-                                         sync_service),
-      bookmark_model_(bookmark_model),
-      history_service_(history_service),
-      component_factory_(component_factory) {}
-
-BookmarkDataTypeController::~BookmarkDataTypeController() {}
-
-bool BookmarkDataTypeController::StartModels() {
-  DCHECK(CalledOnValidThread());
-  if (!DependentsLoaded()) {
-    bookmark_model_observer_.Add(bookmark_model_);
-    history_service_observer_.Add(history_service_);
-    return false;
-  }
-  return true;
-}
-
-void BookmarkDataTypeController::CleanUpState() {
-  DCHECK(CalledOnValidThread());
-  history_service_observer_.RemoveAll();
-  bookmark_model_observer_.RemoveAll();
-}
-
-void BookmarkDataTypeController::CreateSyncComponents() {
-  DCHECK(CalledOnValidThread());
-  syncer::SyncApiComponentFactory::SyncComponents sync_components =
-      component_factory_->CreateBookmarkSyncComponents(
-          CreateErrorHandler(), sync_service()->GetUserShare());
-  set_model_associator(std::move(sync_components.model_associator));
-  set_change_processor(std::move(sync_components.change_processor));
-}
-
-void BookmarkDataTypeController::BookmarkModelChanged() {
-}
-
-void BookmarkDataTypeController::BookmarkModelLoaded(BookmarkModel* model,
-                                                     bool ids_reassigned) {
-  DCHECK(CalledOnValidThread());
-  DCHECK(model->loaded());
-  bookmark_model_observer_.RemoveAll();
-
-  if (!DependentsLoaded())
-    return;
-
-  history_service_observer_.RemoveAll();
-  OnModelLoaded();
-}
-
-void BookmarkDataTypeController::BookmarkModelBeingDeleted(
-    BookmarkModel* model) {
-  CleanUpState();
-}
-
-// Check that both the bookmark model and the history service (for favicons)
-// are loaded.
-bool BookmarkDataTypeController::DependentsLoaded() {
-  DCHECK(CalledOnValidThread());
-  if (!bookmark_model_ || !bookmark_model_->loaded())
-    return false;
-
-  if (!history_service_ || !history_service_->BackendLoaded())
-    return false;
-
-  // All necessary services are loaded.
-  return true;
-}
-
-void BookmarkDataTypeController::OnHistoryServiceLoaded(
-    history::HistoryService* service) {
-  DCHECK(CalledOnValidThread());
-  DCHECK_EQ(state_, MODEL_STARTING);
-  history_service_observer_.RemoveAll();
-
-  if (!DependentsLoaded())
-    return;
-
-  bookmark_model_observer_.RemoveAll();
-  OnModelLoaded();
-}
-
-void BookmarkDataTypeController::HistoryServiceBeingDeleted(
-    history::HistoryService* history_service) {
-  CleanUpState();
-}
-
-}  // namespace sync_bookmarks
diff --git a/components/sync_bookmarks/bookmark_data_type_controller.h b/components/sync_bookmarks/bookmark_data_type_controller.h
deleted file mode 100644
index 3433ef9..0000000
--- a/components/sync_bookmarks/bookmark_data_type_controller.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2012 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 COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_DATA_TYPE_CONTROLLER_H__
-#define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_DATA_TYPE_CONTROLLER_H__
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/scoped_observer.h"
-#include "components/bookmarks/browser/base_bookmark_model_observer.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/history/core/browser/history_service.h"
-#include "components/history/core/browser/history_service_observer.h"
-#include "components/sync/driver/frontend_data_type_controller.h"
-
-namespace syncer {
-class SyncApiComponentFactory;
-class SyncService;
-}  // namespace syncer
-
-namespace sync_bookmarks {
-
-// A class that manages the startup and shutdown of bookmark sync.
-class BookmarkDataTypeController : public syncer::FrontendDataTypeController,
-                                   public bookmarks::BaseBookmarkModelObserver,
-                                   public history::HistoryServiceObserver {
- public:
-  // |dump_stack| is called when an unrecoverable error occurs.
-  BookmarkDataTypeController(
-      const base::RepeatingClosure& dump_stack,
-      syncer::SyncService* sync_service,
-      bookmarks::BookmarkModel* bookmark_model,
-      history::HistoryService* history_service,
-      syncer::SyncApiComponentFactory* component_factory);
-  ~BookmarkDataTypeController() override;
-
- private:
-  // syncer::FrontendDataTypeController:
-  bool StartModels() override;
-  void CleanUpState() override;
-  void CreateSyncComponents() override;
-
-  // bookmarks::BaseBookmarkModelObserver:
-  void BookmarkModelChanged() override;
-  void BookmarkModelLoaded(bookmarks::BookmarkModel* model,
-                           bool ids_reassigned) override;
-  void BookmarkModelBeingDeleted(bookmarks::BookmarkModel* model) override;
-
-  // Helper that returns true iff both the bookmark model and the history
-  // service have finished loading.
-  bool DependentsLoaded();
-
-  // history::HistoryServiceObserver:
-  void OnHistoryServiceLoaded(history::HistoryService* service) override;
-  void HistoryServiceBeingDeleted(
-      history::HistoryService* history_service) override;
-
-  bookmarks::BookmarkModel* const bookmark_model_;
-  history::HistoryService* const history_service_;
-  syncer::SyncApiComponentFactory* const component_factory_;
-
-  ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
-      history_service_observer_{this};
-  ScopedObserver<bookmarks::BookmarkModel, bookmarks::BookmarkModelObserver>
-      bookmark_model_observer_{this};
-
-  DISALLOW_COPY_AND_ASSIGN(BookmarkDataTypeController);
-};
-
-}  // namespace sync_bookmarks
-
-#endif  // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_DATA_TYPE_CONTROLLER_H__
diff --git a/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc b/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc
deleted file mode 100644
index f1f4bbd..0000000
--- a/components/sync_bookmarks/bookmark_data_type_controller_unittest.cc
+++ /dev/null
@@ -1,300 +0,0 @@
-// Copyright (c) 2012 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 "components/sync_bookmarks/bookmark_data_type_controller.h"
-
-#include <memory>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback.h"
-#include "base/run_loop.h"
-#include "base/test/task_environment.h"
-#include "base/threading/sequenced_task_runner_handle.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/bookmarks/test/bookmark_test_helpers.h"
-#include "components/bookmarks/test/test_bookmark_client.h"
-#include "components/history/core/browser/history_service.h"
-#include "components/prefs/testing_pref_service.h"
-#include "components/sync/driver/configure_context.h"
-#include "components/sync/driver/data_type_controller_mock.h"
-#include "components/sync/driver/fake_sync_service.h"
-#include "components/sync/driver/model_associator_mock.h"
-#include "components/sync/driver/sync_api_component_factory_mock.h"
-#include "components/sync/model/change_processor_mock.h"
-#include "components/sync/model/sync_error.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using bookmarks::BookmarkModel;
-using sync_bookmarks::BookmarkDataTypeController;
-using syncer::ChangeProcessorMock;
-using syncer::DataTypeController;
-using syncer::ModelAssociatorMock;
-using syncer::ModelLoadCallbackMock;
-using syncer::StartCallbackMock;
-using testing::_;
-using testing::DoAll;
-using testing::InvokeWithoutArgs;
-using testing::NiceMock;
-using testing::Return;
-using testing::SetArgPointee;
-
-namespace {
-
-class HistoryMock : public history::HistoryService {
- public:
-  HistoryMock() : history::HistoryService() {}
-  MOCK_METHOD0(BackendLoaded, bool(void));
-
-  ~HistoryMock() override {}
-};
-
-}  // namespace
-
-class SyncBookmarkDataTypeControllerTest : public testing::Test {
- public:
-  SyncBookmarkDataTypeControllerTest() {}
-
-  void SetUp() override {
-    model_associator_deleter_ =
-        std::make_unique<NiceMock<ModelAssociatorMock>>();
-    change_processor_deleter_ =
-        std::make_unique<NiceMock<ChangeProcessorMock>>();
-    model_associator_ = model_associator_deleter_.get();
-    change_processor_ = change_processor_deleter_.get();
-    bookmark_model_ = std::make_unique<BookmarkModel>(
-        std::make_unique<bookmarks::TestBookmarkClient>());
-    history_service_ = std::make_unique<HistoryMock>();
-    bookmark_dtc_ = std::make_unique<BookmarkDataTypeController>(
-        base::DoNothing(), &service_, bookmark_model_.get(),
-        history_service_.get(), &components_factory_);
-
-    ON_CALL(components_factory_, CreateBookmarkSyncComponents(_, _))
-        .WillByDefault(testing::InvokeWithoutArgs([=]() {
-          syncer::SyncApiComponentFactory::SyncComponents components;
-          components.model_associator = std::move(model_associator_deleter_);
-          components.change_processor = std::move(change_processor_deleter_);
-          return components;
-        }));
-  }
-
- protected:
-  void LoadBookmarkModel() {
-    TestingPrefServiceSimple prefs;
-    bookmark_model_->Load(&prefs, base::FilePath(),
-                          base::SequencedTaskRunnerHandle::Get(),
-                          base::SequencedTaskRunnerHandle::Get());
-    bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_.get());
-  }
-
-  void SetStartExpectations() {
-    EXPECT_CALL(*history_service_.get(), BackendLoaded())
-        .WillRepeatedly(Return(true));
-    EXPECT_CALL(model_load_callback_, Run(_, _));
-  }
-
-  void SetAssociateExpectations() {
-    EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary()).
-        WillRepeatedly(Return(true));
-    EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-        .WillRepeatedly(DoAll(SetArgPointee<0>(true), Return(true)));
-    EXPECT_CALL(*model_associator_, AssociateModels(_, _)).
-        WillRepeatedly(Return(syncer::SyncError()));
-  }
-
-  void SetStopExpectations() {
-    EXPECT_CALL(*model_associator_, DisassociateModels()).
-                WillOnce(Return(syncer::SyncError()));
-  }
-
-  void Start() {
-    bookmark_dtc_->LoadModels(
-        syncer::ConfigureContext(),
-        base::Bind(&ModelLoadCallbackMock::Run,
-                   base::Unretained(&model_load_callback_)));
-    bookmark_dtc_->StartAssociating(
-        base::Bind(&StartCallbackMock::Run,
-                   base::Unretained(&start_callback_)));
-    base::RunLoop().RunUntilIdle();
-  }
-
-  void NotifyHistoryServiceLoaded() {
-    history_service_->NotifyHistoryServiceLoaded();
-  }
-
-  base::test::SingleThreadTaskEnvironment task_environment_;
-  testing::NiceMock<syncer::SyncApiComponentFactoryMock> components_factory_;
-  std::unique_ptr<BookmarkModel> bookmark_model_;
-  std::unique_ptr<HistoryMock> history_service_;
-  std::unique_ptr<BookmarkDataTypeController> bookmark_dtc_;
-  syncer::FakeSyncService service_;
-  ModelAssociatorMock* model_associator_;
-  ChangeProcessorMock* change_processor_;
-  std::unique_ptr<ModelAssociatorMock> model_associator_deleter_;
-  std::unique_ptr<ChangeProcessorMock> change_processor_deleter_;
-  StartCallbackMock start_callback_;
-  ModelLoadCallbackMock model_load_callback_;
-};
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartDependentsReady) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  SetAssociateExpectations();
-
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
-
-  EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _));
-  Start();
-  EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state());
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartBookmarkModelNotReady) {
-  SetStartExpectations();
-  SetAssociateExpectations();
-
-  EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _));
-  bookmark_dtc_->LoadModels(
-      syncer::ConfigureContext(),
-      base::Bind(&ModelLoadCallbackMock::Run,
-                 base::Unretained(&model_load_callback_)));
-  EXPECT_EQ(DataTypeController::MODEL_STARTING, bookmark_dtc_->state());
-
-  TestingPrefServiceSimple prefs;
-  bookmark_model_->Load(&prefs, base::FilePath(),
-                        base::SequencedTaskRunnerHandle::Get(),
-                        base::SequencedTaskRunnerHandle::Get());
-  bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_.get());
-  EXPECT_EQ(DataTypeController::MODEL_LOADED, bookmark_dtc_->state());
-
-  bookmark_dtc_->StartAssociating(
-      base::Bind(&StartCallbackMock::Run,
-                 base::Unretained(&start_callback_)));
-  base::RunLoop().RunUntilIdle();
-
-  EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state());
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartHistoryServiceNotReady) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  EXPECT_CALL(*history_service_.get(), BackendLoaded())
-      .WillRepeatedly(Return(false));
-
-  bookmark_dtc_->LoadModels(
-      syncer::ConfigureContext(),
-      base::Bind(&ModelLoadCallbackMock::Run,
-                 base::Unretained(&model_load_callback_)));
-
-  EXPECT_EQ(DataTypeController::MODEL_STARTING, bookmark_dtc_->state());
-  testing::Mock::VerifyAndClearExpectations(history_service_.get());
-  EXPECT_CALL(*history_service_.get(), BackendLoaded())
-      .WillRepeatedly(Return(true));
-
-  // Send the notification that the history service has finished loading the db.
-  NotifyHistoryServiceLoaded();
-  EXPECT_EQ(DataTypeController::MODEL_LOADED, bookmark_dtc_->state());
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartFirstRun) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  SetAssociateExpectations();
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillRepeatedly(DoAll(SetArgPointee<0>(false), Return(true)));
-  EXPECT_CALL(start_callback_, Run(DataTypeController::OK_FIRST_RUN, _, _));
-  Start();
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartBusy) {
-  LoadBookmarkModel();
-  EXPECT_CALL(*history_service_.get(), BackendLoaded())
-      .WillRepeatedly(Return(false));
-
-  EXPECT_CALL(model_load_callback_, Run(_, _));
-  bookmark_dtc_->LoadModels(
-      syncer::ConfigureContext(),
-      base::Bind(&ModelLoadCallbackMock::Run,
-                 base::Unretained(&model_load_callback_)));
-  bookmark_dtc_->LoadModels(
-      syncer::ConfigureContext(),
-      base::Bind(&ModelLoadCallbackMock::Run,
-                 base::Unretained(&model_load_callback_)));
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartOk) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  SetAssociateExpectations();
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillRepeatedly(DoAll(SetArgPointee<0>(true), Return(true)));
-
-  EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _));
-  Start();
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartAssociationFailed) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  // Set up association to fail.
-  EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary()).
-      WillRepeatedly(Return(true));
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillRepeatedly(DoAll(SetArgPointee<0>(true), Return(true)));
-  EXPECT_CALL(*model_associator_, AssociateModels(_, _)).
-      WillRepeatedly(Return(syncer::SyncError(FROM_HERE,
-                                              syncer::SyncError::DATATYPE_ERROR,
-                                              "error",
-                                              syncer::BOOKMARKS)));
-
-  EXPECT_CALL(start_callback_,
-              Run(DataTypeController::ASSOCIATION_FAILED, _, _));
-  Start();
-  EXPECT_EQ(DataTypeController::FAILED, bookmark_dtc_->state());
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest,
-       StartAssociationTriggersUnrecoverableError) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  // Set up association to fail with an unrecoverable error.
-  EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary()).
-      WillRepeatedly(Return(true));
-  EXPECT_CALL(*model_associator_, SyncModelHasUserCreatedNodes(_))
-      .WillRepeatedly(DoAll(SetArgPointee<0>(false), Return(false)));
-  EXPECT_CALL(start_callback_,
-              Run(DataTypeController::UNRECOVERABLE_ERROR, _, _));
-  Start();
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, StartAborted) {
-  LoadBookmarkModel();
-  EXPECT_CALL(*history_service_.get(), BackendLoaded())
-      .WillRepeatedly(Return(false));
-
-  bookmark_dtc_->LoadModels(
-      syncer::ConfigureContext(),
-      base::Bind(&ModelLoadCallbackMock::Run,
-                 base::Unretained(&model_load_callback_)));
-
-  bookmark_dtc_->Stop(syncer::STOP_SYNC);
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
-}
-
-TEST_F(SyncBookmarkDataTypeControllerTest, Stop) {
-  LoadBookmarkModel();
-  SetStartExpectations();
-  SetAssociateExpectations();
-  SetStopExpectations();
-
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
-
-  EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _, _));
-  Start();
-  EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state());
-  bookmark_dtc_->Stop(syncer::STOP_SYNC);
-  EXPECT_EQ(DataTypeController::NOT_RUNNING, bookmark_dtc_->state());
-}
diff --git a/components/sync_bookmarks/bookmark_model_associator.cc b/components/sync_bookmarks/bookmark_model_associator.cc
deleted file mode 100644
index b5aad348..0000000
--- a/components/sync_bookmarks/bookmark_model_associator.cc
+++ /dev/null
@@ -1,986 +0,0 @@
-// Copyright 2012 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 "components/sync_bookmarks/bookmark_model_associator.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/containers/adapters.h"
-#include "base/format_macros.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "components/bookmarks/browser/bookmark_client.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/sync/base/data_type_histogram.h"
-#include "components/sync/engine/engine_util.h"
-#include "components/sync/model/sync_error.h"
-#include "components/sync/model/sync_merge_result.h"
-#include "components/sync/nigori/cryptographer.h"
-#include "components/sync/syncable/delete_journal.h"
-#include "components/sync/syncable/entry.h"
-#include "components/sync/syncable/read_node.h"
-#include "components/sync/syncable/read_transaction.h"
-#include "components/sync/syncable/syncable_write_transaction.h"
-#include "components/sync/syncable/write_node.h"
-#include "components/sync/syncable/write_transaction.h"
-#include "components/sync_bookmarks/bookmark_change_processor.h"
-#include "components/undo/bookmark_undo_service.h"
-#include "components/undo/bookmark_undo_utils.h"
-
-using bookmarks::BookmarkModel;
-using bookmarks::BookmarkNode;
-
-namespace sync_bookmarks {
-
-// The sync protocol identifies top-level entities by means of well-known tags,
-// which should not be confused with titles.  Each tag corresponds to a
-// singleton instance of a particular top-level node in a user's share; the
-// tags are consistent across users. The tags allow us to locate the specific
-// folders whose contents we care about synchronizing, without having to do a
-// lookup by name or path.  The tags should not be made user-visible.
-// For example, the tag "bookmark_bar" represents the permanent node for
-// bookmarks bar in Chrome. The tag "other_bookmarks" represents the permanent
-// folder Other Bookmarks in Chrome.
-//
-// It is the responsibility of something upstream (at time of writing,
-// the sync server) to create these tagged nodes when initializing sync
-// for the first time for a user.  Thus, once the backend finishes
-// initializing, the ProfileSyncService can rely on the presence of tagged
-// nodes.
-//
-// TODO(ncarter): Pull these tags from an external protocol specification
-// rather than hardcoding them here.
-const char kBookmarkBarTag[] = "bookmark_bar";
-const char kMobileBookmarksTag[] = "synced_bookmarks";
-const char kOtherBookmarksTag[] = "other_bookmarks";
-
-// Maximum number of bytes to allow in a title (must match sync's internal
-// limits; see write_node.cc).
-const int kTitleLimitBytes = 255;
-
-// Provides the following abstraction: given a parent bookmark node, find best
-// matching child node for many sync nodes.
-class BookmarkNodeFinder {
- public:
-  // Creates an instance with the given parent bookmark node.
-  explicit BookmarkNodeFinder(const BookmarkNode* parent_node);
-
-  // Finds the bookmark node that matches the given url, title and folder
-  // attribute. Returns the matching node if one exists; null otherwise.
-  // If there are multiple matches then a node with ID matching |preferred_id|
-  // is returned; otherwise the first matching node is returned.
-  // If a matching node is found, it's removed for further matches.
-  const BookmarkNode* FindBookmarkNode(const GURL& url,
-                                       const std::string& title,
-                                       bool is_folder,
-                                       int64_t preferred_id);
-
-  // Returns true if |bookmark_node| matches the specified |url|,
-  // |title|, and |is_folder| flags.
-  static bool NodeMatches(const BookmarkNode* bookmark_node,
-                          const GURL& url,
-                          const std::string& title,
-                          bool is_folder);
-
- private:
-  // Maps bookmark node titles to instances, duplicates allowed.
-  // Titles are converted to the sync internal format before
-  // being used as keys for the map.
-  using BookmarkNodeMap = std::multimap<std::string, const BookmarkNode*>;
-  using BookmarkNodeRange =
-      std::pair<BookmarkNodeMap::iterator, BookmarkNodeMap::iterator>;
-
-  // Converts and truncates bookmark titles in the form sync does internally
-  // to avoid mismatches due to sync munging titles.
-  static void ConvertTitleToSyncInternalFormat(const std::string& input,
-                                               std::string* output);
-
-  const BookmarkNode* parent_node_;
-  BookmarkNodeMap child_nodes_;
-
-  DISALLOW_COPY_AND_ASSIGN(BookmarkNodeFinder);
-};
-
-class ScopedAssociationUpdater {
- public:
-  explicit ScopedAssociationUpdater(BookmarkModel* model) {
-    model_ = model;
-    model->BeginExtensiveChanges();
-  }
-
-  ~ScopedAssociationUpdater() {
-    model_->EndExtensiveChanges();
-  }
-
- private:
-  BookmarkModel* model_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScopedAssociationUpdater);
-};
-
-BookmarkNodeFinder::BookmarkNodeFinder(const BookmarkNode* parent_node)
-    : parent_node_(parent_node) {
-  for (const auto& child_node : parent_node_->children()) {
-    std::string title = base::UTF16ToUTF8(child_node->GetTitle());
-    ConvertTitleToSyncInternalFormat(title, &title);
-    child_nodes_.insert(std::make_pair(title, child_node.get()));
-  }
-}
-
-const BookmarkNode* BookmarkNodeFinder::FindBookmarkNode(
-    const GURL& url,
-    const std::string& title,
-    bool is_folder,
-    int64_t preferred_id) {
-  const BookmarkNode* match = nullptr;
-
-  // First lookup a range of bookmarks with the same title.
-  std::string adjusted_title;
-  ConvertTitleToSyncInternalFormat(title, &adjusted_title);
-  BookmarkNodeRange range = child_nodes_.equal_range(adjusted_title);
-  auto match_iter = range.second;
-  for (auto iter = range.first; iter != range.second; ++iter) {
-    // Then within the range match the node by the folder bit
-    // and the url.
-    const BookmarkNode* node = iter->second;
-    if (is_folder == node->is_folder() && url == node->url()) {
-      if (node->id() == preferred_id || preferred_id == 0) {
-        // Preferred match - use this node.
-        match = node;
-        match_iter = iter;
-        break;
-      } else if (match == nullptr) {
-        // First match - continue iterating.
-        match = node;
-        match_iter = iter;
-      }
-    }
-  }
-
-  if (match_iter != range.second) {
-    // Remove the matched node so we don't match with it again.
-    child_nodes_.erase(match_iter);
-  }
-
-  return match;
-}
-
-/* static */
-bool BookmarkNodeFinder::NodeMatches(const BookmarkNode* bookmark_node,
-                                     const GURL& url,
-                                     const std::string& title,
-                                     bool is_folder) {
-  if (url != bookmark_node->url() || is_folder != bookmark_node->is_folder()) {
-    return false;
-  }
-
-  // The title passed to this method comes from a sync directory entry.
-  // The following two lines are needed to make the native bookmark title
-  // comparable. The same conversion is used in BookmarkNodeFinder constructor.
-  std::string bookmark_title = base::UTF16ToUTF8(bookmark_node->GetTitle());
-  ConvertTitleToSyncInternalFormat(bookmark_title, &bookmark_title);
-  return title == bookmark_title;
-}
-
-/* static */
-void BookmarkNodeFinder::ConvertTitleToSyncInternalFormat(
-    const std::string& input, std::string* output) {
-  syncer::SyncAPINameToServerName(input, output);
-  base::TruncateUTF8ToByteSize(*output, kTitleLimitBytes, output);
-}
-
-BookmarkModelAssociator::Context::Context(
-    syncer::SyncMergeResult* local_merge_result,
-    syncer::SyncMergeResult* syncer_merge_result)
-    : local_merge_result_(local_merge_result),
-      syncer_merge_result_(syncer_merge_result),
-      duplicate_count_(0),
-      native_model_sync_state_(UNSET) {}
-
-BookmarkModelAssociator::Context::~Context() {
-}
-
-void BookmarkModelAssociator::Context::PushNode(int64_t sync_id) {
-  dfs_stack_.push(sync_id);
-}
-
-bool BookmarkModelAssociator::Context::PopNode(int64_t* sync_id) {
-  if (dfs_stack_.empty()) {
-    *sync_id = 0;
-    return false;
-  }
-  *sync_id = dfs_stack_.top();
-  dfs_stack_.pop();
-  return true;
-}
-
-void BookmarkModelAssociator::Context::SetPreAssociationVersions(
-    int64_t native_version,
-    int64_t sync_version) {
-  local_merge_result_->set_pre_association_version(native_version);
-  syncer_merge_result_->set_pre_association_version(sync_version);
-}
-
-void BookmarkModelAssociator::Context::SetNumItemsBeforeAssociation(
-    int local_num,
-    int sync_num) {
-  local_merge_result_->set_num_items_before_association(local_num);
-  syncer_merge_result_->set_num_items_before_association(sync_num);
-}
-
-void BookmarkModelAssociator::Context::SetNumItemsAfterAssociation(
-    int local_num,
-    int sync_num) {
-  local_merge_result_->set_num_items_after_association(local_num);
-  syncer_merge_result_->set_num_items_after_association(sync_num);
-}
-
-void BookmarkModelAssociator::Context::IncrementLocalItemsDeleted() {
-  local_merge_result_->set_num_items_deleted(
-      local_merge_result_->num_items_deleted() + 1);
-}
-
-void BookmarkModelAssociator::Context::IncrementLocalItemsAdded() {
-  local_merge_result_->set_num_items_added(
-      local_merge_result_->num_items_added() + 1);
-}
-
-void BookmarkModelAssociator::Context::IncrementLocalItemsModified() {
-  local_merge_result_->set_num_items_modified(
-      local_merge_result_->num_items_modified() + 1);
-}
-
-void BookmarkModelAssociator::Context::IncrementSyncItemsAdded() {
-  syncer_merge_result_->set_num_items_added(
-      syncer_merge_result_->num_items_added() + 1);
-}
-
-void BookmarkModelAssociator::Context::IncrementSyncItemsDeleted(int count) {
-  syncer_merge_result_->set_num_items_deleted(
-      syncer_merge_result_->num_items_deleted() + count);
-}
-
-void BookmarkModelAssociator::Context::UpdateDuplicateCount(
-    const base::string16& title,
-    const GURL& url) {
-  size_t bookmark_hash = base::Hash(title) ^ base::Hash(url.spec());
-  if (!hashes_.insert(bookmark_hash).second) {
-    // This hash code already exists in the set.
-    ++duplicate_count_;
-  }
-}
-
-void BookmarkModelAssociator::Context::AddBookmarkRoot(
-    const bookmarks::BookmarkNode* root) {
-  bookmark_roots_.push_back(root);
-}
-
-int64_t BookmarkModelAssociator::Context::GetSyncPreAssociationVersion() const {
-  return syncer_merge_result_->pre_association_version();
-}
-
-void BookmarkModelAssociator::Context::MarkForVersionUpdate(
-    const bookmarks::BookmarkNode* node) {
-  bookmarks_for_version_update_.push_back(node);
-}
-
-BookmarkModelAssociator::BookmarkModelAssociator(
-    BookmarkModel* bookmark_model,
-    BookmarkUndoService* bookmark_undo_service,
-    favicon::FaviconService* favicon_service,
-    syncer::UserShare* user_share,
-    std::unique_ptr<syncer::DataTypeErrorHandler> unrecoverable_error_handler,
-    bool expect_mobile_bookmarks_folder)
-    : bookmark_model_(bookmark_model),
-      bookmark_undo_service_(bookmark_undo_service),
-      favicon_service_(favicon_service),
-      user_share_(user_share),
-      unrecoverable_error_handler_(std::move(unrecoverable_error_handler)),
-      expect_mobile_bookmarks_folder_(expect_mobile_bookmarks_folder) {
-  DCHECK(bookmark_model_);
-  DCHECK(user_share_);
-  DCHECK(unrecoverable_error_handler_);
-}
-
-BookmarkModelAssociator::~BookmarkModelAssociator() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-}
-
-bookmarks::BookmarkModel* BookmarkModelAssociator::GetBookmarkModel() {
-  return bookmark_model_;
-}
-
-favicon::FaviconService* BookmarkModelAssociator::GetFaviconService() {
-  return favicon_service_;
-}
-
-BookmarkUndoService* BookmarkModelAssociator::GetBookmarkUndoService() {
-  return bookmark_undo_service_;
-}
-
-syncer::SyncError BookmarkModelAssociator::DisassociateModels() {
-  id_map_.clear();
-  id_map_inverse_.clear();
-  dirty_associations_sync_ids_.clear();
-  return syncer::SyncError();
-}
-
-int64_t BookmarkModelAssociator::GetSyncIdFromChromeId(const int64_t& node_id) {
-  BookmarkIdToSyncIdMap::const_iterator iter = id_map_.find(node_id);
-  return iter == id_map_.end() ? syncer::kInvalidId : iter->second;
-}
-
-const BookmarkNode* BookmarkModelAssociator::GetChromeNodeFromSyncId(
-    int64_t sync_id) {
-  SyncIdToBookmarkNodeMap::const_iterator iter = id_map_inverse_.find(sync_id);
-  return iter == id_map_inverse_.end() ? nullptr : iter->second;
-}
-
-bool BookmarkModelAssociator::InitSyncNodeFromChromeId(
-    const int64_t& node_id,
-    syncer::BaseNode* sync_node) {
-  DCHECK(sync_node);
-  int64_t sync_id = GetSyncIdFromChromeId(node_id);
-  if (sync_id == syncer::kInvalidId)
-    return false;
-  if (sync_node->InitByIdLookup(sync_id) != syncer::BaseNode::INIT_OK)
-    return false;
-  DCHECK(sync_node->GetId() == sync_id);
-  return true;
-}
-
-void BookmarkModelAssociator::AddAssociation(const BookmarkNode* node,
-                                             int64_t sync_id) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  int64_t node_id = node->id();
-  DCHECK_NE(sync_id, syncer::kInvalidId);
-  DCHECK(id_map_.find(node_id) == id_map_.end());
-  DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end());
-  id_map_[node_id] = sync_id;
-  id_map_inverse_[sync_id] = node;
-}
-
-void BookmarkModelAssociator::Associate(const BookmarkNode* node,
-                                        const syncer::BaseNode& sync_node) {
-  AddAssociation(node, sync_node.GetId());
-
-  // The same check exists in PersistAssociations. However it is better to
-  // do the check earlier to avoid the cost of decrypting nodes again
-  // in PersistAssociations.
-  if (node->id() != sync_node.GetExternalId()) {
-    dirty_associations_sync_ids_.insert(sync_node.GetId());
-    PostPersistAssociationsTask();
-  }
-}
-
-void BookmarkModelAssociator::Disassociate(int64_t sync_id) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  auto iter = id_map_inverse_.find(sync_id);
-  if (iter == id_map_inverse_.end())
-    return;
-  id_map_.erase(iter->second->id());
-  id_map_inverse_.erase(iter);
-  dirty_associations_sync_ids_.erase(sync_id);
-}
-
-bool BookmarkModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) {
-  DCHECK(has_nodes);
-  *has_nodes = false;
-  bool has_mobile_folder = true;
-
-  syncer::ReadTransaction trans(FROM_HERE, user_share_);
-
-  syncer::ReadNode bookmark_bar_node(&trans);
-  if (bookmark_bar_node.InitByTagLookupForBookmarks(kBookmarkBarTag) !=
-      syncer::BaseNode::INIT_OK) {
-    return false;
-  }
-
-  syncer::ReadNode other_bookmarks_node(&trans);
-  if (other_bookmarks_node.InitByTagLookupForBookmarks(kOtherBookmarksTag) !=
-      syncer::BaseNode::INIT_OK) {
-    return false;
-  }
-
-  syncer::ReadNode mobile_bookmarks_node(&trans);
-  if (mobile_bookmarks_node.InitByTagLookupForBookmarks(kMobileBookmarksTag) !=
-      syncer::BaseNode::INIT_OK) {
-    has_mobile_folder = false;
-  }
-
-  // Sync model has user created nodes if any of the permanent nodes has
-  // children.
-  *has_nodes = bookmark_bar_node.HasChildren() ||
-      other_bookmarks_node.HasChildren() ||
-      (has_mobile_folder && mobile_bookmarks_node.HasChildren());
-  return true;
-}
-
-bool BookmarkModelAssociator::AssociateTaggedPermanentNode(
-    syncer::BaseTransaction* trans,
-    const BookmarkNode* permanent_node,
-    const std::string& tag) {
-  // Do nothing if |permanent_node| is already initialized and associated.
-  int64_t sync_id = GetSyncIdFromChromeId(permanent_node->id());
-  if (sync_id != syncer::kInvalidId)
-    return true;
-
-  syncer::ReadNode sync_node(trans);
-  if (sync_node.InitByTagLookupForBookmarks(tag) != syncer::BaseNode::INIT_OK)
-    return false;
-
-  Associate(permanent_node, sync_node);
-  return true;
-}
-
-syncer::SyncError BookmarkModelAssociator::AssociateModels(
-    syncer::SyncMergeResult* local_merge_result,
-    syncer::SyncMergeResult* syncer_merge_result) {
-  // Since any changes to the bookmark model made here are not user initiated,
-  // these change should not be undoable and so suspend the undo tracking.
-  ScopedSuspendBookmarkUndo suspend_undo(bookmark_undo_service_);
-
-  Context context(local_merge_result, syncer_merge_result);
-
-  syncer::SyncError error = CheckModelSyncState(&context);
-  if (error.IsSet())
-    return error;
-
-  std::unique_ptr<ScopedAssociationUpdater> association_updater(
-      new ScopedAssociationUpdater(bookmark_model_));
-  DisassociateModels();
-
-  error = BuildAssociations(&context);
-  if (error.IsSet()) {
-    // Clear version on bookmark model so that the conservative association
-    // algorithm is used on the next association.
-    bookmark_model_->SetNodeSyncTransactionVersion(
-        bookmark_model_->root_node(),
-        syncer::syncable::kInvalidTransactionVersion);
-  }
-
-  return error;
-}
-
-syncer::SyncError BookmarkModelAssociator::AssociatePermanentFolders(
-    syncer::BaseTransaction* trans,
-    Context* context) {
-  // To prime our association, we associate the top-level nodes, Bookmark Bar
-  // and Other Bookmarks.
-  if (!AssociateTaggedPermanentNode(trans, bookmark_model_->bookmark_bar_node(),
-                                    kBookmarkBarTag)) {
-    return unrecoverable_error_handler_->CreateAndUploadError(
-        FROM_HERE, "Bookmark bar node not found", model_type());
-  }
-
-  if (!AssociateTaggedPermanentNode(trans, bookmark_model_->other_node(),
-                                    kOtherBookmarksTag)) {
-    return unrecoverable_error_handler_->CreateAndUploadError(
-        FROM_HERE, "Other bookmarks node not found", model_type());
-  }
-
-  if (!AssociateTaggedPermanentNode(trans, bookmark_model_->mobile_node(),
-                                    kMobileBookmarksTag) &&
-      expect_mobile_bookmarks_folder_) {
-    return unrecoverable_error_handler_->CreateAndUploadError(
-        FROM_HERE, "Mobile bookmarks node not found", model_type());
-  }
-
-  // Note: the root node may have additional extra nodes. Currently none of
-  // them are meant to sync.
-  int64_t bookmark_bar_sync_id =
-      GetSyncIdFromChromeId(bookmark_model_->bookmark_bar_node()->id());
-  DCHECK_NE(bookmark_bar_sync_id, syncer::kInvalidId);
-  context->AddBookmarkRoot(bookmark_model_->bookmark_bar_node());
-  int64_t other_bookmarks_sync_id =
-      GetSyncIdFromChromeId(bookmark_model_->other_node()->id());
-  DCHECK_NE(other_bookmarks_sync_id, syncer::kInvalidId);
-  context->AddBookmarkRoot(bookmark_model_->other_node());
-  int64_t mobile_bookmarks_sync_id =
-      GetSyncIdFromChromeId(bookmark_model_->mobile_node()->id());
-  if (expect_mobile_bookmarks_folder_)
-    DCHECK_NE(syncer::kInvalidId, mobile_bookmarks_sync_id);
-  if (mobile_bookmarks_sync_id != syncer::kInvalidId)
-    context->AddBookmarkRoot(bookmark_model_->mobile_node());
-
-  // WARNING: The order in which we push these should match their order in the
-  // bookmark model (see BookmarkModel::DoneLoading(..)).
-  context->PushNode(bookmark_bar_sync_id);
-  context->PushNode(other_bookmarks_sync_id);
-  if (mobile_bookmarks_sync_id != syncer::kInvalidId)
-    context->PushNode(mobile_bookmarks_sync_id);
-
-  return syncer::SyncError();
-}
-
-void BookmarkModelAssociator::SetNumItemsBeforeAssociation(
-    syncer::BaseTransaction* trans,
-    Context* context) {
-  int syncer_num = 0;
-  syncer::ReadNode bm_root(trans);
-  if (bm_root.InitTypeRoot(syncer::BOOKMARKS) == syncer::BaseNode::INIT_OK) {
-    syncer_num = bm_root.GetTotalNodeCount();
-  }
-  context->SetNumItemsBeforeAssociation(
-      GetTotalBookmarkCountAndRecordDuplicates(bookmark_model_->root_node(),
-                                               context),
-      syncer_num);
-}
-
-int BookmarkModelAssociator::GetTotalBookmarkCountAndRecordDuplicates(
-    const bookmarks::BookmarkNode* node,
-    Context* context) const {
-  if (!node->is_root())
-    context->UpdateDuplicateCount(node->GetTitle(), node->url());
-
-  int count = 1;  // Start with one to include the node itself.
-  for (const auto& child : node->children())
-    count += GetTotalBookmarkCountAndRecordDuplicates(child.get(), context);
-  return count;
-}
-
-void BookmarkModelAssociator::SetNumItemsAfterAssociation(
-    syncer::BaseTransaction* trans,
-    Context* context) {
-  int syncer_num = 0;
-  syncer::ReadNode bm_root(trans);
-  if (bm_root.InitTypeRoot(syncer::BOOKMARKS) == syncer::BaseNode::INIT_OK) {
-    syncer_num = bm_root.GetTotalNodeCount();
-  }
-  context->SetNumItemsAfterAssociation(
-      bookmark_model_->root_node()->GetTotalNodeCount(), syncer_num);
-}
-
-syncer::SyncError BookmarkModelAssociator::BuildAssociations(Context* context) {
-  DCHECK(bookmark_model_->loaded());
-  DCHECK_NE(context->native_model_sync_state(), AHEAD);
-
-  int initial_duplicate_count = 0;
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  {
-    syncer::WriteTransaction trans(FROM_HERE, user_share_, &new_version);
-
-    syncer::SyncError error = AssociatePermanentFolders(&trans, context);
-    if (error.IsSet())
-      return error;
-
-    SetNumItemsBeforeAssociation(&trans, context);
-    initial_duplicate_count = context->duplicate_count();
-
-    // Remove obsolete bookmarks according to sync delete journal.
-    // TODO(stanisc): crbug.com/456876: rewrite this to avoid a separate
-    // traversal and instead perform deletes at the end of the loop below where
-    // the unmatched bookmark nodes are created as sync nodes.
-    ApplyDeletesFromSyncJournal(&trans, context);
-
-    // Algorithm description:
-    // Match up the roots and recursively do the following:
-    // * For each sync node for the current sync parent node, find the best
-    //   matching bookmark node under the corresponding bookmark parent node.
-    //   If no matching node is found, create a new bookmark node in the same
-    //   position as the corresponding sync node.
-    //   If a matching node is found, update the properties of it from the
-    //   corresponding sync node.
-    // * When all children sync nodes are done, add the extra children bookmark
-    //   nodes to the sync parent node.
-    //
-    // The best match algorithm uses folder title or bookmark title/url to
-    // perform the primary match. If there are multiple match candidates it
-    // selects the preferred one based on sync node external ID match to the
-    // bookmark folder ID.
-    int64_t sync_parent_id;
-    while (context->PopNode(&sync_parent_id)) {
-      syncer::ReadNode sync_parent(&trans);
-      if (sync_parent.InitByIdLookup(sync_parent_id) !=
-          syncer::BaseNode::INIT_OK) {
-        return unrecoverable_error_handler_->CreateAndUploadError(
-            FROM_HERE, "Failed to lookup node.", model_type());
-      }
-      // Only folder nodes are pushed on to the stack.
-      DCHECK(sync_parent.GetIsFolder());
-
-      const BookmarkNode* parent_node = GetChromeNodeFromSyncId(sync_parent_id);
-      if (!parent_node) {
-        return unrecoverable_error_handler_->CreateAndUploadError(
-            FROM_HERE, "Failed to find bookmark node for sync id.",
-            model_type());
-      }
-      DCHECK(parent_node->is_folder());
-
-      std::vector<int64_t> children;
-      sync_parent.GetChildIds(&children);
-
-      error = BuildAssociations(&trans, parent_node, children, context);
-      if (error.IsSet())
-        return error;
-    }
-
-    SetNumItemsAfterAssociation(&trans, context);
-  }
-
-  if (new_version == syncer::syncable::kInvalidTransactionVersion) {
-    // If we get here it means that none of Sync nodes were modified by the
-    // association process.
-    // We need to set |new_version| to the pre-association Sync version;
-    // otherwise BookmarkChangeProcessor::UpdateTransactionVersion call below
-    // won't save it to the native model. That is necessary to ensure that the
-    // native model doesn't get stuck at "unset" version and skips any further
-    // version checks.
-    new_version = context->GetSyncPreAssociationVersion();
-  }
-
-  BookmarkChangeProcessor::UpdateTransactionVersion(
-      new_version, bookmark_model_, context->bookmarks_for_version_update());
-
-  UMA_HISTOGRAM_COUNTS_1M("Sync.BookmarksDuplicationsAtAssociation",
-                          context->duplicate_count());
-  UMA_HISTOGRAM_COUNTS_1M("Sync.BookmarksNewDuplicationsAtAssociation",
-                          context->duplicate_count() - initial_duplicate_count);
-
-  if (context->duplicate_count() > initial_duplicate_count) {
-    UMA_HISTOGRAM_ENUMERATION("Sync.BookmarksModelSyncStateAtNewDuplication",
-                              context->native_model_sync_state(),
-                              NATIVE_MODEL_SYNC_STATE_COUNT);
-  }
-
-  return syncer::SyncError();
-}
-
-syncer::SyncError BookmarkModelAssociator::BuildAssociations(
-    syncer::WriteTransaction* trans,
-    const BookmarkNode* parent_node,
-    const std::vector<int64_t>& sync_ids,
-    Context* context) {
-  BookmarkNodeFinder node_finder(parent_node);
-
-  size_t index = 0;
-  for (auto it = sync_ids.begin(); it != sync_ids.end(); ++it) {
-    int64_t sync_child_id = *it;
-    syncer::ReadNode sync_child_node(trans);
-    if (sync_child_node.InitByIdLookup(sync_child_id) !=
-        syncer::BaseNode::INIT_OK) {
-      return unrecoverable_error_handler_->CreateAndUploadError(
-          FROM_HERE, "Failed to lookup node.", model_type());
-    }
-
-    int64_t external_id = sync_child_node.GetExternalId();
-    GURL url(sync_child_node.GetBookmarkSpecifics().url());
-    const BookmarkNode* child_node = node_finder.FindBookmarkNode(
-        url, sync_child_node.GetTitle(), sync_child_node.GetIsFolder(),
-        external_id);
-    if (child_node) {
-      // Skip local node update if the local model version matches and
-      // the node is already associated and in the right position.
-      bool is_in_sync = (context->native_model_sync_state() == IN_SYNC) &&
-                        (child_node->id() == external_id) &&
-                        (index < parent_node->children().size()) &&
-                        (parent_node->children()[index].get() == child_node);
-      if (!is_in_sync) {
-        BookmarkChangeProcessor::UpdateBookmarkWithSyncData(
-            sync_child_node, bookmark_model_, child_node, favicon_service_);
-        bookmark_model_->Move(child_node, parent_node, index);
-        context->IncrementLocalItemsModified();
-        context->MarkForVersionUpdate(child_node);
-      }
-    } else {
-      syncer::SyncError error;
-      child_node = CreateBookmarkNode(parent_node, index, &sync_child_node, url,
-                                      context, &error);
-      if (!child_node) {
-        if (error.IsSet()) {
-          return error;
-        } else {
-          // Skip this node and continue. Don't increment index in this case.
-          continue;
-        }
-      }
-      context->IncrementLocalItemsAdded();
-      context->MarkForVersionUpdate(child_node);
-    }
-
-    Associate(child_node, sync_child_node);
-
-    if (sync_child_node.GetIsFolder())
-      context->PushNode(sync_child_id);
-    ++index;
-  }
-
-  // At this point all the children nodes of the parent sync node have
-  // corresponding children in the parent bookmark node and they are all in
-  // the right positions: from 0 to index - 1.
-  // So the children starting from index in the parent bookmark node are the
-  // ones that are not present in the parent sync node. So create them.
-  for (size_t i = index; i < parent_node->children().size(); ++i) {
-    int64_t sync_child_id = BookmarkChangeProcessor::CreateSyncNode(
-        parent_node, bookmark_model_, i, trans, this,
-        unrecoverable_error_handler_.get());
-    if (syncer::kInvalidId == sync_child_id) {
-      return unrecoverable_error_handler_->CreateAndUploadError(
-          FROM_HERE, "Failed to create sync node.", model_type());
-    }
-
-    context->IncrementSyncItemsAdded();
-    const BookmarkNode* child_node = parent_node->children()[i].get();
-    context->MarkForVersionUpdate(child_node);
-    if (child_node->is_folder())
-      context->PushNode(sync_child_id);
-  }
-
-  return syncer::SyncError();
-}
-
-const BookmarkNode* BookmarkModelAssociator::CreateBookmarkNode(
-    const BookmarkNode* parent_node,
-    size_t bookmark_index,
-    const syncer::BaseNode* sync_child_node,
-    const GURL& url,
-    Context* context,
-    syncer::SyncError* error) {
-  DCHECK_LE(bookmark_index, parent_node->children().size());
-
-  const std::string& sync_title = sync_child_node->GetTitle();
-
-  if (!sync_child_node->GetIsFolder() && !url.is_valid()) {
-    LOG(WARNING) << "Cannot associate sync node "
-                 << sync_child_node->GetSyncId().value() << " with invalid url "
-                 << url.possibly_invalid_spec() << " and title " << sync_title;
-    // Don't propagate an error to the model_type in this case.
-    return nullptr;
-  }
-
-  base::string16 bookmark_title = base::UTF8ToUTF16(sync_title);
-  const BookmarkNode* child_node = BookmarkChangeProcessor::CreateBookmarkNode(
-      bookmark_title, url, sync_child_node, parent_node, bookmark_model_,
-      favicon_service_, bookmark_index);
-  if (!child_node) {
-    *error = unrecoverable_error_handler_->CreateAndUploadError(
-        FROM_HERE, "Failed to create bookmark node with title " + sync_title +
-                       " and url " + url.possibly_invalid_spec(),
-        model_type());
-    return nullptr;
-  }
-
-  context->UpdateDuplicateCount(bookmark_title, url);
-  return child_node;
-}
-
-struct FolderInfo {
-  FolderInfo(const BookmarkNode* f, const BookmarkNode* p, int64_t id)
-      : folder(f), parent(p), sync_id(id) {}
-  const BookmarkNode* folder;
-  const BookmarkNode* parent;
-  int64_t sync_id;
-};
-using FolderInfoList = std::vector<FolderInfo>;
-
-void BookmarkModelAssociator::ApplyDeletesFromSyncJournal(
-    syncer::BaseTransaction* trans,
-    Context* context) {
-  syncer::BookmarkDeleteJournalList bk_delete_journals;
-  syncer::DeleteJournal::GetBookmarkDeleteJournals(trans, &bk_delete_journals);
-  if (bk_delete_journals.empty())
-    return;
-
-  size_t num_journals_unmatched = bk_delete_journals.size();
-
-  // Make a set of all external IDs in the delete journal,
-  // ignore entries with unset external IDs.
-  std::set<int64_t> journaled_external_ids;
-  for (size_t i = 0; i < num_journals_unmatched; i++) {
-    if (bk_delete_journals[i].external_id != 0)
-      journaled_external_ids.insert(bk_delete_journals[i].external_id);
-  }
-
-  // Check bookmark model from top to bottom.
-  BookmarkStack dfs_stack;
-  for (auto it = context->bookmark_roots().begin();
-       it != context->bookmark_roots().end(); ++it) {
-    dfs_stack.push(*it);
-  }
-
-  // Remember folders that match delete journals in first pass but don't delete
-  // them in case there are bookmarks left under them. After non-folder
-  // bookmarks are removed in first pass, recheck the folders in reverse order
-  // to remove empty ones.
-  FolderInfoList folders_matched;
-  while (!dfs_stack.empty() && num_journals_unmatched > 0) {
-    const BookmarkNode* parent = dfs_stack.top();
-    dfs_stack.pop();
-    DCHECK(parent->is_folder());
-
-    // Enumerate folder children in reverse order to make it easier to remove
-    // bookmarks matching entries in the delete journal.
-    for (const auto& child : base::Reversed(parent->children())) {
-      if (num_journals_unmatched == 0)
-        break;
-      if (child->is_folder())
-        dfs_stack.push(child.get());
-
-      if (journaled_external_ids.find(child->id()) ==
-          journaled_external_ids.end()) {
-        // Skip bookmark node which id is not in the set of external IDs.
-        continue;
-      }
-
-      // Iterate through the journal entries from back to front. Remove matched
-      // journal by moving an unmatched entry at the tail to the matched
-      // position so that we can read unmatched entries off the head in next
-      // loop.
-      for (int journal_index = num_journals_unmatched - 1; journal_index >= 0;
-           --journal_index) {
-        const syncer::BookmarkDeleteJournal& delete_entry =
-            bk_delete_journals[journal_index];
-        if (child->id() == delete_entry.external_id &&
-            BookmarkNodeFinder::NodeMatches(
-                child.get(), GURL(delete_entry.specifics.bookmark().url()),
-                delete_entry.specifics.bookmark().title(),
-                delete_entry.is_folder)) {
-          if (child->is_folder()) {
-            // Remember matched folder without removing and delete only empty
-            // ones later.
-            folders_matched.push_back(
-                FolderInfo(child.get(), parent, delete_entry.id));
-          } else {
-            bookmark_model_->Remove(child.get());
-            context->IncrementLocalItemsDeleted();
-          }
-          // Move unmatched journal here and decrement counter.
-          bk_delete_journals[journal_index] =
-              bk_delete_journals[--num_journals_unmatched];
-          break;
-        }
-      }
-    }
-  }
-
-  // Ids of sync nodes not found in bookmark model, meaning the deletions are
-  // persisted and correponding delete journals can be dropped.
-  std::set<int64_t> journals_to_purge;
-
-  // Remove empty folders from bottom to top.
-  for (auto it = folders_matched.rbegin(); it != folders_matched.rend(); ++it) {
-    if (it->folder->children().empty()) {
-      bookmark_model_->Remove(it->folder);
-      context->IncrementLocalItemsDeleted();
-    } else {
-      // Keep non-empty folder and remove its journal so that it won't match
-      // again in the future.
-      journals_to_purge.insert(it->sync_id);
-    }
-  }
-
-  // Purge unmatched journals.
-  for (size_t i = 0; i < num_journals_unmatched; ++i)
-    journals_to_purge.insert(bk_delete_journals[i].id);
-  syncer::DeleteJournal::PurgeDeleteJournals(trans, journals_to_purge);
-}
-
-void BookmarkModelAssociator::PostPersistAssociationsTask() {
-  // No need to post a task if a task is already pending.
-  if (weak_factory_.HasWeakPtrs())
-    return;
-  base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::BindOnce(&BookmarkModelAssociator::PersistAssociations,
-                                weak_factory_.GetWeakPtr()));
-}
-
-void BookmarkModelAssociator::PersistAssociations() {
-  // If there are no dirty associations we have nothing to do. We handle this
-  // explicity instead of letting the for loop do it to avoid creating a write
-  // transaction in this case.
-  if (dirty_associations_sync_ids_.empty()) {
-    DCHECK(id_map_.empty());
-    DCHECK(id_map_inverse_.empty());
-    return;
-  }
-
-  int64_t new_version = syncer::syncable::kInvalidTransactionVersion;
-  std::vector<const BookmarkNode*> bnodes;
-  {
-    syncer::WriteTransaction trans(FROM_HERE, user_share_, &new_version);
-    DirtyAssociationsSyncIds::iterator iter;
-    for (iter = dirty_associations_sync_ids_.begin();
-         iter != dirty_associations_sync_ids_.end();
-         ++iter) {
-      int64_t sync_id = *iter;
-      syncer::WriteNode sync_node(&trans);
-      if (sync_node.InitByIdLookup(sync_id) != syncer::BaseNode::INIT_OK) {
-        syncer::SyncError error(
-            FROM_HERE,
-            syncer::SyncError::DATATYPE_ERROR,
-            "Could not lookup bookmark node for ID persistence.",
-            syncer::BOOKMARKS);
-        unrecoverable_error_handler_->OnUnrecoverableError(error);
-        return;
-      }
-      const BookmarkNode* node = GetChromeNodeFromSyncId(sync_id);
-      if (node && sync_node.GetExternalId() != node->id()) {
-        sync_node.SetExternalId(node->id());
-        bnodes.push_back(node);
-      }
-    }
-    dirty_associations_sync_ids_.clear();
-  }
-
-  BookmarkChangeProcessor::UpdateTransactionVersion(new_version,
-                                                    bookmark_model_,
-                                                    bnodes);
-}
-
-bool BookmarkModelAssociator::CryptoReadyIfNecessary() {
-  // We only access the cryptographer while holding a transaction.
-  syncer::ReadTransaction trans(FROM_HERE, user_share_);
-  const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
-  return !encrypted_types.Has(syncer::BOOKMARKS) ||
-         trans.GetCryptographer()->CanEncrypt();
-}
-
-syncer::SyncError BookmarkModelAssociator::CheckModelSyncState(
-    Context* context) const {
-  DCHECK_EQ(context->native_model_sync_state(), UNSET);
-  int64_t native_version =
-      bookmark_model_->root_node()->sync_transaction_version();
-
-  syncer::ReadTransaction trans(FROM_HERE, user_share_);
-  int64_t sync_version = trans.GetModelVersion(syncer::BOOKMARKS);
-  context->SetPreAssociationVersions(native_version, sync_version);
-
-  if (native_version != syncer::syncable::kInvalidTransactionVersion) {
-    if (native_version == sync_version) {
-      context->set_native_model_sync_state(IN_SYNC);
-    } else {
-      // Clear version on bookmark model so that we only report error once.
-      bookmark_model_->SetNodeSyncTransactionVersion(
-          bookmark_model_->root_node(),
-          syncer::syncable::kInvalidTransactionVersion);
-
-      // If the native version is higher, there was a sync persistence failure,
-      // and we need to delay association until after a GetUpdates.
-      if (native_version > sync_version) {
-        context->set_native_model_sync_state(AHEAD);
-        std::string message = base::StringPrintf(
-            "Native version (%" PRId64 ") does not match sync version (%"
-                PRId64 ")",
-            native_version,
-            sync_version);
-        return syncer::SyncError(FROM_HERE,
-                                 syncer::SyncError::PERSISTENCE_ERROR,
-                                 message,
-                                 syncer::BOOKMARKS);
-      } else {
-        context->set_native_model_sync_state(BEHIND);
-      }
-    }
-  }
-  return syncer::SyncError();
-}
-
-}  // namespace sync_bookmarks
diff --git a/components/sync_bookmarks/bookmark_model_associator.h b/components/sync_bookmarks/bookmark_model_associator.h
deleted file mode 100644
index 5b44fc9f..0000000
--- a/components/sync_bookmarks/bookmark_model_associator.h
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright (c) 2012 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 COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
-#define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <unordered_set>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/containers/stack.h"
-#include "base/hash/hash.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/strings/string16.h"
-#include "base/threading/thread_checker.h"
-#include "components/sync/base/unrecoverable_error_handler.h"
-#include "components/sync/driver/model_associator.h"
-#include "components/sync/model/data_type_error_handler.h"
-
-class BookmarkUndoService;
-class GURL;
-
-namespace bookmarks {
-class BookmarkModel;
-class BookmarkNode;
-}  // namespace bookmarks
-
-namespace favicon {
-class FaviconService;
-}  // namespace favicon
-
-namespace syncer {
-class BaseNode;
-class BaseTransaction;
-class WriteTransaction;
-struct UserShare;
-}  // namespace syncer
-
-namespace sync_bookmarks {
-
-// Contains all model association related logic:
-// * Algorithm to associate bookmark model and sync model.
-// * Methods to get a bookmark node for a given sync node and vice versa.
-// * Persisting model associations and loading them back.
-class BookmarkModelAssociator : public syncer::AssociatorInterface {
- public:
-  static syncer::ModelType model_type() { return syncer::BOOKMARKS; }
-
-  // |expect_mobile_bookmarks_folder| controls whether or not we
-  // expect the mobile bookmarks permanent folder to be created.
-  // Should be set to true only by mobile clients.
-  BookmarkModelAssociator(
-      bookmarks::BookmarkModel* bookmark_model,
-      BookmarkUndoService* bookmark_undo_service,
-      favicon::FaviconService* favicon_service,
-      syncer::UserShare* user_share,
-      std::unique_ptr<syncer::DataTypeErrorHandler> unrecoverable_error_handler,
-      bool expect_mobile_bookmarks_folder);
-  ~BookmarkModelAssociator() override;
-
-  bookmarks::BookmarkModel* GetBookmarkModel();
-  favicon::FaviconService* GetFaviconService();
-  BookmarkUndoService* GetBookmarkUndoService();
-
-  // AssociatorInterface implementation.
-  //
-  // AssociateModels iterates through both the sync and the browser
-  // bookmark model, looking for matched pairs of items.  For any pairs it
-  // finds, it will call AssociateSyncID.  For any unmatched items,
-  // MergeAndAssociateModels will try to repair the match, e.g. by adding a new
-  // node.  After successful completion, the models should be identical and
-  // corresponding. Returns true on success.  On failure of this step, we
-  // should abort the sync operation and report an error to the user.
-  syncer::SyncError AssociateModels(
-      syncer::SyncMergeResult* local_merge_result,
-      syncer::SyncMergeResult* syncer_merge_result) override;
-
-  syncer::SyncError DisassociateModels() override;
-
-  // The has_nodes out param is true if the sync model has nodes other
-  // than the permanent tagged nodes.
-  bool SyncModelHasUserCreatedNodes(bool* has_nodes) override;
-
-  // Returns sync id for the given bookmark node id.
-  // Returns syncer::kInvalidId if the sync node is not found for the given
-  // bookmark node id.
-  int64_t GetSyncIdFromChromeId(const int64_t& node_id);
-
-  // Returns the bookmark node for the given sync id.
-  // Returns null if no bookmark node is found for the given sync id.
-  const bookmarks::BookmarkNode* GetChromeNodeFromSyncId(int64_t sync_id);
-
-  // Initializes the given sync node from the given bookmark node id.
-  // Returns false if no sync node was found for the given bookmark node id or
-  // if the initialization of sync node fails.
-  bool InitSyncNodeFromChromeId(const int64_t& node_id,
-                                syncer::BaseNode* sync_node);
-
-  // Associates the given bookmark node with the given sync node.
-  void Associate(const bookmarks::BookmarkNode* node,
-                 const syncer::BaseNode& sync_node);
-  // Remove the association that corresponds to the given sync id.
-  void Disassociate(int64_t sync_id);
-
-  void AbortAssociation() override {
-    // No implementation needed, this associator runs on the main
-    // thread.
-  }
-
-  // See ModelAssociator interface.
-  bool CryptoReadyIfNecessary() override;
-
- private:
-  using BookmarkIdToSyncIdMap = std::map<int64_t, int64_t>;
-  using SyncIdToBookmarkNodeMap =
-      std::map<int64_t, const bookmarks::BookmarkNode*>;
-  using DirtyAssociationsSyncIds = std::set<int64_t>;
-  using BookmarkList = std::vector<const bookmarks::BookmarkNode*>;
-  using BookmarkStack = base::stack<const bookmarks::BookmarkNode*>;
-
-  // Add association between native node and sync node to the maps.
-  void AddAssociation(const bookmarks::BookmarkNode* node, int64_t sync_id);
-
-  // Posts a task to persist dirty associations.
-  void PostPersistAssociationsTask();
-  // Persists all dirty associations.
-  void PersistAssociations();
-
-  // Result of the native model version check against the sync
-  // version performed by CheckModelSyncState.
-  enum NativeModelSyncState {
-    // The native version is syncer::syncable::kInvalidTransactionVersion,
-    // which is the case when the version has either not been set yet or reset
-    // as a result of a previous error during the association. Basically the
-    // state should return back to UNSET on an association following the one
-    // where the state was different than IN_SYNC.
-    UNSET,
-    // The native version was in sync with the Sync version.
-    IN_SYNC,
-    // The native version was behing the sync version which indicates a failure
-    // to persist the native bookmarks model.
-    BEHIND,
-    // The native version was ahead of the sync version which indicates a
-    // a failure to persist Sync DB.
-    AHEAD,
-    NATIVE_MODEL_SYNC_STATE_COUNT
-  };
-
-  // Helper class used within AssociateModels to simplify the logic and
-  // minimize the number of arguments passed between private functions.
-  class Context {
-   public:
-    Context(syncer::SyncMergeResult* local_merge_result,
-            syncer::SyncMergeResult* syncer_merge_result);
-    ~Context();
-
-    // Push a sync node to the DFS stack.
-    void PushNode(int64_t sync_id);
-    // Pops a sync node from the DFS stack. Returns false if the stack
-    // is empty.
-    bool PopNode(int64_t* sync_id);
-
-    // The following methods are used to update |local_merge_result_| and
-    // |syncer_merge_result_|.
-    void SetPreAssociationVersions(int64_t native_version,
-                                   int64_t sync_version);
-    void SetNumItemsBeforeAssociation(int local_num, int sync_num);
-    void SetNumItemsAfterAssociation(int local_num, int sync_num);
-    void IncrementLocalItemsDeleted();
-    void IncrementLocalItemsAdded();
-    void IncrementLocalItemsModified();
-    void IncrementSyncItemsAdded();
-    void IncrementSyncItemsDeleted(int count);
-
-    void UpdateDuplicateCount(const base::string16& title, const GURL& url);
-
-    int duplicate_count() const { return duplicate_count_; }
-
-    NativeModelSyncState native_model_sync_state() const {
-      return native_model_sync_state_;
-    }
-    void set_native_model_sync_state(NativeModelSyncState state) {
-      native_model_sync_state_ = state;
-    }
-
-    // Bookmark roots participating in the sync.
-    void AddBookmarkRoot(const bookmarks::BookmarkNode* root);
-    const BookmarkList& bookmark_roots() const { return bookmark_roots_; }
-
-    // Gets pre-association sync version for Bookmarks datatype.
-    int64_t GetSyncPreAssociationVersion() const;
-
-    void MarkForVersionUpdate(const bookmarks::BookmarkNode* node);
-    const BookmarkList& bookmarks_for_version_update() const {
-      return bookmarks_for_version_update_;
-    }
-
-   private:
-    // DFS stack of sync nodes traversed during association.
-    base::stack<int64_t> dfs_stack_;
-    // Local and merge results are not owned.
-    syncer::SyncMergeResult* local_merge_result_;
-    syncer::SyncMergeResult* syncer_merge_result_;
-    // |hashes_| contains hash codes of all native bookmarks
-    // for the purpose of detecting duplicates. A small number of
-    // false positives due to hash collisions is OK because this
-    // data is used for reporting purposes only.
-    std::unordered_set<size_t> hashes_;
-    // Overall number of bookmark collisions from RecordDuplicates call.
-    int duplicate_count_;
-    // Result of the most recent BookmarkModelAssociator::CheckModelSyncState.
-    NativeModelSyncState native_model_sync_state_;
-    // List of bookmark model roots participating in the sync.
-    BookmarkList bookmark_roots_;
-    // List of bookmark nodes for which the transaction version needs to be
-    // updated.
-    BookmarkList bookmarks_for_version_update_;
-
-    DISALLOW_COPY_AND_ASSIGN(Context);
-  };
-
-  // Matches up the bookmark model and the sync model to build model
-  // associations.
-  syncer::SyncError BuildAssociations(Context* context);
-
-  // Two helper functions that populate SyncMergeResult with numbers of
-  // items before/after the association.
-  void SetNumItemsBeforeAssociation(syncer::BaseTransaction* trans,
-                                    Context* context);
-  void SetNumItemsAfterAssociation(syncer::BaseTransaction* trans,
-                                   Context* context);
-
-  // Used by SetNumItemsBeforeAssociation.
-  // Similar to BookmarkNode::GetTotalNodeCount but also scans the native
-  // model for duplicates and records them in |context|.
-  int GetTotalBookmarkCountAndRecordDuplicates(
-      const bookmarks::BookmarkNode* node,
-      Context* context) const;
-
-  // Helper function that associates all tagged permanent folders and primes
-  // the provided context with sync IDs of those folders.
-  syncer::SyncError AssociatePermanentFolders(syncer::BaseTransaction* trans,
-                                              Context* context);
-
-  // Associate a top-level node of the bookmark model with a permanent node in
-  // the sync domain.  Such permanent nodes are identified by a tag that is
-  // well known to the server and the client, and is unique within a particular
-  // user's share.  For example, "other_bookmarks" is the tag for the Other
-  // Bookmarks folder.  The sync nodes are server-created.
-  // Returns true on success, false if association failed.
-  bool AssociateTaggedPermanentNode(
-      syncer::BaseTransaction* trans,
-      const bookmarks::BookmarkNode* permanent_node,
-      const std::string& tag) WARN_UNUSED_RESULT;
-
-  // Removes bookmark nodes whose corresponding sync nodes have been deleted
-  // according to sync delete journals.
-  void ApplyDeletesFromSyncJournal(syncer::BaseTransaction* trans,
-                                   Context* context);
-
-  // The main part of the association process that associatiates
-  // native nodes that are children of |parent_node| with sync nodes with IDs
-  // from |sync_ids|.
-  syncer::SyncError BuildAssociations(
-      syncer::WriteTransaction* trans,
-      const bookmarks::BookmarkNode* parent_node,
-      const std::vector<int64_t>& sync_ids,
-      Context* context);
-
-  // Helper method for creating a new native bookmark node.
-  const bookmarks::BookmarkNode* CreateBookmarkNode(
-      const bookmarks::BookmarkNode* parent_node,
-      size_t bookmark_index,
-      const syncer::BaseNode* sync_child_node,
-      const GURL& url,
-      Context* context,
-      syncer::SyncError* error);
-
-  // Check whether bookmark model and sync model are synced by comparing
-  // their transaction versions.
-  // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where
-  // the native model has a newer transaction verison.
-  syncer::SyncError CheckModelSyncState(Context* context) const;
-
-  base::ThreadChecker thread_checker_;
-  bookmarks::BookmarkModel* const bookmark_model_;
-  BookmarkUndoService* const bookmark_undo_service_;
-  favicon::FaviconService* const favicon_service_;
-  syncer::UserShare* const user_share_;
-  std::unique_ptr<syncer::DataTypeErrorHandler> unrecoverable_error_handler_;
-  const bool expect_mobile_bookmarks_folder_;
-  BookmarkIdToSyncIdMap id_map_;
-  SyncIdToBookmarkNodeMap id_map_inverse_;
-  // Stores sync ids for dirty associations.
-  DirtyAssociationsSyncIds dirty_associations_sync_ids_;
-
-  // Used to post PersistAssociation tasks to the current message loop and
-  // guarantees no invocations can occur if |this| has been deleted. (This
-  // allows this class to be non-refcounted).
-  base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_{this};
-
-  DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
-};
-
-}  // namespace sync_bookmarks
-
-#endif  // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.cc b/components/sync_bookmarks/bookmark_remote_updates_handler.cc
index 8b81f03..c3127571 100644
--- a/components/sync_bookmarks/bookmark_remote_updates_handler.cc
+++ b/components/sync_bookmarks/bookmark_remote_updates_handler.cc
@@ -228,6 +228,27 @@
             bookmark_tracker_->model_type_state().cache_guid() &&
         bookmark_tracker_->GetEntityForSyncId(
             update_entity.originator_client_item_id) != nullptr) {
+      if (tracked_entity) {
+        // We generally shouldn't have an entry for both the old ID and the new
+        // ID, but it could happen due to some past bug (see crbug.com/1004205).
+        // In that case, the two entries should be duplicates in the sense that
+        // they have the same URL.
+        // TODO(crbug.com/516866): Clean up the workaround once this has been
+        // resolved.
+        const SyncedBookmarkTracker::Entity* old_entity =
+            bookmark_tracker_->GetEntityForSyncId(
+                update_entity.originator_client_item_id);
+        const bookmarks::BookmarkNode* old_node = old_entity->bookmark_node();
+        const bookmarks::BookmarkNode* new_node =
+            tracked_entity->bookmark_node();
+        CHECK(old_node->type() == bookmarks::BookmarkNode::URL);
+        CHECK(new_node->type() == bookmarks::BookmarkNode::URL);
+        CHECK(old_node->url() == new_node->url());
+        bookmark_tracker_->Remove(update_entity.originator_client_item_id);
+        bookmark_model_->Remove(old_node);
+        continue;
+      }
+
       bookmark_tracker_->UpdateSyncForLocalCreationIfNeeded(
           /*old_id=*/update_entity.originator_client_item_id,
           /*new_id=*/update_entity.id);
diff --git a/components/sync_bookmarks/bookmark_sync_service.cc b/components/sync_bookmarks/bookmark_sync_service.cc
index 4e43e8345..ed012ee7 100644
--- a/components/sync_bookmarks/bookmark_sync_service.cc
+++ b/components/sync_bookmarks/bookmark_sync_service.cc
@@ -13,11 +13,9 @@
 
 BookmarkSyncService::BookmarkSyncService(
     BookmarkUndoService* bookmark_undo_service) {
-  if (base::FeatureList::IsEnabled(switches::kSyncUSSBookmarks)) {
     bookmark_model_type_processor_ =
         std::make_unique<sync_bookmarks::BookmarkModelTypeProcessor>(
             bookmark_undo_service);
-  }
 }
 
 BookmarkSyncService::~BookmarkSyncService() {}
diff --git a/components/sync_device_info/device_info.cc b/components/sync_device_info/device_info.cc
index b113c68..fa68ae9 100644
--- a/components/sync_device_info/device_info.cc
+++ b/components/sync_device_info/device_info.cc
@@ -52,7 +52,10 @@
       hardware_info_(hardware_info),
       last_updated_timestamp_(last_updated_timestamp),
       send_tab_to_self_receiving_enabled_(send_tab_to_self_receiving_enabled),
-      sharing_info_(sharing_info) {}
+      sharing_info_(sharing_info) {
+  // We do not store device's serial number in DeviceInfo.
+  hardware_info_.serial_number.clear();
+}
 
 DeviceInfo::~DeviceInfo() {}
 
@@ -144,6 +147,7 @@
          this->sync_user_agent() == other.sync_user_agent() &&
          this->device_type() == other.device_type() &&
          this->signin_scoped_device_id() == other.signin_scoped_device_id() &&
+         this->hardware_info() == other.hardware_info() &&
          this->send_tab_to_self_receiving_enabled() ==
              other.send_tab_to_self_receiving_enabled() &&
          this->sharing_info() == other.sharing_info();
@@ -176,4 +180,8 @@
   sharing_info_ = sharing_info;
 }
 
+void DeviceInfo::set_client_name(const std::string& client_name) {
+  client_name_ = client_name;
+}
+
 }  // namespace syncer
diff --git a/components/sync_device_info/device_info.h b/components/sync_device_info/device_info.h
index ba69102..644e2a7 100644
--- a/components/sync_device_info/device_info.h
+++ b/components/sync_device_info/device_info.h
@@ -120,6 +120,8 @@
 
   void set_sharing_info(const base::Optional<SharingInfo>& sharing_info);
 
+  void set_client_name(const std::string& client_name);
+
   // Converts the |DeviceInfo| values to a JS friendly DictionaryValue,
   // which extension APIs can expose to third party apps.
   std::unique_ptr<base::DictionaryValue> ToValue();
@@ -127,7 +129,7 @@
  private:
   const std::string guid_;
 
-  const std::string client_name_;
+  std::string client_name_;
 
   const std::string chrome_version_;
 
diff --git a/components/sync_device_info/device_info_sync_bridge.cc b/components/sync_device_info/device_info_sync_bridge.cc
index 6caa11c..1be67c6 100644
--- a/components/sync_device_info/device_info_sync_bridge.cc
+++ b/components/sync_device_info/device_info_sync_bridge.cc
@@ -204,6 +204,16 @@
   device_info_prefs_->AddLocalCacheGuid(local_cache_guid_);
   // SyncMode determines the client name in GetLocalClientName().
   sync_mode_ = request.sync_mode;
+
+  if (!change_processor()->IsTrackingMetadata()) {
+    return;
+  }
+
+  // Local device's client name needs to updated if OnSyncStarting is called
+  // after local device has already been initialized since the client name
+  // depends on |sync_mode_|.
+  local_device_info_provider_->UpdateClientName(GetLocalClientName());
+  ReconcileLocalAndStored();
 }
 
 std::unique_ptr<MetadataChangeList>
diff --git a/components/sync_device_info/device_info_sync_bridge_unittest.cc b/components/sync_device_info/device_info_sync_bridge_unittest.cc
index 4c2186f..f387e3c 100644
--- a/components/sync_device_info/device_info_sync_bridge_unittest.cc
+++ b/components/sync_device_info/device_info_sync_bridge_unittest.cc
@@ -213,41 +213,6 @@
   return specifics;
 }
 
-DeviceInfoSpecifics DeviceInfoToSpecifics(const DeviceInfo& info) {
-  auto hardware_info = info.hardware_info();
-  DeviceInfoSpecifics specifics;
-  specifics.set_cache_guid(info.guid());
-  specifics.set_client_name(info.client_name());
-  specifics.set_chrome_version(info.chrome_version());
-  specifics.set_sync_user_agent(info.sync_user_agent());
-  specifics.set_device_type(info.device_type());
-  specifics.set_signin_scoped_device_id(info.signin_scoped_device_id());
-  specifics.set_model(hardware_info.model);
-  specifics.set_manufacturer(hardware_info.manufacturer);
-  specifics.set_last_updated_timestamp(TimeToProtoTime(base::Time::Now()));
-
-  sync_pb::FeatureSpecificFields* feature_fields =
-      specifics.mutable_feature_fields();
-  feature_fields->set_send_tab_to_self_receiving_enabled(
-      info.send_tab_to_self_receiving_enabled());
-
-  const base::Optional<DeviceInfo::SharingInfo>& sharing_info =
-      info.sharing_info();
-  if (sharing_info) {
-    sync_pb::SharingSpecificFields* sharing_fields =
-        specifics.mutable_sharing_fields();
-    sharing_fields->set_fcm_token(sharing_info->fcm_token);
-    sharing_fields->set_p256dh(sharing_info->p256dh);
-    sharing_fields->set_auth_secret(sharing_info->auth_secret);
-    for (sync_pb::SharingSpecificFields::EnabledFeatures feature :
-         sharing_info->enabled_features) {
-      sharing_fields->add_enabled_features(feature);
-    }
-  }
-
-  return specifics;
-}
-
 ModelTypeState StateWithEncryption(const std::string& encryption_key_name) {
   ModelTypeState state;
   state.set_initial_sync_done(true);
@@ -317,6 +282,11 @@
 
   void Clear() override { local_device_info_.reset(); }
 
+  void UpdateClientName(const std::string& client_name) override {
+    ASSERT_TRUE(local_device_info_);
+    local_device_info_->set_client_name(client_name);
+  }
+
   version_info::Channel GetChannel() const override {
     return version_info::Channel::UNKNOWN;
   }
@@ -344,7 +314,14 @@
       : store_(ModelTypeStoreTestUtil::CreateInMemoryStoreForTest()),
         local_hardware_info_(GetLocalHardwareInfoBlocking()) {
     DeviceInfoPrefs::RegisterProfilePrefs(pref_service_.registry());
-    ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true));
+
+    // By default, mimic a real processor's behavior for IsTrackingMetadata().
+    ON_CALL(mock_processor_, ModelReadyToSync(_))
+        .WillByDefault([this](std::unique_ptr<MetadataBatch> batch) {
+          ON_CALL(mock_processor_, IsTrackingMetadata())
+              .WillByDefault(
+                  Return(batch->GetModelTypeState().initial_sync_done()));
+        });
   }
 
   ~DeviceInfoSyncBridgeTest() override {
@@ -393,6 +370,7 @@
         bridge()->CreateMetadataChangeList();
 
     metadata_change_list->UpdateModelTypeState(StateWithEncryption(""));
+    ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true));
     bridge()->MergeSyncData(std::move(metadata_change_list),
                             EntityChangeList());
   }
@@ -789,6 +767,7 @@
   EXPECT_CALL(*processor(), Delete(_, _)).Times(0);
 
   bridge()->OnSyncStarting(TestDataTypeActivationRequest(SyncMode::kFull));
+  ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true));
   auto error = bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
                                        EntityChangeList());
   EXPECT_FALSE(error);
@@ -810,6 +789,7 @@
   EXPECT_CALL(*processor(), Delete(_, _)).Times(0);
 
   bridge()->OnSyncStarting(TestDataTypeActivationRequest(SyncMode::kFull));
+  ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true));
   auto error =
       bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
                               EntityAddList({CreateLocalDeviceSpecifics()}));
@@ -1051,6 +1031,7 @@
   // If sync is re-enabled and the remote data is now empty, we shouldn't
   // contain remote data.
   bridge()->OnSyncStarting(TestDataTypeActivationRequest(SyncMode::kFull));
+  ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true));
   bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
                           EntityChangeList());
   // Local device.
@@ -1200,27 +1181,17 @@
   ASSERT_EQ(expected_device_name_full_sync, device->client_name());
 
   // Toggle to transport only sync mode.
-  syncer::EntityChangeList entity_change_list;
-  entity_change_list.push_back(EntityChange::CreateUpdate(
-      device->guid(), SpecificsToEntity(DeviceInfoToSpecifics(*device))));
-  bridge()->ApplyStopSyncChanges(bridge()->CreateMetadataChangeList());
+  bridge()->ApplyStopSyncChanges(/*delete_metadata_change_list=*/nullptr);
   bridge()->OnSyncStarting(
       TestDataTypeActivationRequest(SyncMode::kTransportOnly));
-  bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
-                          std::move(entity_change_list));
 
   device = local_device()->GetLocalDeviceInfo();
   ASSERT_TRUE(device);
   ASSERT_EQ(expected_device_name_transport_only, device->client_name());
 
   // Toggle to full sync mode.
-  ASSERT_TRUE(entity_change_list.empty());
-  entity_change_list.push_back(EntityChange::CreateUpdate(
-      device->guid(), SpecificsToEntity(DeviceInfoToSpecifics(*device))));
-  bridge()->ApplyStopSyncChanges(bridge()->CreateMetadataChangeList());
+  bridge()->ApplyStopSyncChanges(/*delete_metadata_change_list=*/nullptr);
   bridge()->OnSyncStarting(TestDataTypeActivationRequest(SyncMode::kFull));
-  bridge()->MergeSyncData(bridge()->CreateMetadataChangeList(),
-                          std::move(entity_change_list));
 
   device = local_device()->GetLocalDeviceInfo();
   ASSERT_TRUE(device);
diff --git a/components/sync_device_info/local_device_info_provider.h b/components/sync_device_info/local_device_info_provider.h
index cb502af..9f8252b0 100644
--- a/components/sync_device_info/local_device_info_provider.h
+++ b/components/sync_device_info/local_device_info_provider.h
@@ -46,6 +46,10 @@
                           const std::string& client_name,
                           const base::SysInfo::HardwareInfo& hardware_info) = 0;
   virtual void Clear() = 0;
+
+  // Updates the local device's client name. Initialize() must be called before
+  // calling this function.
+  virtual void UpdateClientName(const std::string& client_name) = 0;
 };
 
 }  // namespace syncer
diff --git a/components/sync_device_info/local_device_info_provider_impl.cc b/components/sync_device_info/local_device_info_provider_impl.cc
index 0eb7303..96c889f 100644
--- a/components/sync_device_info/local_device_info_provider_impl.cc
+++ b/components/sync_device_info/local_device_info_provider_impl.cc
@@ -76,4 +76,10 @@
   local_device_info_.reset();
 }
 
+void LocalDeviceInfoProviderImpl::UpdateClientName(
+    const std::string& client_name) {
+  DCHECK(local_device_info_);
+  local_device_info_->set_client_name(client_name);
+}
+
 }  // namespace syncer
diff --git a/components/sync_device_info/local_device_info_provider_impl.h b/components/sync_device_info/local_device_info_provider_impl.h
index 63792c7e..895f466 100644
--- a/components/sync_device_info/local_device_info_provider_impl.h
+++ b/components/sync_device_info/local_device_info_provider_impl.h
@@ -33,6 +33,7 @@
                   const std::string& client_name,
                   const base::SysInfo::HardwareInfo& hardware_info) override;
   void Clear() override;
+  void UpdateClientName(const std::string& client_name) override;
   version_info::Channel GetChannel() const override;
   const DeviceInfo* GetLocalDeviceInfo() const override;
   std::unique_ptr<Subscription> RegisterOnInitializedCallback(
diff --git a/content/browser/blob_storage/blob_registry_wrapper.cc b/content/browser/blob_storage/blob_registry_wrapper.cc
index 336e46c5..5cf53de 100644
--- a/content/browser/blob_storage/blob_registry_wrapper.cc
+++ b/content/browser/blob_storage/blob_registry_wrapper.cc
@@ -12,7 +12,7 @@
 #include "content/public/common/content_features.h"
 #include "storage/browser/blob/blob_registry_impl.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace content {
 
diff --git a/content/browser/blob_storage/blob_url_unittest.cc b/content/browser/blob_storage/blob_url_unittest.cc
index d226e872..1a98fa8b 100644
--- a/content/browser/blob_storage/blob_url_unittest.cc
+++ b/content/browser/blob_storage/blob_url_unittest.cc
@@ -34,9 +34,9 @@
 #include "storage/browser/blob/blob_impl.h"
 #include "storage/browser/blob/blob_storage_context.h"
 #include "storage/browser/blob/blob_url_store_impl.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/fake_blob_data_handle.h"
 #include "storage/browser/test/mock_blob_registry_delegate.h"
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index 99b29aa..48ae6e8 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -74,7 +74,7 @@
 #include "services/service_manager/public/mojom/service.mojom.h"
 #include "storage/browser/blob/blob_storage_context.h"
 #include "storage/browser/database/database_tracker.h"
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 using base::UserDataAdapter;
 
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc
index b103ad9..8525910e 100644
--- a/content/browser/child_process_security_policy_impl.cc
+++ b/content/browser/child_process_security_policy_impl.cc
@@ -39,10 +39,10 @@
 #include "net/base/url_util.h"
 #include "net/url_request/url_request.h"
 #include "services/network/public/cpp/resource_request_body.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_permission_policy.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "url/gurl.h"
 #include "url/url_canon.h"
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc
index 4ec1e64..a35a277 100644
--- a/content/browser/child_process_security_policy_unittest.cc
+++ b/content/browser/child_process_security_policy_unittest.cc
@@ -24,9 +24,9 @@
 #include "content/public/test/test_browser_context.h"
 #include "content/public/test/test_utils.h"
 #include "content/test/test_content_browser_client.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_permission_policy.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/devtools/devtools_stream_file.cc b/content/browser/devtools/devtools_stream_file.cc
index 74e0601..5cd747d 100644
--- a/content/browser/devtools/devtools_stream_file.cc
+++ b/content/browser/devtools/devtools_stream_file.cc
@@ -14,7 +14,7 @@
 #include "base/third_party/icu/icu_utf.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace content {
 
diff --git a/content/browser/fileapi/README.md b/content/browser/fileapi/README.md
index ac24aa5..d9de5ec2 100644
--- a/content/browser/fileapi/README.md
+++ b/content/browser/fileapi/README.md
@@ -5,7 +5,7 @@
 
 ## Related directories
 
-[`//storage/browser/fileapi/`](../../../storage/browser/fileapi) contains the
+[`//storage/browser/file_system/`](../../../storage/browser/file_system) contains the
 rest of the browser side implementation, while
 [`blink/renderer/modules/filesystem`](../../../third_party/blink/renderer/modules/filesystem)
 contains the renderer side implementation and
diff --git a/content/browser/fileapi/browser_file_system_helper.cc b/content/browser/fileapi/browser_file_system_helper.cc
index 2e90937..e01edf8 100644
--- a/content/browser/fileapi/browser_file_system_helper.cc
+++ b/content/browser/fileapi/browser_file_system_helper.cc
@@ -28,14 +28,14 @@
 #include "content/public/common/drop_data.h"
 #include "content/public/common/url_constants.h"
 #include "net/base/filename_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_options.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_permission_policy.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_options.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
 #include "url/gurl.h"
diff --git a/content/browser/fileapi/browser_file_system_helper.h b/content/browser/fileapi/browser_file_system_helper.h
index 64e8658..4067d9e 100644
--- a/content/browser/fileapi/browser_file_system_helper.h
+++ b/content/browser/fileapi/browser_file_system_helper.h
@@ -7,7 +7,7 @@
 
 #include "base/memory/ref_counted.h"
 #include "content/common/content_export.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace storage {
 class FileSystemContext;
diff --git a/content/browser/fileapi/browser_file_system_helper_unittest.cc b/content/browser/fileapi/browser_file_system_helper_unittest.cc
index 6a8620e..14d98bc 100644
--- a/content/browser/fileapi/browser_file_system_helper_unittest.cc
+++ b/content/browser/fileapi/browser_file_system_helper_unittest.cc
@@ -17,10 +17,10 @@
 #include "content/public/test/test_browser_context.h"
 #include "content/public/test/test_utils.h"
 #include "net/base/filename_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_options.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_options.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
diff --git a/content/browser/fileapi/file_system_manager_impl.cc b/content/browser/fileapi/file_system_manager_impl.cc
index b244edd..7989f71 100644
--- a/content/browser/fileapi/file_system_manager_impl.cc
+++ b/content/browser/fileapi/file_system_manager_impl.cc
@@ -29,10 +29,10 @@
 #include "storage/browser/blob/blob_data_builder.h"
 #include "storage/browser/blob/blob_storage_context.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_permission_policy.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_info.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/content/browser/fileapi/file_system_manager_impl.h b/content/browser/fileapi/file_system_manager_impl.h
index c6adc33..60ad4c0c 100644
--- a/content/browser/fileapi/file_system_manager_impl.h
+++ b/content/browser/fileapi/file_system_manager_impl.h
@@ -25,8 +25,8 @@
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/receiver_set.h"
 #include "mojo/public/cpp/bindings/unique_receiver_set.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "third_party/blink/public/mojom/filesystem/file_system.mojom.h"
 
diff --git a/content/browser/fileapi/file_system_operation_runner_unittest.cc b/content/browser/fileapi/file_system_operation_runner_unittest.cc
index 2139521..3e0a9598 100644
--- a/content/browser/fileapi/file_system_operation_runner_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_runner_unittest.cc
@@ -17,10 +17,10 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/browser_task_environment.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/browser/test/test_file_system_options.h"
diff --git a/content/browser/fileapi/file_system_url_loader_factory.cc b/content/browser/fileapi/file_system_url_loader_factory.cc
index 4d6e73d2..0b52ec4c 100644
--- a/content/browser/fileapi/file_system_url_loader_factory.cc
+++ b/content/browser/fileapi/file_system_url_loader_factory.cc
@@ -40,10 +40,10 @@
 #include "net/http/http_util.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/mojom/url_loader.mojom.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using filesystem::mojom::DirectoryEntry;
diff --git a/content/browser/fileapi/file_system_url_loader_factory.h b/content/browser/fileapi/file_system_url_loader_factory.h
index c00d9594..0eafc25 100644
--- a/content/browser/fileapi/file_system_url_loader_factory.h
+++ b/content/browser/fileapi/file_system_url_loader_factory.h
@@ -11,7 +11,7 @@
 #include "base/memory/ref_counted.h"
 #include "content/common/content_export.h"
 #include "services/network/public/mojom/url_loader_factory.mojom.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace content {
 
diff --git a/content/browser/fileapi/file_system_url_loader_factory_browsertest.cc b/content/browser/fileapi/file_system_url_loader_factory_browsertest.cc
index fda4523..9211e18 100644
--- a/content/browser/fileapi/file_system_url_loader_factory_browsertest.cc
+++ b/content/browser/fileapi/file_system_url_loader_factory_browsertest.cc
@@ -31,12 +31,12 @@
 #include "services/network/public/cpp/shared_url_loader_factory.h"
 #include "services/network/public/mojom/url_loader_factory.mojom.h"
 #include "services/network/test/test_url_loader_client.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_backend.h"
diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc
index e9d1db7a..0c126cf 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -50,9 +50,9 @@
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "net/url_request/url_request_context.h"
 #include "storage/browser/blob/blob_data_handle.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_writer_delegate.h"
-#include "storage/browser/fileapi/local_file_stream_writer.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_writer_delegate.h"
+#include "storage/browser/file_system/local_file_stream_writer.h"
 #include "storage/common/database/database_identifier.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "third_party/blink/public/common/indexeddb/indexeddb_key_range.h"
diff --git a/content/browser/media/cdm_file_impl.cc b/content/browser/media/cdm_file_impl.cc
index 0e62e90d..44f5866 100644
--- a/content/browser/media/cdm_file_impl.cc
+++ b/content/browser/media/cdm_file_impl.cc
@@ -19,11 +19,11 @@
 #include "media/base/bind_to_current_loop.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/fileapi/file_system_types.h"
 
diff --git a/content/browser/media/cdm_file_impl.h b/content/browser/media/cdm_file_impl.h
index 48b5398..a0889c0 100644
--- a/content/browser/media/cdm_file_impl.h
+++ b/content/browser/media/cdm_file_impl.h
@@ -17,7 +17,7 @@
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
 #include "media/mojo/mojom/cdm_storage.mojom.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 #include "url/origin.h"
 
 namespace storage {
diff --git a/content/browser/media/cdm_storage_impl.cc b/content/browser/media/cdm_storage_impl.cc
index c15e497..90c54bc 100644
--- a/content/browser/media/cdm_storage_impl.cc
+++ b/content/browser/media/cdm_storage_impl.cc
@@ -18,9 +18,9 @@
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/storage_partition.h"
 #include "ppapi/shared_impl/ppapi_constants.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "url/origin.h"
diff --git a/content/browser/media/media_interface_proxy.cc b/content/browser/media/media_interface_proxy.cc
index 2abb7e49..2f9977a 100644
--- a/content/browser/media/media_interface_proxy.cc
+++ b/content/browser/media/media_interface_proxy.cc
@@ -157,11 +157,11 @@
 }
 
 void MediaInterfaceProxy::CreateVideoDecoder(
-    media::mojom::VideoDecoderRequest request) {
+    mojo::PendingReceiver<media::mojom::VideoDecoder> receiver) {
   DCHECK(thread_checker_.CalledOnValidThread());
   InterfaceFactory* factory = media_interface_factory_ptr_->Get();
   if (factory)
-    factory->CreateVideoDecoder(std::move(request));
+    factory->CreateVideoDecoder(std::move(receiver));
 }
 
 void MediaInterfaceProxy::CreateDefaultRenderer(
diff --git a/content/browser/media/media_interface_proxy.h b/content/browser/media/media_interface_proxy.h
index 0b003eebc..fe04fe3 100644
--- a/content/browser/media/media_interface_proxy.h
+++ b/content/browser/media/media_interface_proxy.h
@@ -51,7 +51,8 @@
   // media::mojom::InterfaceFactory implementation.
   void CreateAudioDecoder(
       mojo::PendingReceiver<media::mojom::AudioDecoder> receiver) final;
-  void CreateVideoDecoder(media::mojom::VideoDecoderRequest request) final;
+  void CreateVideoDecoder(
+      mojo::PendingReceiver<media::mojom::VideoDecoder> receiver) final;
   void CreateDefaultRenderer(const std::string& audio_device_id,
                              media::mojom::RendererRequest request) final;
 #if BUILDFLAG(ENABLE_CAST_RENDERER)
diff --git a/content/browser/media/video_decoder_proxy.cc b/content/browser/media/video_decoder_proxy.cc
index 8217faf6..84fbb79 100644
--- a/content/browser/media/video_decoder_proxy.cc
+++ b/content/browser/media/video_decoder_proxy.cc
@@ -34,12 +34,12 @@
     mojo::PendingReceiver<media::mojom::AudioDecoder> receiver) {}
 
 void VideoDecoderProxy::CreateVideoDecoder(
-    media::mojom::VideoDecoderRequest request) {
+    mojo::PendingReceiver<media::mojom::VideoDecoder> receiver) {
   DVLOG(2) << __func__;
   DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
   InterfaceFactory* factory = GetMediaInterfaceFactory();
   if (factory)
-    factory->CreateVideoDecoder(std::move(request));
+    factory->CreateVideoDecoder(std::move(receiver));
 }
 
 void VideoDecoderProxy::CreateDefaultRenderer(
diff --git a/content/browser/media/video_decoder_proxy.h b/content/browser/media/video_decoder_proxy.h
index bb939801..5f51b05 100644
--- a/content/browser/media/video_decoder_proxy.h
+++ b/content/browser/media/video_decoder_proxy.h
@@ -32,7 +32,8 @@
   // media::mojom::InterfaceFactory implementation.
   void CreateAudioDecoder(
       mojo::PendingReceiver<media::mojom::AudioDecoder> receiver) final;
-  void CreateVideoDecoder(media::mojom::VideoDecoderRequest request) final;
+  void CreateVideoDecoder(
+      mojo::PendingReceiver<media::mojom::VideoDecoder> receiver) final;
   void CreateDefaultRenderer(const std::string& audio_device_id,
                              media::mojom::RendererRequest request) final;
 #if BUILDFLAG(ENABLE_CAST_RENDERER)
diff --git a/content/browser/native_file_system/README.md b/content/browser/native_file_system/README.md
index fef0319..baa8778 100644
--- a/content/browser/native_file_system/README.md
+++ b/content/browser/native_file_system/README.md
@@ -7,7 +7,7 @@
 
 ## Related directories
 
-[`//storage/browser/fileapi/`](../../../storage/browser/fileapi) contains the
+[`//storage/browser/file_system/`](../../../storage/browser/file_system) contains the
 backend this API is built on top of,
 [`blink/renderer/modules/native_file_system`](../../../third_party/blink/renderer/modules/native_file_system)
 contains the renderer side implementation and
diff --git a/content/browser/native_file_system/file_system_chooser.cc b/content/browser/native_file_system/file_system_chooser.cc
index 7b83ed3..699bbca 100644
--- a/content/browser/native_file_system/file_system_chooser.cc
+++ b/content/browser/native_file_system/file_system_chooser.cc
@@ -18,7 +18,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/content_client.h"
 #include "net/base/mime_util.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "ui/shell_dialogs/select_file_policy.h"
 
 namespace content {
diff --git a/content/browser/native_file_system/file_system_chooser.h b/content/browser/native_file_system/file_system_chooser.h
index 029c2f3..0a773f2 100644
--- a/content/browser/native_file_system/file_system_chooser.h
+++ b/content/browser/native_file_system/file_system_chooser.h
@@ -9,7 +9,7 @@
 #include "base/files/file_path.h"
 #include "base/task_runner.h"
 #include "content/common/content_export.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_manager.mojom.h"
 #include "ui/shell_dialogs/select_file_dialog.h"
 
diff --git a/content/browser/native_file_system/native_file_system_directory_handle_impl.cc b/content/browser/native_file_system/native_file_system_directory_handle_impl.cc
index 6307267..21c113d 100644
--- a/content/browser/native_file_system/native_file_system_directory_handle_impl.cc
+++ b/content/browser/native_file_system/native_file_system_directory_handle_impl.cc
@@ -12,8 +12,8 @@
 #include "content/browser/native_file_system/native_file_system_transfer_token_impl.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "net/base/escape.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_error.mojom.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_file_handle.mojom.h"
diff --git a/content/browser/native_file_system/native_file_system_directory_handle_impl.h b/content/browser/native_file_system/native_file_system_directory_handle_impl.h
index 21f71bbd..f31691c 100644
--- a/content/browser/native_file_system/native_file_system_directory_handle_impl.h
+++ b/content/browser/native_file_system/native_file_system_directory_handle_impl.h
@@ -11,7 +11,7 @@
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "content/browser/native_file_system/native_file_system_handle_base.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_directory_handle.mojom.h"
 
 namespace content {
diff --git a/content/browser/native_file_system/native_file_system_file_handle_impl.cc b/content/browser/native_file_system/native_file_system_file_handle_impl.cc
index b574e25c..398874a 100644
--- a/content/browser/native_file_system/native_file_system_file_handle_impl.cc
+++ b/content/browser/native_file_system/native_file_system_file_handle_impl.cc
@@ -15,7 +15,7 @@
 #include "storage/browser/blob/blob_data_builder.h"
 #include "storage/browser/blob/blob_impl.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "third_party/blink/public/mojom/blob/blob.mojom.h"
 #include "third_party/blink/public/mojom/blob/serialized_blob.mojom.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_error.mojom.h"
diff --git a/content/browser/native_file_system/native_file_system_file_handle_impl.h b/content/browser/native_file_system/native_file_system_file_handle_impl.h
index 1bc285c6..2dcc7c0 100644
--- a/content/browser/native_file_system/native_file_system_file_handle_impl.h
+++ b/content/browser/native_file_system/native_file_system_file_handle_impl.h
@@ -11,7 +11,7 @@
 #include "content/browser/native_file_system/native_file_system_manager_impl.h"
 #include "content/common/content_export.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_file_handle.mojom.h"
 
 namespace content {
diff --git a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
index 28c50d48..66dc04d 100644
--- a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
+++ b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
@@ -19,7 +19,7 @@
 #include "net/base/net_errors.h"
 #include "net/base/test_completion_callback.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl.cc b/content/browser/native_file_system/native_file_system_file_writer_impl.cc
index 5a50abd..f359f07 100644
--- a/content/browser/native_file_system/native_file_system_file_writer_impl.cc
+++ b/content/browser/native_file_system/native_file_system_file_writer_impl.cc
@@ -13,7 +13,7 @@
 #include "content/public/common/content_client.h"
 #include "crypto/secure_hash.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "third_party/blink/public/common/blob/blob_utils.h"
 #include "third_party/blink/public/mojom/blob/blob.mojom.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_error.mojom.h"
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl.h b/content/browser/native_file_system/native_file_system_file_writer_impl.h
index 797cb4a..3aa0bca8 100644
--- a/content/browser/native_file_system/native_file_system_file_writer_impl.h
+++ b/content/browser/native_file_system/native_file_system_file_writer_impl.h
@@ -13,7 +13,7 @@
 #include "content/common/content_export.h"
 #include "content/public/browser/native_file_system_permission_context.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_file_writer.mojom.h"
 
 namespace content {
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
index dc9292a7..9b393b7 100644
--- a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
+++ b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
@@ -25,7 +25,7 @@
 #include "storage/browser/blob/blob_data_builder.h"
 #include "storage/browser/blob/blob_impl.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/native_file_system/native_file_system_handle_base.h b/content/browser/native_file_system/native_file_system_handle_base.h
index 025e80ed..c467df2 100644
--- a/content/browser/native_file_system/native_file_system_handle_base.h
+++ b/content/browser/native_file_system/native_file_system_handle_base.h
@@ -12,9 +12,9 @@
 #include "base/threading/sequence_bound.h"
 #include "content/browser/native_file_system/native_file_system_manager_impl.h"
 #include "content/common/content_export.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
 
 namespace storage {
diff --git a/content/browser/native_file_system/native_file_system_manager_impl.cc b/content/browser/native_file_system/native_file_system_manager_impl.cc
index 7b3b4c47..1750a44 100644
--- a/content/browser/native_file_system/native_file_system_manager_impl.cc
+++ b/content/browser/native_file_system/native_file_system_manager_impl.cc
@@ -22,10 +22,10 @@
 #include "content/public/common/content_switches.h"
 #include "mojo/public/cpp/bindings/callback_helpers.h"
 #include "services/network/public/cpp/is_potentially_trustworthy.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/blink/public/common/features.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_error.mojom.h"
diff --git a/content/browser/native_file_system/native_file_system_manager_impl.h b/content/browser/native_file_system/native_file_system_manager_impl.h
index 1138f36..2fb3a885 100644
--- a/content/browser/native_file_system/native_file_system_manager_impl.h
+++ b/content/browser/native_file_system/native_file_system_manager_impl.h
@@ -19,7 +19,7 @@
 #include "mojo/public/cpp/bindings/receiver_set.h"
 #include "mojo/public/cpp/bindings/remote.h"
 #include "mojo/public/cpp/bindings/unique_receiver_set.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_file_writer.mojom.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_manager.mojom.h"
 #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
diff --git a/content/browser/native_file_system/native_file_system_transfer_token_impl.h b/content/browser/native_file_system/native_file_system_transfer_token_impl.h
index 31649d8..a8394065 100644
--- a/content/browser/native_file_system/native_file_system_transfer_token_impl.h
+++ b/content/browser/native_file_system/native_file_system_transfer_token_impl.h
@@ -8,8 +8,8 @@
 #include "content/browser/native_file_system/native_file_system_manager_impl.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/receiver.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "third_party/blink/public/mojom/native_file_system/native_file_system_transfer_token.mojom.h"
 
 namespace content {
diff --git a/content/browser/plugin_private_storage_helper.cc b/content/browser/plugin_private_storage_helper.cc
index cb1f385..8ba8c87 100644
--- a/content/browser/plugin_private_storage_helper.cc
+++ b/content/browser/plugin_private_storage_helper.cc
@@ -25,11 +25,11 @@
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
 #include "ppapi/shared_impl/ppapi_constants.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
 #include "storage/browser/quota/special_storage_policy.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/content/browser/renderer_host/DEPS b/content/browser/renderer_host/DEPS
index 752e437d..bc4e7b7 100644
--- a/content/browser/renderer_host/DEPS
+++ b/content/browser/renderer_host/DEPS
@@ -33,6 +33,7 @@
   ],
   "render_process_host_impl\.cc": [
     "+content/browser/frame_host/render_frame_message_filter.h",
+    "+google_apis/gaia/gaia_switches.h",
     # TODO(crbug.com/734668): Dependencies on ozone should be removed, as content
     # embedded in mus won't be able to talk to the native ozone.
     "+ui/ozone/public/ozone_switches.h",
diff --git a/content/browser/renderer_host/media/audio_service_listener.cc b/content/browser/renderer_host/media/audio_service_listener.cc
index b46c804..bcef6c6 100644
--- a/content/browser/renderer_host/media/audio_service_listener.cc
+++ b/content/browser/renderer_host/media/audio_service_listener.cc
@@ -88,21 +88,20 @@
 
 AudioServiceListener::AudioServiceListener(
     std::unique_ptr<service_manager::Connector> connector)
-    : binding_(this),
-      connector_(std::move(connector)),
+    : connector_(std::move(connector)),
       metrics_(base::DefaultTickClock::GetInstance()) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_);
   if (!connector_)
     return;  // Happens in unittests.
 
-  service_manager::mojom::ServiceManagerPtr service_manager;
-  connector_->BindInterface(service_manager::mojom::kServiceName,
-                            &service_manager);
-  service_manager::mojom::ServiceManagerListenerPtr listener;
-  service_manager::mojom::ServiceManagerListenerRequest request(
-      mojo::MakeRequest(&listener));
+  mojo::Remote<service_manager::mojom::ServiceManager> service_manager;
+  connector_->Connect(service_manager::mojom::kServiceName,
+                      service_manager.BindNewPipeAndPassReceiver());
+  mojo::PendingRemote<service_manager::mojom::ServiceManagerListener> listener;
+  mojo::PendingReceiver<service_manager::mojom::ServiceManagerListener> request(
+      listener.InitWithNewPipeAndPassReceiver());
   service_manager->AddListener(std::move(listener));
-  binding_.Bind(std::move(request));
+  receiver_.Bind(std::move(request));
 }
 
 AudioServiceListener::~AudioServiceListener() {
diff --git a/content/browser/renderer_host/media/audio_service_listener.h b/content/browser/renderer_host/media/audio_service_listener.h
index e2b6db1..fa5a8891 100644
--- a/content/browser/renderer_host/media/audio_service_listener.h
+++ b/content/browser/renderer_host/media/audio_service_listener.h
@@ -13,7 +13,7 @@
 #include "base/process/process_handle.h"
 #include "base/time/time.h"
 #include "content/common/content_export.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/receiver.h"
 #include "services/service_manager/public/cpp/connector.h"
 #include "services/service_manager/public/cpp/identity.h"
 #include "services/service_manager/public/mojom/service_manager.mojom.h"
@@ -90,7 +90,8 @@
 
   void MaybeSetLogFactory();
 
-  mojo::Binding<service_manager::mojom::ServiceManagerListener> binding_;
+  mojo::Receiver<service_manager::mojom::ServiceManagerListener> receiver_{
+      this};
   std::unique_ptr<service_manager::Connector> connector_;
   base::Optional<service_manager::Identity> current_instance_identity_;
   base::Optional<service_manager::mojom::InstanceState> current_instance_state_;
diff --git a/content/browser/renderer_host/pepper/pepper_file_io_host.cc b/content/browser/renderer_host/pepper/pepper_file_io_host.cc
index 4b5e7a1e..716be7d 100644
--- a/content/browser/renderer_host/pepper/pepper_file_io_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_file_io_host.cc
@@ -30,10 +30,10 @@
 #include "ppapi/shared_impl/file_system_util.h"
 #include "ppapi/shared_impl/file_type_conversion.h"
 #include "ppapi/shared_impl/time_conversion.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace content {
diff --git a/content/browser/renderer_host/pepper/pepper_file_io_host.h b/content/browser/renderer_host/pepper/pepper_file_io_host.h
index ce37e89f..6abb723 100644
--- a/content/browser/renderer_host/pepper/pepper_file_io_host.h
+++ b/content/browser/renderer_host/pepper/pepper_file_io_host.h
@@ -24,7 +24,7 @@
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
 #include "ppapi/shared_impl/file_io_state_manager.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/content/browser/renderer_host/pepper/pepper_file_ref_host.cc b/content/browser/renderer_host/pepper/pepper_file_ref_host.cc
index 8af8c58..8552f1f 100644
--- a/content/browser/renderer_host/pepper/pepper_file_ref_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_file_ref_host.cc
@@ -17,7 +17,7 @@
 #include "ppapi/host/ppapi_host.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/file_ref_util.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
+#include "storage/browser/file_system/file_permission_policy.h"
 
 using ppapi::host::ResourceHost;
 
diff --git a/content/browser/renderer_host/pepper/pepper_file_ref_host.h b/content/browser/renderer_host/pepper/pepper_file_ref_host.h
index d5a6e56..875559b0 100644
--- a/content/browser/renderer_host/pepper/pepper_file_ref_host.h
+++ b/content/browser/renderer_host/pepper/pepper_file_ref_host.h
@@ -18,7 +18,7 @@
 #include "ppapi/c/pp_time.h"
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace content {
 class PepperFileRefHost;
diff --git a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
index 49bc08ce..236bcd9 100644
--- a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
@@ -24,8 +24,8 @@
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/file_system_util.h"
 #include "ppapi/shared_impl/file_type_conversion.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
index 57c1eec..9ac9817 100644
--- a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
+++ b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
@@ -21,7 +21,7 @@
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
 #include "ppapi/shared_impl/file_growth.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "url/gurl.h"
 
 namespace content {
diff --git a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
index 63def00f..12b1f5e 100644
--- a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
+++ b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
@@ -36,9 +36,9 @@
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_file_ref_api.h"
 #include "ppapi/thunk/ppb_file_system_api.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using ppapi::host::PpapiHost;
diff --git a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h
index 8935298..811afec 100644
--- a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h
+++ b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h
@@ -15,9 +15,9 @@
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_time.h"
 #include "ppapi/host/ppapi_host.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace content {
 
diff --git a/content/browser/renderer_host/pepper/pepper_security_helper.h b/content/browser/renderer_host/pepper/pepper_security_helper.h
index 790b4cf..4608f80 100644
--- a/content/browser/renderer_host/pepper/pepper_security_helper.h
+++ b/content/browser/renderer_host/pepper/pepper_security_helper.h
@@ -7,7 +7,7 @@
 
 #include "base/files/file_path.h"
 #include "content/common/content_export.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace content {
 
diff --git a/content/browser/renderer_host/pepper/quota_reservation.cc b/content/browser/renderer_host/pepper/quota_reservation.cc
index fda5455..eb9ae9b4 100644
--- a/content/browser/renderer_host/pepper/quota_reservation.cc
+++ b/content/browser/renderer_host/pepper/quota_reservation.cc
@@ -11,9 +11,9 @@
 #include "base/task/post_task.h"
 #include "content/public/browser/browser_task_traits.h"
 #include "content/public/browser/browser_thread.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/quota/open_file_handle.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/quota/open_file_handle.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace content {
diff --git a/content/browser/renderer_host/pepper/quota_reservation.h b/content/browser/renderer_host/pepper/quota_reservation.h
index 84a5f90..cf2c24c2 100644
--- a/content/browser/renderer_host/pepper/quota_reservation.h
+++ b/content/browser/renderer_host/pepper/quota_reservation.h
@@ -12,7 +12,7 @@
 #include "content/common/content_export.h"
 #include "ppapi/c/pp_stdint.h"  // For int64_t on Windows.
 #include "ppapi/shared_impl/file_growth.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "url/gurl.h"
 
 namespace storage {
diff --git a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
index 6130acc..b6b864e 100644
--- a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
+++ b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
@@ -19,7 +19,7 @@
 #include "base/single_thread_task_runner.h"
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/origin.h"
 
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index e25b8ee..89d5e31d 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -179,6 +179,7 @@
 #include "content/public/common/url_constants.h"
 #include "content/public/common/web_preferences.h"
 #include "device/gamepad/gamepad_haptics_manager.h"
+#include "google_apis/gaia/gaia_switches.h"
 #include "gpu/GLES2/gl2extchromium.h"
 #include "gpu/command_buffer/client/gpu_switches.h"
 #include "gpu/command_buffer/common/context_creation_attribs.h"
@@ -215,7 +216,7 @@
 #include "services/service_manager/sandbox/switches.h"
 #include "services/service_manager/zygote/common/zygote_buildflags.h"
 #include "storage/browser/database/database_tracker.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 #include "third_party/blink/public/common/page/launching_process_state.h"
 #include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
 #include "third_party/blink/public/public_buildflags.h"
@@ -3079,6 +3080,7 @@
     switches::kForceOverlayFullscreenVideo,
     switches::kForceVideoOverlays,
     switches::kFullMemoryCrashReport,
+    switches::kGaiaUrl,
     switches::kIPCConnectionTimeout,
     switches::kJavaScriptFlags,
     switches::kLogBestEffortTasks,
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 0cdd7417..5855462 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -100,7 +100,7 @@
 #include "net/base/filename_util.h"
 #include "skia/ext/image_operations.h"
 #include "skia/ext/platform_canvas.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "third_party/blink/public/web/web_ime_text_span.h"
 #include "ui/base/clipboard/clipboard_constants.h"
 #include "ui/base/ui_base_switches.h"
diff --git a/content/browser/service_manager/service_manager_context_browsertest.cc b/content/browser/service_manager/service_manager_context_browsertest.cc
index ce39c6f..15dd1ef 100644
--- a/content/browser/service_manager/service_manager_context_browsertest.cc
+++ b/content/browser/service_manager/service_manager_context_browsertest.cc
@@ -83,17 +83,19 @@
 
 IN_PROC_BROWSER_TEST_F(ServiceManagerContextBrowserTest,
                        ServiceProcessReportsPID) {
-  service_manager::mojom::ServiceManagerListenerPtr listener_proxy;
-  ServiceInstanceListener listener(mojo::MakeRequest(&listener_proxy));
+  mojo::Remote<service_manager::mojom::ServiceManager> service_manager;
+  GetSystemConnector()->Connect(service_manager::mojom::kServiceName,
+                                service_manager.BindNewPipeAndPassReceiver());
 
-  auto* connector = GetSystemConnector();
-  service_manager::mojom::ServiceManagerPtr service_manager;
-  connector->BindInterface(service_manager::mojom::kServiceName,
-                           &service_manager);
+  mojo::PendingRemote<service_manager::mojom::ServiceManagerListener>
+      listener_proxy;
+  ServiceInstanceListener listener(
+      listener_proxy.InitWithNewPipeAndPassReceiver());
+
   service_manager->AddListener(std::move(listener_proxy));
   listener.WaitForInit();
 
-  connector->WarmService(service_manager::ServiceFilter::ByName(
+  GetSystemConnector()->WarmService(service_manager::ServiceFilter::ByName(
       data_decoder::mojom::kServiceName));
 
   // PID should be non-zero, confirming that it was indeed properly reported to
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc
index de9c8f5..12be13c 100644
--- a/content/browser/storage_partition_impl_unittest.cc
+++ b/content/browser/storage_partition_impl_unittest.cc
@@ -48,10 +48,10 @@
 
 #if BUILDFLAG(ENABLE_PLUGINS)
 #include "ppapi/shared_impl/ppapi_constants.h"  // nogncheck
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_util.h"
 #endif  // BUILDFLAG(ENABLE_PLUGINS)
 
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 73179d6..594eea04 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -37,7 +37,7 @@
 #include "services/network/public/mojom/restricted_cookie_manager.mojom-forward.h"
 #include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
 #include "services/network/public/mojom/websocket.mojom-forward.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
 #include "third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-forward.h"
 #include "third_party/blink/public/mojom/web_feature/web_feature.mojom-forward.h"
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index 6412ca48..1ce760d5 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -115,7 +115,7 @@
 #include "services/network/public/mojom/network_service.mojom.h"
 #include "services/network/public/mojom/network_service_test.mojom.h"
 #include "services/service_manager/public/cpp/connector.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "testing/gmock/include/gmock/gmock-matchers.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/blink/public/mojom/filesystem/file_system.mojom.h"
diff --git a/content/public/test/test_fileapi_operation_waiter.h b/content/public/test/test_fileapi_operation_waiter.h
index 18313fa..4b5a39a 100644
--- a/content/public/test/test_fileapi_operation_waiter.h
+++ b/content/public/test/test_fileapi_operation_waiter.h
@@ -11,7 +11,7 @@
 #include "base/files/file.h"
 #include "base/macros.h"
 #include "base/run_loop.h"
-#include "storage/browser/fileapi/file_observers.h"
+#include "storage/browser/file_system/file_observers.h"
 #include "third_party/blink/public/mojom/filesystem/file_system.mojom.h"
 
 namespace content {
diff --git a/content/public/test/throttling_url_loader_test_util.cc b/content/public/test/throttling_url_loader_test_util.cc
deleted file mode 100644
index ca476bc..0000000
--- a/content/public/test/throttling_url_loader_test_util.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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 "content/public/test/throttling_url_loader_test_util.h"
-
-#include <utility>
-
-#include "content/common/throttling_url_loader.h"
-
-namespace content {
-
-std::unique_ptr<network::mojom::URLLoaderClient> CreateThrottlingLoaderAndStart(
-    scoped_refptr<network::SharedURLLoaderFactory> factory,
-    std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles,
-    int32_t routing_id,
-    int32_t request_id,
-    uint32_t options,
-    network::ResourceRequest* url_request,
-    network::mojom::URLLoaderClient* client,
-    const net::NetworkTrafficAnnotationTag& traffic_annotation,
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
-  return ThrottlingURLLoader::CreateLoaderAndStart(
-      std::move(factory), std::move(throttles), routing_id, request_id, options,
-      url_request, client, traffic_annotation, std::move(task_runner));
-}
-
-}  // namespace content
diff --git a/content/public/test/throttling_url_loader_test_util.h b/content/public/test/throttling_url_loader_test_util.h
deleted file mode 100644
index f8cf30b4..0000000
--- a/content/public/test/throttling_url_loader_test_util.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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 CONTENT_PUBLIC_TEST_THROTTLING_URL_LOADER_TEST_UTIL_H_
-#define CONTENT_PUBLIC_TEST_THROTTLING_URL_LOADER_TEST_UTIL_H_
-
-#include <memory>
-#include <vector>
-
-#include "base/memory/scoped_refptr.h"
-#include "base/single_thread_task_runner.h"
-#include "services/network/public/cpp/shared_url_loader_factory.h"
-#include "third_party/blink/public/common/loader/url_loader_throttle.h"
-
-namespace content {
-
-// Allows tests outside of content to interface with a ThrottlingURLLoader.
-std::unique_ptr<network::mojom::URLLoaderClient> CreateThrottlingLoaderAndStart(
-    scoped_refptr<network::SharedURLLoaderFactory> factory,
-    std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles,
-    int32_t routing_id,
-    int32_t request_id,
-    uint32_t options,
-    network::ResourceRequest* url_request,
-    network::mojom::URLLoaderClient* client,
-    const net::NetworkTrafficAnnotationTag& traffic_annotation,
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner);
-
-}  // namespace content
-
-#endif  // CONTENT_PUBLIC_TEST_THROTTLING_URL_LOADER_TEST_UTIL_H_
diff --git a/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc b/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc
index 859fd45..2c8cf325 100644
--- a/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc
+++ b/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.cc
@@ -31,6 +31,7 @@
 #include "media/mojo/clients/mojo_video_encode_accelerator.h"
 #include "media/video/video_encode_accelerator.h"
 #include "mojo/public/cpp/base/shared_memory_utils.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
 #include "services/viz/public/cpp/gpu/context_provider_command_buffer.h"
 #include "third_party/skia/include/core/SkPostConfig.h"
 
@@ -129,7 +130,8 @@
   // (a) saves an ipc call, and (b) makes the return of those configs atomic.
   // Otherwise, we might have received configs for kDefault but not yet
   // kAlternate, for example.
-  interface_factory_->CreateVideoDecoder(mojo::MakeRequest(&video_decoder_));
+  interface_factory_->CreateVideoDecoder(
+      video_decoder_.BindNewPipeAndPassReceiver());
   video_decoder_->GetSupportedConfigs(base::BindOnce(
       &GpuVideoAcceleratorFactoriesImpl::OnSupportedDecoderConfigs,
       base::Unretained(this)));
@@ -236,8 +238,9 @@
   if (CheckContextLost())
     return nullptr;
 
-  media::mojom::VideoDecoderPtr video_decoder;
-  interface_factory_->CreateVideoDecoder(mojo::MakeRequest(&video_decoder));
+  mojo::PendingRemote<media::mojom::VideoDecoder> video_decoder;
+  interface_factory_->CreateVideoDecoder(
+      video_decoder.InitWithNewPipeAndPassReceiver());
   return std::make_unique<media::MojoVideoDecoder>(
       task_runner_, this, media_log, std::move(video_decoder), implementation,
       request_overlay_info_cb, rendering_color_space_);
diff --git a/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.h b/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.h
index cbfce86..5c7b5833 100644
--- a/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.h
+++ b/content/renderer/media/gpu/gpu_video_accelerator_factories_impl.h
@@ -27,6 +27,7 @@
 #include "media/mojo/mojom/video_encode_accelerator.mojom.h"
 #include "media/video/gpu_video_accelerator_factories.h"
 #include "media/video/supported_video_decoder_config.h"
+#include "mojo/public/cpp/bindings/remote.h"
 #include "ui/gfx/geometry/size.h"
 
 namespace gpu {
@@ -178,7 +179,7 @@
   media::mojom::VideoEncodeAcceleratorProviderPtr vea_provider_;
 
   // SupportedDecoderConfigs state.
-  mojo::InterfacePtr<media::mojom::VideoDecoder> video_decoder_;
+  mojo::Remote<media::mojom::VideoDecoder> video_decoder_;
   base::Lock supported_decoder_configs_lock_;
   // If the Optional is empty, then we have not yet gotten the configs.  If the
   // Optional contains an empty vector, then we have gotten the result and there
diff --git a/content/renderer/media/media_interface_factory.cc b/content/renderer/media/media_interface_factory.cc
index db4ab44..b2c485d 100644
--- a/content/renderer/media/media_interface_factory.cc
+++ b/content/renderer/media/media_interface_factory.cc
@@ -40,16 +40,16 @@
 }
 
 void MediaInterfaceFactory::CreateVideoDecoder(
-    media::mojom::VideoDecoderRequest request) {
+    mojo::PendingReceiver<media::mojom::VideoDecoder> receiver) {
   if (!task_runner_->BelongsToCurrentThread()) {
     task_runner_->PostTask(
         FROM_HERE, base::BindOnce(&MediaInterfaceFactory::CreateVideoDecoder,
-                                  weak_this_, std::move(request)));
+                                  weak_this_, std::move(receiver)));
     return;
   }
 
   DVLOG(1) << __func__;
-  GetMediaInterfaceFactory()->CreateVideoDecoder(std::move(request));
+  GetMediaInterfaceFactory()->CreateVideoDecoder(std::move(receiver));
 }
 
 void MediaInterfaceFactory::CreateDefaultRenderer(
diff --git a/content/renderer/media/media_interface_factory.h b/content/renderer/media/media_interface_factory.h
index 45a5460..36b188a 100644
--- a/content/renderer/media/media_interface_factory.h
+++ b/content/renderer/media/media_interface_factory.h
@@ -36,7 +36,8 @@
   // media::mojom::InterfaceFactory implementation.
   void CreateAudioDecoder(
       mojo::PendingReceiver<media::mojom::AudioDecoder> receiver) final;
-  void CreateVideoDecoder(media::mojom::VideoDecoderRequest request) final;
+  void CreateVideoDecoder(
+      mojo::PendingReceiver<media::mojom::VideoDecoder> receiver) final;
   void CreateDefaultRenderer(const std::string& audio_device_id,
                              media::mojom::RendererRequest request) final;
 #if BUILDFLAG(ENABLE_CAST_RENDERER)
diff --git a/content/shell/browser/web_test/web_test_message_filter.cc b/content/shell/browser/web_test/web_test_message_filter.cc
index ad39d63b..25bf7af0 100644
--- a/content/shell/browser/web_test/web_test_message_filter.cc
+++ b/content/shell/browser/web_test/web_test_message_filter.cc
@@ -31,7 +31,7 @@
 #include "net/base/net_errors.h"
 #include "services/network/public/mojom/network_service.mojom.h"
 #include "storage/browser/database/database_tracker.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "url/origin.h"
 
diff --git a/content/shell/test_runner/test_interfaces.cc b/content/shell/test_runner/test_interfaces.cc
index 7f0ac1b..f1e1611 100644
--- a/content/shell/test_runner/test_interfaces.cc
+++ b/content/shell/test_runner/test_interfaces.cc
@@ -137,9 +137,6 @@
     return;
   }
   window_list_.erase(pos);
-
-  if (proxy->webview() == main_view_)
-    SetMainView(nullptr);
 }
 
 TestRunner* TestInterfaces::GetTestRunner() {
diff --git a/content/shell/test_runner/web_view_test_proxy.cc b/content/shell/test_runner/web_view_test_proxy.cc
index 05d3cfca..4925748 100644
--- a/content/shell/test_runner/web_view_test_proxy.cc
+++ b/content/shell/test_runner/web_view_test_proxy.cc
@@ -101,8 +101,10 @@
 
 WebViewTestProxy::~WebViewTestProxy() {
   test_interfaces_->WindowClosed(this);
-  if (test_interfaces_->GetDelegate() == delegate_.get())
+  if (test_interfaces_->GetDelegate() == delegate_.get()) {
     test_interfaces_->SetDelegate(nullptr);
+    test_interfaces_->SetMainView(nullptr);
+  }
 }
 
 TestRunner* WebViewTestProxy::GetTestRunner() {
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 55e1e42..2365fcf 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -228,8 +228,6 @@
     "../public/test/text_input_test_utils.cc",
     "../public/test/text_input_test_utils.h",
     "../public/test/text_input_test_utils_mac.mm",
-    "../public/test/throttling_url_loader_test_util.cc",
-    "../public/test/throttling_url_loader_test_util.h",
     "../public/test/unittest_test_suite.cc",
     "../public/test/unittest_test_suite.h",
     "../public/test/url_loader_interceptor.cc",
diff --git a/docs/chromoting_android_hacking.md b/docs/chromoting_android_hacking.md
index 4ff112f..0bae0f3 100644
--- a/docs/chromoting_android_hacking.md
+++ b/docs/chromoting_android_hacking.md
@@ -80,8 +80,6 @@
 <classpathentry kind="src" path="remoting/android/java/src"/>
 <classpathentry kind="src" path="remoting/android/apk/src"/>
 <classpathentry kind="src" path="remoting/android/javatests/src"/>
-<classpathentry kind="src" path="third_party/blink/renderer/devtools/scripts/jsdoc-validator/src"/>
-<classpathentry kind="src" path="third_party/blink/renderer/devtools/scripts/compiler-runner/src"/>
 <classpathentry kind="src" path="third_party/webrtc/voice_engine/test/android/android_test/src"/>
 <classpathentry kind="src" path="third_party/webrtc/modules/video_capture/android/java/src"/>
 <classpathentry kind="src" path="third_party/webrtc/modules/video_render/android/java/src"/>
diff --git a/docs/ui/ui_devtools/index.md b/docs/ui/ui_devtools/index.md
index 29dc0a47..79bf4d5 100644
--- a/docs/ui/ui_devtools/index.md
+++ b/docs/ui/ui_devtools/index.md
@@ -5,7 +5,7 @@
 
 * [Old Ash Doc](https://www.chromium.org/developers/how-tos/inspecting-ash)
 * [Backend Source Code](https://cs.chromium.org/chromium/src/components/ui_devtools/)
-* [Inspector Frontend Source Code](https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/)
+* [Inspector Frontend Source Code](https://chromium.googlesource.com/devtools/devtools-frontend)
 
 ## How to run
 
diff --git a/docs/workflow/debugging-with-swarming.md b/docs/workflow/debugging-with-swarming.md
index 2de606e..6b62a72 100644
--- a/docs/workflow/debugging-with-swarming.md
+++ b/docs/workflow/debugging-with-swarming.md
@@ -54,6 +54,80 @@
   use_swarming_to_run(type, isolate)
 ```
 
+## The easy way
+
+A lot of the steps described in this doc have been bundled up into 2
+tools. Before using either of these you will need to
+[authenticate](#authenticating).
+
+### run-swarmed.py
+
+A lot of the logic below is wrapped up in `tools/run-swarmed.py`, which you can run
+like this:
+
+```
+$ tools/run-swarmed.py $outdir $target
+```
+
+See the `--help` option of `run-swarmed.py` for more details about that script.
+
+### mb.py run
+
+Similar to `tools/run_swarmed.py`, `mb.py run` bundles much of the logic into a
+single command line. Unlike `tools/run_swarmed.py`, `mb.py run` allows the user
+to specify extra arguments to pass to the test, but has a messier command line.
+
+To use it, run:
+```
+$ tools/mb/mb.py run \
+    -s --no-default-dimensions \
+    -d pool $pool \
+    $criteria \
+    $outdir $target \
+    -- $extra_args
+```
+
+## A concrete example
+
+Here's how to run `chrome_public_test_apk` on a bot with a Nexus 5 running KitKat.
+
+```sh
+$ tools/mb/mb.py run \
+    -s --no-default-dimensions \
+    -d pool Chrome \
+    -d device_os_type userdebug -d device_os KTU84P -d device_type hammerhead \
+    out/Android-arm-dbg chrome_public_test_apk
+```
+
+This assumes you have an `out/Android-arm-dbg/args.gn` like
+
+```
+ffmpeg_branding = "Chrome"
+is_component_build = false
+is_debug = true
+proprietary_codecs = true
+strip_absolute_paths_from_debug_symbols = true
+symbol_level = 1
+system_webview_package_name = "com.google.android.webview"
+target_os = "android"
+use_goma = true
+```
+
+## Bot selection criteria
+
+The examples in this doc use `$criteria`. To figure out what values to use, you
+can go to an existing swarming run
+([recent tasks page](https://chromium-swarm.appspot.com/tasklist)) and
+look at the `Dimensions` section. Each of these becomes a `-d dimension_name
+dimension_value` in your `$criteria`. Click on `bots` (or go
+[here](https://chromium-swarm.appspot.com/botlist)) to be taken to a UI that
+allows you to try out the criteria interactively, so that you can be sure that
+there are bots matching your criteria. Sometimes the web page shows a
+human-friendly name rather than the name required on the commandline. [This
+file](https://cs.chromium.org/chromium/infra/luci/appengine/swarming/ui2/modules/alias.js)
+contains the mapping to human-friendly names. You can test your commandline by
+entering `dimension_name:dimension_value` in the interactive UI.
+
 ## Building an isolate
 
 At the moment, you can only build an isolate locally, like so (commands you type
@@ -74,6 +148,17 @@
 Support for building an isolate using swarming, which would allow you to build
 for a platform you can't build for locally, does not yet exist.
 
+## Authenticating
+
+You may need to log in to `https://isolateserver.appspot.com` to do this:
+
+```
+$ python tools/swarming_client/auth.py login \
+      --service=https://isolateserver.appspot.com
+```
+
+Use your google.com account for this.
+
 ## Uploading an isolate
 
 You can then upload the resulting isolate to the isolate server:
@@ -85,13 +170,6 @@
       -s $outdir/$target.isolated
 ```
 
-You may need to log in to `https://isolateserver.appspot.com` to do this:
-
-```
-$ python tools/swarming_client/auth.py login \
-      --service=https://isolateserver.appspot.com
-```
-
 The `isolate.py` tool will emit something like this:
 
 ```
@@ -153,33 +231,6 @@
 produce the task's results, or you can load that URL and watch the task's
 progress.
 
-## run-swarmed.py
-
-A lot of this logic is wrapped up in `tools/run-swarmed.py`, which you can run
-like this:
-
-```
-$ tools/run-swarmed.py $outdir $target
-```
-
-See the `--help` option of `run-swarmed.py` for more details about that script.
-
-## mb.py run
-
-Similar to `tools/run_swarmed.py`, `mb.py run` bundles much of the logic into a
-single command line. Unlike `tools/run_swarmed.py`, `mb.py run` allows the user
-to specify extra arguments to pass to the test, but has a messier command line.
-
-To use it, run:
-```
-$ tools/mb/mb.py run \
-    -s --no-default-dimensions \
-    -d pool $pool \
-    $criteria \
-    $outdir $target \
-    -- $extra_args
-```
-
 ## Other notes
 
 If you are looking at a Swarming task page, be sure to check the bottom of the
diff --git a/extensions/browser/api/DEPS b/extensions/browser/api/DEPS
index 3ba38ad..87dbfcb4 100644
--- a/extensions/browser/api/DEPS
+++ b/extensions/browser/api/DEPS
@@ -1,7 +1,7 @@
 include_rules = [
   "+components/device_event_log",
   "+services/device/public",
-  "+storage/browser/fileapi",
+  "+storage/browser/file_system",
   "+storage/common/fileapi",
   "+ui/accessibility",
   "+ui/aura",
diff --git a/extensions/browser/api/file_handlers/app_file_handler_util.cc b/extensions/browser/api/file_handlers/app_file_handler_util.cc
index 5e1e198f..54b0376 100644
--- a/extensions/browser/api/file_handlers/app_file_handler_util.cc
+++ b/extensions/browser/api/file_handlers/app_file_handler_util.cc
@@ -24,7 +24,7 @@
 #include "extensions/browser/granted_file_entry.h"
 #include "extensions/common/permissions/permissions_data.h"
 #include "net/base/mime_util.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_types.h"
 
diff --git a/extensions/browser/api/file_handlers/directory_util.cc b/extensions/browser/api/file_handlers/directory_util.cc
index 168a4215..ed92449 100644
--- a/extensions/browser/api/file_handlers/directory_util.cc
+++ b/extensions/browser/api/file_handlers/directory_util.cc
@@ -11,7 +11,7 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "content/public/browser/browser_context.h"
 #include "net/base/filename_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 #if defined(OS_CHROMEOS)
 #include "extensions/browser/api/extensions_api_client.h"
diff --git a/extensions/browser/api/file_handlers/mime_util.cc b/extensions/browser/api/file_handlers/mime_util.cc
index b212e88d..8c406f38 100644
--- a/extensions/browser/api/file_handlers/mime_util.cc
+++ b/extensions/browser/api/file_handlers/mime_util.cc
@@ -14,7 +14,7 @@
 #include "net/base/filename_util.h"
 #include "net/base/mime_sniffer.h"
 #include "net/base/mime_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 #if defined(OS_CHROMEOS)
 #include "extensions/browser/api/extensions_api_client.h"
diff --git a/extensions/browser/api/file_system/file_system_api.cc b/extensions/browser/api/file_system/file_system_api.cc
index b809c61..aa954ba 100644
--- a/extensions/browser/api/file_system/file_system_api.cc
+++ b/extensions/browser/api/file_system/file_system_api.cc
@@ -47,10 +47,10 @@
 #include "extensions/common/permissions/api_permission.h"
 #include "extensions/common/permissions/permissions_data.h"
 #include "net/base/mime_util.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "ui/base/l10n/l10n_util.h"
diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc
index d8f9d8f..569aeb9 100644
--- a/extensions/browser/api/runtime/runtime_api.cc
+++ b/extensions/browser/api/runtime/runtime_api.cc
@@ -38,7 +38,7 @@
 #include "extensions/common/extension.h"
 #include "extensions/common/manifest_handlers/background_info.h"
 #include "extensions/common/manifest_handlers/shared_module_info.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "url/gurl.h"
 
 using content::BrowserContext;
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_d3d.cc b/gpu/command_buffer/service/shared_image_backing_factory_d3d.cc
index 100c60b..47dfb89 100644
--- a/gpu/command_buffer/service/shared_image_backing_factory_d3d.cc
+++ b/gpu/command_buffer/service/shared_image_backing_factory_d3d.cc
@@ -393,7 +393,7 @@
   desc.sampleCount = 1;
 
   texture_ =
-      dawn_native::d3d12::WrapSharedHandle(device_, &desc, shared_handle);
+      dawn_native::d3d12::WrapSharedHandle(device_, &desc, shared_handle, 0);
   if (texture_) {
     // Keep a reference to the texture so that it stays valid (its content
     // might be destroyed).
diff --git a/gpu/command_buffer/tests/webgpu_test.cc b/gpu/command_buffer/tests/webgpu_test.cc
index db56128..de660721 100644
--- a/gpu/command_buffer/tests/webgpu_test.cc
+++ b/gpu/command_buffer/tests/webgpu_test.cc
@@ -31,8 +31,7 @@
 
 bool WebGPUTest::WebGPUSharedImageSupported() const {
   // Currently WebGPUSharedImage is only implemented on Mac, Linux and Windows
-#if (defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_WIN)) && \
-    BUILDFLAG(USE_DAWN)
+#if (defined(OS_MACOSX) || defined(OS_LINUX)) && BUILDFLAG(USE_DAWN)
   return true;
 #else
   return false;
diff --git a/headless/lib/headless_browser_context_browsertest.cc b/headless/lib/headless_browser_context_browsertest.cc
index 6509a64..7fa209ea 100644
--- a/headless/lib/headless_browser_context_browsertest.cc
+++ b/headless/lib/headless_browser_context_browsertest.cc
@@ -150,25 +150,44 @@
 // TODO(https://crbug.com/930356): Re-enable test.
 DISABLED_HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessBrowserContextIsolationTest);
 
-IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, UserDataDir) {
-  // We do not want to bother with posting tasks to create a temp dir.
-  // Just allow IO from main thread for now.
+class HeadlessBrowserUserDataDirTest : public HeadlessBrowserTest {
+ protected:
+  HeadlessBrowserUserDataDirTest() = default;
+  ~HeadlessBrowserUserDataDirTest() override = default;
+  HeadlessBrowserUserDataDirTest(const HeadlessBrowserUserDataDirTest&) =
+      delete;
+  HeadlessBrowserUserDataDirTest& operator=(
+      const HeadlessBrowserUserDataDirTest&) = delete;
+
+  const base::FilePath& user_data_dir() const {
+    return user_data_dir_.GetPath();
+  }
+
+  // HeadlessBrowserTest:
+  void SetUp() override {
+    ASSERT_TRUE(user_data_dir_.CreateUniqueTempDir());
+
+    // The newly created temp directory should be empty.
+    EXPECT_TRUE(base::IsDirectoryEmpty(user_data_dir()));
+
+    HeadlessBrowserTest::SetUp();
+  }
+
+ private:
+  base::ScopedTempDir user_data_dir_;
+};
+
+IN_PROC_BROWSER_TEST_F(HeadlessBrowserUserDataDirTest, Do) {
+  // Allow IO from the main thread.
   base::ThreadRestrictions::SetIOAllowed(true);
 
   EXPECT_TRUE(embedded_test_server()->Start());
 
-  base::ScopedTempDir user_data_dir;
-  ASSERT_TRUE(user_data_dir.CreateUniqueTempDir());
-
-  // Newly created temp directory should be empty.
-  EXPECT_TRUE(base::IsDirectoryEmpty(user_data_dir.GetPath()));
-
-  HeadlessBrowserContext* browser_context =
-      browser()
-          ->CreateBrowserContextBuilder()
-          .SetUserDataDir(user_data_dir.GetPath())
-          .SetIncognitoMode(false)
-          .Build();
+  HeadlessBrowserContext* browser_context = browser()
+                                                ->CreateBrowserContextBuilder()
+                                                .SetUserDataDir(user_data_dir())
+                                                .SetIncognitoMode(false)
+                                                .Build();
 
   HeadlessWebContents* web_contents =
       browser_context->CreateWebContentsBuilder()
@@ -180,7 +199,7 @@
   // Something should be written to this directory.
   // If it is not the case, more complex page may be needed.
   // ServiceWorkers may be a good option.
-  EXPECT_FALSE(base::IsDirectoryEmpty(user_data_dir.GetPath()));
+  EXPECT_FALSE(base::IsDirectoryEmpty(user_data_dir()));
 }
 
 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, IncognitoMode) {
diff --git a/ios/chrome/browser/flags/about_flags.mm b/ios/chrome/browser/flags/about_flags.mm
index 717843fa..d7457f3 100644
--- a/ios/chrome/browser/flags/about_flags.mm
+++ b/ios/chrome/browser/flags/about_flags.mm
@@ -403,10 +403,6 @@
      FEATURE_WITH_PARAMS_VALUE_TYPE(crash_report::kDetectMainThreadFreeze,
                                     kDetectMainThreadFreezeVariations,
                                     "DetectMainThreadFreeze")},
-    {"enable-sync-uss-bookmarks",
-     flag_descriptions::kEnableSyncUSSBookmarksName,
-     flag_descriptions::kEnableSyncUSSBookmarksDescription, flags_ui::kOsIos,
-     FEATURE_VALUE_TYPE(switches::kSyncUSSBookmarks)},
     {"infobar-ui-reboot", flag_descriptions::kInfobarUIRebootName,
      flag_descriptions::kInfobarUIRebootDescription, flags_ui::kOsIos,
      FEATURE_VALUE_TYPE(kInfobarUIReboot)},
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
index 52e6d6b..1193c161 100644
--- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
+++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.cc
@@ -184,10 +184,6 @@
 const char kEnableClipboardProviderTextSuggestionsDescription[] =
     "Enable suggesting a search for text copied to the clipboard";
 
-const char kEnableSyncUSSBookmarksName[] = "Enable USS for bookmarks sync";
-const char kEnableSyncUSSBookmarksDescription[] =
-    "Enables the new, experimental implementation of bookmark sync";
-
 const char kEnableSyncUSSPasswordsName[] = "Enable USS for passwords sync";
 const char kEnableSyncUSSPasswordsDescription[] =
     "Enables the new, experimental implementation of password sync";
diff --git a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
index 341f119..d2534a7 100644
--- a/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
+++ b/ios/chrome/browser/flags/ios_chrome_flag_descriptions.h
@@ -153,9 +153,6 @@
 extern const char kEnableClipboardProviderTextSuggestionsName[];
 extern const char kEnableClipboardProviderTextSuggestionsDescription[];
 
-extern const char kEnableSyncUSSBookmarksName[];
-extern const char kEnableSyncUSSBookmarksDescription[];
-
 extern const char kEnableSyncUSSPasswordsName[];
 extern const char kEnableSyncUSSPasswordsDescription[];
 
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
index 74668f51..18053ff 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
@@ -38,6 +38,12 @@
 // amount of seconds.
 constexpr CGFloat kMinimumLoadingTime = 0.5;
 
+// Height of the section header.
+constexpr CGFloat kSectionHeaderHeight = 6;
+
+// Height of the section footer.
+constexpr CGFloat kSectionFooterHeight = 14;
+
 }  // namespace
 
 @interface FallbackViewController ()
@@ -83,8 +89,8 @@
   [super viewDidLoad];
 
   self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-  self.tableView.sectionHeaderHeight = 0;
-  self.tableView.sectionFooterHeight = 20.0;
+  self.tableView.sectionHeaderHeight = kSectionHeaderHeight;
+  self.tableView.sectionFooterHeight = kSectionFooterHeight;
   self.tableView.estimatedRowHeight = 1;
   self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
   self.tableView.allowsSelection = NO;
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm b/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm
index 2f24a46..bdeaa778 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm
@@ -110,10 +110,15 @@
 }
 
 // Tests the observer correctly identifies when the keyboard stays on screen.
-// TODO(crbug.com/1015550) keyboardDidStayOnScreen is not called on iOS13.
-- (void)DISABLED_testKeyboardDidStayOnScreen {
+- (void)testKeyboardDidStayOnScreen {
+  if (@available(iOS 13, *)) {
+    // On iOS 13 keyboardDidStayOnScreen is not called. This makes the
+    // workaround not needed anymore.
+    return;
+  }
   // Opening the keyboard from a webview blocks EarlGrey's synchronization.
   ScopedSynchronizationDisabler disabler;
+
   // Brings up the keyboard by tapping on one of the form's field.
   TapOnWebElementWithID(kFormElementID1);
 
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
index 479f8f4..5466a76 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
+++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
@@ -16,7 +16,7 @@
 static const CGFloat kChipsHorizontalMargin = -1;
 
 // The multiplier for the base system spacing at the top margin.
-static const CGFloat TopSystemSpacingMultiplier = 1.58;
+static const CGFloat TopSystemSpacingMultiplier = 2;
 
 // The multiplier for the base system spacing at the bottom margin.
 static const CGFloat BottomSystemSpacingMultiplier = 2.26;
diff --git a/ios/chrome/browser/ui/util/keyboard_observer_helper.h b/ios/chrome/browser/ui/util/keyboard_observer_helper.h
index 080d7a5..10cf6f2 100644
--- a/ios/chrome/browser/ui/util/keyboard_observer_helper.h
+++ b/ios/chrome/browser/ui/util/keyboard_observer_helper.h
@@ -30,7 +30,10 @@
 
 // Indicates that |UIKeyboardWillHideNotification| was posted but the keyboard
 // was not hidden. For example, this can happen when jumping between fields.
-- (void)keyboardDidStayOnScreen;
+// Deprecated. This is not needed on iOS 13 and will be deleted once support for
+// iOS 12 is removed.
+- (void)keyboardDidStayOnScreen API_DEPRECATED("Not needed on iOS >12",
+                                               ios(11.0, 13.0));
 
 // Indicates that the keyboard state changed, at least on one of the
 // |KeyboardState| aspects.
diff --git a/ios/chrome/browser/web/push_and_replace_state_navigation_egtest.mm b/ios/chrome/browser/web/push_and_replace_state_navigation_egtest.mm
index 7965b30..57eeeda 100644
--- a/ios/chrome/browser/web/push_and_replace_state_navigation_egtest.mm
+++ b/ios/chrome/browser/web/push_and_replace_state_navigation_egtest.mm
@@ -193,6 +193,85 @@
               pageLoaded:NO];
 }
 
+// Tests calling history.replaceState(), then history.pushState() and then
+// navigating back/forward.
+- (void)testHtml5HistoryReplaceStatePushStateThenGoBackAndForward {
+  const GURL firstReplaceStateURL = web::test::HttpServer::MakeUrl(
+      "http://ios/testing/data/http_server_files/history.html"
+      "#firstReplaceState");
+  const std::string firstReplaceStateOmniboxText =
+      net::GetContentAndFragmentForUrl(firstReplaceStateURL);
+  const GURL replaceStateThenPushStateURL = web::test::HttpServer::MakeUrl(
+      "http://ios/testing/data/http_server_files/history.html"
+      "#replaceStateThenPushState");
+  const std::string replaceStateThenPushStateOmniboxText =
+      net::GetContentAndFragmentForUrl(replaceStateThenPushStateURL);
+
+  web::test::SetUpFileBasedHttpServer();
+  [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kHistoryTestUrl)];
+
+  // Replace state and then push state. Verify that at the end, the URL changed
+  // to the pushed URL and the status was updated.
+  [ChromeEarlGrey tapWebStateElementWithID:@"replaceStateThenPushState"];
+  [self assertStatusText:@"replaceStateThenPushState"
+         withOmniboxText:replaceStateThenPushStateOmniboxText
+              pageLoaded:NO];
+
+  // Go back and check URL.
+  [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()];
+  [self assertStatusText:@"firstReplaceState"
+         withOmniboxText:firstReplaceStateOmniboxText
+              pageLoaded:NO];
+
+  // Go forward and check URL.
+  [[EarlGrey selectElementWithMatcher:ForwardButton()]
+      performAction:grey_tap()];
+  [self assertStatusText:@"replaceStateThenPushState"
+         withOmniboxText:replaceStateThenPushStateOmniboxText
+              pageLoaded:NO];
+}
+
+// Tests calling history.pushState(), then history.replaceState() and then
+// navigating back/forward.
+- (void)testHtml5HistoryPushStateReplaceStateThenGoBackAndForward {
+  const GURL firstPushStateURL = web::test::HttpServer::MakeUrl(
+      "http://ios/testing/data/http_server_files/history.html#firstPushState");
+  const std::string firstPushStateOmniboxText =
+      net::GetContentAndFragmentForUrl(firstPushStateURL);
+  const GURL pushStateThenReplaceStateURL = web::test::HttpServer::MakeUrl(
+      "http://ios/testing/data/http_server_files/history.html"
+      "#pushStateThenReplaceState");
+  const std::string pushStateThenReplaceStateOmniboxText =
+      net::GetContentAndFragmentForUrl(pushStateThenReplaceStateURL);
+
+  web::test::SetUpFileBasedHttpServer();
+
+  const GURL historyTestURL = web::test::HttpServer::MakeUrl(kHistoryTestUrl);
+  [ChromeEarlGrey loadURL:historyTestURL];
+  const std::string historyTestOmniboxText =
+      net::GetContentAndFragmentForUrl(historyTestURL);
+
+  // Push state and then replace state. Verify that at the end, the URL changed
+  // to the replaceState URL and the status was updated.
+  [ChromeEarlGrey tapWebStateElementWithID:@"pushStateThenReplaceState"];
+  [self assertStatusText:@"pushStateThenReplaceState"
+         withOmniboxText:pushStateThenReplaceStateOmniboxText
+              pageLoaded:NO];
+
+  // Go back and check URL.
+  [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()];
+  [self assertStatusText:nil
+         withOmniboxText:historyTestOmniboxText
+              pageLoaded:NO];
+
+  // Go forward and check URL.
+  [[EarlGrey selectElementWithMatcher:ForwardButton()]
+      performAction:grey_tap()];
+  [self assertStatusText:@"pushStateThenReplaceState"
+         withOmniboxText:pushStateThenReplaceStateOmniboxText
+              pageLoaded:NO];
+}
+
 // Tests that page loads occur when navigating to or past a non-pushed URL.
 - (void)testHtml5HistoryNavigatingPastNonPushedURL {
   GURL nonPushedURL = web::test::HttpServer::MakeUrl(kNonPushedUrl);
diff --git a/ios/testing/data/http_server_files/history.html b/ios/testing/data/http_server_files/history.html
index 6d08717..69f276b 100644
--- a/ios/testing/data/http_server_files/history.html
+++ b/ios/testing/data/http_server_files/history.html
@@ -40,6 +40,10 @@
     id="replaceStateRootPathSpace" onclick="replaceStateRootPathSpace()" /><br>
 <input type="button" value="replaceStatePath"
     id="replaceStatePath" onclick="replaceStatePath()" /><br>
+<input type="button" value="replaceStateThenPushState"
+    id="replaceStateThenPushState" onclick="replaceStateThenPushState()" /><br>
+<input type="button" value="pushStateThenReplaceState"
+    id="pushStateThenReplaceState" onclick="pushStateThenReplaceState()" /><br>
 
 <br>
 <br>
diff --git a/ios/testing/data/http_server_files/history.js b/ios/testing/data/http_server_files/history.js
index 8fd1eb0..27205a0 100644
--- a/ios/testing/data/http_server_files/history.js
+++ b/ios/testing/data/http_server_files/history.js
@@ -118,6 +118,24 @@
   updateStatusText('replaceStatePath');
 };
 
+function replaceStateThenPushState() {
+  clearOnloadDivText();
+  window.history.replaceState('firstReplaceState', 'First replaceState',
+      '#firstReplaceState');
+  window.history.pushState('replaceStateThenPushState',
+      'Replace state then push state', '#replaceStateThenPushState');
+  updateStatusText('replaceStateThenPushState');
+}
+
+function pushStateThenReplaceState() {
+  clearOnloadDivText();
+  window.history.pushState('firstPushState', 'First pushState',
+      '#firstPushState');
+  window.history.replaceState('pushStateThenReplaceState',
+      'Push state then replace state', '#pushStateThenReplaceState');
+  updateStatusText('pushStateThenReplaceState');
+}
+
 function goBack() {
   clearOnloadDivText();
   window.history.back();
diff --git a/ios/web/navigation/crw_js_navigation_handler.h b/ios/web/navigation/crw_js_navigation_handler.h
index ef891ac..5b4a3ea55 100644
--- a/ios/web/navigation/crw_js_navigation_handler.h
+++ b/ios/web/navigation/crw_js_navigation_handler.h
@@ -14,7 +14,6 @@
 class UserInteractionState;
 class NavigationContextImpl;
 }
-@class CRWJSInjector;
 @class CRWJSNavigationHandler;
 
 @protocol CRWJSNavigationHandlerDelegate
@@ -35,10 +34,6 @@
 - (WKWebView*)webViewForJSNavigationHandler:
     (CRWJSNavigationHandler*)navigationHandler;
 
-// Returns the associated js injector.
-- (CRWJSInjector*)JSInjectorForJSNavigationHandler:
-    (CRWJSNavigationHandler*)navigationHandler;
-
 // Instructs the delegate to update SSL status.
 - (void)JSNavigationHandlerUpdateSSLStatusForCurrentNavigationItem:
     (CRWJSNavigationHandler*)navigationHandler;
diff --git a/ios/web/navigation/crw_js_navigation_handler.mm b/ios/web/navigation/crw_js_navigation_handler.mm
index 2fe09dc..dc9812a 100644
--- a/ios/web/navigation/crw_js_navigation_handler.mm
+++ b/ios/web/navigation/crw_js_navigation_handler.mm
@@ -56,8 +56,6 @@
     web::UserInteractionState* userInteractionState;
 // Returns WKWebView from self.delegate.
 @property(nonatomic, readonly, weak) WKWebView* webView;
-// Returns CRWJSInjector from self.delegate.
-@property(nonatomic, readonly, weak) CRWJSInjector* JSInjector;
 // Returns current URL from self.delegate.
 @property(nonatomic, readonly, assign) GURL currentURL;
 
@@ -132,10 +130,6 @@
   return [self.delegate webViewForJSNavigationHandler:self];
 }
 
-- (CRWJSInjector*)JSInjector {
-  return [self.delegate JSInjectorForJSNavigationHandler:self];
-}
-
 - (GURL)currentURL {
   return [self.delegate currentURLForJSNavigationHandler:self];
 }
@@ -223,22 +217,6 @@
                                  self.webView)];
   [self.delegate
       JSNavigationHandlerUpdateSSLStatusForCurrentNavigationItem:self];
-
-  // This is needed for some special pushState. See http://crbug.com/949305 .
-  NSString* replaceWebViewJS = [self javaScriptToReplaceWebViewURL:pushURL
-                                                   stateObjectJSON:stateObject];
-  __weak CRWJSNavigationHandler* weakSelf = self;
-  [self.JSInjector
-      executeJavaScript:replaceWebViewJS
-      completionHandler:^(id, NSError*) {
-        CRWJSNavigationHandler* strongSelf = weakSelf;
-        if (strongSelf && !strongSelf.beingDestroyed) {
-          [strongSelf.delegate
-              JSNavigationHandlerOptOutScrollsToTopForSubviews:self];
-          [strongSelf.delegate JSNavigationHandler:self
-                               didFinishNavigation:nullptr];
-        }
-      }];
 }
 
 // Handles the navigation.didReplaceState message sent from |senderFrame|.
@@ -286,17 +264,6 @@
                     stateObject:stateObject
                  hasUserGesture:self.userInteractionState->IsUserInteracting(
                                     self.webView)];
-  NSString* replaceStateJS = [self javaScriptToReplaceWebViewURL:replaceURL
-                                                 stateObjectJSON:stateObject];
-  __weak CRWJSNavigationHandler* weakSelf = self;
-  [self.JSInjector executeJavaScript:replaceStateJS
-                   completionHandler:^(id, NSError*) {
-                     CRWJSNavigationHandler* strongSelf = weakSelf;
-                     if (!strongSelf || strongSelf.beingDestroyed)
-                       return;
-                     [strongSelf.delegate JSNavigationHandler:self
-                                          didFinishNavigation:nullptr];
-                   }];
   return;
 }
 
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 51d93f9..ced49011 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -2229,11 +2229,6 @@
   return self.webView;
 }
 
-- (CRWJSInjector*)JSInjectorForJSNavigationHandler:
-    (CRWJSNavigationHandler*)navigationHandler {
-  return self.jsInjector;
-}
-
 - (void)JSNavigationHandlerUpdateSSLStatusForCurrentNavigationItem:
     (CRWJSNavigationHandler*)navigationHandler {
   [self updateSSLStatusForCurrentNavigationItem];
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 0d329cd..efdf47d2 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -256,23 +256,24 @@
   SerialRunner::Queue fns;
 
   // Initialize demuxer.
-  fns.Push(base::BindRepeating(&RendererWrapper::InitializeDemuxer,
-                               weak_factory_.GetWeakPtr()));
+  fns.Push(base::BindOnce(&RendererWrapper::InitializeDemuxer,
+                          weak_factory_.GetWeakPtr()));
 
   // Once the demuxer is initialized successfully, media metadata must be
   // available - report the metadata to client. If starting without a renderer
   // we'll complete initialization at this point.
-  fns.Push(base::BindRepeating(&RendererWrapper::ReportMetadata,
-                               weak_factory_.GetWeakPtr(), start_type));
+  fns.Push(base::BindOnce(&RendererWrapper::ReportMetadata,
+                          weak_factory_.GetWeakPtr(), start_type));
 
   // Initialize renderer.
-  fns.Push(base::BindRepeating(&RendererWrapper::InitializeRenderer,
-                               weak_factory_.GetWeakPtr()));
+  fns.Push(base::BindOnce(&RendererWrapper::InitializeRenderer,
+                          weak_factory_.GetWeakPtr()));
 
   // Run tasks.
   pending_callbacks_ = SerialRunner::Run(
-      fns, base::BindRepeating(&RendererWrapper::CompleteSeek,
-                               weak_factory_.GetWeakPtr(), base::TimeDelta()));
+      std::move(fns),
+      base::BindRepeating(&RendererWrapper::CompleteSeek,
+                          weak_factory_.GetWeakPtr(), base::TimeDelta()));
 }
 
 void PipelineImpl::RendererWrapper::Stop() {
@@ -334,16 +335,16 @@
 
   // Flush.
   DCHECK(shared_state_.renderer);
-  bound_fns.Push(base::BindRepeating(
+  bound_fns.Push(base::BindOnce(
       &Renderer::Flush, base::Unretained(shared_state_.renderer.get())));
 
   // Seek demuxer.
-  bound_fns.Push(base::BindRepeating(&Demuxer::Seek, base::Unretained(demuxer_),
-                                     seek_timestamp));
+  bound_fns.Push(base::BindOnce(&Demuxer::Seek, base::Unretained(demuxer_),
+                                seek_timestamp));
 
   // Run tasks.
   pending_callbacks_ = SerialRunner::Run(
-      bound_fns,
+      std::move(bound_fns),
       base::BindRepeating(&RendererWrapper::CompleteSeek,
                           weak_factory_.GetWeakPtr(), seek_timestamp));
 }
@@ -376,8 +377,8 @@
 
   // No need to flush the renderer since it's going to be destroyed.
   pending_callbacks_ = SerialRunner::Run(
-      fns, base::BindRepeating(&RendererWrapper::CompleteSuspend,
-                               weak_factory_.GetWeakPtr()));
+      std::move(fns), base::BindRepeating(&RendererWrapper::CompleteSuspend,
+                                          weak_factory_.GetWeakPtr()));
 }
 
 void PipelineImpl::RendererWrapper::Resume(std::unique_ptr<Renderer> renderer,
@@ -419,8 +420,9 @@
                                weak_factory_.GetWeakPtr()));
 
   pending_callbacks_ = SerialRunner::Run(
-      fns, base::BindRepeating(&RendererWrapper::CompleteSeek,
-                               weak_factory_.GetWeakPtr(), start_timestamp));
+      std::move(fns),
+      base::BindRepeating(&RendererWrapper::CompleteSeek,
+                          weak_factory_.GetWeakPtr(), start_timestamp));
 }
 
 void PipelineImpl::RendererWrapper::SetPlaybackRate(double playback_rate) {
diff --git a/media/base/pipeline_status.h b/media/base/pipeline_status.h
index d6eb5aa..5759bbd 100644
--- a/media/base/pipeline_status.h
+++ b/media/base/pipeline_status.h
@@ -58,7 +58,7 @@
   PIPELINE_STATUS_MAX = DEMUXER_ERROR_DETECTED_HLS,
 };
 
-typedef base::Callback<void(PipelineStatus)> PipelineStatusCB;
+typedef base::RepeatingCallback<void(PipelineStatus)> PipelineStatusCB;
 
 struct PipelineDecoderInfo {
   bool is_platform_decoder = false;
diff --git a/media/base/serial_runner.cc b/media/base/serial_runner.cc
index 924e3ee..88d8133 100644
--- a/media/base/serial_runner.cc
+++ b/media/base/serial_runner.cc
@@ -13,20 +13,18 @@
 namespace media {
 
 // Converts a Closure into a bound function accepting a PipelineStatusCB.
-static void RunClosure(
-    const base::Closure& closure,
-    const PipelineStatusCB& status_cb) {
-  closure.Run();
+static void RunClosure(base::OnceClosure closure,
+                       const PipelineStatusCB& status_cb) {
+  std::move(closure).Run();
   status_cb.Run(PIPELINE_OK);
 }
 
 // Converts a bound function accepting a Closure into a bound function
 // accepting a PipelineStatusCB. Since closures have no way of reporting a
 // status |status_cb| is executed with PIPELINE_OK.
-static void RunBoundClosure(
-    const SerialRunner::BoundClosure& bound_closure,
-    const PipelineStatusCB& status_cb) {
-  bound_closure.Run(base::Bind(status_cb, PIPELINE_OK));
+static void RunBoundClosure(SerialRunner::BoundClosure bound_closure,
+                            const PipelineStatusCB& status_cb) {
+  std::move(bound_closure).Run(base::BindRepeating(status_cb, PIPELINE_OK));
 }
 
 // Runs |status_cb| with |last_status| on |task_runner|.
@@ -36,30 +34,29 @@
     PipelineStatus last_status) {
   // Force post to permit cancellation of a series in the scenario where all
   // bound functions run on the same thread.
-  task_runner->PostTask(FROM_HERE, base::BindOnce(status_cb, last_status));
+  task_runner->PostTask(FROM_HERE, base::BindRepeating(status_cb, last_status));
 }
 
 SerialRunner::Queue::Queue() = default;
-SerialRunner::Queue::Queue(const Queue& other) = default;
+SerialRunner::Queue::Queue(Queue&& other) = default;
 SerialRunner::Queue::~Queue() = default;
 
-void SerialRunner::Queue::Push(const base::Closure& closure) {
-  bound_fns_.push(base::Bind(&RunClosure, closure));
+void SerialRunner::Queue::Push(base::OnceClosure closure) {
+  bound_fns_.push_back(base::BindOnce(&RunClosure, std::move(closure)));
 }
 
-void SerialRunner::Queue::Push(
-    const BoundClosure& bound_closure) {
-  bound_fns_.push(base::Bind(&RunBoundClosure, bound_closure));
+void SerialRunner::Queue::Push(BoundClosure bound_closure) {
+  bound_fns_.push_back(
+      base::BindOnce(&RunBoundClosure, std::move(bound_closure)));
 }
 
-void SerialRunner::Queue::Push(
-    const BoundPipelineStatusCB& bound_status_cb) {
-  bound_fns_.push(bound_status_cb);
+void SerialRunner::Queue::Push(BoundPipelineStatusCB bound_status_cb) {
+  bound_fns_.push_back(std::move(bound_status_cb));
 }
 
 SerialRunner::BoundPipelineStatusCB SerialRunner::Queue::Pop() {
-  BoundPipelineStatusCB bound_fn = bound_fns_.front();
-  bound_fns_.pop();
+  BoundPipelineStatusCB bound_fn = std::move(bound_fns_.front());
+  bound_fns_.pop_front();
   return bound_fn;
 }
 
@@ -67,10 +64,9 @@
   return bound_fns_.empty();
 }
 
-SerialRunner::SerialRunner(const Queue& bound_fns,
-                           const PipelineStatusCB& done_cb)
+SerialRunner::SerialRunner(Queue&& bound_fns, const PipelineStatusCB& done_cb)
     : task_runner_(base::ThreadTaskRunnerHandle::Get()),
-      bound_fns_(bound_fns),
+      bound_fns_(std::move(bound_fns)),
       done_cb_(done_cb) {
   // Respect both cancellation and calling stack guarantees for |done_cb|
   // when empty.
@@ -87,10 +83,10 @@
 SerialRunner::~SerialRunner() = default;
 
 std::unique_ptr<SerialRunner> SerialRunner::Run(
-    const Queue& bound_fns,
+    Queue&& bound_fns,
     const PipelineStatusCB& done_cb) {
   std::unique_ptr<SerialRunner> callback_series(
-      new SerialRunner(bound_fns, done_cb));
+      new SerialRunner(std::move(bound_fns), done_cb));
   return callback_series;
 }
 
@@ -104,10 +100,10 @@
   }
 
   BoundPipelineStatusCB bound_fn = bound_fns_.Pop();
-  bound_fn.Run(base::Bind(
-      &RunOnTaskRunner,
-      task_runner_,
-      base::Bind(&SerialRunner::RunNextInSeries, weak_factory_.GetWeakPtr())));
+  std::move(bound_fn).Run(
+      base::BindRepeating(&RunOnTaskRunner, task_runner_,
+                          base::BindRepeating(&SerialRunner::RunNextInSeries,
+                                              weak_factory_.GetWeakPtr())));
 }
 
 }  // namespace media
diff --git a/media/base/serial_runner.h b/media/base/serial_runner.h
index 4e8b70cd..86830dd 100644
--- a/media/base/serial_runner.h
+++ b/media/base/serial_runner.h
@@ -8,7 +8,7 @@
 #include <memory>
 
 #include "base/callback.h"
-#include "base/containers/queue.h"
+#include "base/containers/circular_deque.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
@@ -26,28 +26,31 @@
 // the completion callback as the series progresses.
 class MEDIA_EXPORT SerialRunner {
  public:
-  // TODO(dalecurtis): Change SerialRunner to use OnceCallback.
-  typedef base::Callback<void(const base::Closure&)> BoundClosure;
-  typedef base::Callback<void(const PipelineStatusCB&)> BoundPipelineStatusCB;
+  typedef base::OnceCallback<void(const base::Closure&)> BoundClosure;
+  typedef base::OnceCallback<void(const PipelineStatusCB&)>
+      BoundPipelineStatusCB;
 
   // Serial queue of bound functions to run.
   class MEDIA_EXPORT Queue {
    public:
     Queue();
-    Queue(const Queue& other);
+    Queue(Queue&& other);
     ~Queue();
 
-    void Push(const base::Closure& closure);
-    void Push(const BoundClosure& bound_fn);
-    void Push(const BoundPipelineStatusCB& bound_fn);
+    void Push(base::OnceClosure closure);
+    void Push(BoundClosure bound_fn);
+    void Push(BoundPipelineStatusCB bound_fn);
 
    private:
+    Queue(const Queue&) = delete;
+    Queue& operator=(const Queue&) = delete;
+
     friend class SerialRunner;
 
     BoundPipelineStatusCB Pop();
     bool empty();
 
-    base::queue<BoundPipelineStatusCB> bound_fns_;
+    base::circular_deque<BoundPipelineStatusCB> bound_fns_;
   };
 
   // Executes the bound functions in series, executing |done_cb| when finished.
@@ -64,13 +67,13 @@
   //
   // Deleting the object will prevent execution of any unstarted bound
   // functions, including |done_cb|.
-  static std::unique_ptr<SerialRunner> Run(const Queue& bound_fns,
+  static std::unique_ptr<SerialRunner> Run(Queue&& bound_fns,
                                            const PipelineStatusCB& done_cb);
 
  private:
   friend std::default_delete<SerialRunner>;
 
-  SerialRunner(const Queue& bound_fns, const PipelineStatusCB& done_cb);
+  SerialRunner(Queue&& bound_fns, const PipelineStatusCB& done_cb);
   ~SerialRunner();
 
   void RunNextInSeries(PipelineStatus last_status);
diff --git a/media/base/serial_runner_unittest.cc b/media/base/serial_runner_unittest.cc
index 70a6722..1510822 100644
--- a/media/base/serial_runner_unittest.cc
+++ b/media/base/serial_runner_unittest.cc
@@ -25,8 +25,9 @@
 
   void RunSerialRunner() {
     task_environment_.GetMainThreadTaskRunner()->PostTask(
-        FROM_HERE, base::BindOnce(&SerialRunnerTest::StartRunnerInternal,
-                                  base::Unretained(this), bound_fns_));
+        FROM_HERE,
+        base::BindOnce(&SerialRunnerTest::StartRunnerInternal,
+                       base::Unretained(this), std::move(bound_fns_)));
     base::RunLoop().RunUntilIdle();
   }
 
@@ -34,32 +35,29 @@
   // |status|. called(i) returns whether the i'th bound function pushed to the
   // queue was called while running the SerialRunner.
   void PushBoundFunction(PipelineStatus status) {
-    bound_fns_.Push(base::Bind(&SerialRunnerTest::RunBoundFunction,
-                               base::Unretained(this),
-                               status,
-                               called_.size()));
+    bound_fns_.Push(base::BindOnce(&SerialRunnerTest::RunBoundFunction,
+                                   base::Unretained(this), status,
+                                   called_.size()));
     called_.push_back(false);
   }
 
   void PushBoundClosure() {
-    bound_fns_.Push(base::Bind(&SerialRunnerTest::RunBoundClosure,
-                               base::Unretained(this),
-                               called_.size()));
+    bound_fns_.Push(base::BindOnce(&SerialRunnerTest::RunBoundClosure,
+                                   base::Unretained(this), called_.size()));
     called_.push_back(false);
   }
 
   void PushClosure() {
-    bound_fns_.Push(base::Bind(&SerialRunnerTest::RunClosure,
-                               base::Unretained(this),
-                               called_.size()));
+    bound_fns_.Push(base::BindOnce(&SerialRunnerTest::RunClosure,
+                                   base::Unretained(this), called_.size()));
     called_.push_back(false);
   }
 
   // Push a bound function to the queue that will delete the SerialRunner,
   // which should cancel all remaining queued work.
   void PushCancellation() {
-    bound_fns_.Push(base::Bind(&SerialRunnerTest::CancelSerialRunner,
-                               base::Unretained(this)));
+    bound_fns_.Push(base::BindOnce(&SerialRunnerTest::CancelSerialRunner,
+                                   base::Unretained(this)));
   }
 
   // Queries final status of pushed functions and done callback. Valid only
@@ -101,10 +99,12 @@
     called_[index] = true;
   }
 
-  void StartRunnerInternal(const SerialRunner::Queue& bound_fns) {
+  void StartRunnerInternal(SerialRunner::Queue bound_fns) {
     inside_start_ = true;
-    runner_ = SerialRunner::Run(bound_fns_, base::Bind(
-        &SerialRunnerTest::DoneCallback, base::Unretained(this)));
+    runner_ =
+        SerialRunner::Run(std::move(bound_fns),
+                          base::BindRepeating(&SerialRunnerTest::DoneCallback,
+                                              base::Unretained(this)));
     inside_start_ = false;
   }
 
diff --git a/media/capture/video/chromeos/camera_device_delegate.cc b/media/capture/video/chromeos/camera_device_delegate.cc
index 84dbb8e..e21bcdf 100644
--- a/media/capture/video/chromeos/camera_device_delegate.cc
+++ b/media/capture/video/chromeos/camera_device_delegate.cc
@@ -202,17 +202,15 @@
   }
   device_context_->SetSensorOrientation(sensor_orientation[0]);
 
-  // |device_ops_| is bound after the MakeRequest call.
-  cros::mojom::Camera3DeviceOpsRequest device_ops_request =
-      mojo::MakeRequest(&device_ops_);
-  device_ops_.set_connection_error_handler(base::BindOnce(
-      &CameraDeviceDelegate::OnMojoConnectionError, GetWeakPtr()));
+  // |device_ops_| is bound after the BindNewPipeAndPassReceiver call.
   camera_hal_delegate_->OpenDevice(
       camera_hal_delegate_->GetCameraIdFromDeviceId(
           device_descriptor_.device_id),
-      std::move(device_ops_request),
+      device_ops_.BindNewPipeAndPassReceiver(),
       BindToCurrentLoop(
           base::BindOnce(&CameraDeviceDelegate::OnOpenedDevice, GetWeakPtr())));
+  device_ops_.set_disconnect_handler(base::BindOnce(
+      &CameraDeviceDelegate::OnMojoConnectionError, GetWeakPtr()));
 }
 
 void CameraDeviceDelegate::StopAndDeAllocate(
diff --git a/media/capture/video/chromeos/camera_device_delegate.h b/media/capture/video/chromeos/camera_device_delegate.h
index 36adf9f5..7440e2b5 100644
--- a/media/capture/video/chromeos/camera_device_delegate.h
+++ b/media/capture/video/chromeos/camera_device_delegate.h
@@ -15,6 +15,7 @@
 #include "media/capture/video/chromeos/mojom/camera_common.mojom.h"
 #include "media/capture/video/video_capture_device.h"
 #include "media/capture/video_capture_types.h"
+#include "mojo/public/cpp/bindings/remote.h"
 #include "ui/gfx/geometry/size.h"
 #include "ui/gfx/range/range.h"
 
@@ -194,7 +195,7 @@
   // settings, etc.
   cros::mojom::CameraMetadataPtr static_metadata_;
 
-  cros::mojom::Camera3DeviceOpsPtr device_ops_;
+  mojo::Remote<cros::mojom::Camera3DeviceOps> device_ops_;
 
   // Where all the Mojo IPC calls takes place.
   const scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
diff --git a/media/capture/video/chromeos/camera_device_delegate_unittest.cc b/media/capture/video/chromeos/camera_device_delegate_unittest.cc
index 259ac99b..f034c3f 100644
--- a/media/capture/video/chromeos/camera_device_delegate_unittest.cc
+++ b/media/capture/video/chromeos/camera_device_delegate_unittest.cc
@@ -24,6 +24,7 @@
 #include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h"
 #include "media/capture/video/mock_gpu_memory_buffer_manager.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/receiver.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -116,7 +117,7 @@
 class CameraDeviceDelegateTest : public ::testing::Test {
  public:
   CameraDeviceDelegateTest()
-      : mock_camera_device_binding_(&mock_camera_device_),
+      : mock_camera_device_receiver_(&mock_camera_device_),
         device_delegate_thread_("DeviceDelegateThread"),
         hal_delegate_thread_("HalDelegateThread") {}
 
@@ -129,7 +130,7 @@
     auto get_camera_info = base::BindRepeating(
         &CameraHalDelegate::GetCameraInfoFromDeviceId, camera_hal_delegate_);
     camera_hal_delegate_->SetCameraModule(
-        mock_camera_module_.GetInterfacePtrInfo());
+        mock_camera_module_.GetPendingRemote());
   }
 
   void TearDown() override {
@@ -245,9 +246,9 @@
 
   void OpenMockCameraDevice(
       int32_t camera_id,
-      cros::mojom::Camera3DeviceOpsRequest& device_ops_request,
+      mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
       base::OnceCallback<void(int32_t)>& callback) {
-    mock_camera_device_binding_.Bind(std::move(device_ops_request));
+    mock_camera_device_receiver_.Bind(std::move(device_ops_receiver));
     std::move(callback).Run(0);
   }
 
@@ -306,9 +307,7 @@
   }
 
   void CloseMockCameraDevice(base::OnceCallback<void(int32_t)>& callback) {
-    if (mock_camera_device_binding_.is_bound()) {
-      mock_camera_device_binding_.Close();
-    }
+    mock_camera_device_receiver_.reset();
     callback_ops_.reset();
     std::move(callback).Run(0);
   }
@@ -472,7 +471,7 @@
   unittest_internal::MockGpuMemoryBufferManager mock_gpu_memory_buffer_manager_;
 
   testing::StrictMock<MockCameraDevice> mock_camera_device_;
-  mojo::Binding<cros::mojom::Camera3DeviceOps> mock_camera_device_binding_;
+  mojo::Receiver<cros::mojom::Camera3DeviceOps> mock_camera_device_receiver_;
   cros::mojom::Camera3CallbackOpsPtr callback_ops_;
 
   base::Thread device_delegate_thread_;
@@ -539,13 +538,15 @@
   base::WaitableEvent stop_posted;
   auto open_device_quit_loop_cb =
       [&](int32_t camera_id,
-          cros::mojom::Camera3DeviceOpsRequest& device_ops_request,
+          mojo::PendingReceiver<cros::mojom::Camera3DeviceOps>
+              device_ops_receiver,
           base::OnceCallback<void(int32_t)>& callback) {
         QuitRunLoop();
         // Make sure StopAndDeAllocate() is called before the device opened
         // callback.
         stop_posted.Wait();
-        OpenMockCameraDevice(camera_id, device_ops_request, callback);
+        OpenMockCameraDevice(camera_id, std::move(device_ops_receiver),
+                             callback);
       };
   EXPECT_CALL(mock_camera_module_, DoOpenDevice(0, _, _))
       .Times(1)
@@ -668,15 +669,17 @@
       .Times(AtLeast(1))
       .WillRepeatedly(InvokeWithoutArgs(stop_on_error));
 
-  // Hold the |device_ops_request| to make the behavior of CameraDeviceDelegate
+  // Hold the |device_ops_receiver| to make the behavior of CameraDeviceDelegate
   // deterministic. Otherwise the connection error handler would race with the
   // callback of OpenDevice(), because they are in different mojo channels.
-  cros::mojom::Camera3DeviceOpsRequest device_ops_request_holder;
+  mojo::PendingReceiver<cros::mojom::Camera3DeviceOps>
+      device_ops_receiver_holder;
   auto open_device_with_error_cb =
       [&](int32_t camera_id,
-          cros::mojom::Camera3DeviceOpsRequest& device_ops_request,
+          mojo::PendingReceiver<cros::mojom::Camera3DeviceOps>
+              device_ops_receiver,
           base::OnceCallback<void(int32_t)>& callback) {
-        device_ops_request_holder = std::move(device_ops_request);
+        device_ops_receiver_holder = std::move(device_ops_receiver);
         std::move(callback).Run(-ENODEV);
       };
   EXPECT_CALL(mock_camera_module_, DoOpenDevice(0, _, _))
diff --git a/media/capture/video/chromeos/camera_hal_delegate.cc b/media/capture/video/chromeos/camera_hal_delegate.cc
index bfba4c1..3622044 100644
--- a/media/capture/video/chromeos/camera_hal_delegate.cc
+++ b/media/capture/video/chromeos/camera_hal_delegate.cc
@@ -37,8 +37,9 @@
       scoped_refptr<CameraHalDelegate> camera_hal_delegate)
       : camera_hal_delegate_(std::move(camera_hal_delegate)) {}
 
-  void OnChannelCreated(cros::mojom::CameraModulePtr camera_module) override {
-    camera_hal_delegate_->SetCameraModule(camera_module.PassInterface());
+  void OnChannelCreated(
+      mojo::PendingRemote<cros::mojom::CameraModule> camera_module) override {
+    camera_hal_delegate_->SetCameraModule(std::move(camera_module));
   }
 
  private:
@@ -113,10 +114,10 @@
 }
 
 void CameraHalDelegate::SetCameraModule(
-    cros::mojom::CameraModulePtrInfo camera_module_ptr_info) {
+    mojo::PendingRemote<cros::mojom::CameraModule> camera_module) {
   ipc_task_runner_->PostTask(
       FROM_HERE, base::BindOnce(&CameraHalDelegate::SetCameraModuleOnIpcThread,
-                                this, base::Passed(&camera_module_ptr_info)));
+                                this, std::move(camera_module)));
 }
 
 void CameraHalDelegate::Reset() {
@@ -325,7 +326,7 @@
 
 void CameraHalDelegate::OpenDevice(
     int32_t camera_id,
-    cros::mojom::Camera3DeviceOpsRequest device_ops_request,
+    mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
     OpenDeviceCallback callback) {
   DCHECK(!ipc_task_runner_->BelongsToCurrentThread());
   // This method may be called on any thread except |ipc_task_runner_|.
@@ -335,7 +336,7 @@
   ipc_task_runner_->PostTask(
       FROM_HERE,
       base::BindOnce(&CameraHalDelegate::OpenDeviceOnIpcThread, this, camera_id,
-                     base::Passed(&device_ops_request), std::move(callback)));
+                     std::move(device_ops_receiver), std::move(callback)));
 }
 
 int CameraHalDelegate::GetCameraIdFromDeviceId(const std::string& device_id) {
@@ -348,24 +349,24 @@
 }
 
 void CameraHalDelegate::SetCameraModuleOnIpcThread(
-    cros::mojom::CameraModulePtrInfo camera_module_ptr_info) {
+    mojo::PendingRemote<cros::mojom::CameraModule> camera_module) {
   DCHECK(ipc_task_runner_->BelongsToCurrentThread());
   if (camera_module_.is_bound()) {
     LOG(ERROR) << "CameraModule is already bound";
     return;
   }
-  camera_module_ = mojo::MakeProxy(std::move(camera_module_ptr_info));
-  camera_module_.set_connection_error_handler(
-      base::BindOnce(&CameraHalDelegate::ResetMojoInterfaceOnIpcThread, this));
+  if (camera_module.is_valid()) {
+    camera_module_.Bind(std::move(camera_module));
+    camera_module_.set_disconnect_handler(base::BindOnce(
+        &CameraHalDelegate::ResetMojoInterfaceOnIpcThread, this));
+  }
   camera_module_has_been_set_.Signal();
 }
 
 void CameraHalDelegate::ResetMojoInterfaceOnIpcThread() {
   DCHECK(ipc_task_runner_->BelongsToCurrentThread());
   camera_module_.reset();
-  if (camera_module_callbacks_.is_bound()) {
-    camera_module_callbacks_.Close();
-  }
+  camera_module_callbacks_.reset();
   vendor_tag_ops_delegate_.Reset();
   builtin_camera_info_updated_.Reset();
   camera_module_has_been_set_.Reset();
@@ -416,12 +417,8 @@
   // Per camera HAL v3 specification SetCallbacks() should be called after the
   // first time GetNumberOfCameras() is called, and before other CameraModule
   // functions are called.
-  cros::mojom::CameraModuleCallbacksPtr camera_module_callbacks_ptr;
-  cros::mojom::CameraModuleCallbacksRequest camera_module_callbacks_request =
-      mojo::MakeRequest(&camera_module_callbacks_ptr);
-  camera_module_callbacks_.Bind(std::move(camera_module_callbacks_request));
   camera_module_->SetCallbacks(
-      std::move(camera_module_callbacks_ptr),
+      camera_module_callbacks_.BindNewPipeAndPassRemote(),
       base::BindOnce(&CameraHalDelegate::OnSetCallbacksOnIpcThread, this));
 
   camera_module_->GetVendorTagOps(
@@ -509,10 +506,10 @@
 
 void CameraHalDelegate::OpenDeviceOnIpcThread(
     int32_t camera_id,
-    cros::mojom::Camera3DeviceOpsRequest device_ops_request,
+    mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
     OpenDeviceCallback callback) {
   DCHECK(ipc_task_runner_->BelongsToCurrentThread());
-  camera_module_->OpenDevice(camera_id, std::move(device_ops_request),
+  camera_module_->OpenDevice(camera_id, std::move(device_ops_receiver),
                              std::move(callback));
 }
 
diff --git a/media/capture/video/chromeos/camera_hal_delegate.h b/media/capture/video/chromeos/camera_hal_delegate.h
index 83795c3..bcd28a5 100644
--- a/media/capture/video/chromeos/camera_hal_delegate.h
+++ b/media/capture/video/chromeos/camera_hal_delegate.h
@@ -20,7 +20,10 @@
 #include "media/capture/video/chromeos/vendor_tag_ops_delegate.h"
 #include "media/capture/video/video_capture_device_factory.h"
 #include "media/capture/video_capture_types.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
 
 namespace media {
 
@@ -46,7 +49,8 @@
   // Registers the camera client observer to the CameraHalDispatcher instance.
   void RegisterCameraClient();
 
-  void SetCameraModule(cros::mojom::CameraModulePtrInfo camera_module_ptr_info);
+  void SetCameraModule(
+      mojo::PendingRemote<cros::mojom::CameraModule> camera_module);
 
   // Resets various mojo bindings, WaitableEvents, and cached information.
   void Reset();
@@ -69,9 +73,10 @@
   // This method may be called on any thread; |callback| will run on
   // |ipc_task_runner_|.
   using OpenDeviceCallback = base::OnceCallback<void(int32_t)>;
-  void OpenDevice(int32_t camera_id,
-                  cros::mojom::Camera3DeviceOpsRequest device_ops_request,
-                  OpenDeviceCallback callback);
+  void OpenDevice(
+      int32_t camera_id,
+      mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
+      OpenDeviceCallback callback);
 
   // Gets camera id from device id. Returns -1 on error.
   int GetCameraIdFromDeviceId(const std::string& device_id);
@@ -86,7 +91,7 @@
   ~CameraHalDelegate() final;
 
   void SetCameraModuleOnIpcThread(
-      cros::mojom::CameraModulePtrInfo camera_module_ptr_info);
+      mojo::PendingRemote<cros::mojom::CameraModule> camera_module);
 
   // Resets the Mojo interface and bindings.
   void ResetMojoInterfaceOnIpcThread();
@@ -122,7 +127,7 @@
   // This method runs on |ipc_task_runner_|.
   void OpenDeviceOnIpcThread(
       int32_t camera_id,
-      cros::mojom::Camera3DeviceOpsRequest device_ops_request,
+      mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
       OpenDeviceCallback callback);
 
   // CameraModuleCallbacks implementation. Operates on |ipc_task_runner_|.
@@ -174,11 +179,11 @@
 
   // The Mojo proxy to access the camera module at the remote camera HAL.  Bound
   // to |ipc_task_runner_|.
-  cros::mojom::CameraModulePtr camera_module_;
+  mojo::Remote<cros::mojom::CameraModule> camera_module_;
 
-  // The Mojo binding serving the camera module callbacks.  Bound to
+  // The Mojo receiver serving the camera module callbacks.  Bound to
   // |ipc_task_runner_|.
-  mojo::Binding<cros::mojom::CameraModuleCallbacks> camera_module_callbacks_;
+  mojo::Receiver<cros::mojom::CameraModuleCallbacks> camera_module_callbacks_;
 
   // An internal delegate to handle VendorTagOps mojo connection and query
   // information of vendor tags.  Bound to |ipc_task_runner_|.
diff --git a/media/capture/video/chromeos/camera_hal_delegate_unittest.cc b/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
index f9eeee8..a2328cf 100644
--- a/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
+++ b/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
@@ -18,6 +18,7 @@
 #include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h"
 #include "media/capture/video/mock_gpu_memory_buffer_manager.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -46,7 +47,7 @@
     camera_hal_delegate_ =
         new CameraHalDelegate(hal_delegate_thread_.task_runner());
     camera_hal_delegate_->SetCameraModule(
-        mock_camera_module_.GetInterfacePtrInfo());
+        mock_camera_module_.GetPendingRemote());
   }
 
   void TearDown() override {
@@ -154,7 +155,7 @@
       };
 
   auto set_callbacks_cb =
-      [&](cros::mojom::CameraModuleCallbacksPtr& callbacks,
+      [&](mojo::PendingRemote<cros::mojom::CameraModuleCallbacks>& callbacks,
           cros::mojom::CameraModule::SetCallbacksCallback&) {
         mock_camera_module_.NotifyCameraDeviceChange(
             2, cros::mojom::CameraDeviceStatus::CAMERA_DEVICE_STATUS_PRESENT);
@@ -163,10 +164,10 @@
   EXPECT_CALL(mock_camera_module_, DoGetNumberOfCameras(_))
       .Times(1)
       .WillOnce(Invoke(get_number_of_cameras_cb));
-  EXPECT_CALL(
-      mock_camera_module_,
-      DoSetCallbacks(A<cros::mojom::CameraModuleCallbacksPtr&>(),
-                     A<cros::mojom::CameraModule::SetCallbacksCallback&>()))
+  EXPECT_CALL(mock_camera_module_,
+              DoSetCallbacks(
+                  A<mojo::PendingRemote<cros::mojom::CameraModuleCallbacks>&>(),
+                  A<cros::mojom::CameraModule::SetCallbacksCallback&>()))
       .Times(1)
       .WillOnce(Invoke(set_callbacks_cb));
   EXPECT_CALL(mock_camera_module_,
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
index 2858f46..90271c3 100644
--- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
+++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -22,6 +22,7 @@
 #include "base/synchronization/waitable_event.h"
 #include "base/trace_event/trace_event.h"
 #include "media/capture/video/chromeos/mojom/camera_common.mojom.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/platform/named_platform_channel.h"
 #include "mojo/public/cpp/platform/platform_channel.h"
 #include "mojo/public/cpp/platform/socket_utils_posix.h"
@@ -70,7 +71,8 @@
       mojo::PendingRemote<cros::mojom::CameraHalClient> client)
       : client_(std::move(client)) {}
 
-  void OnChannelCreated(cros::mojom::CameraModulePtr camera_module) override {
+  void OnChannelCreated(
+      mojo::PendingRemote<cros::mojom::CameraModule> camera_module) override {
     client_->SetUpChannel(std::move(camera_module));
   }
 
@@ -357,11 +359,10 @@
 void CameraHalDispatcherImpl::EstablishMojoChannel(
     CameraClientObserver* client_observer) {
   DCHECK(proxy_task_runner_->BelongsToCurrentThread());
-  cros::mojom::CameraModulePtr camera_module_ptr;
-  cros::mojom::CameraModuleRequest camera_module_request =
-      mojo::MakeRequest(&camera_module_ptr);
-  camera_hal_server_->CreateChannel(std::move(camera_module_request));
-  client_observer->OnChannelCreated(std::move(camera_module_ptr));
+  mojo::PendingRemote<cros::mojom::CameraModule> camera_module;
+  camera_hal_server_->CreateChannel(
+      camera_module.InitWithNewPipeAndPassReceiver());
+  client_observer->OnChannelCreated(std::move(camera_module));
 }
 
 void CameraHalDispatcherImpl::OnPeerConnected(
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.h b/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
index b8370d0..bf1475a 100644
--- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
+++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
@@ -39,7 +39,8 @@
 class CAPTURE_EXPORT CameraClientObserver {
  public:
   virtual ~CameraClientObserver();
-  virtual void OnChannelCreated(cros::mojom::CameraModulePtr camera_module) = 0;
+  virtual void OnChannelCreated(
+      mojo::PendingRemote<cros::mojom::CameraModule> camera_module) = 0;
 };
 
 // The CameraHalDispatcherImpl hosts and waits on the unix domain socket
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
index e93be07..72e98ce 100644
--- a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
+++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
@@ -13,6 +13,7 @@
 #include "base/test/task_environment.h"
 #include "media/capture/video/chromeos/mojom/camera_common.mojom.h"
 #include "media/capture/video/chromeos/mojom/cros_camera_service.mojom.h"
+#include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/receiver.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -30,12 +31,13 @@
 
   ~MockCameraHalServer() = default;
 
-  void CreateChannel(
-      cros::mojom::CameraModuleRequest camera_module_request) override {
-    DoCreateChannel(camera_module_request);
+  void CreateChannel(mojo::PendingReceiver<cros::mojom::CameraModule>
+                         camera_module_receiver) override {
+    DoCreateChannel(std::move(camera_module_receiver));
   }
   MOCK_METHOD1(DoCreateChannel,
-               void(cros::mojom::CameraModuleRequest& camera_module_request));
+               void(mojo::PendingReceiver<cros::mojom::CameraModule>
+                        camera_module_receiver));
 
   MOCK_METHOD1(SetTracingEnabled, void(bool enabled));
 
@@ -54,11 +56,13 @@
 
   ~MockCameraHalClient() = default;
 
-  void SetUpChannel(cros::mojom::CameraModulePtr camera_module_ptr) override {
-    DoSetUpChannel(camera_module_ptr);
+  void SetUpChannel(
+      mojo::PendingRemote<cros::mojom::CameraModule> camera_module) override {
+    DoSetUpChannel(std::move(camera_module));
   }
-  MOCK_METHOD1(DoSetUpChannel,
-               void(cros::mojom::CameraModulePtr& camera_module_ptr));
+  MOCK_METHOD1(
+      DoSetUpChannel,
+      void(mojo::PendingRemote<cros::mojom::CameraModule> camera_module));
 
   mojo::PendingRemote<cros::mojom::CameraHalClient> GetPendingRemote() {
     return receiver_.BindNewPipeAndPassRemote();
diff --git a/media/capture/video/chromeos/mock_camera_module.cc b/media/capture/video/chromeos/mock_camera_module.cc
index 7de302515c2..15d3b601 100644
--- a/media/capture/video/chromeos/mock_camera_module.cc
+++ b/media/capture/video/chromeos/mock_camera_module.cc
@@ -12,8 +12,7 @@
 namespace media {
 namespace unittest_internal {
 
-MockCameraModule::MockCameraModule()
-    : mock_module_thread_("MockModuleThread"), binding_(this) {
+MockCameraModule::MockCameraModule() : mock_module_thread_("MockModuleThread") {
   mock_module_thread_.Start();
 }
 
@@ -26,9 +25,9 @@
 
 void MockCameraModule::OpenDevice(
     int32_t camera_id,
-    cros::mojom::Camera3DeviceOpsRequest device_ops_request,
+    mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
     OpenDeviceCallback callback) {
-  DoOpenDevice(camera_id, device_ops_request, callback);
+  DoOpenDevice(camera_id, std::move(device_ops_receiver), callback);
 }
 
 void MockCameraModule::GetNumberOfCameras(GetNumberOfCamerasCallback callback) {
@@ -41,10 +40,10 @@
 }
 
 void MockCameraModule::SetCallbacks(
-    cros::mojom::CameraModuleCallbacksPtr callbacks,
+    mojo::PendingRemote<cros::mojom::CameraModuleCallbacks> callbacks,
     SetCallbacksCallback callback) {
   DoSetCallbacks(callbacks, callback);
-  callbacks_ = std::move(callbacks);
+  callbacks_.Bind(std::move(callbacks));
   std::move(callback).Run(0);
 }
 
@@ -81,22 +80,21 @@
   callbacks_->CameraDeviceStatusChange(camera_id, status);
 }
 
-cros::mojom::CameraModulePtrInfo MockCameraModule::GetInterfacePtrInfo() {
+mojo::PendingRemote<cros::mojom::CameraModule>
+MockCameraModule::GetPendingRemote() {
   base::WaitableEvent done(base::WaitableEvent::ResetPolicy::MANUAL,
                            base::WaitableEvent::InitialState::NOT_SIGNALED);
-  cros::mojom::CameraModulePtrInfo ptr_info;
+  mojo::PendingRemote<cros::mojom::CameraModule> pending_remote;
   mock_module_thread_.task_runner()->PostTask(
-      FROM_HERE,
-      base::BindOnce(&MockCameraModule::BindOnThread, base::Unretained(this),
-                     base::Unretained(&done), base::Unretained(&ptr_info)));
+      FROM_HERE, base::BindOnce(&MockCameraModule::BindOnThread,
+                                base::Unretained(this), base::Unretained(&done),
+                                base::Unretained(&pending_remote)));
   done.Wait();
-  return ptr_info;
+  return pending_remote;
 }
 
 void MockCameraModule::CloseBindingOnThread() {
-  if (binding_.is_bound()) {
-    binding_.Close();
-  }
+  receiver_.reset();
   if (callbacks_.is_bound()) {
     callbacks_.reset();
   }
@@ -104,12 +102,8 @@
 
 void MockCameraModule::BindOnThread(
     base::WaitableEvent* done,
-    cros::mojom::CameraModulePtrInfo* ptr_info) {
-  cros::mojom::CameraModulePtr camera_module_ptr;
-  cros::mojom::CameraModuleRequest camera_module_request =
-      mojo::MakeRequest(&camera_module_ptr);
-  binding_.Bind(std::move(camera_module_request));
-  *ptr_info = camera_module_ptr.PassInterface();
+    mojo::PendingRemote<cros::mojom::CameraModule>* pending_remote) {
+  *pending_remote = receiver_.BindNewPipeAndPassRemote();
   done->Signal();
 }
 
diff --git a/media/capture/video/chromeos/mock_camera_module.h b/media/capture/video/chromeos/mock_camera_module.h
index 84611e5..8479c9a 100644
--- a/media/capture/video/chromeos/mock_camera_module.h
+++ b/media/capture/video/chromeos/mock_camera_module.h
@@ -11,8 +11,10 @@
 #include "base/threading/thread.h"
 #include "media/capture/video/chromeos/mojom/camera3.mojom.h"
 #include "media/capture/video/chromeos/mojom/camera_common.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 namespace media {
@@ -24,12 +26,14 @@
 
   ~MockCameraModule();
 
-  void OpenDevice(int32_t camera_id,
-                  cros::mojom::Camera3DeviceOpsRequest device_ops_request,
-                  OpenDeviceCallback callback) override;
+  void OpenDevice(
+      int32_t camera_id,
+      mojo::PendingReceiver<cros::mojom::Camera3DeviceOps> device_ops_receiver,
+      OpenDeviceCallback callback) override;
   MOCK_METHOD3(DoOpenDevice,
                void(int32_t camera_id,
-                    cros::mojom::Camera3DeviceOpsRequest& device_ops_request,
+                    mojo::PendingReceiver<cros::mojom::Camera3DeviceOps>
+                        device_ops_receiver,
                     OpenDeviceCallback& callback));
 
   void GetNumberOfCameras(GetNumberOfCamerasCallback callback) override;
@@ -41,11 +45,13 @@
   MOCK_METHOD2(DoGetCameraInfo,
                void(int32_t camera_id, GetCameraInfoCallback& callback));
 
-  void SetCallbacks(cros::mojom::CameraModuleCallbacksPtr callbacks,
-                    SetCallbacksCallback callback) override;
-  MOCK_METHOD2(DoSetCallbacks,
-               void(cros::mojom::CameraModuleCallbacksPtr& callbacks,
-                    SetCallbacksCallback& callback));
+  void SetCallbacks(
+      mojo::PendingRemote<cros::mojom::CameraModuleCallbacks> callbacks,
+      SetCallbacksCallback callback) override;
+  MOCK_METHOD2(
+      DoSetCallbacks,
+      void(mojo::PendingRemote<cros::mojom::CameraModuleCallbacks>& callbacks,
+           SetCallbacksCallback& callback));
 
   void Init(InitCallback callback) override;
   MOCK_METHOD1(DoInit, void(InitCallback& callback));
@@ -69,7 +75,7 @@
   void NotifyCameraDeviceChange(int camera_id,
                                 cros::mojom::CameraDeviceStatus status);
 
-  cros::mojom::CameraModulePtrInfo GetInterfacePtrInfo();
+  mojo::PendingRemote<cros::mojom::CameraModule> GetPendingRemote();
 
  private:
   void NotifyCameraDeviceChangeOnThread(int camera_id,
@@ -77,12 +83,13 @@
 
   void CloseBindingOnThread();
 
-  void BindOnThread(base::WaitableEvent* done,
-                    cros::mojom::CameraModulePtrInfo* ptr_info);
+  void BindOnThread(
+      base::WaitableEvent* done,
+      mojo::PendingRemote<cros::mojom::CameraModule>* pending_remote);
 
   base::Thread mock_module_thread_;
-  mojo::Binding<cros::mojom::CameraModule> binding_;
-  cros::mojom::CameraModuleCallbacksPtr callbacks_;
+  mojo::Receiver<cros::mojom::CameraModule> receiver_{this};
+  mojo::Remote<cros::mojom::CameraModuleCallbacks> callbacks_;
 
   DISALLOW_COPY_AND_ASSIGN(MockCameraModule);
 };
diff --git a/media/capture/video/chromeos/mock_vendor_tag_ops.cc b/media/capture/video/chromeos/mock_vendor_tag_ops.cc
index 137f99a..cb828d2d 100644
--- a/media/capture/video/chromeos/mock_vendor_tag_ops.cc
+++ b/media/capture/video/chromeos/mock_vendor_tag_ops.cc
@@ -27,7 +27,6 @@
     mojo::PendingReceiver<cros::mojom::VendorTagOps> receiver) {
   base::WaitableEvent done(base::WaitableEvent::ResetPolicy::MANUAL,
                            base::WaitableEvent::InitialState::NOT_SIGNALED);
-  cros::mojom::CameraModulePtrInfo ptr_info;
   mock_vendor_tag_ops_thread_.task_runner()->PostTask(
       FROM_HERE,
       base::BindOnce(&MockVendorTagOps::BindOnThread, base::Unretained(this),
diff --git a/media/capture/video/chromeos/mojom/camera_common.mojom b/media/capture/video/chromeos/mojom/camera_common.mojom
index be70337..7c084726 100644
--- a/media/capture/video/chromeos/mojom/camera_common.mojom
+++ b/media/capture/video/chromeos/mojom/camera_common.mojom
@@ -91,7 +91,8 @@
 interface CameraModule {
   // Opens the camera device specified by |camera_id|.  On success, the camera
   // device is accessible through the |device_ops| returned.
-  OpenDevice@0(int32 camera_id, Camera3DeviceOps& device_ops_request)
+  OpenDevice@0(int32 camera_id,
+               pending_receiver<Camera3DeviceOps> device_ops_request)
       => (int32 result);
 
   // Gets the number of cameras currently present on the system.
@@ -101,7 +102,8 @@
   GetCameraInfo@2(int32 camera_id) => (int32 result, CameraInfo? camera_info);
 
   // Registers the CameraModuleCallbacks interface with the camera HAL.
-  SetCallbacks@3(CameraModuleCallbacks callbacks) => (int32 result);
+  SetCallbacks@3(pending_remote<CameraModuleCallbacks> callbacks)
+      => (int32 result);
 
   // Turns on or off the torch mode of the flash unit associated with the given
   // |camera_id|.
diff --git a/media/capture/video/chromeos/mojom/cros_camera_service.mojom b/media/capture/video/chromeos/mojom/cros_camera_service.mojom
index a8e388c..03f5a00 100644
--- a/media/capture/video/chromeos/mojom/cros_camera_service.mojom
+++ b/media/capture/video/chromeos/mojom/cros_camera_service.mojom
@@ -45,7 +45,7 @@
   // HAL v3 adapter.  Upon successfully binding of |camera_module_request|, the
   // caller will have a established Mojo channel to the camera HAL v3 adapter
   // process.
-  CreateChannel@0(CameraModule& camera_module_request);
+  CreateChannel@0(pending_receiver<CameraModule> camera_module_request);
 
   // Enable or disable tracing.
   [MinVersion=3]
@@ -63,5 +63,5 @@
   // CameraHalServer which holds the original Mojo channel crashes,
   // CameraHalDispatcher will call SetUpChannel again once a new CameraHalServer
   // reconnects.
-  SetUpChannel@0(CameraModule camera_module_ptr);
+  SetUpChannel@0(pending_remote<CameraModule> camera_module_ptr);
 };
diff --git a/media/cast/OWNERS b/media/cast/OWNERS
index b44d282f..c0d2923c 100644
--- a/media/cast/OWNERS
+++ b/media/cast/OWNERS
@@ -1,3 +1,4 @@
 miu@chromium.org
+mfoltz@chromium.org
 
 # COMPONENT: Internals>Cast>Streaming
diff --git a/media/gpu/linux/video_decoder_pipeline.cc b/media/gpu/linux/video_decoder_pipeline.cc
index 9777c07..38f64a3 100644
--- a/media/gpu/linux/video_decoder_pipeline.cc
+++ b/media/gpu/linux/video_decoder_pipeline.cc
@@ -54,11 +54,13 @@
   DCHECK(client_task_runner_);
   DVLOGF(2);
 
-  weak_this_ = weak_this_factory_.GetWeakPtr();
+  client_weak_this_ = client_weak_this_factory_.GetWeakPtr();
+  decoder_weak_this_ = decoder_weak_this_factory_.GetWeakPtr();
   frame_pool_->set_parent_task_runner(decoder_task_runner_);
   frame_converter_->Initialize(
-      client_task_runner_,
-      base::BindRepeating(&VideoDecoderPipeline::OnFrameConverted, weak_this_));
+      decoder_task_runner_,
+      base::BindRepeating(&VideoDecoderPipeline::OnFrameConverted,
+                          decoder_weak_this_));
 }
 
 VideoDecoderPipeline::~VideoDecoderPipeline() {
@@ -72,11 +74,7 @@
   DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
   DVLOGF(2);
 
-  weak_this_factory_.InvalidateWeakPtrs();
-
-  decoder_.reset();
-  used_create_vd_func_ = nullptr;
-  frame_converter_.reset();
+  client_weak_this_factory_.InvalidateWeakPtrs();
 
   decoder_task_runner_->PostTask(
       FROM_HERE, base::BindOnce(&VideoDecoderPipeline::DestroyTask,
@@ -87,9 +85,17 @@
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(3);
 
-  // |frame_pool_| should be destroyed on |decoder_task_runner_|, which is set
-  // by frame_pool_->set_parent_task_runner().
+  decoder_weak_this_factory_.InvalidateWeakPtrs();
+
+  // |frame_pool_| and |frame_converter_| should be destroyed on
+  // |decoder_task_runner_|, which is set by
+  // frame_pool_->set_parent_task_runner() and frame_converter_->Initialize().
   frame_pool_.reset();
+  frame_converter_.reset();
+
+  decoder_.reset();
+  used_create_vd_func_ = nullptr;
+
   delete this;
 }
 
@@ -130,7 +136,6 @@
                                       const OutputCB& output_cb,
                                       const WaitingCB& waiting_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  DCHECK(!init_cb_);
   VLOGF(2) << "config: " << config.AsHumanReadableString();
 
   if (!config.IsValidConfig()) {
@@ -150,6 +155,19 @@
   }
 
   needs_bitstream_conversion_ = (config.codec() == kCodecH264);
+
+  decoder_task_runner_->PostTask(
+      FROM_HERE,
+      base::BindOnce(&VideoDecoderPipeline::InitializeTask, decoder_weak_this_,
+                     config, std::move(init_cb), std::move(output_cb)));
+}
+
+void VideoDecoderPipeline::InitializeTask(const VideoDecoderConfig& config,
+                                          InitCB init_cb,
+                                          const OutputCB& output_cb) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
+  DCHECK(!init_cb_);
+
   client_output_cb_ = std::move(output_cb);
   init_cb_ = std::move(init_cb);
   base::queue<VideoDecoderPipeline::CreateVDFunc> create_vd_funcs =
@@ -163,17 +181,17 @@
         // If it fails to re-initialize current |decoder_|, it will create
         // another decoder instance by trying available VD creation functions
         // again. See |OnInitializeDone| for detail.
-        base::BindOnce(&VideoDecoderPipeline::OnInitializeDone, weak_this_,
-                       std::move(create_vd_funcs), config),
-        base::BindRepeating(&VideoDecoderPipeline::OnFrameDecodedThunk,
-                            client_task_runner_, weak_this_));
+        base::BindOnce(&VideoDecoderPipeline::OnInitializeDone,
+                       decoder_weak_this_, std::move(create_vd_funcs), config),
+        base::BindRepeating(&VideoDecoderPipeline::OnFrameDecoded,
+                            decoder_weak_this_));
   }
 }
 
 void VideoDecoderPipeline::CreateAndInitializeVD(
     base::queue<VideoDecoderPipeline::CreateVDFunc> create_vd_funcs,
     VideoDecoderConfig config) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK(init_cb_);
   DCHECK(!decoder_);
   DCHECK(!used_create_vd_func_);
@@ -181,14 +199,15 @@
 
   if (create_vd_funcs.empty()) {
     DVLOGF(2) << "No available video decoder.";
-    std::move(init_cb_).Run(false);
+    client_task_runner_->PostTask(FROM_HERE,
+                                  base::BindOnce(std::move(init_cb_), false));
     return;
   }
 
   used_create_vd_func_ = create_vd_funcs.front();
   create_vd_funcs.pop();
   decoder_ = used_create_vd_func_(
-      client_task_runner_, decoder_task_runner_,
+      decoder_task_runner_,
       base::BindRepeating(&VideoDecoderPipeline::GetVideoFramePool,
                           base::Unretained(this)));
   if (!decoder_) {
@@ -199,23 +218,24 @@
 
   decoder_->Initialize(
       config,
-      base::BindOnce(&VideoDecoderPipeline::OnInitializeDone, weak_this_,
-                     std::move(create_vd_funcs), config),
-      base::BindRepeating(&VideoDecoderPipeline::OnFrameDecodedThunk,
-                          client_task_runner_, weak_this_));
+      base::BindOnce(&VideoDecoderPipeline::OnInitializeDone,
+                     decoder_weak_this_, std::move(create_vd_funcs), config),
+      base::BindRepeating(&VideoDecoderPipeline::OnFrameDecoded,
+                          decoder_weak_this_));
 }
 
 void VideoDecoderPipeline::OnInitializeDone(
     base::queue<VideoDecoderPipeline::CreateVDFunc> create_vd_funcs,
     VideoDecoderConfig config,
     bool success) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK(init_cb_);
   DVLOGF(4) << "Initialization " << (success ? "success." : "failure.");
 
   if (success) {
     DVLOGF(2) << "Initialize VD successfully.";
-    std::move(init_cb_).Run(true);
+    client_task_runner_->PostTask(FROM_HERE,
+                                  base::BindOnce(std::move(init_cb_), true));
     return;
   }
 
@@ -227,17 +247,26 @@
 
 void VideoDecoderPipeline::Reset(base::OnceClosure closure) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DVLOGF(3);
+
+  decoder_task_runner_->PostTask(
+      FROM_HERE, base::BindOnce(&VideoDecoderPipeline::ResetTask,
+                                decoder_weak_this_, std::move(closure)));
+}
+
+void VideoDecoderPipeline::ResetTask(base::OnceClosure closure) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK(decoder_);
   DCHECK(!client_reset_cb_);
   DVLOGF(3);
 
   client_reset_cb_ = std::move(closure);
   decoder_->Reset(
-      base::BindOnce(&VideoDecoderPipeline::OnResetDone, weak_this_));
+      base::BindOnce(&VideoDecoderPipeline::OnResetDone, decoder_weak_this_));
 }
 
 void VideoDecoderPipeline::OnResetDone() {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK(client_reset_cb_);
   DVLOGF(3);
 
@@ -245,25 +274,37 @@
 
   CallFlushCbIfNeeded(DecodeStatus::ABORTED);
 
-  std::move(client_reset_cb_).Run();
+  client_task_runner_->PostTask(FROM_HERE, std::move(client_reset_cb_));
 }
 
 void VideoDecoderPipeline::Decode(scoped_refptr<DecoderBuffer> buffer,
                                   DecodeCB decode_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DVLOGF(4);
+
+  decoder_task_runner_->PostTask(
+      FROM_HERE,
+      base::BindOnce(&VideoDecoderPipeline::DecodeTask, decoder_weak_this_,
+                     std::move(buffer), std::move(decode_cb)));
+}
+
+void VideoDecoderPipeline::DecodeTask(scoped_refptr<DecoderBuffer> buffer,
+                                      DecodeCB decode_cb) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK(decoder_);
   DVLOGF(4);
 
   bool is_flush = buffer->end_of_stream();
-  decoder_->Decode(std::move(buffer),
-                   base::BindOnce(&VideoDecoderPipeline::OnDecodeDone,
-                                  weak_this_, is_flush, std::move(decode_cb)));
+  decoder_->Decode(
+      std::move(buffer),
+      base::BindOnce(&VideoDecoderPipeline::OnDecodeDone, decoder_weak_this_,
+                     is_flush, std::move(decode_cb)));
 }
 
 void VideoDecoderPipeline::OnDecodeDone(bool is_flush,
                                         DecodeCB decode_cb,
                                         DecodeStatus status) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(4) << "is_flush: " << is_flush << ", status: " << status;
 
   if (has_error_)
@@ -271,55 +312,16 @@
 
   if (is_flush && status == DecodeStatus::OK) {
     client_flush_cb_ = std::move(decode_cb);
-    // TODO(akahuang): The order between flush cb and output cb is preserved
-    // only when OnFrameDecodedThunk() run on |client_task_runner_|. Remove
-    // OnFrameDecodedThunk() when we make sure all VD callbacks are called on
-    // the same thread.
     CallFlushCbIfNeeded(DecodeStatus::OK);
     return;
   }
 
-  std::move(decode_cb).Run(status);
-}
-
-// static
-void VideoDecoderPipeline::OnFrameDecodedThunk(
-    scoped_refptr<base::SequencedTaskRunner> task_runner,
-    base::Optional<base::WeakPtr<VideoDecoderPipeline>> pipeline,
-    scoped_refptr<VideoFrame> frame) {
-  DCHECK(task_runner);
-  DCHECK(pipeline);
-  DVLOGF(4);
-
-  // Workaround for some decoder's non-conformant behavior:
-  // Decoders are supposed to call the output callback "as soon as possible",
-  // i.e. directly in their own thread. If they do so the OnFrameDecoded task is
-  // scheduled on the client task queue, and we have no race condition if we
-  // are destroyed after that.
-  //
-  // But some decoders will run the output callback on their client thread, i.e.
-  // our own task runner. If we get destroyed before that task is processed,
-  // then OnFrameDecoded would be scheduled after our destruction and thus
-  // would never be run, making the client miss a frame.
-  //
-  // So we first check whether we already are running on our task runner, and
-  // execute OnFrameDecoded without delay in that case. Hopefully this can be
-  // removed in the future.
-  //
-  // TODO fix the Mojo service so we don't need to do this dance anymore.
-  if (task_runner->RunsTasksInCurrentSequence()) {
-    if (*pipeline)
-      (*pipeline)->OnFrameDecoded(std::move(frame));
-    return;
-  }
-
-  task_runner->PostTask(FROM_HERE,
-                        base::BindOnce(&VideoDecoderPipeline::OnFrameDecoded,
-                                       *pipeline, std::move(frame)));
+  client_task_runner_->PostTask(FROM_HERE,
+                                base::BindOnce(std::move(decode_cb), status));
 }
 
 void VideoDecoderPipeline::OnFrameDecoded(scoped_refptr<VideoFrame> frame) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK(frame_converter_);
   DVLOGF(4);
 
@@ -330,7 +332,7 @@
 }
 
 void VideoDecoderPipeline::OnFrameConverted(scoped_refptr<VideoFrame> frame) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(4);
 
   if (!frame)
@@ -340,14 +342,20 @@
     return;
   }
 
-  client_output_cb_.Run(std::move(frame));
+  // MojoVideoDecoderService expects the |output_cb_| to be called on the client
+  // task runner, even though media::VideoDecoder states frames should be output
+  // without any thread jumping.
+  // Note that all the decode/flush/output/reset callbacks are executed on
+  // |client_task_runner_|.
+  client_task_runner_->PostTask(
+      FROM_HERE, base::BindOnce(client_output_cb_, std::move(frame)));
 
   // After outputting a frame, flush might be completed.
   CallFlushCbIfNeeded(DecodeStatus::OK);
 }
 
 void VideoDecoderPipeline::OnError(const std::string& msg) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   VLOGF(1) << msg;
 
   has_error_ = true;
@@ -355,7 +363,7 @@
 }
 
 void VideoDecoderPipeline::CallFlushCbIfNeeded(DecodeStatus status) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(3) << "status: " << status;
 
   if (!client_flush_cb_)
@@ -365,7 +373,8 @@
   if (status == DecodeStatus::OK && frame_converter_->HasPendingFrames())
     return;
 
-  std::move(client_flush_cb_).Run(status);
+  client_task_runner_->PostTask(
+      FROM_HERE, base::BindOnce(std::move(client_flush_cb_), status));
 }
 
 DmabufVideoFramePool* VideoDecoderPipeline::GetVideoFramePool() const {
diff --git a/media/gpu/linux/video_decoder_pipeline.h b/media/gpu/linux/video_decoder_pipeline.h
index 32aa613..2904250 100644
--- a/media/gpu/linux/video_decoder_pipeline.h
+++ b/media/gpu/linux/video_decoder_pipeline.h
@@ -87,7 +87,6 @@
   // Function signature for creating VideoDecoder.
   using CreateVDFunc = std::unique_ptr<DecoderInterface> (*)(
       scoped_refptr<base::SequencedTaskRunner>,
-      scoped_refptr<base::SequencedTaskRunner>,
       base::RepeatingCallback<DmabufVideoFramePool*()>);
   using GetCreateVDFunctionsCB =
       base::RepeatingCallback<base::queue<CreateVDFunc>(CreateVDFunc)>;
@@ -129,6 +128,12 @@
   void Destroy() override;
   void DestroyTask();
 
+  void InitializeTask(const VideoDecoderConfig& config,
+                      InitCB init_cb,
+                      const OutputCB& output_cb);
+  void ResetTask(base::OnceClosure closure);
+  void DecodeTask(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb);
+
   void CreateAndInitializeVD(base::queue<CreateVDFunc> create_vd_funcs,
                              VideoDecoderConfig config);
   void OnInitializeDone(base::queue<CreateVDFunc> create_vd_funcs,
@@ -140,10 +145,6 @@
   void OnFrameConverted(scoped_refptr<VideoFrame> frame);
   void OnError(const std::string& msg);
 
-  static void OnFrameDecodedThunk(
-      scoped_refptr<base::SequencedTaskRunner> task_runner,
-      base::Optional<base::WeakPtr<VideoDecoderPipeline>> pipeline,
-      scoped_refptr<VideoFrame> frame);
   void OnFrameDecoded(scoped_refptr<VideoFrame> frame);
 
   // Call |client_flush_cb_| with |status| if we need.
@@ -157,8 +158,8 @@
   const scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
   SEQUENCE_CHECKER(client_sequence_checker_);
 
-  // The decoder task runner and its sequence checker. |decoder_| should post
-  // time-consuming task and call |frame_pool_|'s methods on this task runner.
+  // The decoder task runner and its sequence checker. Call |decoder_|'s,
+  // |frame_pool_|'s, and |frame_converter_|'s methods on this task runner.
   const scoped_refptr<base::SequencedTaskRunner> decoder_task_runner_;
   SEQUENCE_CHECKER(decoder_sequence_checker_);
 
@@ -190,9 +191,13 @@
   // Set to true when any unexpected error occurs.
   bool has_error_ = false;
 
+  base::WeakPtr<VideoDecoderPipeline> client_weak_this_;
+  base::WeakPtr<VideoDecoderPipeline> decoder_weak_this_;
+
   // The weak pointer of this, bound to |client_task_runner_|.
-  base::WeakPtr<VideoDecoderPipeline> weak_this_;
-  base::WeakPtrFactory<VideoDecoderPipeline> weak_this_factory_{this};
+  base::WeakPtrFactory<VideoDecoderPipeline> client_weak_this_factory_{this};
+  // The weak pointer of this, bound to |decoder_task_runner_|.
+  base::WeakPtrFactory<VideoDecoderPipeline> decoder_weak_this_factory_{this};
 };
 
 }  // namespace media
diff --git a/media/gpu/v4l2/v4l2_slice_video_decoder.cc b/media/gpu/v4l2/v4l2_slice_video_decoder.cc
index 246eb1c..33ab40db 100644
--- a/media/gpu/v4l2/v4l2_slice_video_decoder.cc
+++ b/media/gpu/v4l2/v4l2_slice_video_decoder.cc
@@ -42,10 +42,9 @@
 // static
 std::unique_ptr<VideoDecoderPipeline::DecoderInterface>
 V4L2SliceVideoDecoder::Create(
-    scoped_refptr<base::SequencedTaskRunner> client_task_runner,
     scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
     GetFramePoolCB get_pool_cb) {
-  DCHECK(client_task_runner->RunsTasksInCurrentSequence());
+  DCHECK(decoder_task_runner->RunsTasksInCurrentSequence());
   DCHECK(get_pool_cb);
 
   scoped_refptr<V4L2Device> device = V4L2Device::Create();
@@ -55,8 +54,7 @@
   }
 
   return base::WrapUnique<VideoDecoderPipeline::DecoderInterface>(
-      new V4L2SliceVideoDecoder(std::move(client_task_runner),
-                                std::move(decoder_task_runner),
+      new V4L2SliceVideoDecoder(std::move(decoder_task_runner),
                                 std::move(device), std::move(get_pool_cb)));
 }
 
@@ -73,36 +71,20 @@
 }
 
 V4L2SliceVideoDecoder::V4L2SliceVideoDecoder(
-    scoped_refptr<base::SequencedTaskRunner> client_task_runner,
     scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
     scoped_refptr<V4L2Device> device,
     GetFramePoolCB get_pool_cb)
     : device_(std::move(device)),
       get_pool_cb_(std::move(get_pool_cb)),
-      client_task_runner_(std::move(client_task_runner)),
       decoder_task_runner_(std::move(decoder_task_runner)),
       weak_this_factory_(this) {
-  DETACH_FROM_SEQUENCE(client_sequence_checker_);
-  DETACH_FROM_SEQUENCE(decoder_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   VLOGF(2);
+
   weak_this_ = weak_this_factory_.GetWeakPtr();
 }
 
 V4L2SliceVideoDecoder::~V4L2SliceVideoDecoder() {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  VLOGF(2);
-
-  // We need this event to synchronously destroy this instance.
-  // TODO(akahuang): Remove this event by manipulating this instance only on one
-  // sequence.
-  base::WaitableEvent event;
-  decoder_task_runner_->PostTask(
-      FROM_HERE, base::BindOnce(&V4L2SliceVideoDecoder::DestroyTask, weak_this_,
-                                base::Unretained(&event)));
-  event.Wait();
-}
-
-void V4L2SliceVideoDecoder::DestroyTask(base::WaitableEvent* event) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(2);
 
@@ -124,34 +106,20 @@
   }
 
   weak_this_factory_.InvalidateWeakPtrs();
-
-  event->Signal();
 }
 
 void V4L2SliceVideoDecoder::Initialize(const VideoDecoderConfig& config,
                                        InitCB init_cb,
                                        const OutputCB& output_cb) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  DCHECK(config.IsValidConfig());
-
-  decoder_task_runner_->PostTask(
-      FROM_HERE,
-      base::BindOnce(&V4L2SliceVideoDecoder::InitializeTask, weak_this_, config,
-                     std::move(init_cb), std::move(output_cb)));
-}
-
-void V4L2SliceVideoDecoder::InitializeTask(const VideoDecoderConfig& config,
-                                           InitCB init_cb,
-                                           const OutputCB& output_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
+  DCHECK(config.IsValidConfig());
   DCHECK(state_ == State::kUninitialized || state_ == State::kDecoding);
   DVLOGF(3);
 
   // Reset V4L2 device and queue if reinitializing decoder.
   if (state_ != State::kUninitialized) {
     if (!StopStreamV4L2Queue()) {
-      client_task_runner_->PostTask(FROM_HERE,
-                                    base::BindOnce(std::move(init_cb), false));
+      std::move(init_cb).Run(false);
       return;
     }
 
@@ -163,8 +131,7 @@
     device_ = V4L2Device::Create();
     if (!device_) {
       VLOGF(1) << "Failed to create V4L2 device.";
-      client_task_runner_->PostTask(FROM_HERE,
-                                    base::BindOnce(std::move(init_cb), false));
+      std::move(init_cb).Run(false);
       return;
     }
 
@@ -185,8 +152,7 @@
       !device_->Open(V4L2Device::Type::kDecoder, input_format_fourcc)) {
     VLOGF(1) << "Failed to open device for profile: " << profile
              << " fourcc: " << FourccToString(input_format_fourcc);
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
@@ -196,8 +162,7 @@
       (caps.capabilities & kCapsRequired) != kCapsRequired) {
     VLOGF(1) << "ioctl() failed: VIDIOC_QUERYCAP, "
              << "caps check failed: 0x" << std::hex << caps.capabilities;
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
@@ -208,8 +173,7 @@
   output_queue_ = device_->GetQueue(V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
   if (!input_queue_ || !output_queue_) {
     VLOGF(1) << "Failed to create V4L2 queue.";
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
@@ -217,46 +181,40 @@
   backend_ = std::make_unique<V4L2StatelessVideoDecoderBackend>(
       this, device_, frame_pool_, profile, decoder_task_runner_);
   if (!backend_->Initialize()) {
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
   // Setup input format.
   if (!SetupInputFormat(input_format_fourcc)) {
     VLOGF(1) << "Failed to setup input format.";
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
   if (!SetCodedSizeOnInputQueue(config.coded_size())) {
     VLOGF(1) << "Failed to set coded size on input queue";
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
   // Setup output format.
   if (!SetupOutputFormat(config.coded_size(), config.visible_rect())) {
     VLOGF(1) << "Failed to setup output format.";
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
   if (input_queue_->AllocateBuffers(kNumInputBuffers, V4L2_MEMORY_MMAP) == 0) {
     VLOGF(1) << "Failed to allocate input buffer.";
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
   // Call init_cb
   output_cb_ = output_cb;
   SetState(State::kDecoding);
-  client_task_runner_->PostTask(FROM_HERE,
-                                base::BindOnce(std::move(init_cb), true));
+  std::move(init_cb).Run(true);
 }
 
 bool V4L2SliceVideoDecoder::SetupInputFormat(uint32_t input_format_fourcc) {
@@ -377,15 +335,6 @@
 }
 
 void V4L2SliceVideoDecoder::Reset(base::OnceClosure closure) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  DVLOGF(3);
-
-  decoder_task_runner_->PostTask(
-      FROM_HERE, base::BindOnce(&V4L2SliceVideoDecoder::ResetTask, weak_this_,
-                                std::move(closure)));
-}
-
-void V4L2SliceVideoDecoder::ResetTask(base::OnceClosure closure) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(3);
 
@@ -404,22 +353,11 @@
       return;
   }
 
-  client_task_runner_->PostTask(FROM_HERE, std::move(closure));
+  std::move(closure).Run();
 }
 
 void V4L2SliceVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
                                    DecodeCB decode_cb) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-
-  decoder_task_runner_->PostTask(
-      FROM_HERE,
-      base::BindOnce(&V4L2SliceVideoDecoder::EnqueueDecodeTask, weak_this_,
-                     std::move(buffer), std::move(decode_cb)));
-}
-
-void V4L2SliceVideoDecoder::EnqueueDecodeTask(
-    scoped_refptr<DecoderBuffer> buffer,
-    V4L2SliceVideoDecoder::DecodeCB decode_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DCHECK_NE(state_, State::kUninitialized);
 
@@ -584,13 +522,6 @@
   }
 }
 
-void V4L2SliceVideoDecoder::RunDecodeCB(DecodeCB cb, DecodeStatus status) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
-
-  client_task_runner_->PostTask(FROM_HERE,
-                                base::BindOnce(std::move(cb), status));
-}
-
 void V4L2SliceVideoDecoder::OutputFrame(scoped_refptr<VideoFrame> frame,
                                         const gfx::Rect& visible_rect,
                                         base::TimeDelta timestamp) {
@@ -614,9 +545,7 @@
 
     frame = std::move(wrapped_frame);
   }
-
-  client_task_runner_->PostTask(FROM_HERE,
-                                base::BindOnce(output_cb_, std::move(frame)));
+  output_cb_.Run(std::move(frame));
 }
 
 void V4L2SliceVideoDecoder::SetState(State new_state) {
diff --git a/media/gpu/v4l2/v4l2_slice_video_decoder.h b/media/gpu/v4l2/v4l2_slice_video_decoder.h
index 89afd737..9ce6843 100644
--- a/media/gpu/v4l2/v4l2_slice_video_decoder.h
+++ b/media/gpu/v4l2/v4l2_slice_video_decoder.h
@@ -21,7 +21,6 @@
 #include "base/optional.h"
 #include "base/sequence_checker.h"
 #include "base/sequenced_task_runner.h"
-#include "base/synchronization/waitable_event.h"
 #include "base/threading/thread.h"
 #include "base/time/time.h"
 #include "media/base/video_frame_layout.h"
@@ -46,7 +45,6 @@
   // ensure V4L2SliceVideoDecoder is available on the device. It will be
   // determined in Initialize().
   static std::unique_ptr<VideoDecoderPipeline::DecoderInterface> Create(
-      scoped_refptr<base::SequencedTaskRunner> client_task_runner,
       scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
       GetFramePoolCB get_pool_cb);
 
@@ -67,7 +65,6 @@
   bool ChangeResolution(gfx::Size pic_size,
                         gfx::Rect visible_rect,
                         size_t num_output_frames) override;
-  void RunDecodeCB(DecodeCB cb, DecodeStatus status) override;
   void OutputFrame(scoped_refptr<VideoFrame> frame,
                    const gfx::Rect& visible_rect,
                    base::TimeDelta timestamp) override;
@@ -76,7 +73,6 @@
   friend class V4L2SliceVideoDecoderTest;
 
   V4L2SliceVideoDecoder(
-      scoped_refptr<base::SequencedTaskRunner> client_task_runner,
       scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
       scoped_refptr<V4L2Device> device,
       GetFramePoolCB get_pool_cb);
@@ -110,10 +106,6 @@
     SEQUENCE_CHECKER(sequence_checker_);
   };
 
-  // Initialize on decoder thread.
-  void InitializeTask(const VideoDecoderConfig& config,
-                      InitCB init_cb,
-                      const OutputCB& output_cb);
   // Setup format for input queue.
   bool SetupInputFormat(uint32_t input_format_fourcc);
 
@@ -137,15 +129,6 @@
       const gfx::Size& size,
       const gfx::Rect& visible_rect);
 
-  // Destroy on decoder thread.
-  void DestroyTask(base::WaitableEvent* event);
-  // Reset on decoder thread.
-  void ResetTask(base::OnceClosure closure);
-
-  // Enqueue |buffer| to be decoded. |decode_cb| will be called once |buffer|
-  // is no longer used.
-  void EnqueueDecodeTask(scoped_refptr<DecoderBuffer> buffer,
-                         V4L2SliceVideoDecoder::DecodeCB decode_cb);
   // Start streaming V4L2 input and output queues. Attempt to start
   // |device_poll_thread_| before starting streaming.
   bool StartStreamV4L2Queue();
@@ -168,11 +151,8 @@
   GetFramePoolCB get_pool_cb_;
   DmabufVideoFramePool* frame_pool_ = nullptr;
 
-  // Client task runner. All public methods of
+  // Decoder task runner. All public methods of
   // VideoDecoderPipeline::DecoderInterface are executed at this task runner.
-  const scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
-  // Thread to communicate with the device on. Most of internal methods and data
-  // members are manipulated on this thread.
   const scoped_refptr<base::SequencedTaskRunner> decoder_task_runner_;
 
   // State of the instance.
@@ -192,7 +172,6 @@
 
   BitstreamIdGenerator bitstream_id_generator_;
 
-  SEQUENCE_CHECKER(client_sequence_checker_);
   SEQUENCE_CHECKER(decoder_sequence_checker_);
 
   // |weak_this_| must be dereferenced and invalidated on
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend.h b/media/gpu/v4l2/v4l2_video_decoder_backend.h
index 512f3e2..1bfbc7d 100644
--- a/media/gpu/v4l2/v4l2_video_decoder_backend.h
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend.h
@@ -51,9 +51,6 @@
     virtual bool ChangeResolution(gfx::Size pic_size,
                                   gfx::Rect visible_rect,
                                   size_t num_output_frames) = 0;
-    // Call the decode callback and count the number of pending callbacks.
-    virtual void RunDecodeCB(VideoDecoder::DecodeCB cb,
-                             DecodeStatus status) = 0;
     // Convert the frame and call the output callback.
     virtual void OutputFrame(scoped_refptr<VideoFrame> frame,
                              const gfx::Rect& visible_rect,
@@ -65,8 +62,7 @@
   virtual bool Initialize() = 0;
 
   // Schedule |buffer| to be processed, with bitstream ID |bitstream_id|.
-  // The backend must call V4L2SliceVideoDecoder::RunDecodeCB() with |decode_cb|
-  // as argument once the buffer is not used anymore.
+  // The backend must call |decode_cb| once the buffer is not used anymore.
   virtual void EnqueueDecodeTask(scoped_refptr<DecoderBuffer> buffer,
                                  VideoDecoder::DecodeCB decode_cb,
                                  int32_t bitstream_id) = 0;
diff --git a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
index 143f773..ed5d154a 100644
--- a/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
+++ b/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
@@ -396,8 +396,7 @@
         // Current decode request is finished processing.
         if (current_decode_request_) {
           DCHECK(current_decode_request_->decode_cb);
-          client_->RunDecodeCB(std::move(current_decode_request_->decode_cb),
-                               DecodeStatus::OK);
+          std::move(current_decode_request_->decode_cb).Run(DecodeStatus::OK);
           current_decode_request_ = base::nullopt;
         }
 
@@ -469,7 +468,7 @@
       case OutputRequest::kFlushFence:
         DCHECK(output_request_queue_.empty());
         DVLOGF(2) << "Flush finished.";
-        client_->RunDecodeCB(std::move(flush_cb_), DecodeStatus::OK);
+        std::move(flush_cb_).Run(DecodeStatus::OK);
         resume_decode = true;
         break;
 
@@ -539,18 +538,18 @@
     output_request_queue_.pop();
 
   if (flush_cb_)
-    client_->RunDecodeCB(std::move(flush_cb_), status);
+    std::move(flush_cb_).Run(status);
 
   // Clear current_decode_request_ and decode_request_queue_.
   if (current_decode_request_) {
-    client_->RunDecodeCB(std::move(current_decode_request_->decode_cb), status);
+    std::move(current_decode_request_->decode_cb).Run(status);
     current_decode_request_ = base::nullopt;
   }
 
   while (!decode_request_queue_.empty()) {
     auto request = std::move(decode_request_queue_.front());
     decode_request_queue_.pop();
-    client_->RunDecodeCB(std::move(request.decode_cb), status);
+    std::move(request.decode_cb).Run(status);
   }
 }
 
diff --git a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
index a03f3bd..500c582 100644
--- a/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
+++ b/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
@@ -1005,7 +1005,7 @@
       if (bitstream_buffer_pool_.empty()) {
         DVLOGF(4) << "No free bitstream buffer, skip.";
         output_buffer_queue_.push_front(std::move(output_buf));
-        return;
+        break;
       }
 
       auto buffer_ref = std::move(bitstream_buffer_pool_.back());
@@ -1044,6 +1044,13 @@
       IOCTL_OR_ERROR_RETURN(VIDIOC_ENCODER_CMD, &cmd);
     }
   }
+
+  // We may free some V4L2 output buffers above. Enqueue them if needed.
+  if (output_queue_->FreeBuffersCount() > 0) {
+    encoder_thread_.task_runner()->PostTask(
+        FROM_HERE, base::BindOnce(&V4L2VideoEncodeAccelerator::Enqueue,
+                                  base::Unretained(this)));
+  }
 }
 
 bool V4L2VideoEncodeAccelerator::EnqueueInputRecord() {
diff --git a/media/gpu/vaapi/vaapi_video_decoder.cc b/media/gpu/vaapi/vaapi_video_decoder.cc
index 7dfbaf0..c8f53b32 100644
--- a/media/gpu/vaapi/vaapi_video_decoder.cc
+++ b/media/gpu/vaapi/vaapi_video_decoder.cc
@@ -65,12 +65,10 @@
 // static
 std::unique_ptr<VideoDecoderPipeline::DecoderInterface>
 VaapiVideoDecoder::Create(
-    scoped_refptr<base::SequencedTaskRunner> client_task_runner,
     scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
     GetFramePoolCB get_pool_cb) {
   return base::WrapUnique<VideoDecoderPipeline::DecoderInterface>(
-      new VaapiVideoDecoder(std::move(client_task_runner),
-                            std::move(decoder_task_runner),
+      new VaapiVideoDecoder(std::move(decoder_task_runner),
                             std::move(get_pool_cb)));
 }
 
@@ -81,37 +79,21 @@
 }
 
 VaapiVideoDecoder::VaapiVideoDecoder(
-    scoped_refptr<base::SequencedTaskRunner> client_task_runner,
     scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
     GetFramePoolCB get_pool_cb)
     : get_pool_cb_(std::move(get_pool_cb)),
       buffer_id_to_timestamp_(kTimestampCacheSize),
-      client_task_runner_(std::move(client_task_runner)),
       decoder_task_runner_(std::move(decoder_task_runner)),
       weak_this_factory_(this) {
-  DETACH_FROM_SEQUENCE(decoder_sequence_checker_);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   VLOGF(2);
 
   weak_this_ = weak_this_factory_.GetWeakPtr();
 }
 
 VaapiVideoDecoder::~VaapiVideoDecoder() {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  VLOGF(2);
-
-  // We need this event to synchronously destroy this instance.
-  // TODO(akahuang): Remove this event by manipulating this instance only on one
-  // sequence.
-  base::WaitableEvent event;
-  decoder_task_runner_->PostTask(
-      FROM_HERE, base::BindOnce(&VaapiVideoDecoder::DestroyTask, weak_this_,
-                                base::Unretained(&event)));
-  event.Wait();
-}
-
-void VaapiVideoDecoder::DestroyTask(base::WaitableEvent* event) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
-  DVLOGF(2);
+  VLOGF(2);
 
   // Abort all currently scheduled decode tasks.
   ClearDecodeTaskQueue(DecodeStatus::ABORTED);
@@ -122,34 +104,20 @@
   }
 
   weak_this_factory_.InvalidateWeakPtrs();
-
-  event->Signal();
 }
 
 void VaapiVideoDecoder::Initialize(const VideoDecoderConfig& config,
                                    InitCB init_cb,
                                    const OutputCB& output_cb) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  DCHECK(config.IsValidConfig());
-
-  decoder_task_runner_->PostTask(
-      FROM_HERE,
-      base::BindOnce(&VaapiVideoDecoder::InitializeTask, weak_this_, config,
-                     std::move(init_cb), std::move(output_cb)));
-}
-
-void VaapiVideoDecoder::InitializeTask(const VideoDecoderConfig& config,
-                                       InitCB init_cb,
-                                       OutputCB output_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
+  DCHECK(config.IsValidConfig());
   DCHECK(state_ == State::kUninitialized || state_ == State::kWaitingForInput);
   DVLOGF(3);
 
   // Reinitializing the decoder is allowed if there are no pending decodes.
   if (current_decode_task_ || !decode_task_queue_.empty()) {
     VLOGF(1) << "Don't call Initialize() while there are pending decode tasks";
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
@@ -175,8 +143,7 @@
   if (!vaapi_wrapper_.get()) {
     VLOGF(1) << "Failed initializing VAAPI for profile "
              << GetProfileName(profile);
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
@@ -194,8 +161,7 @@
         config.color_space_info()));
   } else {
     VLOGF(1) << "Unsupported profile " << GetProfileName(profile);
-    client_task_runner_->PostTask(FROM_HERE,
-                                  base::BindOnce(std::move(init_cb), false));
+    std::move(init_cb).Run(false);
     return;
   }
 
@@ -209,28 +175,18 @@
   SetState(State::kWaitingForInput);
 
   // Notify client initialization was successful.
-  client_task_runner_->PostTask(FROM_HERE,
-                                base::BindOnce(std::move(init_cb), true));
+  std::move(init_cb).Run(true);
 }
 
 void VaapiVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
                                DecodeCB decode_cb) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-
-  decoder_task_runner_->PostTask(
-      FROM_HERE, base::BindOnce(&VaapiVideoDecoder::QueueDecodeTask, weak_this_,
-                                std::move(buffer), std::move(decode_cb)));
-}
-
-void VaapiVideoDecoder::QueueDecodeTask(scoped_refptr<DecoderBuffer> buffer,
-                                        DecodeCB decode_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(4) << "Queuing input buffer, id: " << next_buffer_id_ << ", size: "
             << (buffer->end_of_stream() ? 0 : buffer->data_size());
 
   // If we're in the error state, immediately fail the decode task.
   if (state_ == State::kError) {
-    RunDecodeCB(std::move(decode_cb), DecodeStatus::DECODE_ERROR);
+    std::move(decode_cb).Run(DecodeStatus::DECODE_ERROR);
     return;
   }
 
@@ -291,8 +247,7 @@
     case AcceleratedVideoDecoder::kRanOutOfStreamData:
       // Decoding was successful, notify client and try to schedule the next
       // task. Switch to the idle state if we ran out of buffers to decode.
-      RunDecodeCB(std::move(current_decode_task_->decode_done_cb_),
-                  DecodeStatus::OK);
+      std::move(current_decode_task_->decode_done_cb_).Run(DecodeStatus::OK);
       current_decode_task_ = base::nullopt;
       if (!decode_task_queue_.empty()) {
         ScheduleNextDecodeTask();
@@ -330,12 +285,12 @@
   DVLOGF(4);
 
   if (current_decode_task_) {
-    RunDecodeCB(std::move(current_decode_task_->decode_done_cb_), status);
+    std::move(current_decode_task_->decode_done_cb_).Run(status);
     current_decode_task_ = base::nullopt;
   }
 
   while (!decode_task_queue_.empty()) {
-    RunDecodeCB(std::move(decode_task_queue_.front().decode_done_cb_), status);
+    std::move(decode_task_queue_.front().decode_done_cb_).Run(status);
     decode_task_queue_.pop();
   }
 }
@@ -439,8 +394,7 @@
     video_frame = std::move(wrapped_frame);
   }
 
-  client_task_runner_->PostTask(
-      FROM_HERE, base::BindOnce(output_cb_, std::move(video_frame)));
+  output_cb_.Run(std::move(video_frame));
 }
 
 void VaapiVideoDecoder::ChangeFrameResolutionTask() {
@@ -522,8 +476,7 @@
   DCHECK(output_frames_.empty());
 
   // Notify the client flushing is done.
-  RunDecodeCB(std::move(current_decode_task_->decode_done_cb_),
-              DecodeStatus::OK);
+  std::move(current_decode_task_->decode_done_cb_).Run(DecodeStatus::OK);
   current_decode_task_ = base::nullopt;
 
   // Wait for new decodes, no decode tasks should be queued while flushing.
@@ -531,21 +484,12 @@
 }
 
 void VaapiVideoDecoder::Reset(base::OnceClosure reset_cb) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-  DVLOGF(2);
-
-  decoder_task_runner_->PostTask(
-      FROM_HERE, base::BindOnce(&VaapiVideoDecoder::ResetTask, weak_this_,
-                                std::move(reset_cb)));
-}
-
-void VaapiVideoDecoder::ResetTask(base::OnceClosure reset_cb) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(2);
 
   // If we encountered an error, skip reset and notify client.
   if (state_ == State::kError) {
-    client_task_runner_->PostTask(FROM_HERE, std::move(reset_cb));
+    std::move(reset_cb).Run();
     return;
   }
 
@@ -568,17 +512,10 @@
   DCHECK(decode_task_queue_.empty());
   DVLOGF(2);
 
-  client_task_runner_->PostTask(FROM_HERE, std::move(reset_cb));
+  std::move(reset_cb).Run();
   SetState(State::kWaitingForInput);
 }
 
-void VaapiVideoDecoder::RunDecodeCB(DecodeCB cb, DecodeStatus status) {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
-
-  client_task_runner_->PostTask(FROM_HERE,
-                                base::BindOnce(std::move(cb), status));
-}
-
 void VaapiVideoDecoder::SetState(State state) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(decoder_sequence_checker_);
   DVLOGF(4) << static_cast<int>(state)
diff --git a/media/gpu/vaapi/vaapi_video_decoder.h b/media/gpu/vaapi/vaapi_video_decoder.h
index 7771889..1af2663 100644
--- a/media/gpu/vaapi/vaapi_video_decoder.h
+++ b/media/gpu/vaapi/vaapi_video_decoder.h
@@ -20,7 +20,6 @@
 #include "base/memory/weak_ptr.h"
 #include "base/optional.h"
 #include "base/sequence_checker.h"
-#include "base/synchronization/waitable_event.h"
 #include "base/threading/thread.h"
 #include "base/time/time.h"
 #include "media/base/video_codecs.h"
@@ -45,7 +44,6 @@
   using GetFramePoolCB = base::RepeatingCallback<DmabufVideoFramePool*()>;
 
   static std::unique_ptr<VideoDecoderPipeline::DecoderInterface> Create(
-      scoped_refptr<base::SequencedTaskRunner> client_task_runner,
       scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
       GetFramePoolCB get_pool);
 
@@ -90,21 +88,10 @@
   };
 
   VaapiVideoDecoder(
-      scoped_refptr<base::SequencedTaskRunner> client_task_runner,
       scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
       GetFramePoolCB get_pool);
   ~VaapiVideoDecoder() override;
 
-  // Initialize the VAAPI video decoder on the decoder thread.
-  void InitializeTask(const VideoDecoderConfig& config,
-                      InitCB init_cb,
-                      OutputCB output_cb);
-  // Destroy the VAAPI video decoder on the decoder thread.
-  void DestroyTask(base::WaitableEvent* event);
-
-  // Queue a decode task on the decoder thread. If the decoder is currently
-  // waiting for input buffers decoding will be started.
-  void QueueDecodeTask(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb);
   // Schedule the next decode task in the queue to be executed.
   void ScheduleNextDecodeTask();
   // Try to decode a single input buffer on the decoder thread.
@@ -138,15 +125,9 @@
   // tasks have been executed and all frames have been output.
   void FlushTask();
 
-  // Reset the decoder on the decoder thread. This will abort any pending decode
-  // task. The |reset_cb| will be passed to ResetDoneTask() and called when
-  // resetting has completed.
-  void ResetTask(base::OnceClosure reset_cb);
-  // Called on the decoder thread once resetting is done. Executes |reset_cb|.
+  // Called when resetting the decoder is done, executes |reset_cb|.
   void ResetDoneTask(base::OnceClosure reset_cb);
 
-  // Called on decoder thread to schedule |decode_cb| on the client task runner.
-  void RunDecodeCB(DecodeCB decode_cb, DecodeStatus status);
   // Change the current |state_| to the specified |state| on the decoder thread.
   void SetState(State state);
 
@@ -188,10 +169,8 @@
   std::unique_ptr<AcceleratedVideoDecoder> decoder_;
   scoped_refptr<VaapiWrapper> vaapi_wrapper_;
 
-  const scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
   const scoped_refptr<base::SequencedTaskRunner> decoder_task_runner_;
 
-  SEQUENCE_CHECKER(client_sequence_checker_);
   SEQUENCE_CHECKER(decoder_sequence_checker_);
 
   base::WeakPtr<VaapiVideoDecoder> weak_this_;
diff --git a/media/mojo/clients/mojo_decoder_factory.cc b/media/mojo/clients/mojo_decoder_factory.cc
index b19440d1..9d1b747 100644
--- a/media/mojo/clients/mojo_decoder_factory.cc
+++ b/media/mojo/clients/mojo_decoder_factory.cc
@@ -49,26 +49,29 @@
     const gfx::ColorSpace& target_color_space,
     std::vector<std::unique_ptr<VideoDecoder>>* video_decoders) {
 #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
-  mojom::VideoDecoderPtr video_decoder_ptr;
 
 #if defined(OS_WIN)
   // If the D3D11VideoDecoder is enabled, then push a kAlternate decoder ahead
   // of the default one.
   if (base::FeatureList::IsEnabled(media::kD3D11VideoDecoder)) {
+    mojo::PendingRemote<mojom::VideoDecoder> d3d11_video_decoder_remote;
     interface_factory_->CreateVideoDecoder(
-        mojo::MakeRequest(&video_decoder_ptr));
+        d3d11_video_decoder_remote.InitWithNewPipeAndPassReceiver());
 
     video_decoders->push_back(std::make_unique<MojoVideoDecoder>(
-        task_runner, gpu_factories, media_log, std::move(video_decoder_ptr),
+        task_runner, gpu_factories, media_log,
+        std::move(d3d11_video_decoder_remote),
         VideoDecoderImplementation::kAlternate, request_overlay_info_cb,
         target_color_space));
   }
 #endif  // defined(OS_WIN)
-
-  interface_factory_->CreateVideoDecoder(mojo::MakeRequest(&video_decoder_ptr));
+  mojo::PendingRemote<mojom::VideoDecoder> d3d11_video_decoder_remote;
+  interface_factory_->CreateVideoDecoder(
+      d3d11_video_decoder_remote.InitWithNewPipeAndPassReceiver());
 
   video_decoders->push_back(std::make_unique<MojoVideoDecoder>(
-      task_runner, gpu_factories, media_log, std::move(video_decoder_ptr),
+      task_runner, gpu_factories, media_log,
+      std::move(d3d11_video_decoder_remote),
       VideoDecoderImplementation::kDefault, request_overlay_info_cb,
       target_color_space));
 
diff --git a/media/mojo/clients/mojo_video_decoder.cc b/media/mojo/clients/mojo_video_decoder.cc
index 77b426e..9e67e16 100644
--- a/media/mojo/clients/mojo_video_decoder.cc
+++ b/media/mojo/clients/mojo_video_decoder.cc
@@ -28,6 +28,9 @@
 #include "media/video/gpu_video_accelerator_factories.h"
 #include "media/video/video_decode_accelerator.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/pending_associated_remote.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/shared_remote.h"
 
 namespace media {
 namespace {
@@ -69,22 +72,22 @@
   REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE();
 
   MojoVideoFrameHandleReleaser(
-      mojom::VideoFrameHandleReleaserPtrInfo
-          video_frame_handle_releaser_ptr_info,
+      mojo::PendingRemote<mojom::VideoFrameHandleReleaser>
+          video_frame_handle_releaser_remote,
       scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
     // Connection errors are not handled because we wouldn't do anything
     // differently. ("If a tree falls in a forest...")
     video_frame_handle_releaser_ =
-        mojom::ThreadSafeVideoFrameHandleReleaserPtr::Create(
-            std::move(video_frame_handle_releaser_ptr_info),
+        mojo::SharedRemote<mojom::VideoFrameHandleReleaser>(
+            std::move(video_frame_handle_releaser_remote),
             std::move(task_runner));
   }
 
   void ReleaseVideoFrame(const base::UnguessableToken& release_token,
                          const gpu::SyncToken& release_sync_token) {
     DVLOG(3) << __func__ << "(" << release_token << ")";
-    (*video_frame_handle_releaser_)
-        ->ReleaseVideoFrame(release_token, release_sync_token);
+    video_frame_handle_releaser_->ReleaseVideoFrame(release_token,
+                                                    release_sync_token);
   }
 
   // Create a ReleaseMailboxCB that calls Release(). Since the callback holds a
@@ -101,7 +104,7 @@
   friend class base::RefCountedThreadSafe<MojoVideoFrameHandleReleaser>;
   ~MojoVideoFrameHandleReleaser() {}
 
-  scoped_refptr<mojom::ThreadSafeVideoFrameHandleReleaserPtr>
+  mojo::SharedRemote<mojom::VideoFrameHandleReleaser>
       video_frame_handle_releaser_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoVideoFrameHandleReleaser);
@@ -111,17 +114,16 @@
     scoped_refptr<base::SingleThreadTaskRunner> task_runner,
     GpuVideoAcceleratorFactories* gpu_factories,
     MediaLog* media_log,
-    mojom::VideoDecoderPtr remote_decoder,
+    mojo::PendingRemote<mojom::VideoDecoder> pending_remote_decoder,
     VideoDecoderImplementation implementation,
     const RequestOverlayInfoCB& request_overlay_info_cb,
     const gfx::ColorSpace& target_color_space)
     : task_runner_(task_runner),
-      remote_decoder_info_(remote_decoder.PassInterface()),
+      pending_remote_decoder_(std::move(pending_remote_decoder)),
       gpu_factories_(gpu_factories),
       timestamps_(128),
       writer_capacity_(
           GetDefaultDecoderBufferConverterCapacity(DemuxerStream::VIDEO)),
-      client_binding_(this),
       media_log_service_(media_log),
       media_log_binding_(&media_log_service_),
       request_overlay_info_cb_(request_overlay_info_cb),
@@ -338,15 +340,17 @@
   DCHECK(task_runner_->BelongsToCurrentThread());
   DCHECK(!remote_decoder_bound_);
 
-  remote_decoder_.Bind(std::move(remote_decoder_info_));
+  remote_decoder_.Bind(std::move(pending_remote_decoder_));
   remote_decoder_bound_ = true;
 
-  remote_decoder_.set_connection_error_handler(
+  remote_decoder_.set_disconnect_handler(
       base::Bind(&MojoVideoDecoder::Stop, base::Unretained(this)));
 
   // Create |client| interface (bound to |this|).
-  mojom::VideoDecoderClientAssociatedPtrInfo client_ptr_info;
-  client_binding_.Bind(mojo::MakeRequest(&client_ptr_info));
+  mojo::PendingAssociatedRemote<mojom::VideoDecoderClient>
+      client_pending_remote;
+  client_receiver_.Bind(
+      client_pending_remote.InitWithNewEndpointAndPassReceiver());
 
   // Create |media_log| interface (bound to |media_log_service_|).
   mojom::MediaLogAssociatedPtrInfo media_log_ptr_info;
@@ -380,7 +384,7 @@
   }
 
   remote_decoder_->Construct(
-      std::move(client_ptr_info), std::move(media_log_ptr_info),
+      std::move(client_pending_remote), std::move(media_log_ptr_info),
       std::move(video_frame_handle_releaser_receiver),
       std::move(remote_consumer_handle), std::move(command_buffer_id),
       video_decoder_implementation_, target_color_space_);
diff --git a/media/mojo/clients/mojo_video_decoder.h b/media/mojo/clients/mojo_video_decoder.h
index 6d60605..a051471 100644
--- a/media/mojo/clients/mojo_video_decoder.h
+++ b/media/mojo/clients/mojo_video_decoder.h
@@ -15,6 +15,9 @@
 #include "media/mojo/mojom/video_decoder.mojom.h"
 #include "media/video/video_decode_accelerator.h"
 #include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/bindings/associated_receiver.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
 #include "ui/gfx/color_space.h"
 
 namespace base {
@@ -35,13 +38,14 @@
 class MojoVideoDecoder final : public VideoDecoder,
                                public mojom::VideoDecoderClient {
  public:
-  MojoVideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
-                   GpuVideoAcceleratorFactories* gpu_factories,
-                   MediaLog* media_log,
-                   mojom::VideoDecoderPtr remote_decoder,
-                   VideoDecoderImplementation implementation,
-                   const RequestOverlayInfoCB& request_overlay_info_cb,
-                   const gfx::ColorSpace& target_color_space);
+  MojoVideoDecoder(
+      scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+      GpuVideoAcceleratorFactories* gpu_factories,
+      MediaLog* media_log,
+      mojo::PendingRemote<mojom::VideoDecoder> pending_remote_decoder,
+      VideoDecoderImplementation implementation,
+      const RequestOverlayInfoCB& request_overlay_info_cb,
+      const gfx::ColorSpace& target_color_space);
   ~MojoVideoDecoder() final;
 
   // VideoDecoder implementation.
@@ -91,7 +95,7 @@
 
   // Used to pass the remote decoder from the constructor (on the main thread)
   // to Initialize() (on the media thread).
-  mojom::VideoDecoderPtrInfo remote_decoder_info_;
+  mojo::PendingRemote<mojom::VideoDecoder> pending_remote_decoder_;
 
   // Manages VideoFrame destruction callbacks.
   scoped_refptr<MojoVideoFrameHandleReleaser> mojo_video_frame_handle_releaser_;
@@ -109,14 +113,14 @@
   // large enough to account for any amount of frame reordering.
   base::MRUCache<int64_t, base::TimeTicks> timestamps_;
 
-  mojom::VideoDecoderPtr remote_decoder_;
+  mojo::Remote<mojom::VideoDecoder> remote_decoder_;
   std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_;
 
   uint32_t writer_capacity_ = 0;
 
   bool remote_decoder_bound_ = false;
   bool has_connection_error_ = false;
-  mojo::AssociatedBinding<mojom::VideoDecoderClient> client_binding_;
+  mojo::AssociatedReceiver<mojom::VideoDecoderClient> client_receiver_{this};
   MojoMediaLogService media_log_service_;
   mojo::AssociatedBinding<mojom::MediaLog> media_log_binding_;
   RequestOverlayInfoCB request_overlay_info_cb_;
diff --git a/media/mojo/mojom/interface_factory.mojom b/media/mojo/mojom/interface_factory.mojom
index a7e69871..dbb9cba 100644
--- a/media/mojo/mojom/interface_factory.mojom
+++ b/media/mojo/mojom/interface_factory.mojom
@@ -18,7 +18,7 @@
 // ContentDecryptionModules created with the same factory.
 interface InterfaceFactory {
   CreateAudioDecoder(pending_receiver<AudioDecoder> audio_decoder);
-  CreateVideoDecoder(VideoDecoder& video_decoder);
+  CreateVideoDecoder(pending_receiver<VideoDecoder> video_decoder);
 
   // Creates a regular media::Renderer (DefaultRendererFactory).
   CreateDefaultRenderer(string audio_device_id, Renderer& renderer);
diff --git a/media/mojo/services/interface_factory_impl.cc b/media/mojo/services/interface_factory_impl.cc
index fc4775b..9d827b4 100644
--- a/media/mojo/services/interface_factory_impl.cc
+++ b/media/mojo/services/interface_factory_impl.cc
@@ -83,13 +83,12 @@
 }
 
 void InterfaceFactoryImpl::CreateVideoDecoder(
-    mojom::VideoDecoderRequest request) {
+    mojo::PendingReceiver<mojom::VideoDecoder> receiver) {
   DVLOG(2) << __func__;
 #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
-  video_decoder_bindings_.AddBinding(
-      std::make_unique<MojoVideoDecoderService>(mojo_media_client_,
-                                                &cdm_service_context_),
-      std::move(request));
+  video_decoder_receivers_.Add(std::make_unique<MojoVideoDecoderService>(
+                                   mojo_media_client_, &cdm_service_context_),
+                               std::move(receiver));
 #endif  // BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
 }
 
@@ -233,7 +232,7 @@
 #endif  // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER)
 
 #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
-  if (!video_decoder_bindings_.empty())
+  if (!video_decoder_receivers_.empty())
     return false;
 #endif  // BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
 
@@ -270,7 +269,7 @@
 #endif  // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER)
 
 #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
-  video_decoder_bindings_.set_connection_error_handler(connection_error_cb);
+  video_decoder_receivers_.set_disconnect_handler(connection_error_cb);
 #endif  // BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
 
 #if BUILDFLAG(ENABLE_MOJO_RENDERER)
diff --git a/media/mojo/services/interface_factory_impl.h b/media/mojo/services/interface_factory_impl.h
index 1814b047..5e5db22 100644
--- a/media/mojo/services/interface_factory_impl.h
+++ b/media/mojo/services/interface_factory_impl.h
@@ -42,7 +42,8 @@
   // mojom::InterfaceFactory implementation.
   void CreateAudioDecoder(
       mojo::PendingReceiver<mojom::AudioDecoder> receiver) final;
-  void CreateVideoDecoder(mojom::VideoDecoderRequest request) final;
+  void CreateVideoDecoder(
+      mojo::PendingReceiver<mojom::VideoDecoder> receiver) final;
   void CreateDefaultRenderer(const std::string& audio_device_id,
                              mojom::RendererRequest request) final;
 #if BUILDFLAG(ENABLE_CAST_RENDERER)
@@ -92,7 +93,7 @@
 #endif  // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER)
 
 #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
-  mojo::StrongBindingSet<mojom::VideoDecoder> video_decoder_bindings_;
+  mojo::UniqueReceiverSet<mojom::VideoDecoder> video_decoder_receivers_;
 #endif  // BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
 
 #if BUILDFLAG(ENABLE_MOJO_RENDERER) || BUILDFLAG(ENABLE_CAST_RENDERER)
diff --git a/media/mojo/test/mojo_video_decoder_integration_test.cc b/media/mojo/test/mojo_video_decoder_integration_test.cc
index 8612f8e..ba86d61 100644
--- a/media/mojo/test/mojo_video_decoder_integration_test.cc
+++ b/media/mojo/test/mojo_video_decoder_integration_test.cc
@@ -33,7 +33,9 @@
 #include "media/mojo/services/mojo_cdm_service_context.h"
 #include "media/mojo/services/mojo_media_client.h"
 #include "media/mojo/services/mojo_video_decoder_service.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "mojo/public/cpp/bindings/self_owned_receiver.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/gfx/color_space.h"
@@ -207,12 +209,12 @@
 
   void SetWriterCapacity(uint32_t capacity) { writer_capacity_ = capacity; }
 
-  mojom::VideoDecoderPtr CreateRemoteVideoDecoder() {
-    mojom::VideoDecoderPtr remote_video_decoder;
-    mojo::MakeStrongBinding(
+  mojo::PendingRemote<mojom::VideoDecoder> CreateRemoteVideoDecoder() {
+    mojo::PendingRemote<mojom::VideoDecoder> remote_video_decoder;
+    mojo::MakeSelfOwnedReceiver(
         std::make_unique<MojoVideoDecoderService>(&mojo_media_client_,
                                                   &mojo_cdm_service_context_),
-        mojo::MakeRequest(&remote_video_decoder));
+        remote_video_decoder.InitWithNewPipeAndPassReceiver());
     return remote_video_decoder;
   }
 
@@ -340,7 +342,8 @@
 TEST_F(MojoVideoDecoderIntegrationTest, CreateAndDestroy) {}
 
 TEST_F(MojoVideoDecoderIntegrationTest, GetSupportedConfigs) {
-  mojom::VideoDecoderPtr remote_video_decoder = CreateRemoteVideoDecoder();
+  mojo::Remote<mojom::VideoDecoder> remote_video_decoder(
+      CreateRemoteVideoDecoder());
   StrictMock<
       base::MockCallback<mojom::VideoDecoder::GetSupportedConfigsCallback>>
       callback;
diff --git a/media/remoting/OWNERS b/media/remoting/OWNERS
index e85c2ba..84ce14c 100644
--- a/media/remoting/OWNERS
+++ b/media/remoting/OWNERS
@@ -1,4 +1,5 @@
 erickung@chromium.org
 miu@chromium.org
+mfoltz@chromium.org
 
 # COMPONENT: Internals>Cast>Streaming
diff --git a/services/audio/test/service_lifetime_test_template.h b/services/audio/test/service_lifetime_test_template.h
index 38a8e84..5b401aab 100644
--- a/services/audio/test/service_lifetime_test_template.h
+++ b/services/audio/test/service_lifetime_test_template.h
@@ -32,9 +32,10 @@
         service_manager::mojom::kServiceName,
         service_manager.BindNewPipeAndPassReceiver());
 
-    service_manager::mojom::ServiceManagerListenerPtr listener;
+    mojo::PendingRemote<service_manager::mojom::ServiceManagerListener>
+        listener;
     service_observer_ = std::make_unique<ServiceObserverMock>(
-        mojom::kServiceName, mojo::MakeRequest(&listener));
+        mojom::kServiceName, listener.InitWithNewPipeAndPassReceiver());
 
     base::RunLoop wait_loop;
     EXPECT_CALL(*service_observer_, Initialized())
diff --git a/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java b/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
index 5f3696c..860a9da 100644
--- a/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
+++ b/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
@@ -24,14 +24,14 @@
 import org.chromium.base.Callback;
 import org.chromium.base.ContextUtils;
 import org.chromium.base.Log;
+import org.chromium.device.mojom.NdefError;
+import org.chromium.device.mojom.NdefErrorType;
 import org.chromium.device.mojom.NdefMessage;
+import org.chromium.device.mojom.NdefPushOptions;
+import org.chromium.device.mojom.NdefPushTarget;
+import org.chromium.device.mojom.NdefScanOptions;
 import org.chromium.device.mojom.Nfc;
 import org.chromium.device.mojom.NfcClient;
-import org.chromium.device.mojom.NfcError;
-import org.chromium.device.mojom.NfcErrorType;
-import org.chromium.device.mojom.NfcPushOptions;
-import org.chromium.device.mojom.NfcPushTarget;
-import org.chromium.device.mojom.NfcScanOptions;
 import org.chromium.mojo.bindings.Callbacks;
 import org.chromium.mojo.system.MojoException;
 
@@ -80,7 +80,7 @@
 
     /**
      * Object that contains data that was passed to method
-     * #push(NdefMessage message, NfcPushOptions options, PushResponse callback)
+     * #push(NdefMessage message, NdefPushOptions options, PushResponse callback)
      * @see PendingPushOperation
      */
     private PendingPushOperation mPendingPushOperation;
@@ -103,12 +103,12 @@
     private int mWatcherId;
 
     /**
-     * Map of watchId <-> NfcScanOptions. All NfcScanOptions are matched against tag that is in
+     * Map of watchId <-> NdefScanOptions. All NdefScanOptions are matched against tag that is in
      * proximity, when match algorithm (@see #matchesWatchOptions) returns true, watcher with
      * corresponding ID would be notified using NfcClient interface.
      * @see NfcClient#onWatch(int[] id, String serial_number, NdefMessage message)
      */
-    private final SparseArray<NfcScanOptions> mWatchers = new SparseArray<>();
+    private final SparseArray<NdefScanOptions> mWatchers = new SparseArray<>();
 
     /**
      * Handler that runs delayed push timeout task.
@@ -171,8 +171,8 @@
 
     /**
      * Sets NfcClient. NfcClient interface is used to notify mojo NFC service client when NFC
-     * device is in proximity and has NdefMessage that matches NfcScanOptions criteria.
-     * @see Nfc#watch(NfcScanOptions options, int id, WatchResponse callback)
+     * device is in proximity and has NdefMessage that matches NdefScanOptions criteria.
+     * @see Nfc#watch(NdefScanOptions options, int id, WatchResponse callback)
      *
      * @param client @see NfcClient
      */
@@ -183,31 +183,31 @@
 
     /**
      * Pushes NdefMessage to Tag or Peer, whenever NFC device is in proximity. At the moment, only
-     * passive NFC devices are supported (NfcPushTarget.TAG).
+     * passive NFC devices are supported (NdefPushTarget.TAG).
      *
      * @param message that should be pushed to NFC device.
      * @param options that contain information about timeout and target device type.
      * @param callback that is used to notify when push operation is completed.
      */
     @Override
-    public void push(NdefMessage message, NfcPushOptions options, PushResponse callback) {
+    public void push(NdefMessage message, NdefPushOptions options, PushResponse callback) {
         if (!checkIfReady(callback)) return;
 
         if (!NdefMessageValidator.isValid(message)) {
-            callback.call(createError(NfcErrorType.INVALID_MESSAGE));
+            callback.call(createError(NdefErrorType.INVALID_MESSAGE));
             return;
         }
 
-        // Check NfcPushOptions that are not supported by Android platform.
-        if (options.target == NfcPushTarget.PEER || options.timeout < 0
+        // Check NdefPushOptions that are not supported by Android platform.
+        if (options.target == NdefPushTarget.PEER || options.timeout < 0
                 || (options.timeout > Long.MAX_VALUE && !Double.isInfinite(options.timeout))) {
-            callback.call(createError(NfcErrorType.NOT_SUPPORTED));
+            callback.call(createError(NdefErrorType.NOT_SUPPORTED));
             return;
         }
 
         // If previous pending push operation is not completed, cancel it.
         if (mPendingPushOperation != null) {
-            mPendingPushOperation.complete(createError(NfcErrorType.OPERATION_CANCELLED));
+            mPendingPushOperation.complete(createError(NdefErrorType.OPERATION_CANCELLED));
             cancelPushTimeoutTask();
         }
 
@@ -221,45 +221,45 @@
 
     /**
      * Cancels pending push operation.
-     * At the moment, only passive NFC devices are supported (NfcPushTarget.TAG).
+     * At the moment, only passive NFC devices are supported (NdefPushTarget.TAG).
      *
-     * @param target @see NfcPushTarget
+     * @param target @see NdefPushTarget
      * @param callback that is used to notify caller when cancelPush() is completed.
      */
     @Override
     public void cancelPush(int target, CancelPushResponse callback) {
         if (!checkIfReady(callback)) return;
 
-        if (target == NfcPushTarget.PEER) {
-            callback.call(createError(NfcErrorType.NOT_SUPPORTED));
+        if (target == NdefPushTarget.PEER) {
+            callback.call(createError(NdefErrorType.NOT_SUPPORTED));
             return;
         }
 
         if (mPendingPushOperation == null) {
-            callback.call(createError(NfcErrorType.CANNOT_CANCEL));
+            callback.call(createError(NdefErrorType.CANNOT_CANCEL));
         } else {
-            completePendingPushOperation(createError(NfcErrorType.OPERATION_CANCELLED));
+            completePendingPushOperation(createError(NdefErrorType.OPERATION_CANCELLED));
             callback.call(null);
         }
     }
 
     /**
      * Watch method allows to set filtering criteria for NdefMessages that are found when NFC device
-     * is within proximity. When NdefMessage that matches NfcScanOptions is found, it is passed to
+     * is within proximity. When NdefMessage that matches NdefScanOptions is found, it is passed to
      * NfcClient interface together with corresponding watch ID.
      * @see NfcClient#onWatch(int[] id, String serial_number, NdefMessage message)
      *
-     * @param options used to filter NdefMessages, @see NfcScanOptions.
+     * @param options used to filter NdefMessages, @see NdefScanOptions.
      * @param callback that is used to notify caller when watch() is completed.
      */
     @Override
-    public void watch(NfcScanOptions options, int id, WatchResponse callback) {
+    public void watch(NdefScanOptions options, int id, WatchResponse callback) {
         if (!checkIfReady(callback)) return;
         // We received a duplicate |id| here that should never happen, in such a case we should
         // report a bad message to Mojo but unfortunately Mojo bindings for Java does not support
         // this feature yet. So, we just passes back a generic error instead.
         if (mWatchers.indexOfKey(id) >= 0) {
-            callback.call(createError(NfcErrorType.NOT_READABLE));
+            callback.call(createError(NdefErrorType.NOT_READABLE));
             return;
         }
         mWatchers.put(id, options);
@@ -279,7 +279,7 @@
         if (!checkIfReady(callback)) return;
 
         if (mWatchers.indexOfKey(id) < 0) {
-            callback.call(createError(NfcErrorType.NOT_FOUND));
+            callback.call(createError(NdefErrorType.NOT_FOUND));
         } else {
             mWatchers.remove(id);
             callback.call(null);
@@ -297,7 +297,7 @@
         if (!checkIfReady(callback)) return;
 
         if (mWatchers.size() == 0) {
-            callback.call(createError(NfcErrorType.NOT_FOUND));
+            callback.call(createError(NdefErrorType.NOT_FOUND));
         } else {
             mWatchers.clear();
             callback.call(null);
@@ -338,13 +338,13 @@
      */
     private static class PendingPushOperation {
         public final NdefMessage ndefMessage;
-        public final NfcPushOptions nfcPushOptions;
+        public final NdefPushOptions ndefPushOptions;
         private final PushResponse mPushResponseCallback;
 
         public PendingPushOperation(
-                NdefMessage message, NfcPushOptions options, PushResponse callback) {
+                NdefMessage message, NdefPushOptions options, PushResponse callback) {
             ndefMessage = message;
-            nfcPushOptions = options;
+            ndefPushOptions = options;
             mPushResponseCallback = callback;
         }
 
@@ -352,18 +352,18 @@
          * Completes pending push operation.
          *
          * @param error should be null when operation is completed successfully, otherwise,
-         * error object with corresponding NfcErrorType should be provided.
+         * error object with corresponding NdefErrorType should be provided.
          */
-        public void complete(NfcError error) {
+        public void complete(NdefError error) {
             if (mPushResponseCallback != null) mPushResponseCallback.call(error);
         }
     }
 
     /**
-     * Helper method that creates NfcError object from NfcErrorType.
+     * Helper method that creates NdefError object from NdefErrorType.
      */
-    private NfcError createError(int errorType) {
-        NfcError error = new NfcError();
+    private NdefError createError(int errorType) {
+        NdefError error = new NdefError();
         error.errorType = errorType;
         return error;
     }
@@ -372,25 +372,25 @@
      * Checks if NFC funcionality can be used by the mojo service. If permission to use NFC is
      * granted and hardware is enabled, returns null.
      */
-    private NfcError checkIfReady() {
+    private NdefError checkIfReady() {
         if (!mHasPermission || mActivity == null) {
-            return createError(NfcErrorType.NOT_ALLOWED);
+            return createError(NdefErrorType.NOT_ALLOWED);
         } else if (mNfcManager == null || mNfcAdapter == null) {
-            return createError(NfcErrorType.NOT_SUPPORTED);
+            return createError(NdefErrorType.NOT_SUPPORTED);
         } else if (!mNfcAdapter.isEnabled()) {
-            return createError(NfcErrorType.NOT_READABLE);
+            return createError(NdefErrorType.NOT_READABLE);
         }
         return null;
     }
 
     /**
-     * Uses checkIfReady() method and if NFC cannot be used, calls mojo callback with NfcError.
+     * Uses checkIfReady() method and if NFC cannot be used, calls mojo callback with NdefError.
      *
      * @param WatchResponse Callback that is provided to watch() method.
      * @return boolean true if NFC functionality can be used, false otherwise.
      */
     private boolean checkIfReady(WatchResponse callback) {
-        NfcError error = checkIfReady();
+        NdefError error = checkIfReady();
         if (error == null) return true;
 
         callback.call(error);
@@ -398,14 +398,14 @@
     }
 
     /**
-     * Uses checkIfReady() method and if NFC cannot be used, calls mojo callback with NfcError.
+     * Uses checkIfReady() method and if NFC cannot be used, calls mojo callback with NdefError.
      *
      * @param callback Generic callback that is provided to push(), cancelPush(),
      * cancelWatch() and cancelAllWatches() methods.
      * @return boolean true if NFC functionality can be used, false otherwise.
      */
-    private boolean checkIfReady(Callbacks.Callback1<NfcError> callback) {
-        NfcError error = checkIfReady();
+    private boolean checkIfReady(Callbacks.Callback1<NdefError> callback) {
+        NdefError error = checkIfReady();
         if (error == null) return true;
 
         callback.call(error);
@@ -483,7 +483,7 @@
      * Handles completion of pending push operation, cancels timeout task and completes push
      * operation. On error, invalidates #mTagHandler.
      */
-    private void pendingPushOperationCompleted(NfcError error) {
+    private void pendingPushOperationCompleted(NdefError error) {
         completePendingPushOperation(error);
         if (error != null) mTagHandler = null;
     }
@@ -491,7 +491,7 @@
     /**
      * Completes pending push operation and disables reader mode if needed.
      */
-    private void completePendingPushOperation(NfcError error) {
+    private void completePendingPushOperation(NdefError error) {
         if (mPendingPushOperation == null) return;
 
         cancelPushTimeoutTask();
@@ -518,13 +518,13 @@
             pendingPushOperationCompleted(null);
         } catch (InvalidNdefMessageException e) {
             Log.w(TAG, "Cannot write data to NFC tag. Invalid NdefMessage.");
-            pendingPushOperationCompleted(createError(NfcErrorType.INVALID_MESSAGE));
+            pendingPushOperationCompleted(createError(NdefErrorType.INVALID_MESSAGE));
         } catch (TagLostException e) {
             Log.w(TAG, "Cannot write data to NFC tag. Tag is lost.");
-            pendingPushOperationCompleted(createError(NfcErrorType.IO_ERROR));
+            pendingPushOperationCompleted(createError(NdefErrorType.IO_ERROR));
         } catch (FormatException | IllegalStateException | IOException e) {
             Log.w(TAG, "Cannot write data to NFC tag. IO_ERROR.");
-            pendingPushOperationCompleted(createError(NfcErrorType.IO_ERROR));
+            pendingPushOperationCompleted(createError(NdefErrorType.IO_ERROR));
         }
     }
 
@@ -535,7 +535,7 @@
         if (mTagHandler == null || mClient == null || mWatchers.size() == 0) return;
 
         // Skip reading if there is a pending push operation and ignoreRead flag is set.
-        if (mPendingPushOperation != null && mPendingPushOperation.nfcPushOptions.ignoreRead) {
+        if (mPendingPushOperation != null && mPendingPushOperation.ndefPushOptions.ignoreRead) {
             return;
         }
 
@@ -566,7 +566,7 @@
     }
 
     /**
-     * Iterates through active watchers and if any of those match NfcScanOptions criteria,
+     * Iterates through active watchers and if any of those match NdefScanOptions criteria,
      * delivers NdefMessage to the client.
      */
     private void notifyMatchingWatchers(android.nfc.NdefMessage message) {
@@ -574,7 +574,7 @@
             NdefMessage ndefMessage = NdefMessageUtils.toNdefMessage(message);
             List<Integer> watchIds = new ArrayList<Integer>();
             for (int i = 0; i < mWatchers.size(); i++) {
-                NfcScanOptions options = mWatchers.valueAt(i);
+                NdefScanOptions options = mWatchers.valueAt(i);
                 if (matchesWatchOptions(ndefMessage, options)) {
                     watchIds.add(mWatchers.keyAt(i));
                 }
@@ -595,7 +595,7 @@
     /**
      * Implements matching algorithm.
      */
-    private boolean matchesWatchOptions(NdefMessage message, NfcScanOptions options) {
+    private boolean matchesWatchOptions(NdefMessage message, NdefScanOptions options) {
         // Filter by WebNfc watch Id.
         if (!matchesWebNfcId(message.url, options.url)) return false;
 
@@ -685,7 +685,7 @@
     /**
      * Schedules task that is executed after timeout and cancels pending push operation.
      */
-    private void schedulePushTimeoutTask(NfcPushOptions options) {
+    private void schedulePushTimeoutTask(NdefPushOptions options) {
         assert mPushTimeoutRunnable == null;
         // Default timeout value.
         if (Double.isInfinite(options.timeout)) return;
@@ -694,7 +694,7 @@
         mPushTimeoutRunnable = new Runnable() {
             @Override
             public void run() {
-                completePendingPushOperation(createError(NfcErrorType.TIMER_EXPIRED));
+                completePendingPushOperation(createError(NdefErrorType.TIMER_EXPIRED));
             }
         };
 
diff --git a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
index 9d359c6..949d650 100644
--- a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
+++ b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
@@ -42,20 +42,20 @@
 import org.chromium.base.Callback;
 import org.chromium.base.ContextUtils;
 import org.chromium.base.test.util.Feature;
+import org.chromium.device.mojom.NdefError;
+import org.chromium.device.mojom.NdefErrorType;
 import org.chromium.device.mojom.NdefMessage;
+import org.chromium.device.mojom.NdefPushOptions;
+import org.chromium.device.mojom.NdefPushTarget;
 import org.chromium.device.mojom.NdefRecord;
 import org.chromium.device.mojom.NdefRecordTypeFilter;
+import org.chromium.device.mojom.NdefScanOptions;
 import org.chromium.device.mojom.Nfc.CancelAllWatchesResponse;
 import org.chromium.device.mojom.Nfc.CancelPushResponse;
 import org.chromium.device.mojom.Nfc.CancelWatchResponse;
 import org.chromium.device.mojom.Nfc.PushResponse;
 import org.chromium.device.mojom.Nfc.WatchResponse;
 import org.chromium.device.mojom.NfcClient;
-import org.chromium.device.mojom.NfcError;
-import org.chromium.device.mojom.NfcErrorType;
-import org.chromium.device.mojom.NfcPushOptions;
-import org.chromium.device.mojom.NfcPushTarget;
-import org.chromium.device.mojom.NfcScanOptions;
 import org.chromium.testing.local.LocalRobolectricTestRunner;
 
 import java.io.IOException;
@@ -82,7 +82,7 @@
     @Mock
     private NfcTagHandler mNfcTagHandler;
     @Captor
-    private ArgumentCaptor<NfcError> mErrorCaptor;
+    private ArgumentCaptor<NdefError> mErrorCaptor;
     @Captor
     private ArgumentCaptor<int[]> mOnWatchCallbackCaptor;
 
@@ -174,7 +174,7 @@
         CancelAllWatchesResponse mockCallback = mock(CancelAllWatchesResponse.class);
         nfc.cancelAllWatches(mockCallback);
         verify(mockCallback).call(mErrorCaptor.capture());
-        assertEquals(NfcErrorType.NOT_SUPPORTED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.NOT_SUPPORTED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -190,7 +190,7 @@
         CancelAllWatchesResponse mockCallback = mock(CancelAllWatchesResponse.class);
         nfc.cancelAllWatches(mockCallback);
         verify(mockCallback).call(mErrorCaptor.capture());
-        assertEquals(NfcErrorType.NOT_ALLOWED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.NOT_ALLOWED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -202,7 +202,7 @@
         TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
         mDelegate.invokeCallback();
         WatchResponse mockCallback = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId, mockCallback);
+        nfc.watch(createNdefScanOptions(), mNextWatchId, mockCallback);
         verify(mockCallback).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
     }
@@ -423,10 +423,10 @@
         TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
         mDelegate.invokeCallback();
         PushResponse mockCallback = mock(PushResponse.class);
-        nfc.push(new NdefMessage(), createNfcPushOptions(), mockCallback);
+        nfc.push(new NdefMessage(), createNdefPushOptions(), mockCallback);
         nfc.processPendingOperationsForTesting(mNfcTagHandler);
         verify(mockCallback).call(mErrorCaptor.capture());
-        assertEquals(NfcErrorType.INVALID_MESSAGE, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.INVALID_MESSAGE, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -443,7 +443,7 @@
         mDelegate.invokeCallback();
         nfc.setClient(mNfcClient);
         WatchResponse mockCallback = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId, mockCallback);
+        nfc.watch(createNdefScanOptions(), mNextWatchId, mockCallback);
         nfc.suspendNfcOperations();
         verify(mNfcAdapter, times(1)).disableReaderMode(mActivity);
         nfc.resumeNfcOperations();
@@ -473,7 +473,7 @@
         TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
         mDelegate.invokeCallback();
         PushResponse mockCallback = mock(PushResponse.class);
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(), mockCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(), mockCallback);
         nfc.processPendingOperationsForTesting(mNfcTagHandler);
         verify(mockCallback).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
@@ -489,12 +489,12 @@
         mDelegate.invokeCallback();
         PushResponse mockPushCallback = mock(PushResponse.class);
         CancelPushResponse mockCancelPushCallback = mock(CancelPushResponse.class);
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(), mockPushCallback);
-        nfc.cancelPush(NfcPushTarget.ANY, mockCancelPushCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(), mockPushCallback);
+        nfc.cancelPush(NdefPushTarget.ANY, mockCancelPushCallback);
 
         // Check that push request was cancelled with OPERATION_CANCELLED.
         verify(mockPushCallback).call(mErrorCaptor.capture());
-        assertEquals(NfcErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
 
         // Check that cancel request was successfuly completed.
         verify(mockCancelPushCallback).call(mErrorCaptor.capture());
@@ -512,7 +512,7 @@
         nfc.setClient(mNfcClient);
         int watchId1 = mNextWatchId++;
         WatchResponse mockWatchCallback1 = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), watchId1, mockWatchCallback1);
+        nfc.watch(createNdefScanOptions(), watchId1, mockWatchCallback1);
 
         // Check that watch requests were completed successfully.
         verify(mockWatchCallback1).call(mErrorCaptor.capture());
@@ -520,7 +520,7 @@
 
         int watchId2 = mNextWatchId++;
         WatchResponse mockWatchCallback2 = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), watchId2, mockWatchCallback2);
+        nfc.watch(createNdefScanOptions(), watchId2, mockWatchCallback2);
         verify(mockWatchCallback2).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
 
@@ -546,7 +546,7 @@
         nfc.setClient(mNfcClient);
 
         // Should match by WebNFC Id (exact match).
-        NfcScanOptions options1 = createNfcScanOptions();
+        NdefScanOptions options1 = createNdefScanOptions();
         options1.url = TEST_URL;
         int watchId1 = mNextWatchId++;
         WatchResponse mockWatchCallback1 = mock(WatchResponse.class);
@@ -555,7 +555,7 @@
         assertNull(mErrorCaptor.getValue());
 
         // Should match by media type.
-        NfcScanOptions options2 = createNfcScanOptions();
+        NdefScanOptions options2 = createNdefScanOptions();
         options2.mediaType = TEXT_MIME;
         int watchId2 = mNextWatchId++;
         WatchResponse mockWatchCallback2 = mock(WatchResponse.class);
@@ -564,7 +564,7 @@
         assertNull(mErrorCaptor.getValue());
 
         // Should match by record type.
-        NfcScanOptions options3 = createNfcScanOptions();
+        NdefScanOptions options3 = createNdefScanOptions();
         NdefRecordTypeFilter typeFilter = new NdefRecordTypeFilter();
         typeFilter.recordType = NdefMessageUtils.RECORD_TYPE_URL;
         options3.recordFilter = typeFilter;
@@ -575,7 +575,7 @@
         assertNull(mErrorCaptor.getValue());
 
         // Should not match
-        NfcScanOptions options4 = createNfcScanOptions();
+        NdefScanOptions options4 = createNdefScanOptions();
         options4.url = AUTHOR_RECORD_DOMAIN;
         int watchId4 = mNextWatchId++;
         WatchResponse mockWatchCallback4 = mock(WatchResponse.class);
@@ -604,7 +604,7 @@
         TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
         mDelegate.invokeCallback();
         WatchResponse mockWatchCallback = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId, mockWatchCallback);
+        nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback);
 
         verify(mockWatchCallback).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
@@ -632,11 +632,11 @@
         mDelegate.invokeCallback();
         WatchResponse mockWatchCallback1 = mock(WatchResponse.class);
         WatchResponse mockWatchCallback2 = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId++, mockWatchCallback1);
+        nfc.watch(createNdefScanOptions(), mNextWatchId++, mockWatchCallback1);
         verify(mockWatchCallback1).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
 
-        nfc.watch(createNfcScanOptions(), mNextWatchId++, mockWatchCallback2);
+        nfc.watch(createNdefScanOptions(), mNextWatchId++, mockWatchCallback2);
         verify(mockWatchCallback2).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
 
@@ -657,7 +657,7 @@
         TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
         mDelegate.invokeCallback();
         WatchResponse mockWatchCallback = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId, mockWatchCallback);
+        nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback);
 
         verify(mockWatchCallback).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
@@ -666,7 +666,7 @@
         nfc.cancelWatch(mNextWatchId + 1, mockCancelWatchCallback);
 
         verify(mockCancelWatchCallback).call(mErrorCaptor.capture());
-        assertEquals(NfcErrorType.NOT_FOUND, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.NOT_FOUND, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -682,7 +682,7 @@
         nfc.cancelAllWatches(mockCallback);
 
         verify(mockCallback).call(mErrorCaptor.capture());
-        assertEquals(NfcErrorType.NOT_FOUND, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.NOT_FOUND, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -695,7 +695,7 @@
         mDelegate.invokeCallback();
         nfc.setClient(mNfcClient);
         WatchResponse mockWatchCallback = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId, mockWatchCallback);
+        nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback);
 
         // Force read operation to fail
         doThrow(IllegalStateException.class).when(mNfcTagHandler).read();
@@ -723,13 +723,13 @@
         doThrow(IllegalStateException.class)
                 .when(mNfcTagHandler)
                 .write(any(android.nfc.NdefMessage.class));
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(), mockCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(), mockCallback);
         nfc.processPendingOperationsForTesting(mNfcTagHandler);
         verify(mockCallback).call(mErrorCaptor.capture());
 
         // Test that correct error is returned.
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.IO_ERROR, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.IO_ERROR, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -743,7 +743,7 @@
         PushResponse mockCallback = mock(PushResponse.class);
 
         // Set 1 millisecond timeout.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(1), mockCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(1), mockCallback);
 
         // Wait for timeout.
         ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
@@ -751,7 +751,7 @@
         // Test that correct error is returned.
         verify(mockCallback).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -765,8 +765,8 @@
 
         PushResponse mockCallback1 = mock(PushResponse.class);
         PushResponse mockCallback2 = mock(PushResponse.class);
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(), mockCallback1);
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(), mockCallback2);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(), mockCallback1);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(), mockCallback2);
 
         verify(mNfcAdapter, times(1))
                 .enableReaderMode(any(Activity.class), any(ReaderCallback.class), anyInt(),
@@ -775,7 +775,7 @@
 
         verify(mockCallback1).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -789,7 +789,7 @@
         PushResponse mockCallback = mock(PushResponse.class);
 
         // Set 1 millisecond timeout.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(1), mockCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(1), mockCallback);
 
         verify(mNfcAdapter, times(1))
                 .enableReaderMode(any(Activity.class), any(ReaderCallback.class), anyInt(),
@@ -804,7 +804,7 @@
         // Test that correct error is returned.
         verify(mockCallback).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -820,23 +820,23 @@
         PushResponse mockCallback1 = mock(PushResponse.class);
 
         // First push without timeout, must be completed with OPERATION_CANCELLED.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(), mockCallback1);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(), mockCallback1);
 
         PushResponse mockCallback2 = mock(PushResponse.class);
 
         // Second push with 1 millisecond timeout, should be cancelled before timer expires,
         // thus, operation must be completed with OPERATION_CANCELLED.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(1), mockCallback2);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(1), mockCallback2);
 
         verify(mNfcAdapter, times(1))
                 .enableReaderMode(any(Activity.class), any(ReaderCallback.class), anyInt(),
                         (Bundle) isNull());
         verify(mockCallback1).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
 
         CancelPushResponse mockCancelPushCallback = mock(CancelPushResponse.class);
-        nfc.cancelPush(NfcPushTarget.ANY, mockCancelPushCallback);
+        nfc.cancelPush(NdefPushTarget.ANY, mockCancelPushCallback);
 
         // Reader mode is disabled after cancelPush is invoked.
         verify(mNfcAdapter, times(1)).disableReaderMode(mActivity);
@@ -850,7 +850,7 @@
         // Test that correct error is returned.
         verify(mockCallback2).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -866,12 +866,12 @@
         PushResponse mockCallback1 = mock(PushResponse.class);
 
         // First push without timeout, must be completed with OPERATION_CANCELLED.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(1), mockCallback1);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(1), mockCallback1);
 
         PushResponse mockCallback2 = mock(PushResponse.class);
 
         // Second push with 1 millisecond timeout, should be cancelled with TIMER_EXPIRED.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(1), mockCallback2);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(1), mockCallback2);
 
         verify(mNfcAdapter, times(1))
                 .enableReaderMode(any(Activity.class), any(ReaderCallback.class), anyInt(),
@@ -882,7 +882,7 @@
 
         verify(mockCallback1).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
 
         // Wait for delayed tasks to complete.
         ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
@@ -893,7 +893,7 @@
         // Test that correct error is returned for second push.
         verify(mockCallback2).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -906,11 +906,11 @@
         TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
         mDelegate.invokeCallback();
         WatchResponse mockWatchCallback = mock(WatchResponse.class);
-        nfc.watch(createNfcScanOptions(), mNextWatchId, mockWatchCallback);
+        nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback);
 
         PushResponse mockPushCallback = mock(PushResponse.class);
         // Should be cancelled with TIMER_EXPIRED.
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(1), mockPushCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(1), mockPushCallback);
 
         verify(mNfcAdapter, times(1))
                 .enableReaderMode(any(Activity.class), any(ReaderCallback.class), anyInt(),
@@ -922,7 +922,7 @@
         // Push was cancelled with TIMER_EXPIRED.
         verify(mockPushCallback).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.TIMER_EXPIRED, mErrorCaptor.getValue().errorType);
 
         verify(mNfcAdapter, times(0)).disableReaderMode(mActivity);
 
@@ -948,19 +948,19 @@
         PushResponse mockCallback = mock(PushResponse.class);
 
         // Long overflow
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(Long.MAX_VALUE + 1), mockCallback);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(Long.MAX_VALUE + 1), mockCallback);
 
         verify(mockCallback).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.NOT_SUPPORTED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.NOT_SUPPORTED, mErrorCaptor.getValue().errorType);
 
         // Test negative timeout
         PushResponse mockCallback2 = mock(PushResponse.class);
-        nfc.push(createMojoNdefMessage(), createNfcPushOptions(-1), mockCallback2);
+        nfc.push(createMojoNdefMessage(), createNdefPushOptions(-1), mockCallback2);
 
         verify(mockCallback2).call(mErrorCaptor.capture());
         assertNotNull(mErrorCaptor.getValue());
-        assertEquals(NfcErrorType.NOT_SUPPORTED, mErrorCaptor.getValue().errorType);
+        assertEquals(NdefErrorType.NOT_SUPPORTED, mErrorCaptor.getValue().errorType);
     }
 
     /**
@@ -976,7 +976,7 @@
         // Should match.
         int watchId1 = mNextWatchId++;
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "https://test.com/*";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, watchId1, mockWatchCallback);
@@ -987,7 +987,7 @@
         // Should match.
         int watchId2 = mNextWatchId++;
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "https://test.com/contact/42";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, watchId2, mockWatchCallback);
@@ -998,7 +998,7 @@
         // Should match.
         int watchId3 = mNextWatchId++;
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "https://subdomain.test.com/*";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, watchId3, mockWatchCallback);
@@ -1009,7 +1009,7 @@
         // Should match.
         int watchId4 = mNextWatchId++;
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "https://subdomain.test.com/contact";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, watchId4, mockWatchCallback);
@@ -1019,7 +1019,7 @@
 
         // Should not match.
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "https://www.test.com/*";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, mNextWatchId++, mockWatchCallback);
@@ -1029,7 +1029,7 @@
 
         // Should not match.
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "http://test.com/*";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, mNextWatchId++, mockWatchCallback);
@@ -1039,7 +1039,7 @@
 
         // Should not match.
         {
-            NfcScanOptions options = createNfcScanOptions();
+            NdefScanOptions options = createNdefScanOptions();
             options.url = "invalid pattern url";
             WatchResponse mockWatchCallback = mock(WatchResponse.class);
             nfc.watch(options, mNextWatchId++, mockWatchCallback);
@@ -1078,7 +1078,7 @@
         nfc.setClient(mNfcClient);
 
         // Should not match when invalid WebNFC Id is received.
-        NfcScanOptions options = createNfcScanOptions();
+        NdefScanOptions options = createNdefScanOptions();
         options.url = "https://test.com/*";
         WatchResponse mockWatchCallback = mock(WatchResponse.class);
         nfc.watch(options, mNextWatchId, mockWatchCallback);
@@ -1118,32 +1118,32 @@
         emptyNdefRecord.recordType = NdefMessageUtils.RECORD_TYPE_EMPTY;
         NdefMessage ndefMessage = createMojoNdefMessage(TEST_URL, emptyNdefRecord);
 
-        nfc.push(ndefMessage, createNfcPushOptions(), mockCallback);
+        nfc.push(ndefMessage, createNdefPushOptions(), mockCallback);
         nfc.processPendingOperationsForTesting(mNfcTagHandler);
         verify(mockCallback).call(mErrorCaptor.capture());
         assertNull(mErrorCaptor.getValue());
     }
 
     /**
-     * Creates NfcPushOptions with default values.
+     * Creates NdefPushOptions with default values.
      */
-    private NfcPushOptions createNfcPushOptions() {
-        return createNfcPushOptions(/*timeout=*/Double.POSITIVE_INFINITY);
+    private NdefPushOptions createNdefPushOptions() {
+        return createNdefPushOptions(/*timeout=*/Double.POSITIVE_INFINITY);
     }
 
     /**
-     * Creates NfcPushOptions with specified timeout.
+     * Creates NdefPushOptions with specified timeout.
      */
-    private NfcPushOptions createNfcPushOptions(double timeout) {
-        NfcPushOptions pushOptions = new NfcPushOptions();
-        pushOptions.target = NfcPushTarget.ANY;
+    private NdefPushOptions createNdefPushOptions(double timeout) {
+        NdefPushOptions pushOptions = new NdefPushOptions();
+        pushOptions.target = NdefPushTarget.ANY;
         pushOptions.timeout = timeout;
         pushOptions.ignoreRead = false;
         return pushOptions;
     }
 
-    private NfcScanOptions createNfcScanOptions() {
-        NfcScanOptions options = new NfcScanOptions();
+    private NdefScanOptions createNdefScanOptions() {
+        NdefScanOptions options = new NdefScanOptions();
         options.url = "";
         options.mediaType = "";
         options.recordFilter = null;
diff --git a/services/device/public/mojom/nfc.mojom b/services/device/public/mojom/nfc.mojom
index a856866..fc9ed5d4 100644
--- a/services/device/public/mojom/nfc.mojom
+++ b/services/device/public/mojom/nfc.mojom
@@ -4,7 +4,7 @@
 
 module device.mojom;
 
-enum NFCErrorType {
+enum NDEFErrorType {
   // No permssion.
   NOT_ALLOWED,
   // No hardware support, no NFC adapter, the connection cannot be established,
@@ -21,7 +21,7 @@
   IO_ERROR
 };
 
-enum NFCPushTarget {
+enum NDEFPushTarget {
   // The target of a push operation must be the NFC tag.
   TAG,
   // The target of a push operation must be the NFC peer (device to device).
@@ -30,8 +30,8 @@
   ANY
 };
 
-struct NFCError {
-  NFCErrorType error_type;
+struct NDEFError {
+  NDEFErrorType error_type;
 };
 
 struct NDEFRecord {
@@ -51,16 +51,16 @@
 
   // The |url| field is an ASCII serialized origin, optionally followed by a URL
   // path. It represents Web NFC id, that can be used for matching Web NFC
-  // content with the filter specified by |url| field in NFCScanOptions.
+  // content with the filter specified by |url| field in NDEFScanOptions.
   string? url;
 
   // Maximum size of NFC message that can be sent over IPC is 32KB.
   const uint32 kMaxSize = 32768;
 };
 
-struct NFCPushOptions {
+struct NDEFPushOptions {
   // The target of the push operation.
-  NFCPushTarget target;
+  NDEFPushTarget target;
 
   // The timeout for the push operation, in milliseconds.
   double timeout;
@@ -74,7 +74,7 @@
   string? record_type;
 };
 
-struct NFCScanOptions {
+struct NDEFScanOptions {
   // Defines filtering constraint for NFC messages with specified |url|.
   string? url;
 
@@ -91,24 +91,24 @@
   SetClient(pending_remote<NFCClient> client);
 
   // Pushes data to NFC device.
-  // NFCPushOptions specify timeout and type of device where data should be
+  // NDEFPushOptions specify timeout and type of device where data should be
   // pushed. If timeout is defined and data is not pushed before timeout is
   // expired, callback with corresponding error is called.
-  Push(NDEFMessage message, NFCPushOptions? options) => (NFCError? error);
+  Push(NDEFMessage message, NDEFPushOptions? options) => (NDEFError? error);
 
   // Cancels pending push request.
-  CancelPush(NFCPushTarget target) => (NFCError? error);
+  CancelPush(NDEFPushTarget target) => (NDEFError? error);
 
   // Starts watching for nearby NFC devices with data that matches
-  // NFCScanOptions filtering criteria. |id| identifies each watch request on
+  // NDEFScanOptions filtering criteria. |id| identifies each watch request on
   // the current Mojo connection.
-  Watch(NFCScanOptions options, uint32 id) => (NFCError? error);
+  Watch(NDEFScanOptions options, uint32 id) => (NDEFError? error);
 
   // Cancels watch operation with provided id.
-  CancelWatch (uint32 id) => (NFCError? error);
+  CancelWatch (uint32 id) => (NDEFError? error);
 
   // Cancels all watch operations.
-  CancelAllWatches () => (NFCError? error);
+  CancelAllWatches () => (NDEFError? error);
 
   // Suspends all pending NFC operations. Could be used when web page
   // visibility or focus is lost.
diff --git a/services/service_manager/public/mojom/service_manager.mojom b/services/service_manager/public/mojom/service_manager.mojom
index e560e487..0ad380b 100644
--- a/services/service_manager/public/mojom/service_manager.mojom
+++ b/services/service_manager/public/mojom/service_manager.mojom
@@ -81,5 +81,5 @@
 
 interface ServiceManager {
   // The listener is removed when the |listener| pipe is closed.
-  AddListener(ServiceManagerListener listener);
+  AddListener(pending_remote<ServiceManagerListener> listener);
 };
diff --git a/services/service_manager/service_instance.cc b/services/service_manager/service_instance.cc
index e4d580f..934bc54 100644
--- a/services/service_manager/service_instance.cc
+++ b/services/service_manager/service_instance.cc
@@ -588,7 +588,8 @@
   OnServiceDisconnected();
 }
 
-void ServiceInstance::AddListener(mojom::ServiceManagerListenerPtr listener) {
+void ServiceInstance::AddListener(
+    mojo::PendingRemote<mojom::ServiceManagerListener> listener) {
   service_manager_->AddListener(std::move(listener));
 }
 
diff --git a/services/service_manager/service_instance.h b/services/service_manager/service_instance.h
index d71e497..a061083 100644
--- a/services/service_manager/service_instance.h
+++ b/services/service_manager/service_instance.h
@@ -152,7 +152,8 @@
   void RequestQuit() override;
 
   // mojom::ServiceManager:
-  void AddListener(mojom::ServiceManagerListenerPtr listener) override;
+  void AddListener(
+      mojo::PendingRemote<mojom::ServiceManagerListener> listener) override;
 
   // Always owns |this|.
   service_manager::ServiceManager* const service_manager_;
diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc
index 8d872cc..53ac49a 100644
--- a/services/service_manager/service_manager.cc
+++ b/services/service_manager/service_manager.cc
@@ -401,9 +401,10 @@
 }
 
 void ServiceManager::OnInstanceStopped(const Identity& identity) {
-  listeners_.ForAllPtrs([&identity](mojom::ServiceManagerListener* listener) {
+  for (auto& listener : listeners_) {
     listener->OnServiceStopped(identity);
-  });
+  }
+
   if (!instance_quit_callback_.is_null())
     std::move(instance_quit_callback_).Run(identity);
 }
@@ -416,31 +417,29 @@
 
 void ServiceManager::NotifyServiceCreated(const ServiceInstance& instance) {
   mojom::RunningServiceInfoPtr info = instance.CreateRunningServiceInfo();
-  listeners_.ForAllPtrs([&info](mojom::ServiceManagerListener* listener) {
+  for (auto& listener : listeners_) {
     listener->OnServiceCreated(info.Clone());
-  });
+  }
 }
 
 void ServiceManager::NotifyServiceStarted(const Identity& identity,
                                           base::ProcessId pid) {
-  listeners_.ForAllPtrs(
-      [&identity, pid](mojom::ServiceManagerListener* listener) {
-        listener->OnServiceStarted(identity, pid);
-      });
+  for (auto& listener : listeners_) {
+    listener->OnServiceStarted(identity, pid);
+  }
 }
 
 void ServiceManager::NotifyServiceFailedToStart(const Identity& identity) {
-  listeners_.ForAllPtrs([&identity](mojom::ServiceManagerListener* listener) {
+  for (auto& listener : listeners_) {
     listener->OnServiceFailedToStart(identity);
-  });
+  }
 }
 
 void ServiceManager::NotifyServicePIDReceived(const Identity& identity,
                                               base::ProcessId pid) {
-  listeners_.ForAllPtrs(
-      [&identity, pid](mojom::ServiceManagerListener* listener) {
-        listener->OnServicePIDReceived(identity, pid);
-      });
+  for (auto& listener : listeners_) {
+    listener->OnServicePIDReceived(identity, pid);
+  }
 }
 
 ServiceInstance* ServiceManager::CreateServiceInstance(
@@ -461,13 +460,16 @@
   return raw_instance;
 }
 
-void ServiceManager::AddListener(mojom::ServiceManagerListenerPtr listener) {
+void ServiceManager::AddListener(
+    mojo::PendingRemote<mojom::ServiceManagerListener> listener) {
   std::vector<mojom::RunningServiceInfoPtr> infos;
   for (auto& instance : instances_)
     infos.push_back(instance->CreateRunningServiceInfo());
 
-  listener->OnInit(std::move(infos));
-  listeners_.AddPtr(std::move(listener));
+  mojo::Remote<mojom::ServiceManagerListener> listener_remote;
+  listener_remote.Bind(std::move(listener));
+  listener_remote->OnInit(std::move(infos));
+  listeners_.Add(std::move(listener_remote));
 }
 
 void ServiceManager::OnBindInterface(
diff --git a/services/service_manager/service_manager.h b/services/service_manager/service_manager.h
index ec1ab1b..4b456be 100644
--- a/services/service_manager/service_manager.h
+++ b/services/service_manager/service_manager.h
@@ -18,6 +18,7 @@
 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/remote_set.h"
 #include "services/service_manager/catalog.h"
 #include "services/service_manager/public/cpp/identity.h"
 #include "services/service_manager/public/cpp/manifest.h"
@@ -184,7 +185,7 @@
                                          const Manifest& manifest);
 
   // Called from the instance implementing mojom::ServiceManager.
-  void AddListener(mojom::ServiceManagerListenerPtr listener);
+  void AddListener(mojo::PendingRemote<mojom::ServiceManagerListener> listener);
 
   // Service:
   void OnBindInterface(const BindSourceInfo& source_info,
@@ -210,7 +211,7 @@
   // ServiceInstance still has an entry in |instances_|.
   ServiceInstance* service_manager_instance_;
 
-  mojo::InterfacePtrSet<mojom::ServiceManagerListener> listeners_;
+  mojo::RemoteSet<mojom::ServiceManagerListener> listeners_;
   base::OnceCallback<void(const Identity&)> instance_quit_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(ServiceManager);
diff --git a/services/service_manager/tests/lifecycle/lifecycle_unittest.cc b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
index b006fd6..18fd941 100644
--- a/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
+++ b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
@@ -246,10 +246,10 @@
     mojom::ServiceManagerPtr service_manager;
     connector()->BindInterface(service_manager::mojom::kServiceName,
                                &service_manager);
-    mojom::ServiceManagerListenerPtr listener;
+    mojo::PendingRemote<mojom::ServiceManagerListener> listener;
     base::RunLoop loop;
-    InstanceState* state =
-        new InstanceState(MakeRequest(&listener), loop.QuitClosure());
+    InstanceState* state = new InstanceState(
+        listener.InitWithNewPipeAndPassReceiver(), loop.QuitClosure());
     service_manager->AddListener(std::move(listener));
     loop.Run();
     return base::WrapUnique(state);
diff --git a/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc b/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc
index d189e44..72e8776 100644
--- a/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc
+++ b/services/service_manager/tests/service_manager/service_manager_listener_unittest.cc
@@ -117,9 +117,9 @@
     mojom::ServiceManagerPtr service_manager;
     connector()->BindInterface(mojom::kServiceName, &service_manager);
 
-    mojom::ServiceManagerListenerPtr listener_proxy;
-    listener_ =
-        std::make_unique<TestListener>(mojo::MakeRequest(&listener_proxy));
+    mojo::PendingRemote<mojom::ServiceManagerListener> listener_proxy;
+    listener_ = std::make_unique<TestListener>(
+        listener_proxy.InitWithNewPipeAndPassReceiver());
     service_manager->AddListener(std::move(listener_proxy));
     listener_->WaitForInit();
   }
diff --git a/services/service_manager/tests/service_manager/service_manager_unittest.cc b/services/service_manager/tests/service_manager/service_manager_unittest.cc
index ae0c283..f9dd311 100644
--- a/services/service_manager/tests/service_manager/service_manager_unittest.cc
+++ b/services/service_manager/tests/service_manager/service_manager_unittest.cc
@@ -173,8 +173,8 @@
     connector()->BindInterface(service_manager::mojom::kServiceName,
                                &service_manager);
 
-    mojom::ServiceManagerListenerPtr listener;
-    binding_.Bind(mojo::MakeRequest(&listener));
+    mojo::PendingRemote<mojom::ServiceManagerListener> listener;
+    binding_.Bind(listener.InitWithNewPipeAndPassReceiver());
     service_manager->AddListener(std::move(listener));
 
     wait_for_instances_loop_ = std::make_unique<base::RunLoop>();
diff --git a/services/tracing/tracing_service.cc b/services/tracing/tracing_service.cc
index c3428a7..a4e23dd 100644
--- a/services/tracing/tracing_service.cc
+++ b/services/tracing/tracing_service.cc
@@ -11,7 +11,7 @@
 #include "base/bind.h"
 #include "base/stl_util.h"
 #include "base/timer/timer.h"
-#include "mojo/public/cpp/bindings/remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
 #include "services/service_manager/public/mojom/service_manager.mojom.h"
 #include "services/tracing/agent_registry.h"
 #include "services/tracing/coordinator.h"
@@ -34,14 +34,15 @@
       : connector_(connector),
         agent_registry_(agent_registry),
         coordinator_(coordinator) {
-    service_manager::mojom::ServiceManagerPtr service_manager;
-    connector_->BindInterface(service_manager::mojom::kServiceName,
-                              &service_manager);
-    service_manager::mojom::ServiceManagerListenerPtr listener;
-    service_manager::mojom::ServiceManagerListenerRequest request(
-        mojo::MakeRequest(&listener));
+    mojo::Remote<service_manager::mojom::ServiceManager> service_manager;
+    connector_->Connect(service_manager::mojom::kServiceName,
+                        service_manager.BindNewPipeAndPassReceiver());
+    mojo::PendingRemote<service_manager::mojom::ServiceManagerListener>
+        listener;
+    mojo::PendingReceiver<service_manager::mojom::ServiceManagerListener>
+        request(listener.InitWithNewPipeAndPassReceiver());
     service_manager->AddListener(std::move(listener));
-    binding_.Bind(std::move(request));
+    receiver_.Bind(std::move(request));
   }
 
   size_t CountServicesWithPID(uint32_t pid) {
@@ -158,7 +159,8 @@
     agent_registry_->BindAgentRegistryReceiver(std::move(registry_receiver));
   }
 
-  mojo::Binding<service_manager::mojom::ServiceManagerListener> binding_{this};
+  mojo::Receiver<service_manager::mojom::ServiceManagerListener> receiver_{
+      this};
   service_manager::Connector* const connector_;
   AgentRegistry* const agent_registry_;
   Coordinator* const coordinator_;
diff --git a/storage/browser/BUILD.gn b/storage/browser/BUILD.gn
index 59614d0..50c69a0 100644
--- a/storage/browser/BUILD.gn
+++ b/storage/browser/BUILD.gn
@@ -65,112 +65,112 @@
     "database/databases_table.h",
     "database/vfs_backend.cc",
     "database/vfs_backend.h",
-    "fileapi/async_file_util.h",
-    "fileapi/async_file_util_adapter.cc",
-    "fileapi/async_file_util_adapter.h",
-    "fileapi/copy_or_move_file_validator.h",
-    "fileapi/copy_or_move_operation_delegate.cc",
-    "fileapi/copy_or_move_operation_delegate.h",
-    "fileapi/dragged_file_util.cc",
-    "fileapi/dragged_file_util.h",
-    "fileapi/external_mount_points.cc",
-    "fileapi/external_mount_points.h",
-    "fileapi/file_observers.h",
-    "fileapi/file_permission_policy.h",
-    "fileapi/file_stream_reader.cc",
-    "fileapi/file_stream_reader.h",
-    "fileapi/file_stream_writer.h",
-    "fileapi/file_system_backend.h",
-    "fileapi/file_system_context.cc",
-    "fileapi/file_system_context.h",
-    "fileapi/file_system_file_stream_reader.cc",
-    "fileapi/file_system_file_stream_reader.h",
-    "fileapi/file_system_file_util.cc",
-    "fileapi/file_system_file_util.h",
-    "fileapi/file_system_operation.h",
-    "fileapi/file_system_operation_context.cc",
-    "fileapi/file_system_operation_context.h",
-    "fileapi/file_system_operation_impl.cc",
-    "fileapi/file_system_operation_impl.h",
-    "fileapi/file_system_operation_runner.cc",
-    "fileapi/file_system_operation_runner.h",
-    "fileapi/file_system_options.cc",
-    "fileapi/file_system_options.h",
-    "fileapi/file_system_quota_client.cc",
-    "fileapi/file_system_quota_client.h",
-    "fileapi/file_system_quota_util.h",
-    "fileapi/file_system_url.cc",
-    "fileapi/file_system_url.h",
-    "fileapi/file_system_usage_cache.cc",
-    "fileapi/file_system_usage_cache.h",
-    "fileapi/file_writer_delegate.cc",
-    "fileapi/file_writer_delegate.h",
-    "fileapi/isolated_context.cc",
-    "fileapi/isolated_context.h",
-    "fileapi/isolated_file_system_backend.cc",
-    "fileapi/isolated_file_system_backend.h",
-    "fileapi/local_file_stream_reader.cc",
-    "fileapi/local_file_stream_reader.h",
-    "fileapi/local_file_stream_writer.cc",
-    "fileapi/local_file_stream_writer.h",
-    "fileapi/local_file_util.cc",
-    "fileapi/local_file_util.h",
-    "fileapi/memory_file_stream_reader.cc",
-    "fileapi/memory_file_stream_reader.h",
-    "fileapi/memory_file_stream_writer.cc",
-    "fileapi/memory_file_stream_writer.h",
-    "fileapi/mount_points.cc",
-    "fileapi/mount_points.h",
-    "fileapi/native_file_util.cc",
-    "fileapi/native_file_util.h",
-    "fileapi/obfuscated_file_util.cc",
-    "fileapi/obfuscated_file_util.h",
-    "fileapi/obfuscated_file_util_delegate.h",
-    "fileapi/obfuscated_file_util_disk_delegate.cc",
-    "fileapi/obfuscated_file_util_disk_delegate.h",
-    "fileapi/obfuscated_file_util_memory_delegate.cc",
-    "fileapi/obfuscated_file_util_memory_delegate.h",
-    "fileapi/open_file_system_mode.h",
-    "fileapi/plugin_private_file_system_backend.cc",
-    "fileapi/plugin_private_file_system_backend.h",
-    "fileapi/quota/open_file_handle.cc",
-    "fileapi/quota/open_file_handle.h",
-    "fileapi/quota/open_file_handle_context.cc",
-    "fileapi/quota/open_file_handle_context.h",
-    "fileapi/quota/quota_backend_impl.cc",
-    "fileapi/quota/quota_backend_impl.h",
-    "fileapi/quota/quota_reservation.cc",
-    "fileapi/quota/quota_reservation.h",
-    "fileapi/quota/quota_reservation_buffer.cc",
-    "fileapi/quota/quota_reservation_buffer.h",
-    "fileapi/quota/quota_reservation_manager.cc",
-    "fileapi/quota/quota_reservation_manager.h",
-    "fileapi/recursive_operation_delegate.cc",
-    "fileapi/recursive_operation_delegate.h",
-    "fileapi/remove_operation_delegate.cc",
-    "fileapi/remove_operation_delegate.h",
-    "fileapi/sandbox_directory_database.cc",
-    "fileapi/sandbox_directory_database.h",
-    "fileapi/sandbox_file_stream_writer.cc",
-    "fileapi/sandbox_file_stream_writer.h",
-    "fileapi/sandbox_file_system_backend.cc",
-    "fileapi/sandbox_file_system_backend.h",
-    "fileapi/sandbox_file_system_backend_delegate.cc",
-    "fileapi/sandbox_file_system_backend_delegate.h",
-    "fileapi/sandbox_isolated_origin_database.cc",
-    "fileapi/sandbox_isolated_origin_database.h",
-    "fileapi/sandbox_origin_database.cc",
-    "fileapi/sandbox_origin_database.h",
-    "fileapi/sandbox_origin_database_interface.cc",
-    "fileapi/sandbox_origin_database_interface.h",
-    "fileapi/sandbox_prioritized_origin_database.cc",
-    "fileapi/sandbox_prioritized_origin_database.h",
-    "fileapi/sandbox_quota_observer.cc",
-    "fileapi/sandbox_quota_observer.h",
-    "fileapi/task_runner_bound_observer_list.h",
-    "fileapi/transient_file_util.cc",
-    "fileapi/transient_file_util.h",
-    "fileapi/watcher_manager.h",
+    "file_system/async_file_util.h",
+    "file_system/async_file_util_adapter.cc",
+    "file_system/async_file_util_adapter.h",
+    "file_system/copy_or_move_file_validator.h",
+    "file_system/copy_or_move_operation_delegate.cc",
+    "file_system/copy_or_move_operation_delegate.h",
+    "file_system/dragged_file_util.cc",
+    "file_system/dragged_file_util.h",
+    "file_system/external_mount_points.cc",
+    "file_system/external_mount_points.h",
+    "file_system/file_observers.h",
+    "file_system/file_permission_policy.h",
+    "file_system/file_stream_reader.cc",
+    "file_system/file_stream_reader.h",
+    "file_system/file_stream_writer.h",
+    "file_system/file_system_backend.h",
+    "file_system/file_system_context.cc",
+    "file_system/file_system_context.h",
+    "file_system/file_system_file_stream_reader.cc",
+    "file_system/file_system_file_stream_reader.h",
+    "file_system/file_system_file_util.cc",
+    "file_system/file_system_file_util.h",
+    "file_system/file_system_operation.h",
+    "file_system/file_system_operation_context.cc",
+    "file_system/file_system_operation_context.h",
+    "file_system/file_system_operation_impl.cc",
+    "file_system/file_system_operation_impl.h",
+    "file_system/file_system_operation_runner.cc",
+    "file_system/file_system_operation_runner.h",
+    "file_system/file_system_options.cc",
+    "file_system/file_system_options.h",
+    "file_system/file_system_quota_client.cc",
+    "file_system/file_system_quota_client.h",
+    "file_system/file_system_quota_util.h",
+    "file_system/file_system_url.cc",
+    "file_system/file_system_url.h",
+    "file_system/file_system_usage_cache.cc",
+    "file_system/file_system_usage_cache.h",
+    "file_system/file_writer_delegate.cc",
+    "file_system/file_writer_delegate.h",
+    "file_system/isolated_context.cc",
+    "file_system/isolated_context.h",
+    "file_system/isolated_file_system_backend.cc",
+    "file_system/isolated_file_system_backend.h",
+    "file_system/local_file_stream_reader.cc",
+    "file_system/local_file_stream_reader.h",
+    "file_system/local_file_stream_writer.cc",
+    "file_system/local_file_stream_writer.h",
+    "file_system/local_file_util.cc",
+    "file_system/local_file_util.h",
+    "file_system/memory_file_stream_reader.cc",
+    "file_system/memory_file_stream_reader.h",
+    "file_system/memory_file_stream_writer.cc",
+    "file_system/memory_file_stream_writer.h",
+    "file_system/mount_points.cc",
+    "file_system/mount_points.h",
+    "file_system/native_file_util.cc",
+    "file_system/native_file_util.h",
+    "file_system/obfuscated_file_util.cc",
+    "file_system/obfuscated_file_util.h",
+    "file_system/obfuscated_file_util_delegate.h",
+    "file_system/obfuscated_file_util_disk_delegate.cc",
+    "file_system/obfuscated_file_util_disk_delegate.h",
+    "file_system/obfuscated_file_util_memory_delegate.cc",
+    "file_system/obfuscated_file_util_memory_delegate.h",
+    "file_system/open_file_system_mode.h",
+    "file_system/plugin_private_file_system_backend.cc",
+    "file_system/plugin_private_file_system_backend.h",
+    "file_system/quota/open_file_handle.cc",
+    "file_system/quota/open_file_handle.h",
+    "file_system/quota/open_file_handle_context.cc",
+    "file_system/quota/open_file_handle_context.h",
+    "file_system/quota/quota_backend_impl.cc",
+    "file_system/quota/quota_backend_impl.h",
+    "file_system/quota/quota_reservation.cc",
+    "file_system/quota/quota_reservation.h",
+    "file_system/quota/quota_reservation_buffer.cc",
+    "file_system/quota/quota_reservation_buffer.h",
+    "file_system/quota/quota_reservation_manager.cc",
+    "file_system/quota/quota_reservation_manager.h",
+    "file_system/recursive_operation_delegate.cc",
+    "file_system/recursive_operation_delegate.h",
+    "file_system/remove_operation_delegate.cc",
+    "file_system/remove_operation_delegate.h",
+    "file_system/sandbox_directory_database.cc",
+    "file_system/sandbox_directory_database.h",
+    "file_system/sandbox_file_stream_writer.cc",
+    "file_system/sandbox_file_stream_writer.h",
+    "file_system/sandbox_file_system_backend.cc",
+    "file_system/sandbox_file_system_backend.h",
+    "file_system/sandbox_file_system_backend_delegate.cc",
+    "file_system/sandbox_file_system_backend_delegate.h",
+    "file_system/sandbox_isolated_origin_database.cc",
+    "file_system/sandbox_isolated_origin_database.h",
+    "file_system/sandbox_origin_database.cc",
+    "file_system/sandbox_origin_database.h",
+    "file_system/sandbox_origin_database_interface.cc",
+    "file_system/sandbox_origin_database_interface.h",
+    "file_system/sandbox_prioritized_origin_database.cc",
+    "file_system/sandbox_prioritized_origin_database.h",
+    "file_system/sandbox_quota_observer.cc",
+    "file_system/sandbox_quota_observer.h",
+    "file_system/task_runner_bound_observer_list.h",
+    "file_system/transient_file_util.cc",
+    "file_system/transient_file_util.h",
+    "file_system/watcher_manager.h",
     "quota/client_usage_tracker.cc",
     "quota/client_usage_tracker.h",
     "quota/padding_key.cc",
@@ -230,7 +230,7 @@
 
 executable("dump_file_system") {
   sources = [
-    "fileapi/dump_file_system.cc",
+    "file_system/dump_file_system.cc",
   ]
 
   deps = [
@@ -263,40 +263,40 @@
     "database/database_tracker_unittest.cc",
     "database/database_util_unittest.cc",
     "database/databases_table_unittest.cc",
-    "fileapi/copy_or_move_file_validator_unittest.cc",
-    "fileapi/copy_or_move_operation_delegate_unittest.cc",
-    "fileapi/dragged_file_util_unittest.cc",
-    "fileapi/external_mount_points_unittest.cc",
-    "fileapi/file_stream_test_utils.cc",
-    "fileapi/file_stream_test_utils.h",
-    "fileapi/file_system_context_unittest.cc",
-    "fileapi/file_system_file_stream_reader_unittest.cc",
-    "fileapi/file_system_operation_impl_unittest.cc",
-    "fileapi/file_system_operation_impl_write_unittest.cc",
-    "fileapi/file_system_quota_client_unittest.cc",
-    "fileapi/file_system_url_unittest.cc",
-    "fileapi/file_system_usage_cache_unittest.cc",
-    "fileapi/file_writer_delegate_unittest.cc",
-    "fileapi/isolated_context_unittest.cc",
-    "fileapi/local_file_stream_reader_unittest.cc",
-    "fileapi/local_file_stream_writer_unittest.cc",
-    "fileapi/local_file_util_unittest.cc",
-    "fileapi/memory_file_stream_reader_unittest.cc",
-    "fileapi/memory_file_stream_writer_unittest.cc",
-    "fileapi/native_file_util_unittest.cc",
-    "fileapi/obfuscated_file_util_memory_delegate_unittest.cc",
-    "fileapi/obfuscated_file_util_unittest.cc",
-    "fileapi/plugin_private_file_system_backend_unittest.cc",
-    "fileapi/quota/quota_backend_impl_unittest.cc",
-    "fileapi/quota/quota_reservation_manager_unittest.cc",
-    "fileapi/recursive_operation_delegate_unittest.cc",
-    "fileapi/sandbox_directory_database_unittest.cc",
-    "fileapi/sandbox_file_system_backend_delegate_unittest.cc",
-    "fileapi/sandbox_file_system_backend_unittest.cc",
-    "fileapi/sandbox_isolated_origin_database_unittest.cc",
-    "fileapi/sandbox_origin_database_unittest.cc",
-    "fileapi/sandbox_prioritized_origin_database_unittest.cc",
-    "fileapi/transient_file_util_unittest.cc",
+    "file_system/copy_or_move_file_validator_unittest.cc",
+    "file_system/copy_or_move_operation_delegate_unittest.cc",
+    "file_system/dragged_file_util_unittest.cc",
+    "file_system/external_mount_points_unittest.cc",
+    "file_system/file_stream_test_utils.cc",
+    "file_system/file_stream_test_utils.h",
+    "file_system/file_system_context_unittest.cc",
+    "file_system/file_system_file_stream_reader_unittest.cc",
+    "file_system/file_system_operation_impl_unittest.cc",
+    "file_system/file_system_operation_impl_write_unittest.cc",
+    "file_system/file_system_quota_client_unittest.cc",
+    "file_system/file_system_url_unittest.cc",
+    "file_system/file_system_usage_cache_unittest.cc",
+    "file_system/file_writer_delegate_unittest.cc",
+    "file_system/isolated_context_unittest.cc",
+    "file_system/local_file_stream_reader_unittest.cc",
+    "file_system/local_file_stream_writer_unittest.cc",
+    "file_system/local_file_util_unittest.cc",
+    "file_system/memory_file_stream_reader_unittest.cc",
+    "file_system/memory_file_stream_writer_unittest.cc",
+    "file_system/native_file_util_unittest.cc",
+    "file_system/obfuscated_file_util_memory_delegate_unittest.cc",
+    "file_system/obfuscated_file_util_unittest.cc",
+    "file_system/plugin_private_file_system_backend_unittest.cc",
+    "file_system/quota/quota_backend_impl_unittest.cc",
+    "file_system/quota/quota_reservation_manager_unittest.cc",
+    "file_system/recursive_operation_delegate_unittest.cc",
+    "file_system/sandbox_directory_database_unittest.cc",
+    "file_system/sandbox_file_system_backend_delegate_unittest.cc",
+    "file_system/sandbox_file_system_backend_unittest.cc",
+    "file_system/sandbox_isolated_origin_database_unittest.cc",
+    "file_system/sandbox_origin_database_unittest.cc",
+    "file_system/sandbox_prioritized_origin_database_unittest.cc",
+    "file_system/transient_file_util_unittest.cc",
     "quota/quota_database_unittest.cc",
     "quota/quota_manager_unittest.cc",
     "quota/quota_settings_unittest.cc",
@@ -333,8 +333,8 @@
     "test/fake_blob_data_handle.h",
     "test/fake_progress_client.cc",
     "test/fake_progress_client.h",
-    "test/fileapi_test_file_set.cc",
-    "test/fileapi_test_file_set.h",
+    "test/file_system_test_file_set.cc",
+    "test/file_system_test_file_set.h",
     "test/mock_blob_registry_delegate.cc",
     "test/mock_blob_registry_delegate.h",
     "test/mock_blob_util.cc",
diff --git a/storage/browser/blob/blob_data_builder.h b/storage/browser/blob/blob_data_builder.h
index 81b7da9..e717e1c 100644
--- a/storage/browser/blob/blob_data_builder.h
+++ b/storage/browser/blob/blob_data_builder.h
@@ -21,7 +21,7 @@
 #include "storage/browser/blob/blob_entry.h"
 #include "storage/browser/blob/shareable_blob_data_item.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace storage {
 class BlobSliceTest;
diff --git a/storage/browser/blob/blob_data_handle.cc b/storage/browser/blob/blob_data_handle.cc
index 36d19d37..2dc1699 100644
--- a/storage/browser/blob/blob_data_handle.cc
+++ b/storage/browser/blob/blob_data_handle.cc
@@ -20,9 +20,9 @@
 #include "storage/browser/blob/blob_data_snapshot.h"
 #include "storage/browser/blob/blob_reader.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "url/gurl.h"
 
 namespace storage {
diff --git a/storage/browser/blob/blob_data_item.cc b/storage/browser/blob/blob_data_item.cc
index 0a98e09..54c531cc9 100644
--- a/storage/browser/blob/blob_data_item.cc
+++ b/storage/browser/blob/blob_data_item.cc
@@ -10,7 +10,7 @@
 
 #include "base/strings/string_number_conversions.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "third_party/blink/public/common/blob/blob_utils.h"
 
 namespace storage {
diff --git a/storage/browser/blob/blob_reader.cc b/storage/browser/blob/blob_reader.cc
index 66e7300..ed13b00 100644
--- a/storage/browser/blob/blob_reader.cc
+++ b/storage/browser/blob/blob_reader.cc
@@ -22,9 +22,9 @@
 #include "net/base/net_errors.h"
 #include "storage/browser/blob/blob_data_handle.h"
 #include "storage/browser/blob/blob_data_snapshot.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/storage_histograms.h"
 
 namespace storage {
diff --git a/storage/browser/blob/blob_reader_unittest.cc b/storage/browser/blob/blob_reader_unittest.cc
index 2ce6629..9c8faf714 100644
--- a/storage/browser/blob/blob_reader_unittest.cc
+++ b/storage/browser/blob/blob_reader_unittest.cc
@@ -30,9 +30,9 @@
 #include "storage/browser/blob/blob_data_handle.h"
 #include "storage/browser/blob/blob_reader.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/fake_blob_data_handle.h"
 #include "storage/browser/test/test_file_system_context.h"
diff --git a/storage/browser/blob/blob_registry_impl.h b/storage/browser/blob/blob_registry_impl.h
index b46b5cfc..c85bf665 100644
--- a/storage/browser/blob/blob_registry_impl.h
+++ b/storage/browser/blob/blob_registry_impl.h
@@ -11,7 +11,7 @@
 #include "base/containers/unique_ptr_adapters.h"
 #include "mojo/public/cpp/bindings/receiver_set.h"
 #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "third_party/blink/public/mojom/blob/blob_registry.mojom.h"
 
 namespace storage {
diff --git a/storage/browser/fileapi/OWNERS b/storage/browser/file_system/OWNERS
similarity index 100%
rename from storage/browser/fileapi/OWNERS
rename to storage/browser/file_system/OWNERS
diff --git a/storage/browser/fileapi/README.md b/storage/browser/file_system/README.md
similarity index 100%
rename from storage/browser/fileapi/README.md
rename to storage/browser/file_system/README.md
diff --git a/storage/browser/fileapi/async_file_util.h b/storage/browser/file_system/async_file_util.h
similarity index 98%
rename from storage/browser/fileapi/async_file_util.h
rename to storage/browser/file_system/async_file_util.h
index da9090e..6f4ef3c3 100644
--- a/storage/browser/fileapi/async_file_util.h
+++ b/storage/browser/file_system/async_file_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_ASYNC_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_ASYNC_FILE_UTIL_H_
 
 #include <stdint.h>
 
@@ -15,7 +15,7 @@
 #include "base/files/file.h"
 #include "base/macros.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation.h"
 
 namespace base {
 class Time;
@@ -357,4 +357,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_ASYNC_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/async_file_util_adapter.cc b/storage/browser/file_system/async_file_util_adapter.cc
similarity index 95%
rename from storage/browser/fileapi/async_file_util_adapter.cc
rename to storage/browser/file_system/async_file_util_adapter.cc
index b297ec7..e5eaa13 100644
--- a/storage/browser/fileapi/async_file_util_adapter.cc
+++ b/storage/browser/file_system/async_file_util_adapter.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/async_file_util_adapter.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -18,10 +18,10 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 using base::Owned;
@@ -54,8 +54,7 @@
 
 class GetFileInfoHelper {
  public:
-  GetFileInfoHelper()
-      : error_(base::File::FILE_OK) {}
+  GetFileInfoHelper() : error_(base::File::FILE_OK) {}
 
   void GetFileInfo(FileSystemFileUtil* file_util,
                    FileSystemOperationContext* context,
@@ -79,8 +78,8 @@
   void CreateSnapshotFile(FileSystemFileUtil* file_util,
                           FileSystemOperationContext* context,
                           const FileSystemURL& url) {
-    scoped_file_ = file_util->CreateSnapshotFile(
-        context, url, &error_, &file_info_, &platform_path_);
+    scoped_file_ = file_util->CreateSnapshotFile(context, url, &error_,
+                                                 &file_info_, &platform_path_);
   }
 
   void ReplyFileInfo(AsyncFileUtil::GetFileInfoCallback callback) {
@@ -164,8 +163,7 @@
 
 }  // namespace
 
-AsyncFileUtilAdapter::AsyncFileUtilAdapter(
-    FileSystemFileUtil* sync_file_util)
+AsyncFileUtilAdapter::AsyncFileUtilAdapter(FileSystemFileUtil* sync_file_util)
     : sync_file_util_(sync_file_util) {
   DCHECK(sync_file_util_.get());
 }
diff --git a/storage/browser/fileapi/async_file_util_adapter.h b/storage/browser/file_system/async_file_util_adapter.h
similarity index 93%
rename from storage/browser/fileapi/async_file_util_adapter.h
rename to storage/browser/file_system/async_file_util_adapter.h
index 1a1d303..ad4abec 100644
--- a/storage/browser/fileapi/async_file_util_adapter.h
+++ b/storage/browser/file_system/async_file_util_adapter.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_
-#define STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_ASYNC_FILE_UTIL_ADAPTER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_ASYNC_FILE_UTIL_ADAPTER_H_
 
 #include <stdint.h>
 
@@ -12,7 +12,7 @@
 #include "base/component_export.h"
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
-#include "storage/browser/fileapi/async_file_util.h"
+#include "storage/browser/file_system/async_file_util.h"
 
 namespace storage {
 
@@ -39,9 +39,7 @@
 
   ~AsyncFileUtilAdapter() override;
 
-  FileSystemFileUtil* sync_file_util() {
-    return sync_file_util_.get();
-  }
+  FileSystemFileUtil* sync_file_util() { return sync_file_util_.get(); }
 
   // AsyncFileUtil overrides.
   void CreateOrOpen(std::unique_ptr<FileSystemOperationContext> context,
@@ -108,4 +106,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_ASYNC_FILE_UTIL_ADAPTER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_ASYNC_FILE_UTIL_ADAPTER_H_
diff --git a/storage/browser/fileapi/copy_or_move_file_validator.h b/storage/browser/file_system/copy_or_move_file_validator.h
similarity index 88%
rename from storage/browser/fileapi/copy_or_move_file_validator.h
rename to storage/browser/file_system/copy_or_move_file_validator.h
index 80fe801..e6dcb6e0 100644
--- a/storage/browser/fileapi/copy_or_move_file_validator.h
+++ b/storage/browser/file_system/copy_or_move_file_validator.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_
-#define STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_COPY_OR_MOVE_FILE_VALIDATOR_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_COPY_OR_MOVE_FILE_VALIDATOR_H_
 
 #include "base/callback.h"
 #include "base/component_export.h"
@@ -51,4 +51,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_COPY_OR_MOVE_FILE_VALIDATOR_H_
diff --git a/storage/browser/fileapi/copy_or_move_file_validator_unittest.cc b/storage/browser/file_system/copy_or_move_file_validator_unittest.cc
similarity index 84%
rename from storage/browser/fileapi/copy_or_move_file_validator_unittest.cc
rename to storage/browser/file_system/copy_or_move_file_validator_unittest.cc
index 2add6cd5..9343efa 100644
--- a/storage/browser/fileapi/copy_or_move_file_validator_unittest.cc
+++ b/storage/browser/file_system/copy_or_move_file_validator_unittest.cc
@@ -16,12 +16,12 @@
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_backend.h"
@@ -69,8 +69,8 @@
     // Set up TestFileSystemBackend to require CopyOrMoveFileValidator.
     storage::FileSystemBackend* test_file_system_backend =
         file_system_context_->GetFileSystemBackend(kWithValidatorType);
-    static_cast<TestFileSystemBackend*>(test_file_system_backend)->
-        set_require_copy_or_move_validator(true);
+    static_cast<TestFileSystemBackend*>(test_file_system_backend)
+        ->set_require_copy_or_move_validator(true);
 
     // Sets up source.
     storage::FileSystemBackend* src_file_system_backend =
@@ -112,9 +112,8 @@
     ASSERT_TRUE(FileExists(copy_src_, 10));
     ASSERT_FALSE(FileExists(copy_dest_, 10));
 
-    EXPECT_EQ(expected,
-              AsyncFileTestHelper::Copy(
-                  file_system_context_.get(), copy_src_, copy_dest_));
+    EXPECT_EQ(expected, AsyncFileTestHelper::Copy(file_system_context_.get(),
+                                                  copy_src_, copy_dest_));
 
     EXPECT_TRUE(FileExists(copy_src_, 10));
     if (expected == base::File::FILE_OK)
@@ -127,9 +126,8 @@
     ASSERT_TRUE(FileExists(move_src_, 10));
     ASSERT_FALSE(FileExists(move_dest_, 10));
 
-    EXPECT_EQ(expected,
-              AsyncFileTestHelper::Move(
-                  file_system_context_.get(), move_src_, move_dest_));
+    EXPECT_EQ(expected, AsyncFileTestHelper::Move(file_system_context_.get(),
+                                                  move_src_, move_dest_));
 
     if (expected == base::File::FILE_OK) {
       EXPECT_FALSE(FileExists(move_src_, 10));
@@ -158,8 +156,8 @@
         AsyncFileTestHelper::CreateFile(file_system_context_.get(), url);
     if (result != base::File::FILE_OK)
       return result;
-    return AsyncFileTestHelper::TruncateFile(
-        file_system_context_.get(), url, size);
+    return AsyncFileTestHelper::TruncateFile(file_system_context_.get(), url,
+                                             size);
   }
 
   base::File::Error CreateDirectory(const FileSystemURL& url) {
@@ -168,8 +166,8 @@
   }
 
   bool FileExists(const FileSystemURL& url, int64_t expected_size) {
-    return AsyncFileTestHelper::FileExists(
-        file_system_context_.get(), url, expected_size);
+    return AsyncFileTestHelper::FileExists(file_system_context_.get(), url,
+                                           expected_size);
   }
 
   base::ScopedTempDir base_;
@@ -193,11 +191,7 @@
 };
 
 // For TestCopyOrMoveFileValidatorFactory
-enum Validity {
-  VALID,
-  PRE_WRITE_INVALID,
-  POST_WRITE_INVALID
-};
+enum Validity { VALID, PRE_WRITE_INVALID, POST_WRITE_INVALID };
 
 class TestCopyOrMoveFileValidatorFactory
     : public storage::CopyOrMoveFileValidatorFactory {
@@ -218,13 +212,12 @@
   class TestCopyOrMoveFileValidator : public CopyOrMoveFileValidator {
    public:
     explicit TestCopyOrMoveFileValidator(Validity validity)
-        : result_(validity == VALID || validity == POST_WRITE_INVALID ?
-                  base::File::FILE_OK :
-                  base::File::FILE_ERROR_SECURITY),
-          write_result_(validity == VALID || validity == PRE_WRITE_INVALID ?
-                        base::File::FILE_OK :
-                        base::File::FILE_ERROR_SECURITY) {
-    }
+        : result_(validity == VALID || validity == POST_WRITE_INVALID
+                      ? base::File::FILE_OK
+                      : base::File::FILE_ERROR_SECURITY),
+          write_result_(validity == VALID || validity == PRE_WRITE_INVALID
+                            ? base::File::FILE_OK
+                            : base::File::FILE_ERROR_SECURITY) {}
     ~TestCopyOrMoveFileValidator() override = default;
 
     void StartPreWriteValidation(
@@ -259,9 +252,8 @@
 TEST(CopyOrMoveFileValidatorTest, NoValidatorWithinSameFSType) {
   // Within a file system type, validation is not expected, so it should
   // work for kWithValidatorType without a validator set.
-  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"),
-                                           kWithValidatorType,
-                                           kWithValidatorType);
+  CopyOrMoveFileValidatorTestHelper helper(
+      GURL("http://foo"), kWithValidatorType, kWithValidatorType);
   helper.SetUp();
   helper.CopyTest(base::File::FILE_OK);
   helper.MoveTest(base::File::FILE_OK);
@@ -270,8 +262,7 @@
 TEST(CopyOrMoveFileValidatorTest, MissingValidator) {
   // Copying or moving into a kWithValidatorType requires a file
   // validator.  An error is expected if copy is attempted without a validator.
-  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"),
-                                           kNoValidatorType,
+  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"), kNoValidatorType,
                                            kWithValidatorType);
   helper.SetUp();
   helper.CopyTest(base::File::FILE_ERROR_SECURITY);
@@ -279,8 +270,7 @@
 }
 
 TEST(CopyOrMoveFileValidatorTest, AcceptAll) {
-  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"),
-                                           kNoValidatorType,
+  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"), kNoValidatorType,
                                            kWithValidatorType);
   helper.SetUp();
   std::unique_ptr<CopyOrMoveFileValidatorFactory> factory(
@@ -292,8 +282,7 @@
 }
 
 TEST(CopyOrMoveFileValidatorTest, AcceptNone) {
-  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"),
-                                           kNoValidatorType,
+  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"), kNoValidatorType,
                                            kWithValidatorType);
   helper.SetUp();
   std::unique_ptr<CopyOrMoveFileValidatorFactory> factory(
@@ -306,8 +295,7 @@
 
 TEST(CopyOrMoveFileValidatorTest, OverrideValidator) {
   // Once set, you can not override the validator.
-  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"),
-                                           kNoValidatorType,
+  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"), kNoValidatorType,
                                            kWithValidatorType);
   helper.SetUp();
   std::unique_ptr<CopyOrMoveFileValidatorFactory> reject_factory(
@@ -323,8 +311,7 @@
 }
 
 TEST(CopyOrMoveFileValidatorTest, RejectPostWrite) {
-  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"),
-                                           kNoValidatorType,
+  CopyOrMoveFileValidatorTestHelper helper(GURL("http://foo"), kNoValidatorType,
                                            kWithValidatorType);
   helper.SetUp();
   std::unique_ptr<CopyOrMoveFileValidatorFactory> factory(
diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate.cc b/storage/browser/file_system/copy_or_move_operation_delegate.cc
similarity index 97%
rename from storage/browser/fileapi/copy_or_move_operation_delegate.cc
rename to storage/browser/file_system/copy_or_move_operation_delegate.cc
index df61d43..851f104 100644
--- a/storage/browser/fileapi/copy_or_move_operation_delegate.cc
+++ b/storage/browser/file_system/copy_or_move_operation_delegate.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/copy_or_move_operation_delegate.h"
+#include "storage/browser/file_system/copy_or_move_operation_delegate.h"
 
 #include <stdint.h>
 
@@ -16,13 +16,13 @@
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace storage {
@@ -711,9 +711,8 @@
     DidFlush(is_eof, result);
 }
 
-void CopyOrMoveOperationDelegate::StreamCopyHelper::DidFlush(
-    bool is_eof,
-    int result) {
+void CopyOrMoveOperationDelegate::StreamCopyHelper::DidFlush(bool is_eof,
+                                                             int result) {
   if (cancel_requested_) {
     std::move(completion_callback_).Run(base::File::FILE_ERROR_ABORT);
     return;
diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate.h b/storage/browser/file_system/copy_or_move_operation_delegate.h
similarity index 92%
rename from storage/browser/fileapi/copy_or_move_operation_delegate.h
rename to storage/browser/file_system/copy_or_move_operation_delegate.h
index f54a359..e91bf10 100644
--- a/storage/browser/fileapi/copy_or_move_operation_delegate.h
+++ b/storage/browser/file_system/copy_or_move_operation_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_COPY_OR_MOVE_OPERATION_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_COPY_OR_MOVE_OPERATION_DELEGATE_H_
 
 #include <stdint.h>
 
@@ -14,35 +14,31 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/time/time.h"
-#include "storage/browser/fileapi/recursive_operation_delegate.h"
+#include "storage/browser/file_system/recursive_operation_delegate.h"
 
 namespace net {
 class DrainableIOBuffer;
 class IOBufferWithSize;
-}
+}  // namespace net
 
 namespace storage {
 class FileStreamReader;
 enum class FlushPolicy;
-}
+}  // namespace storage
 
 namespace storage {
 
 class FileStreamWriter;
 
 // A delegate class for recursive copy or move operations.
-class CopyOrMoveOperationDelegate
-    : public RecursiveOperationDelegate {
+class CopyOrMoveOperationDelegate : public RecursiveOperationDelegate {
  public:
   class CopyOrMoveImpl;
   using CopyProgressCallback = FileSystemOperation::CopyProgressCallback;
   using CopyOrMoveOption = FileSystemOperation::CopyOrMoveOption;
   using ErrorBehavior = FileSystemOperation::ErrorBehavior;
 
-  enum OperationType {
-    OPERATION_COPY,
-    OPERATION_MOVE
-  };
+  enum OperationType { OPERATION_COPY, OPERATION_MOVE };
 
   // Helper to copy a file by reader and writer streams.
   // Export for testing.
@@ -160,4 +156,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_COPY_OR_MOVE_OPERATION_DELEGATE_H_
diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
similarity index 91%
rename from storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
rename to storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
index cd0c8c9..bc3e541 100644
--- a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
+++ b/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
@@ -23,17 +23,17 @@
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/copy_or_move_operation_delegate.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/copy_or_move_operation_delegate.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/browser/test/async_file_test_helper.h"
-#include "storage/browser/test/fileapi_test_file_set.h"
+#include "storage/browser/test/file_system_test_file_set.h"
 #include "storage/browser/test/mock_quota_manager.h"
 #include "storage/browser/test/mock_quota_manager_proxy.h"
 #include "storage/browser/test/test_file_system_backend.h"
@@ -79,12 +79,11 @@
     explicit TestValidator(bool pre_copy_valid,
                            bool post_copy_valid,
                            const std::string& reject_string)
-        : result_(pre_copy_valid ? base::File::FILE_OK :
-                                   base::File::FILE_ERROR_SECURITY),
-          write_result_(post_copy_valid ? base::File::FILE_OK :
-                                          base::File::FILE_ERROR_SECURITY),
-          reject_string_(reject_string) {
-    }
+        : result_(pre_copy_valid ? base::File::FILE_OK
+                                 : base::File::FILE_ERROR_SECURITY),
+          write_result_(post_copy_valid ? base::File::FILE_OK
+                                        : base::File::FILE_ERROR_SECURITY),
+          reject_string_(reject_string) {}
     ~TestValidator() override = default;
 
     void StartPreWriteValidation(
@@ -151,8 +150,7 @@
 
 class ScopedThreadStopper {
  public:
-  ScopedThreadStopper(base::Thread* thread) : thread_(thread) {
-  }
+  ScopedThreadStopper(base::Thread* thread) : thread_(thread) {}
 
   ~ScopedThreadStopper() {
     if (thread_) {
@@ -192,13 +190,9 @@
     task_environment_.RunUntilIdle();
   }
 
-  void SetUp() {
-    SetUp(true, true);
-  }
+  void SetUp() { SetUp(true, true); }
 
-  void SetUpNoValidator() {
-    SetUp(true, false);
-  }
+  void SetUpNoValidator() { SetUp(true, false); }
 
   void SetUp(bool require_copy_or_move_validator,
              bool init_copy_or_move_validator) {
@@ -271,8 +265,7 @@
         origin_, dest_type_, base::FilePath::FromUTF8Unsafe(path));
   }
 
-  base::File::Error Copy(const FileSystemURL& src,
-                         const FileSystemURL& dest) {
+  base::File::Error Copy(const FileSystemURL& src, const FileSystemURL& dest) {
     return AsyncFileTestHelper::Copy(file_system_context_.get(), src, dest);
   }
 
@@ -280,12 +273,11 @@
       const FileSystemURL& src,
       const FileSystemURL& dest,
       const AsyncFileTestHelper::CopyProgressCallback& progress_callback) {
-    return AsyncFileTestHelper::CopyWithProgress(
-        file_system_context_.get(), src, dest, progress_callback);
+    return AsyncFileTestHelper::CopyWithProgress(file_system_context_.get(),
+                                                 src, dest, progress_callback);
   }
 
-  base::File::Error Move(const FileSystemURL& src,
-                         const FileSystemURL& dest) {
+  base::File::Error Move(const FileSystemURL& src, const FileSystemURL& dest) {
     return AsyncFileTestHelper::Move(file_system_context_.get(), src, dest);
   }
 
@@ -310,15 +302,13 @@
     return result;
   }
 
-  void VerifyTestCaseFiles(
-      const FileSystemURL& root,
-      const FileSystemTestCaseRecord* const test_cases,
-      size_t test_case_size) {
+  void VerifyTestCaseFiles(const FileSystemURL& root,
+                           const FileSystemTestCaseRecord* const test_cases,
+                           size_t test_case_size) {
     std::map<base::FilePath, const FileSystemTestCaseRecord*> test_case_map;
     for (size_t i = 0; i < test_case_size; ++i) {
-      test_case_map[
-          base::FilePath(test_cases[i].path).NormalizePathSeparators()] =
-              &test_cases[i];
+      test_case_map[base::FilePath(test_cases[i].path)
+                        .NormalizePathSeparators()] = &test_cases[i];
     }
 
     base::queue<FileSystemURL> directories;
@@ -355,8 +345,8 @@
 
   base::File::Error ReadDirectory(const FileSystemURL& url,
                                   FileEntryList* entries) {
-    return AsyncFileTestHelper::ReadDirectory(
-        file_system_context_.get(), url, entries);
+    return AsyncFileTestHelper::ReadDirectory(file_system_context_.get(), url,
+                                              entries);
   }
 
   base::File::Error CreateDirectory(const FileSystemURL& url) {
@@ -369,13 +359,13 @@
         AsyncFileTestHelper::CreateFile(file_system_context_.get(), url);
     if (result != base::File::FILE_OK)
       return result;
-    return AsyncFileTestHelper::TruncateFile(
-        file_system_context_.get(), url, size);
+    return AsyncFileTestHelper::TruncateFile(file_system_context_.get(), url,
+                                             size);
   }
 
   bool FileExists(const FileSystemURL& url, int64_t expected_size) {
-    return AsyncFileTestHelper::FileExists(
-        file_system_context_.get(), url, expected_size);
+    return AsyncFileTestHelper::FileExists(file_system_context_.get(), url,
+                                           expected_size);
   }
 
   bool DirectoryExists(const FileSystemURL& url) {
@@ -539,23 +529,20 @@
   // Set up a source directory.
   ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
   ASSERT_EQ(base::File::FILE_OK,
-            helper.SetUpTestCaseFiles(src,
-                                      kRegularFileSystemTestCases,
+            helper.SetUpTestCaseFiles(src, kRegularFileSystemTestCases,
                                       kRegularFileSystemTestCaseSize));
   int64_t src_increase = helper.GetSourceUsage() - src_initial_usage;
 
   // Copy it.
   ASSERT_EQ(base::File::FILE_OK,
             helper.CopyWithProgress(
-                src, dest,
-                AsyncFileTestHelper::CopyProgressCallback()));
+                src, dest, AsyncFileTestHelper::CopyProgressCallback()));
 
   // Verify.
   ASSERT_TRUE(helper.DirectoryExists(src));
   ASSERT_TRUE(helper.DirectoryExists(dest));
 
-  helper.VerifyTestCaseFiles(dest,
-                             kRegularFileSystemTestCases,
+  helper.VerifyTestCaseFiles(dest, kRegularFileSystemTestCases,
                              kRegularFileSystemTestCaseSize);
 
   int64_t src_new_usage = helper.GetSourceUsage();
@@ -579,8 +566,7 @@
   // Set up a source directory.
   ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
   ASSERT_EQ(base::File::FILE_OK,
-            helper.SetUpTestCaseFiles(src,
-                                      kRegularFileSystemTestCases,
+            helper.SetUpTestCaseFiles(src, kRegularFileSystemTestCases,
                                       kRegularFileSystemTestCaseSize));
   int64_t src_increase = helper.GetSourceUsage() - src_initial_usage;
 
@@ -591,8 +577,7 @@
   ASSERT_FALSE(helper.DirectoryExists(src));
   ASSERT_TRUE(helper.DirectoryExists(dest));
 
-  helper.VerifyTestCaseFiles(dest,
-                             kRegularFileSystemTestCases,
+  helper.VerifyTestCaseFiles(dest, kRegularFileSystemTestCases,
                              kRegularFileSystemTestCaseSize);
 
   int64_t src_new_usage = helper.GetSourceUsage();
@@ -615,8 +600,7 @@
   // Set up a source directory.
   ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
   ASSERT_EQ(base::File::FILE_OK,
-            helper.SetUpTestCaseFiles(src,
-                                      kRegularFileSystemTestCases,
+            helper.SetUpTestCaseFiles(src, kRegularFileSystemTestCases,
                                       kRegularFileSystemTestCaseSize));
 
   // Move it.
@@ -630,7 +614,7 @@
   // After file 3 is processed, file 2 is rejected by the validator and the
   // operation fails. That is, only file 3 should be in dest.
   FileSystemTestCaseRecord kMoveDirResultCases[] = {
-    {false, FILE_PATH_LITERAL("file 3"), 0},
+      {false, FILE_PATH_LITERAL("file 3"), 0},
   };
 
   helper.VerifyTestCaseFiles(dest, kMoveDirResultCases,
@@ -667,8 +651,7 @@
   // Set up a source directory.
   ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
   ASSERT_EQ(base::File::FILE_OK,
-            helper.SetUpTestCaseFiles(src,
-                                      kRegularFileSystemTestCases,
+            helper.SetUpTestCaseFiles(src, kRegularFileSystemTestCases,
                                       kRegularFileSystemTestCaseSize));
 
   std::vector<ProgressRecord> records;
@@ -703,8 +686,7 @@
     ASSERT_NE(end_index, records.size());
     ASSERT_NE(begin_index, end_index);
 
-    EXPECT_EQ(FileSystemOperation::BEGIN_COPY_ENTRY,
-              records[begin_index].type);
+    EXPECT_EQ(FileSystemOperation::BEGIN_COPY_ENTRY, records[begin_index].type);
     EXPECT_FALSE(records[begin_index].dest_url.is_valid());
     EXPECT_EQ(FileSystemOperation::END_COPY_ENTRY, records[end_index].type);
     EXPECT_EQ(dest_url, records[end_index].dest_url);
diff --git a/storage/browser/fileapi/dragged_file_util.cc b/storage/browser/file_system/dragged_file_util.cc
similarity index 85%
rename from storage/browser/fileapi/dragged_file_util.cc
rename to storage/browser/file_system/dragged_file_util.cc
index bcc98d3..e48e479c 100644
--- a/storage/browser/fileapi/dragged_file_util.cc
+++ b/storage/browser/file_system/dragged_file_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/dragged_file_util.h"
+#include "storage/browser/file_system/dragged_file_util.h"
 
 #include <stdint.h>
 
@@ -12,11 +12,11 @@
 
 #include "base/files/file_util.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/native_file_util.h"
 
 namespace storage {
 
@@ -97,8 +97,7 @@
     file_info->size = 0;
     return base::File::FILE_OK;
   }
-  base::File::Error error =
-      NativeFileUtil::GetFileInfo(url.path(), file_info);
+  base::File::Error error = NativeFileUtil::GetFileInfo(url.path(), file_info);
   if (IsHiddenItem(url.path()) && !base::FilePath().IsParent(url.path())) {
     // Don't follow symlinks unless it's the one that are selected by the user.
     return base::File::FILE_ERROR_NOT_FOUND;
@@ -118,10 +117,9 @@
 
   // Root path case.
   std::vector<FileInfo> toplevels;
-  IsolatedContext::GetInstance()->GetDraggedFileInfo(
-      root.filesystem_id(), &toplevels);
-  return std::unique_ptr<AbstractFileEnumerator>(
-      new SetFileEnumerator(toplevels, recursive));
+  IsolatedContext::GetInstance()->GetDraggedFileInfo(root.filesystem_id(),
+                                                     &toplevels);
+  return std::make_unique<SetFileEnumerator>(toplevels, recursive);
 }
 
 }  // namespace storage
diff --git a/storage/browser/fileapi/dragged_file_util.h b/storage/browser/file_system/dragged_file_util.h
similarity index 83%
rename from storage/browser/fileapi/dragged_file_util.h
rename to storage/browser/file_system/dragged_file_util.h
index f5168a3..0590b90 100644
--- a/storage/browser/fileapi/dragged_file_util.h
+++ b/storage/browser/file_system/dragged_file_util.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_DRAGGED_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_DRAGGED_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_DRAGGED_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_DRAGGED_FILE_UTIL_H_
 
 #include <memory>
 
 #include "base/component_export.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/local_file_util.h"
+#include "storage/browser/file_system/local_file_util.h"
 
 namespace storage {
 
@@ -39,4 +39,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_DRAGGED_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_DRAGGED_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/dragged_file_util_unittest.cc b/storage/browser/file_system/dragged_file_util_unittest.cc
similarity index 79%
rename from storage/browser/fileapi/dragged_file_util_unittest.cc
rename to storage/browser/file_system/dragged_file_util_unittest.cc
index 751e36f..f9d1220 100644
--- a/storage/browser/fileapi/dragged_file_util_unittest.cc
+++ b/storage/browser/file_system/dragged_file_util_unittest.cc
@@ -21,14 +21,14 @@
 #include "base/time/time.h"
 #include "build/build_config.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
-#include "storage/browser/fileapi/dragged_file_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/local_file_util.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/dragged_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/local_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "storage/browser/test/async_file_test_helper.h"
-#include "storage/browser/test/fileapi_test_file_set.h"
+#include "storage/browser/test/file_system_test_file_set.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -50,7 +50,9 @@
 // RegularTestCases (so that we can simulate a drop with files/directories
 // from multiple directories).
 constexpr const base::FilePath::CharType* kRootPaths[] = {
-    FILE_PATH_LITERAL("a"), FILE_PATH_LITERAL("b/c"), FILE_PATH_LITERAL("etc"),
+    FILE_PATH_LITERAL("a"),
+    FILE_PATH_LITERAL("b/c"),
+    FILE_PATH_LITERAL("etc"),
 };
 
 base::FilePath GetTopLevelPath(const base::FilePath& path) {
@@ -78,8 +80,8 @@
   if (root.virtual_path().empty())
     return url.virtual_path();
   base::FilePath relative;
-  const bool success = root.virtual_path().AppendRelativePath(
-      url.virtual_path(), &relative);
+  const bool success =
+      root.virtual_path().AppendRelativePath(url.virtual_path(), &relative);
   DCHECK(success);
   return relative;
 }
@@ -132,7 +134,8 @@
   base::FilePath GetTestCasePlatformPath(
       const base::FilePath::StringType& path) {
     return toplevel_root_map_[GetTopLevelPath(base::FilePath(path))]
-        .Append(path).NormalizePathSeparators();
+        .Append(path)
+        .NormalizePathSeparators();
   }
 
   base::FilePath GetTestCaseLocalPath(const base::FilePath& path) {
@@ -143,18 +146,16 @@
   }
 
   FileSystemURL GetFileSystemURL(const base::FilePath& path) const {
-    base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(
-        filesystem_id()).Append(path);
+    base::FilePath virtual_path =
+        isolated_context()->CreateVirtualRootPath(filesystem_id()).Append(path);
     return file_system_context_->CreateCrackedFileSystemURL(
-        GURL("http://example.com"),
-        storage::kFileSystemTypeIsolated,
+        GURL("http://example.com"), storage::kFileSystemTypeIsolated,
         virtual_path);
   }
 
   FileSystemURL GetOtherFileSystemURL(const base::FilePath& path) const {
     return file_system_context()->CreateCrackedFileSystemURL(
-        GURL("http://example.com"),
-        storage::kFileSystemTypeTemporary,
+        GURL("http://example.com"), storage::kFileSystemTypeTemporary,
         base::FilePath().AppendASCII("dest").Append(path));
   }
 
@@ -162,23 +163,21 @@
                                   const FileSystemURL& url2) {
     // Get the file info and the platform path for url1.
     base::File::Info info1;
-    ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::GetMetadata(
-                  file_system_context(), url1, &info1));
+    ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::GetMetadata(
+                                       file_system_context(), url1, &info1));
     base::FilePath platform_path1;
     ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::GetPlatformPath(
-                  file_system_context(), url1, &platform_path1));
+              AsyncFileTestHelper::GetPlatformPath(file_system_context(), url1,
+                                                   &platform_path1));
 
     // Get the file info and the platform path  for url2.
     base::File::Info info2;
-    ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::GetMetadata(
-                  file_system_context(), url2, &info2));
+    ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::GetMetadata(
+                                       file_system_context(), url2, &info2));
     base::FilePath platform_path2;
     ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::GetPlatformPath(
-                  file_system_context(), url2, &platform_path2));
+              AsyncFileTestHelper::GetPlatformPath(file_system_context(), url2,
+                                                   &platform_path2));
 
     // See if file info matches with the other one.
     EXPECT_EQ(info1.is_directory, info2.is_directory);
@@ -206,9 +205,8 @@
       FileSystemURL dir = directories.front();
       directories.pop();
 
-      ASSERT_EQ(base::File::FILE_OK,
-                AsyncFileTestHelper::ReadDirectory(
-                    file_system_context(), dir, &entries));
+      ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::ReadDirectory(
+                                         file_system_context(), dir, &entries));
       for (size_t i = 0; i < entries.size(); ++i) {
         FileSystemURL url =
             GetEntryURL(file_system_context(), dir, entries[i].name.value());
@@ -225,14 +223,13 @@
       FileSystemURL dir = directories.front();
       directories.pop();
 
-      ASSERT_EQ(base::File::FILE_OK,
-                AsyncFileTestHelper::ReadDirectory(
-                    file_system_context(), dir, &entries));
+      ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::ReadDirectory(
+                                         file_system_context(), dir, &entries));
       for (size_t i = 0; i < entries.size(); ++i) {
         FileSystemURL url2 =
             GetEntryURL(file_system_context(), dir, entries[i].name.value());
-        FileSystemURL url1 = GetOtherURL(file_system_context(),
-                                         root2, root1, url2);
+        FileSystemURL url1 =
+            GetOtherURL(file_system_context(), root2, root1, url2);
         if (entries[i].type == filesystem::mojom::FsFileType::DIRECTORY) {
           directories.push(url2);
           EXPECT_EQ(IsDirectoryEmpty(file_system_context(), url1),
@@ -251,7 +248,6 @@
         file_system_context());
   }
 
-
  private:
   void SimulateDropFiles() {
     size_t root_path_index = 0;
@@ -293,8 +289,7 @@
 TEST_F(DraggedFileUtilTest, BasicTest) {
   for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
     SCOPED_TRACE(testing::Message() << "Testing RegularTestCases " << i);
-    const FileSystemTestCaseRecord& test_case =
-        kRegularFileSystemTestCases[i];
+    const FileSystemTestCaseRecord& test_case = kRegularFileSystemTestCases[i];
 
     FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
 
@@ -318,11 +313,11 @@
 
 TEST_F(DraggedFileUtilTest, UnregisteredPathsTest) {
   static const FileSystemTestCaseRecord kUnregisteredCases[] = {
-    {true, FILE_PATH_LITERAL("nonexistent"), 0},
-    {true, FILE_PATH_LITERAL("nonexistent/dir foo"), 0},
-    {false, FILE_PATH_LITERAL("nonexistent/false"), 0},
-    {false, FILE_PATH_LITERAL("foo"), 30},
-    {false, FILE_PATH_LITERAL("bar"), 20},
+      {true, FILE_PATH_LITERAL("nonexistent"), 0},
+      {true, FILE_PATH_LITERAL("nonexistent/dir foo"), 0},
+      {false, FILE_PATH_LITERAL("nonexistent/false"), 0},
+      {false, FILE_PATH_LITERAL("foo"), 30},
+      {false, FILE_PATH_LITERAL("bar"), 20},
   };
 
   for (size_t i = 0; i < base::size(kUnregisteredCases); ++i) {
@@ -352,13 +347,12 @@
 
 TEST_F(DraggedFileUtilTest, ReadDirectoryTest) {
   for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
-    const FileSystemTestCaseRecord& test_case =
-        kRegularFileSystemTestCases[i];
+    const FileSystemTestCaseRecord& test_case = kRegularFileSystemTestCases[i];
     if (!test_case.is_directory)
       continue;
 
-    SCOPED_TRACE(testing::Message() << "Testing RegularTestCases " << i
-                 << ": " << test_case.path);
+    SCOPED_TRACE(testing::Message()
+                 << "Testing RegularTestCases " << i << ": " << test_case.path);
 
     // Read entries in the directory to construct the expected results map.
     using EntryMap =
@@ -384,19 +378,17 @@
       // Creates a symlink for each file/directory.
       // They should be ignored by ReadDirectory, so we don't add them
       // to expected_entry_map.
-      base::CreateSymbolicLink(
-          current,
-          dir_path.Append(current.BaseName().AddExtension(
-              FILE_PATH_LITERAL("link"))));
+      base::CreateSymbolicLink(current,
+                               dir_path.Append(current.BaseName().AddExtension(
+                                   FILE_PATH_LITERAL("link"))));
 #endif
     }
 
     // Perform ReadDirectory in the isolated filesystem.
     FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
     FileEntryList entries;
-    ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::ReadDirectory(
-                  file_system_context(), url, &entries));
+    ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::ReadDirectory(
+                                       file_system_context(), url, &entries));
 
     EXPECT_EQ(expected_entry_map.size(), entries.size());
     for (size_t i = 0; i < entries.size(); ++i) {
@@ -411,8 +403,7 @@
 
 TEST_F(DraggedFileUtilTest, GetLocalFilePathTest) {
   for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
-    const FileSystemTestCaseRecord& test_case =
-        kRegularFileSystemTestCases[i];
+    const FileSystemTestCaseRecord& test_case = kRegularFileSystemTestCases[i];
     FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
 
     FileSystemOperationContext context(file_system_context());
@@ -433,34 +424,31 @@
   base::queue<FileSystemURL> directories;
   directories.push(src_root);
 
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::CreateDirectory(file_system_context(),
-                                                 dest_root));
+  ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::CreateDirectory(
+                                     file_system_context(), dest_root));
 
   while (!directories.empty()) {
     FileSystemURL dir = directories.front();
     directories.pop();
-    ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::ReadDirectory(file_system_context(),
-                                                 dir, &entries));
+    ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::ReadDirectory(
+                                       file_system_context(), dir, &entries));
     for (size_t i = 0; i < entries.size(); ++i) {
       FileSystemURL src_url =
           GetEntryURL(file_system_context(), dir, entries[i].name.value());
-      FileSystemURL dest_url = GetOtherURL(file_system_context(),
-                                           src_root, dest_root, src_url);
+      FileSystemURL dest_url =
+          GetOtherURL(file_system_context(), src_root, dest_root, src_url);
 
       if (entries[i].type == filesystem::mojom::FsFileType::DIRECTORY) {
-        ASSERT_EQ(base::File::FILE_OK,
-                  AsyncFileTestHelper::CreateDirectory(file_system_context(),
-                                                       dest_url));
+        ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::CreateDirectory(
+                                           file_system_context(), dest_url));
         directories.push(src_url);
         continue;
       }
-      SCOPED_TRACE(testing::Message() << "Testing file copy "
-                   << src_url.path().value());
-      ASSERT_EQ(base::File::FILE_OK,
-                AsyncFileTestHelper::Copy(file_system_context(),
-                                          src_url, dest_url));
+      SCOPED_TRACE(testing::Message()
+                   << "Testing file copy " << src_url.path().value());
+      ASSERT_EQ(
+          base::File::FILE_OK,
+          AsyncFileTestHelper::Copy(file_system_context(), src_url, dest_url));
       VerifyFilesHaveSameContent(src_url, dest_url);
     }
   }
@@ -470,34 +458,32 @@
   FileSystemURL src_root = GetFileSystemURL(base::FilePath());
   FileSystemURL dest_root = GetOtherFileSystemURL(base::FilePath());
 
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::CreateDirectory(file_system_context(),
-                                                 dest_root));
+  ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::CreateDirectory(
+                                     file_system_context(), dest_root));
 
   FileEntryList entries;
   ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::ReadDirectory(file_system_context(),
-                                               src_root, &entries));
+            AsyncFileTestHelper::ReadDirectory(file_system_context(), src_root,
+                                               &entries));
   for (size_t i = 0; i < entries.size(); ++i) {
     if (entries[i].type != filesystem::mojom::FsFileType::DIRECTORY)
       continue;
     FileSystemURL src_url =
         GetEntryURL(file_system_context(), src_root, entries[i].name.value());
-    FileSystemURL dest_url = GetOtherURL(file_system_context(),
-                                         src_root, dest_root, src_url);
-    SCOPED_TRACE(testing::Message() << "Testing file copy "
-                 << src_url.path().value());
-    ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::Copy(file_system_context(),
-                                        src_url, dest_url));
+    FileSystemURL dest_url =
+        GetOtherURL(file_system_context(), src_root, dest_root, src_url);
+    SCOPED_TRACE(testing::Message()
+                 << "Testing file copy " << src_url.path().value());
+    ASSERT_EQ(
+        base::File::FILE_OK,
+        AsyncFileTestHelper::Copy(file_system_context(), src_url, dest_url));
     VerifyDirectoriesHaveSameContent(src_url, dest_url);
   }
 }
 
 TEST_F(DraggedFileUtilTest, TouchTest) {
   for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
-    const FileSystemTestCaseRecord& test_case =
-        kRegularFileSystemTestCases[i];
+    const FileSystemTestCaseRecord& test_case = kRegularFileSystemTestCases[i];
     if (test_case.is_directory)
       continue;
     SCOPED_TRACE(testing::Message() << test_case.path);
@@ -508,15 +494,14 @@
 
     EXPECT_EQ(base::File::FILE_OK,
               file_util()->Touch(GetOperationContext().get(), url,
-                                 last_access_time,
-                                 last_modified_time));
+                                 last_access_time, last_modified_time));
 
     // Verification.
     base::File::Info info;
     base::FilePath platform_path;
     ASSERT_EQ(base::File::FILE_OK,
-              file_util()->GetFileInfo(GetOperationContext().get(), url,
-                                       &info, &platform_path));
+              file_util()->GetFileInfo(GetOperationContext().get(), url, &info,
+                                       &platform_path));
     EXPECT_EQ(last_access_time.ToTimeT(), info.last_accessed.ToTimeT());
     EXPECT_EQ(last_modified_time.ToTimeT(), info.last_modified.ToTimeT());
   }
@@ -524,8 +509,7 @@
 
 TEST_F(DraggedFileUtilTest, TruncateTest) {
   for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
-    const FileSystemTestCaseRecord& test_case =
-        kRegularFileSystemTestCases[i];
+    const FileSystemTestCaseRecord& test_case = kRegularFileSystemTestCases[i];
     if (test_case.is_directory)
       continue;
 
@@ -538,16 +522,16 @@
     EXPECT_EQ(base::File::FILE_OK,
               file_util()->Truncate(GetOperationContext().get(), url, 0));
     ASSERT_EQ(base::File::FILE_OK,
-              file_util()->GetFileInfo(GetOperationContext().get(), url,
-                                       &info, &platform_path));
+              file_util()->GetFileInfo(GetOperationContext().get(), url, &info,
+                                       &platform_path));
     EXPECT_EQ(0, info.size);
 
     // Truncate (extend) to 999.
     EXPECT_EQ(base::File::FILE_OK,
               file_util()->Truncate(GetOperationContext().get(), url, 999));
     ASSERT_EQ(base::File::FILE_OK,
-              file_util()->GetFileInfo(GetOperationContext().get(), url,
-                                       &info, &platform_path));
+              file_util()->GetFileInfo(GetOperationContext().get(), url, &info,
+                                       &platform_path));
     EXPECT_EQ(999, info.size);
   }
 }
diff --git a/storage/browser/fileapi/dump_file_system.cc b/storage/browser/file_system/dump_file_system.cc
similarity index 88%
rename from storage/browser/fileapi/dump_file_system.cc
rename to storage/browser/file_system/dump_file_system.cc
index e152cd0d..81bc6c8 100644
--- a/storage/browser/fileapi/dump_file_system.cc
+++ b/storage/browser/file_system/dump_file_system.cc
@@ -42,11 +42,11 @@
 #include "base/files/file_util.h"
 #include "base/format_macros.h"
 #include "base/strings/stringprintf.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/sandbox_directory_database.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
-#include "storage/browser/fileapi/sandbox_prioritized_origin_database.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/sandbox_directory_database.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_prioritized_origin_database.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 
@@ -61,9 +61,8 @@
 }
 
 void ShowUsageAndExit(const std::string& arg0) {
-  ShowMessageAndExit(
-      "Usage: " + arg0 +
-      " [-l] [-t] [-s] <filesystem dir> [origin]...");
+  ShowMessageAndExit("Usage: " + arg0 +
+                     " [-l] [-t] [-s] <filesystem dir> [origin]...");
 }
 
 }  // namespace
@@ -94,8 +93,8 @@
 
     SandboxDirectoryDatabase::FileInfo info;
     if (!directory_db.GetFileInfo(id, &info)) {
-      ShowMessageAndExit(base::StringPrintf("GetFileInfo failed for %" PRId64,
-                                            id));
+      ShowMessageAndExit(
+          base::StringPrintf("GetFileInfo failed for %" PRId64, id));
     }
 
     const std::string name =
@@ -109,7 +108,7 @@
       }
 
       for (size_t j = children.size(); j; j--)
-        paths.push(make_pair(children[j-1], name));
+        paths.push(make_pair(children[j - 1], name));
     }
 
     // +1 for the leading extra slash.
@@ -139,8 +138,7 @@
                                    const std::string& origin_name) {
   if (base::PathExists(file_system_dir.Append(
           SandboxPrioritizedOriginDatabase::kPrimaryOriginFile))) {
-    return base::FilePath(
-        SandboxPrioritizedOriginDatabase::kPrimaryDirectory);
+    return base::FilePath(SandboxPrioritizedOriginDatabase::kPrimaryDirectory);
   }
 
   SandboxOriginDatabase origin_db(file_system_dir, nullptr);
@@ -151,8 +149,8 @@
   }
 
   if (!origin_db.GetPathForOrigin(origin_name, &origin_dir)) {
-    ShowMessageAndExit("Failed to get path of origin " + origin_name +
-                       " in " + FilePathToString(file_system_dir));
+    ShowMessageAndExit("Failed to get path of origin " + origin_name + " in " +
+                       FilePathToString(file_system_dir));
   }
 
   return origin_dir;
diff --git a/storage/browser/fileapi/external_mount_points.cc b/storage/browser/file_system/external_mount_points.cc
similarity index 93%
rename from storage/browser/fileapi/external_mount_points.cc
rename to storage/browser/file_system/external_mount_points.cc
index 601a2183..8fa5324 100644
--- a/storage/browser/fileapi/external_mount_points.cc
+++ b/storage/browser/file_system/external_mount_points.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 #include <memory>
 
 #include "base/files/file_path.h"
 #include "base/lazy_instance.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace {
 
@@ -129,8 +129,8 @@
   return true;
 }
 
-bool ExternalMountPoints::GetRegisteredPath(
-    const std::string& filesystem_id, base::FilePath* path) const {
+bool ExternalMountPoints::GetRegisteredPath(const std::string& filesystem_id,
+                                            base::FilePath* path) const {
   DCHECK(path);
   base::AutoLock locker(lock_);
   auto found = instance_map_.find(filesystem_id);
@@ -270,10 +270,9 @@
       return FileSystemURL();
 #else
     // On other OS, it is simply a native local path.
-    return FileSystemURL(
-        url.origin(), url.mount_type(), url.virtual_path(),
-        url.mount_filesystem_id(), kFileSystemTypeNativeLocal,
-        url.path(), url.filesystem_id(), url.mount_option());
+    return FileSystemURL(url.origin(), url.mount_type(), url.virtual_path(),
+                         url.mount_filesystem_id(), kFileSystemTypeNativeLocal,
+                         url.path(), url.filesystem_id(), url.mount_option());
 #endif
   }
 
@@ -283,16 +282,16 @@
   base::FilePath cracked_path;
   FileSystemMountOption cracked_mount_option;
 
-  if (!CrackVirtualPath(virtual_path, &mount_name, &cracked_type,
-                        &cracked_id, &cracked_path, &cracked_mount_option)) {
+  if (!CrackVirtualPath(virtual_path, &mount_name, &cracked_type, &cracked_id,
+                        &cracked_path, &cracked_mount_option)) {
     return FileSystemURL();
   }
 
   return FileSystemURL(
       url.origin(), url.mount_type(), url.virtual_path(),
       !url.filesystem_id().empty() ? url.filesystem_id() : mount_name,
-      cracked_type, cracked_path,
-      cracked_id.empty() ? mount_name : cracked_id, cracked_mount_option);
+      cracked_type, cracked_path, cracked_id.empty() ? mount_name : cracked_id,
+      cracked_mount_option);
 }
 
 bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name,
diff --git a/storage/browser/fileapi/external_mount_points.h b/storage/browser/file_system/external_mount_points.h
similarity index 92%
rename from storage/browser/fileapi/external_mount_points.h
rename to storage/browser/file_system/external_mount_points.h
index a793823f..fdb4029 100644
--- a/storage/browser/fileapi/external_mount_points.h
+++ b/storage/browser/file_system/external_mount_points.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_
-#define STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_EXTERNAL_MOUNT_POINTS_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_EXTERNAL_MOUNT_POINTS_H_
 
 #include <map>
 #include <memory>
@@ -14,7 +14,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/synchronization/lock.h"
-#include "storage/browser/fileapi/mount_points.h"
+#include "storage/browser/file_system/mount_points.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_types.h"
 
@@ -106,10 +106,9 @@
   // Returns the virtual root path that looks like /<mount_name>.
   base::FilePath CreateVirtualRootPath(const std::string& mount_name) const;
 
-  FileSystemURL CreateExternalFileSystemURL(
-      const GURL& origin,
-      const std::string& mount_name,
-      const base::FilePath& path) const;
+  FileSystemURL CreateExternalFileSystemURL(const GURL& origin,
+                                            const std::string& mount_name,
+                                            const base::FilePath& path) const;
 
   // Revoke all registered filesystems. Used only by testing (for clean-ups).
   void RevokeAllFileSystems();
@@ -155,4 +154,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_EXTERNAL_MOUNT_POINTS_H_
diff --git a/storage/browser/fileapi/external_mount_points_unittest.cc b/storage/browser/file_system/external_mount_points_unittest.cc
similarity index 81%
rename from storage/browser/fileapi/external_mount_points_unittest.cc
rename to storage/browser/file_system/external_mount_points_unittest.cc
index 7c768b1..6cb4640 100644
--- a/storage/browser/fileapi/external_mount_points_unittest.cc
+++ b/storage/browser/file_system/external_mount_points_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/file_system/external_mount_points.h"
 
 #include <stddef.h>
 
@@ -11,7 +11,7 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/stl_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -95,7 +95,7 @@
     {"root", DRIVE FPL("/"), false, nullptr},
     // Path contains .. component.
     {"funky", DRIVE FPL("/tt/fun/../funky"), false, nullptr},
-    // Windows separators.
+  // Windows separators.
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
     {"win", DRIVE FPL("\\try\\separators\\win"), true,
      DRIVE FPL("\\try\\separators\\win")},
@@ -137,33 +137,27 @@
   scoped_refptr<storage::ExternalMountPoints> mount_points(
       storage::ExternalMountPoints::CreateRefCounted());
 
-  mount_points->RegisterFileSystem("c",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("c", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/a/b/c")));
   // Note that "/a/b/c" < "/a/b/c(1)" < "/a/b/c/".
-  mount_points->RegisterFileSystem("c(1)",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("c(1)", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/a/b/c(1)")));
-  mount_points->RegisterFileSystem("x",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("x", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/z/y/x")));
-  mount_points->RegisterFileSystem("o",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("o", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/m/n/o")));
   // A mount point whose name does not match its path base name.
-  mount_points->RegisterFileSystem("mount",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("mount", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/root/foo")));
   // A mount point with an empty path.
-  mount_points->RegisterFileSystem("empty_path",
-                                   storage::kFileSystemTypeNativeLocal,
-                                   storage::FileSystemMountOption(),
-                                   base::FilePath());
+  mount_points->RegisterFileSystem(
+      "empty_path", storage::kFileSystemTypeNativeLocal,
+      storage::FileSystemMountOption(), base::FilePath());
 
   struct TestCase {
     const base::FilePath::CharType* const local_path;
@@ -173,46 +167,46 @@
 
   const TestCase kTestCases[] = {
     // Empty path.
-    { FPL(""), false, FPL("") },
+    {FPL(""), false, FPL("")},
     // No registered mount point (but is parent to a mount point).
-    { DRIVE FPL("/a/b"), false, FPL("") },
+    {DRIVE FPL("/a/b"), false, FPL("")},
     // No registered mount point (but is parent to a mount point).
-    { DRIVE FPL("/z/y"), false, FPL("") },
+    {DRIVE FPL("/z/y"), false, FPL("")},
     // No registered mount point (but is parent to a mount point).
-    { DRIVE FPL("/m/n"), false, FPL("") },
+    {DRIVE FPL("/m/n"), false, FPL("")},
     // No registered mount point.
-    { DRIVE FPL("/foo/mount"), false, FPL("") },
+    {DRIVE FPL("/foo/mount"), false, FPL("")},
     // An existing mount point path is substring.
-    { DRIVE FPL("/a/b/c1"), false, FPL("") },
+    {DRIVE FPL("/a/b/c1"), false, FPL("")},
     // No leading /.
-    { DRIVE FPL("a/b/c"), false, FPL("") },
+    {DRIVE FPL("a/b/c"), false, FPL("")},
     // Sibling to a root path.
-    { DRIVE FPL("/a/b/d/e"), false, FPL("") },
+    {DRIVE FPL("/a/b/d/e"), false, FPL("")},
     // Sibling to a root path.
-    { DRIVE FPL("/z/y/v/u"), false, FPL("") },
+    {DRIVE FPL("/z/y/v/u"), false, FPL("")},
     // Sibling to a root path.
-    { DRIVE FPL("/m/n/p/q"), false, FPL("") },
+    {DRIVE FPL("/m/n/p/q"), false, FPL("")},
     // Mount point root path.
-    { DRIVE FPL("/a/b/c"), true, FPL("c") },
+    {DRIVE FPL("/a/b/c"), true, FPL("c")},
     // Mount point root path.
-    { DRIVE FPL("/z/y/x"), true, FPL("x") },
+    {DRIVE FPL("/z/y/x"), true, FPL("x")},
     // Mount point root path.
-    { DRIVE FPL("/m/n/o"), true, FPL("o") },
+    {DRIVE FPL("/m/n/o"), true, FPL("o")},
     // Mount point child path.
-    { DRIVE FPL("/a/b/c/d/e"), true, FPL("c/d/e") },
+    {DRIVE FPL("/a/b/c/d/e"), true, FPL("c/d/e")},
     // Mount point child path.
-    { DRIVE FPL("/z/y/x/v/u"), true, FPL("x/v/u") },
+    {DRIVE FPL("/z/y/x/v/u"), true, FPL("x/v/u")},
     // Mount point child path.
-    { DRIVE FPL("/m/n/o/p/q"), true, FPL("o/p/q") },
+    {DRIVE FPL("/m/n/o/p/q"), true, FPL("o/p/q")},
     // Name doesn't match mount point path base name.
-    { DRIVE FPL("/root/foo/a/b/c"), true, FPL("mount/a/b/c") },
-    { DRIVE FPL("/root/foo"), true, FPL("mount") },
+    {DRIVE FPL("/root/foo/a/b/c"), true, FPL("mount/a/b/c")},
+    {DRIVE FPL("/root/foo"), true, FPL("mount")},
     // Mount point contains character whose ASCII code is smaller than file path
     // separator's.
-    { DRIVE FPL("/a/b/c(1)/d/e"), true, FPL("c(1)/d/e") },
+    {DRIVE FPL("/a/b/c(1)/d/e"), true, FPL("c(1)/d/e")},
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
     // Path with win separators mixed in.
-    { DRIVE FPL("/a\\b\\c/d"), true, FPL("c/d") },
+    {DRIVE FPL("/a\\b\\c/d"), true, FPL("c/d")},
 #endif
   };
 
@@ -273,20 +267,16 @@
   const url::Origin kTestOrigin =
       url::Origin::Create(GURL("http://chromium.org"));
 
-  mount_points->RegisterFileSystem("c",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("c", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/a/b/c")));
-  mount_points->RegisterFileSystem("c(1)",
-                                   storage::kFileSystemTypeDrive,
+  mount_points->RegisterFileSystem("c(1)", storage::kFileSystemTypeDrive,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/a/b/c(1)")));
-  mount_points->RegisterFileSystem("empty_path",
-                                   storage::kFileSystemTypeSyncable,
-                                   storage::FileSystemMountOption(),
-                                   base::FilePath());
-  mount_points->RegisterFileSystem("mount",
-                                   storage::kFileSystemTypeDrive,
+  mount_points->RegisterFileSystem(
+      "empty_path", storage::kFileSystemTypeSyncable,
+      storage::FileSystemMountOption(), base::FilePath());
+  mount_points->RegisterFileSystem("mount", storage::kFileSystemTypeDrive,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/root")));
 
@@ -301,8 +291,7 @@
 
   // Try native local which is not cracked.
   FileSystemURL native_local = mount_points->CreateCrackedFileSystemURL(
-      kTestOrigin,
-      storage::kFileSystemTypeNativeLocal,
+      kTestOrigin, storage::kFileSystemTypeNativeLocal,
       base::FilePath(FPL("c")));
   EXPECT_FALSE(native_local.is_valid());
 
@@ -350,8 +339,7 @@
 
   for (size_t i = 0; i < base::size(kTestCases); ++i) {
     FileSystemURL cracked = mount_points->CreateCrackedFileSystemURL(
-        kTestOrigin,
-        storage::kFileSystemTypeExternal,
+        kTestOrigin, storage::kFileSystemTypeExternal,
         base::FilePath(kTestCases[i].path));
 
     EXPECT_EQ(kTestCases[i].expect_valid, cracked.is_valid())
@@ -360,15 +348,15 @@
     if (!kTestCases[i].expect_valid)
       continue;
 
-    EXPECT_EQ(kTestOrigin, cracked.origin())
-        << "Test case index: " << i;
+    EXPECT_EQ(kTestOrigin, cracked.origin()) << "Test case index: " << i;
     EXPECT_EQ(kTestCases[i].expect_type, cracked.type())
         << "Test case index: " << i;
-    EXPECT_EQ(base::FilePath(
-        kTestCases[i].expect_path).NormalizePathSeparators(), cracked.path())
+    EXPECT_EQ(
+        base::FilePath(kTestCases[i].expect_path).NormalizePathSeparators(),
+        cracked.path())
         << "Test case index: " << i;
     EXPECT_EQ(base::FilePath(kTestCases[i].path).NormalizePathSeparators(),
-                       cracked.virtual_path())
+              cracked.virtual_path())
         << "Test case index: " << i;
     EXPECT_EQ(kTestCases[i].expect_fs_id, cracked.filesystem_id())
         << "Test case index: " << i;
@@ -383,20 +371,16 @@
 
   const GURL kTestOrigin("http://chromium.org");
 
-  mount_points->RegisterFileSystem("c",
-                                   storage::kFileSystemTypeNativeLocal,
+  mount_points->RegisterFileSystem("c", storage::kFileSystemTypeNativeLocal,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/a/b/c")));
-  mount_points->RegisterFileSystem("c(1)",
-                                   storage::kFileSystemTypeDrive,
+  mount_points->RegisterFileSystem("c(1)", storage::kFileSystemTypeDrive,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/a/b/c(1)")));
-  mount_points->RegisterFileSystem("empty_path",
-                                   storage::kFileSystemTypeSyncable,
-                                   storage::FileSystemMountOption(),
-                                   base::FilePath());
-  mount_points->RegisterFileSystem("mount",
-                                   storage::kFileSystemTypeDrive,
+  mount_points->RegisterFileSystem(
+      "empty_path", storage::kFileSystemTypeSyncable,
+      storage::FileSystemMountOption(), base::FilePath());
+  mount_points->RegisterFileSystem("mount", storage::kFileSystemTypeDrive,
                                    storage::FileSystemMountOption(),
                                    base::FilePath(DRIVE FPL("/root")));
 
@@ -449,9 +433,9 @@
     base::FilePath cracked_path;
     storage::FileSystemMountOption cracked_option;
     EXPECT_EQ(kTestCases[i].expect_valid,
-              mount_points->CrackVirtualPath(base::FilePath(kTestCases[i].path),
-                  &cracked_name, &cracked_type, &cracked_id, &cracked_path,
-                  &cracked_option))
+              mount_points->CrackVirtualPath(
+                  base::FilePath(kTestCases[i].path), &cracked_name,
+                  &cracked_type, &cracked_id, &cracked_path, &cracked_option))
         << "Test case index: " << i;
 
     if (!kTestCases[i].expect_valid)
@@ -459,8 +443,9 @@
 
     EXPECT_EQ(kTestCases[i].expect_type, cracked_type)
         << "Test case index: " << i;
-    EXPECT_EQ(base::FilePath(
-        kTestCases[i].expect_path).NormalizePathSeparators(), cracked_path)
+    EXPECT_EQ(
+        base::FilePath(kTestCases[i].expect_path).NormalizePathSeparators(),
+        cracked_path)
         << "Test case index: " << i;
     EXPECT_EQ(kTestCases[i].expect_name, cracked_name)
         << "Test case index: " << i;
@@ -489,16 +474,15 @@
   std::string cracked_id;
   storage::FileSystemMountOption option;
   base::FilePath path;
-  EXPECT_TRUE(mount_points->CrackVirtualPath(
-      base::FilePath(FPL("nosync/file")), &name, &type, &cracked_id, &path,
-      &option));
+  EXPECT_TRUE(mount_points->CrackVirtualPath(base::FilePath(FPL("nosync/file")),
+                                             &name, &type, &cracked_id, &path,
+                                             &option));
   EXPECT_EQ(storage::FlushPolicy::NO_FLUSH_ON_COMPLETION,
             option.flush_policy());
-  EXPECT_TRUE(mount_points->CrackVirtualPath(
-      base::FilePath(FPL("sync/file")), &name, &type, &cracked_id, &path,
-      &option));
+  EXPECT_TRUE(mount_points->CrackVirtualPath(base::FilePath(FPL("sync/file")),
+                                             &name, &type, &cracked_id, &path,
+                                             &option));
   EXPECT_EQ(storage::FlushPolicy::FLUSH_ON_COMPLETION, option.flush_policy());
 }
 
 }  // namespace content
-
diff --git a/storage/browser/fileapi/file_observers.h b/storage/browser/file_system/file_observers.h
similarity index 94%
rename from storage/browser/fileapi/file_observers.h
rename to storage/browser/file_system/file_observers.h
index 901e2a1..7384cc5 100644
--- a/storage/browser/fileapi/file_observers.h
+++ b/storage/browser/file_system/file_observers.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_OBSERVERS_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_OBSERVERS_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_OBSERVERS_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_OBSERVERS_H_
 
 #include <stdint.h>
 
@@ -82,4 +82,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_OBSERVERS_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_OBSERVERS_H_
diff --git a/storage/browser/fileapi/file_permission_policy.h b/storage/browser/file_system/file_permission_policy.h
similarity index 76%
rename from storage/browser/fileapi/file_permission_policy.h
rename to storage/browser/file_system/file_permission_policy.h
index 88c2ee84..988d3f2 100644
--- a/storage/browser/fileapi/file_permission_policy.h
+++ b/storage/browser/file_system/file_permission_policy.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_PERMISSION_POLICY_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_PERMISSION_POLICY_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_PERMISSION_POLICY_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_PERMISSION_POLICY_H_
 
 namespace storage {
 
@@ -23,4 +23,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_PERMISSION_POLICY_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_PERMISSION_POLICY_H_
diff --git a/storage/browser/fileapi/file_stream_reader.cc b/storage/browser/file_system/file_stream_reader.cc
similarity index 93%
rename from storage/browser/fileapi/file_stream_reader.cc
rename to storage/browser/file_system/file_stream_reader.cc
index db237a1..73a0a3a 100644
--- a/storage/browser/fileapi/file_stream_reader.cc
+++ b/storage/browser/file_system/file_stream_reader.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 
 #include <stdint.h>
 
diff --git a/storage/browser/fileapi/file_stream_reader.h b/storage/browser/file_system/file_stream_reader.h
similarity index 95%
rename from storage/browser/fileapi/file_stream_reader.h
rename to storage/browser/file_system/file_stream_reader.h
index 6c987a0..c293e529 100644
--- a/storage/browser/fileapi/file_stream_reader.h
+++ b/storage/browser/file_system/file_stream_reader.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BLOB_FILE_STREAM_READER_H_
-#define STORAGE_BLOB_FILE_STREAM_READER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_READER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_READER_H_
 
 #include <stdint.h>
 
@@ -19,7 +19,7 @@
 class FilePath;
 class TaskRunner;
 class Time;
-}
+}  // namespace base
 
 namespace net {
 class IOBuffer;
@@ -29,7 +29,7 @@
 class FileSystemContext;
 class FileSystemURL;
 class ObfuscatedFileUtilMemoryDelegate;
-}
+}  // namespace storage
 
 namespace storage {
 
@@ -120,4 +120,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BLOB_FILE_STREAM_READER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_READER_H_
diff --git a/storage/browser/fileapi/file_stream_test_utils.cc b/storage/browser/file_system/file_stream_test_utils.cc
similarity index 91%
rename from storage/browser/fileapi/file_stream_test_utils.cc
rename to storage/browser/file_system/file_stream_test_utils.cc
index 127fee1..835a423 100644
--- a/storage/browser/fileapi/file_stream_test_utils.cc
+++ b/storage/browser/file_system/file_stream_test_utils.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_stream_test_utils.h"
+#include "storage/browser/file_system/file_stream_test_utils.h"
 
 #include <string>
 #include <utility>
@@ -10,8 +10,8 @@
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "net/base/test_completion_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace storage {
diff --git a/storage/browser/fileapi/file_stream_test_utils.h b/storage/browser/file_system/file_stream_test_utils.h
similarity index 81%
rename from storage/browser/fileapi/file_stream_test_utils.h
rename to storage/browser/file_system/file_stream_test_utils.h
index ed67e09..5714f7a 100644
--- a/storage/browser/fileapi/file_stream_test_utils.h
+++ b/storage/browser/file_system/file_stream_test_utils.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_STREAM_TEST_UTILS_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_STREAM_TEST_UTILS_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_TEST_UTILS_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_TEST_UTILS_H_
 
 #include <string>
 
@@ -26,4 +26,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_STREAM_TEST_UTILS_H_
\ No newline at end of file
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_TEST_UTILS_H_
\ No newline at end of file
diff --git a/storage/browser/fileapi/file_stream_writer.h b/storage/browser/file_system/file_stream_writer.h
similarity index 95%
rename from storage/browser/fileapi/file_stream_writer.h
rename to storage/browser/file_system/file_stream_writer.h
index 0e976db..62d5023a 100644
--- a/storage/browser/fileapi/file_stream_writer.h
+++ b/storage/browser/file_system/file_stream_writer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_WRITER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_WRITER_H_
 
 #include <stdint.h>
 
@@ -16,7 +16,7 @@
 namespace base {
 class FilePath;
 class TaskRunner;
-}
+}  // namespace base
 
 namespace net {
 class IOBuffer;
@@ -107,4 +107,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_STREAM_WRITER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_STREAM_WRITER_H_
diff --git a/storage/browser/fileapi/file_system_backend.h b/storage/browser/file_system/file_system_backend.h
similarity index 93%
rename from storage/browser/fileapi/file_system_backend.h
rename to storage/browser/file_system/file_system_backend.h
index e811f95..f796b071 100644
--- a/storage/browser/fileapi/file_system_backend.h
+++ b/storage/browser/file_system/file_system_backend.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_BACKEND_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_BACKEND_H_
 
 #include <stdint.h>
 
@@ -16,9 +16,9 @@
 #include "base/component_export.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
-#include "storage/browser/fileapi/open_file_system_mode.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_permission_policy.h"
+#include "storage/browser/file_system/open_file_system_mode.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 class GURL;
@@ -86,7 +86,8 @@
   // and |type|.  If |error_code| is File::FILE_OK and the result is nullptr,
   // then no validator is required.
   virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
-      FileSystemType type, base::File::Error* error_code) = 0;
+      FileSystemType type,
+      base::File::Error* error_code) = 0;
 
   // Returns a new instance of the specialized FileSystemOperation for this
   // backend based on the given triplet of |origin_url|, |file_system_type|
@@ -171,8 +172,7 @@
       const std::string& extension_id,
       const base::FilePath& virtual_path) = 0;
   // Revokes file access from extension identified with |extension_id|.
-  virtual void RevokeAccessForExtension(
-        const std::string& extension_id) = 0;
+  virtual void RevokeAccessForExtension(const std::string& extension_id) = 0;
   // Gets virtual path by known filesystem path. Returns false when filesystem
   // path is not exposed by this provider.
   virtual bool GetVirtualPath(const base::FilePath& file_system_path,
@@ -192,4 +192,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_BACKEND_H_
diff --git a/storage/browser/fileapi/file_system_context.cc b/storage/browser/file_system/file_system_context.cc
similarity index 90%
rename from storage/browser/fileapi/file_system_context.cc
rename to storage/browser/file_system/file_system_context.cc
index 9558876..b384e6a4 100644
--- a/storage/browser/fileapi/file_system_context.cc
+++ b/storage/browser/file_system/file_system_context.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -19,21 +19,21 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/util/type_safety/pass_key.h"
 #include "net/url_request/url_request.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_permission_policy.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_options.h"
-#include "storage/browser/fileapi/file_system_quota_client.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/isolated_file_system_backend.h"
-#include "storage/browser/fileapi/mount_points.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_permission_policy.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_options.h"
+#include "storage/browser/file_system/file_system_quota_client.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/isolated_file_system_backend.h"
+#include "storage/browser/file_system/mount_points.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/browser/quota/special_storage_policy.h"
 #include "storage/common/fileapi/file_system_info.h"
@@ -105,8 +105,7 @@
       return FILE_PERMISSION_USE_FILE_PERMISSION;
 
     case kFileSystemTypeRestrictedNativeLocal:
-      return FILE_PERMISSION_READ_ONLY |
-             FILE_PERMISSION_USE_FILE_PERMISSION;
+      return FILE_PERMISSION_READ_ONLY | FILE_PERMISSION_USE_FILE_PERMISSION;
 
     case kFileSystemTypeDeviceMedia:
     case kFileSystemTypeNativeMedia:
@@ -254,16 +253,15 @@
   operation_runner_->Shutdown();
 }
 
-FileSystemQuotaUtil*
-FileSystemContext::GetQuotaUtil(FileSystemType type) const {
+FileSystemQuotaUtil* FileSystemContext::GetQuotaUtil(
+    FileSystemType type) const {
   FileSystemBackend* backend = GetFileSystemBackend(type);
   if (!backend)
     return nullptr;
   return backend->GetQuotaUtil();
 }
 
-AsyncFileUtil* FileSystemContext::GetAsyncFileUtil(
-    FileSystemType type) const {
+AsyncFileUtil* FileSystemContext::GetAsyncFileUtil(FileSystemType type) const {
   FileSystemBackend* backend = GetFileSystemBackend(type);
   if (!backend)
     return nullptr;
@@ -272,14 +270,14 @@
 
 CopyOrMoveFileValidatorFactory*
 FileSystemContext::GetCopyOrMoveFileValidatorFactory(
-    FileSystemType type, base::File::Error* error_code) const {
+    FileSystemType type,
+    base::File::Error* error_code) const {
   DCHECK(error_code);
   *error_code = base::File::FILE_OK;
   FileSystemBackend* backend = GetFileSystemBackend(type);
   if (!backend)
     return nullptr;
-  return backend->GetCopyOrMoveFileValidatorFactory(
-      type, error_code);
+  return backend->GetCopyOrMoveFileValidatorFactory(type, error_code);
 }
 
 FileSystemBackend* FileSystemContext::GetFileSystemBackend(
@@ -330,8 +328,7 @@
   return types;
 }
 
-ExternalFileSystemBackend*
-FileSystemContext::external_backend() const {
+ExternalFileSystemBackend* FileSystemContext::external_backend() const {
   return static_cast<ExternalFileSystemBackend*>(
       GetFileSystemBackend(kFileSystemTypeExternal));
 }
@@ -441,22 +438,22 @@
     int64_t max_bytes_to_read,
     const base::Time& expected_modification_time) {
   if (!url.is_valid())
-    return std::unique_ptr<storage::FileStreamReader>();
+    return nullptr;
   FileSystemBackend* backend = GetFileSystemBackend(url.type());
   if (!backend)
-    return std::unique_ptr<storage::FileStreamReader>();
-  return backend->CreateFileStreamReader(
-      url, offset, max_bytes_to_read, expected_modification_time, this);
+    return nullptr;
+  return backend->CreateFileStreamReader(url, offset, max_bytes_to_read,
+                                         expected_modification_time, this);
 }
 
 std::unique_ptr<FileStreamWriter> FileSystemContext::CreateFileStreamWriter(
     const FileSystemURL& url,
     int64_t offset) {
   if (!url.is_valid())
-    return std::unique_ptr<FileStreamWriter>();
+    return nullptr;
   FileSystemBackend* backend = GetFileSystemBackend(url.type());
   if (!backend)
-    return std::unique_ptr<FileStreamWriter>();
+    return nullptr;
   return backend->CreateFileStreamWriter(url, offset, this);
 }
 
@@ -513,7 +510,8 @@
 }
 
 FileSystemOperation* FileSystemContext::CreateFileSystemOperation(
-    const FileSystemURL& url, base::File::Error* error_code) {
+    const FileSystemURL& url,
+    base::File::Error* error_code) {
   if (!url.is_valid()) {
     if (error_code)
       *error_code = base::File::FILE_ERROR_INVALID_URL;
@@ -565,10 +563,10 @@
 
 void FileSystemContext::RegisterBackend(FileSystemBackend* backend) {
   const FileSystemType mount_types[] = {
-    kFileSystemTypeTemporary,
-    kFileSystemTypePersistent,
-    kFileSystemTypeIsolated,
-    kFileSystemTypeExternal,
+      kFileSystemTypeTemporary,
+      kFileSystemTypePersistent,
+      kFileSystemTypeIsolated,
+      kFileSystemTypeExternal,
   };
   // Register file system backends for public mount types.
   for (const auto& mount_type : mount_types) {
@@ -583,8 +581,8 @@
        t < kFileSystemInternalTypeEnumEnd; ++t) {
     FileSystemType type = static_cast<FileSystemType>(t);
     if (backend->CanHandleType(type)) {
-      const bool inserted = backend_map_.insert(
-          std::make_pair(type, backend)).second;
+      const bool inserted =
+          backend_map_.insert(std::make_pair(type, backend)).second;
       DCHECK(inserted);
     }
   }
@@ -604,8 +602,8 @@
     return;
   }
 
-  storage::FileSystemInfo info(
-      filesystem_name, filesystem_root, url.mount_type());
+  storage::FileSystemInfo info(filesystem_name, filesystem_root,
+                               url.mount_type());
 
   // Extract the virtual path not containing a filesystem type part from |url|.
   base::FilePath parent = CrackURL(filesystem_root).virtual_path();
diff --git a/storage/browser/fileapi/file_system_context.h b/storage/browser/file_system/file_system_context.h
similarity index 94%
rename from storage/browser/fileapi/file_system_context.h
rename to storage/browser/file_system/file_system_context.h
index c609cd8..89b821cf 100644
--- a/storage/browser/fileapi/file_system_context.h
+++ b/storage/browser/file_system/file_system_context.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_CONTEXT_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_CONTEXT_H_
 
 #include <stdint.h>
 
@@ -20,18 +20,18 @@
 #include "base/sequenced_task_runner_helpers.h"
 #include "base/threading/sequence_bound.h"
 #include "build/build_config.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/open_file_system_mode.h"
-#include "storage/browser/fileapi/plugin_private_file_system_backend.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/open_file_system_mode.h"
+#include "storage/browser/file_system/plugin_private_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace base {
 class FilePath;
 class SequencedTaskRunner;
 class SingleThreadTaskRunner;
-}
+}  // namespace base
 
 namespace leveleb {
 class Env;
@@ -153,13 +153,13 @@
   // |type|.  If |error_code| is File::FILE_OK and the result is nullptr,
   // then no validator is required.
   CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
-      FileSystemType type, base::File::Error* error_code) const;
+      FileSystemType type,
+      base::File::Error* error_code) const;
 
   // Returns the file system backend instance for the given |type|.
   // This may return nullptr if it is given an invalid or unsupported filesystem
   // type.
-  FileSystemBackend* GetFileSystemBackend(
-      FileSystemType type) const;
+  FileSystemBackend* GetFileSystemBackend(FileSystemType type) const;
 
   // Returns the watcher manager for the given |type|.
   // This may return nullptr if the type does not support watching.
@@ -327,9 +327,8 @@
   // depending on the filesystem type pointed by the |url|.
   //
   // Called by FileSystemOperationRunner.
-  FileSystemOperation* CreateFileSystemOperation(
-      const FileSystemURL& url,
-      base::File::Error* error_code);
+  FileSystemOperation* CreateFileSystemOperation(const FileSystemURL& url,
+                                                 base::File::Error* error_code);
 
   // For non-cracked isolated and external mount points, returns a FileSystemURL
   // created by cracking |url|. The url is cracked using MountPoints registered
@@ -408,4 +407,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_CONTEXT_H_
diff --git a/storage/browser/fileapi/file_system_context_unittest.cc b/storage/browser/file_system/file_system_context_unittest.cc
similarity index 98%
rename from storage/browser/fileapi/file_system_context_unittest.cc
rename to storage/browser/file_system/file_system_context_unittest.cc
index b2d0c68..7a39c23 100644
--- a/storage/browser/fileapi/file_system_context_unittest.cc
+++ b/storage/browser/file_system/file_system_context_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 #include <stddef.h>
 
@@ -13,9 +13,9 @@
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "build/build_config.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "storage/browser/test/mock_quota_manager.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_options.h"
diff --git a/storage/browser/fileapi/file_system_file_stream_reader.cc b/storage/browser/file_system/file_system_file_stream_reader.cc
similarity index 93%
rename from storage/browser/fileapi/file_system_file_stream_reader.cc
rename to storage/browser/file_system/file_system_file_stream_reader.cc
index 8657f56..a30f90ad 100644
--- a/storage/browser/fileapi/file_system_file_stream_reader.cc
+++ b/storage/browser/file_system/file_system_file_stream_reader.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_file_stream_reader.h"
+#include "storage/browser/file_system/file_system_file_stream_reader.h"
 
 #include <stdint.h>
 
@@ -14,10 +14,10 @@
 #include "net/base/file_stream.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
-#include "storage/browser/fileapi/plugin_private_file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/plugin_private_file_system_backend.h"
 
 using storage::FileStreamReader;
 
diff --git a/storage/browser/fileapi/file_system_file_stream_reader.h b/storage/browser/file_system/file_system_file_stream_reader.h
similarity index 88%
rename from storage/browser/fileapi/file_system_file_stream_reader.h
rename to storage/browser/file_system/file_system_file_stream_reader.h
index 1132df7..651562b 100644
--- a/storage/browser/fileapi/file_system_file_stream_reader.h
+++ b/storage/browser/file_system/file_system_file_stream_reader.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_FILE_STREAM_READER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_FILE_STREAM_READER_H_
 
 #include <stdint.h>
 
@@ -17,8 +17,8 @@
 #include "base/time/time.h"
 #include "net/base/completion_once_callback.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace base {
 class FilePath;
@@ -84,4 +84,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_FILE_STREAM_READER_H_
diff --git a/storage/browser/fileapi/file_system_file_stream_reader_unittest.cc b/storage/browser/file_system/file_system_file_stream_reader_unittest.cc
similarity index 90%
rename from storage/browser/fileapi/file_system_file_stream_reader_unittest.cc
rename to storage/browser/file_system/file_system_file_stream_reader_unittest.cc
index 0020d60..e8ed6fb 100644
--- a/storage/browser/fileapi/file_system_file_stream_reader_unittest.cc
+++ b/storage/browser/file_system/file_system_file_stream_reader_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_file_stream_reader.h"
+#include "storage/browser/file_system/file_system_file_stream_reader.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -20,10 +20,10 @@
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "net/base/test_completion_callback.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_stream_test_utils.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_stream_test_utils.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -43,7 +43,9 @@
 const char kTestData[] = "0123456789";
 const int kTestDataSize = base::size(kTestData) - 1;
 
-void NeverCalled(int unused) { ADD_FAILURE(); }
+void NeverCalled(int unused) {
+  ADD_FAILURE();
+}
 
 }  // namespace
 
@@ -74,10 +76,9 @@
       const std::string& file_name,
       int64_t initial_offset,
       const base::Time& expected_modification_time) {
-    return new FileSystemFileStreamReader(file_system_context_.get(),
-                                          GetFileSystemURL(file_name),
-                                          initial_offset,
-                                          expected_modification_time);
+    return new FileSystemFileStreamReader(
+        file_system_context_.get(), GetFileSystemURL(file_name), initial_offset,
+        expected_modification_time);
   }
 
   base::Time test_file_modification_time() const {
@@ -96,8 +97,8 @@
 
     base::File::Info file_info;
     ASSERT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::GetMetadata(
-                  file_system_context_.get(), url, &file_info));
+              AsyncFileTestHelper::GetMetadata(file_system_context_.get(), url,
+                                               &file_info));
     if (modification_time)
       *modification_time = file_info.last_modified;
   }
@@ -111,8 +112,7 @@
 
   FileSystemURL GetFileSystemURL(const std::string& file_name) {
     return file_system_context_->CreateCrackedFileSystemURL(
-        GURL(kURLOrigin),
-        storage::kFileSystemTypeTemporary,
+        GURL(kURLOrigin), storage::kFileSystemTypeTemporary,
         base::FilePath().AppendASCII(file_name));
   }
 
diff --git a/storage/browser/fileapi/file_system_file_util.cc b/storage/browser/file_system/file_system_file_util.cc
similarity index 90%
rename from storage/browser/fileapi/file_system_file_util.cc
rename to storage/browser/file_system/file_system_file_util.cc
index c08695b..e91f58d 100644
--- a/storage/browser/fileapi/file_system_file_util.cc
+++ b/storage/browser/file_system/file_system_file_util.cc
@@ -4,7 +4,7 @@
 
 #include <stdint.h>
 
-#include "storage/browser/fileapi/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_file_util.h"
 
 namespace storage {
 
diff --git a/storage/browser/fileapi/file_system_file_util.h b/storage/browser/file_system/file_system_file_util.h
similarity index 73%
rename from storage/browser/fileapi/file_system_file_util.h
rename to storage/browser/file_system/file_system_file_util.h
index bc4b2b44..18ab01e 100644
--- a/storage/browser/fileapi/file_system_file_util.h
+++ b/storage/browser/file_system/file_system_file_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_FILE_UTIL_H_
 
 #include <stdint.h>
 
@@ -14,7 +14,7 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "storage/browser/blob/scoped_file.h"
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation.h"
 
 namespace base {
 class Time;
@@ -64,33 +64,31 @@
   // Creates or opens a file with the given flags.
   // See header comments for AsyncFileUtil::CreateOrOpen() for more details.
   // This is used only by Pepper/NaCl File API.
-  virtual base::File CreateOrOpen(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      int file_flags) = 0;
+  virtual base::File CreateOrOpen(FileSystemOperationContext* context,
+                                  const FileSystemURL& url,
+                                  int file_flags) = 0;
 
   // Ensures that the given |url| exist.  This creates a empty new file
   // at |url| if the |url| does not exist.
   // See header comments for AsyncFileUtil::EnsureFileExists() for more details.
   virtual base::File::Error EnsureFileExists(
       FileSystemOperationContext* context,
-      const FileSystemURL& url, bool* created) = 0;
+      const FileSystemURL& url,
+      bool* created) = 0;
 
   // Creates directory at given url.
   // See header comments for AsyncFileUtil::CreateDirectory() for more details.
-  virtual base::File::Error CreateDirectory(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      bool exclusive,
-      bool recursive) = 0;
+  virtual base::File::Error CreateDirectory(FileSystemOperationContext* context,
+                                            const FileSystemURL& url,
+                                            bool exclusive,
+                                            bool recursive) = 0;
 
   // Retrieves the information about a file.
   // See header comments for AsyncFileUtil::GetFileInfo() for more details.
-  virtual base::File::Error GetFileInfo(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      base::File::Info* file_info,
-      base::FilePath* platform_path) = 0;
+  virtual base::File::Error GetFileInfo(FileSystemOperationContext* context,
+                                        const FileSystemURL& url,
+                                        base::File::Info* file_info,
+                                        base::FilePath* platform_path) = 0;
 
   // Returns a pointer to a new instance of AbstractFileEnumerator which is
   // implemented for each FileSystemFileUtil subclass. The instance needs to be
@@ -115,11 +113,10 @@
 
   // Updates the file metadata information.
   // See header comments for AsyncFileUtil::Touch() for more details.
-  virtual base::File::Error Touch(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      const base::Time& last_access_time,
-      const base::Time& last_modified_time) = 0;
+  virtual base::File::Error Touch(FileSystemOperationContext* context,
+                                  const FileSystemURL& url,
+                                  const base::Time& last_access_time,
+                                  const base::Time& last_modified_time) = 0;
 
   // Truncates a file to the given length.
   // See header comments for AsyncFileUtil::Truncate() for more details.
@@ -143,32 +140,29 @@
   // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
   //   its parent path is a file.
   //
-  virtual base::File::Error CopyOrMoveFile(
-      FileSystemOperationContext* context,
-      const FileSystemURL& src_url,
-      const FileSystemURL& dest_url,
-      CopyOrMoveOption option,
-      bool copy) = 0;
+  virtual base::File::Error CopyOrMoveFile(FileSystemOperationContext* context,
+                                           const FileSystemURL& src_url,
+                                           const FileSystemURL& dest_url,
+                                           CopyOrMoveOption option,
+                                           bool copy) = 0;
 
   // Copies in a single file from a different filesystem.
   // See header comments for AsyncFileUtil::CopyInForeignFile() for
   // more details.
   virtual base::File::Error CopyInForeignFile(
-        FileSystemOperationContext* context,
-        const base::FilePath& src_file_path,
-        const FileSystemURL& dest_url) = 0;
+      FileSystemOperationContext* context,
+      const base::FilePath& src_file_path,
+      const FileSystemURL& dest_url) = 0;
 
   // Deletes a single file.
   // See header comments for AsyncFileUtil::DeleteFile() for more details.
-  virtual base::File::Error DeleteFile(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url) = 0;
+  virtual base::File::Error DeleteFile(FileSystemOperationContext* context,
+                                       const FileSystemURL& url) = 0;
 
   // Deletes a single empty directory.
   // See header comments for AsyncFileUtil::DeleteDirectory() for more details.
-  virtual base::File::Error DeleteDirectory(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url) = 0;
+  virtual base::File::Error DeleteDirectory(FileSystemOperationContext* context,
+                                            const FileSystemURL& url) = 0;
 
   // Creates a local snapshot file for a given |url| and returns the
   // metadata and platform path of the snapshot file via |callback|.
@@ -191,4 +185,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/file_system_operation.h b/storage/browser/file_system/file_system_operation.h
similarity index 98%
rename from storage/browser/fileapi/file_system_operation.h
rename to storage/browser/file_system/file_system_operation.h
index 450bf98..9259b64 100644
--- a/storage/browser/fileapi/file_system_operation.h
+++ b/storage/browser/file_system/file_system_operation.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_H_
 
 #include <stdint.h>
 
@@ -17,7 +17,7 @@
 #include "base/process/process.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "storage/browser/blob/blob_reader.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
 
 namespace base {
 class Time;
@@ -515,4 +515,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_H_
diff --git a/storage/browser/fileapi/file_system_operation_context.cc b/storage/browser/file_system/file_system_operation_context.cc
similarity index 77%
rename from storage/browser/fileapi/file_system_operation_context.cc
rename to storage/browser/file_system/file_system_operation_context.cc
index 3c727d39..681509ed 100644
--- a/storage/browser/fileapi/file_system_operation_context.cc
+++ b/storage/browser/file_system/file_system_operation_context.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
 
 #include "base/sequenced_task_runner.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace storage {
 
@@ -14,8 +14,7 @@
     : file_system_context_(context),
       task_runner_(file_system_context_->default_file_task_runner()),
       allowed_bytes_growth_(0),
-      quota_limit_type_(storage::kQuotaLimitTypeUnknown) {
-}
+      quota_limit_type_(storage::kQuotaLimitTypeUnknown) {}
 
 FileSystemOperationContext::FileSystemOperationContext(
     FileSystemContext* context,
@@ -23,8 +22,7 @@
     : file_system_context_(context),
       task_runner_(task_runner),
       allowed_bytes_growth_(0),
-      quota_limit_type_(storage::kQuotaLimitTypeUnknown) {
-}
+      quota_limit_type_(storage::kQuotaLimitTypeUnknown) {}
 
 FileSystemOperationContext::~FileSystemOperationContext() {
   DetachFromSequence();
diff --git a/storage/browser/fileapi/file_system_operation_context.h b/storage/browser/file_system/file_system_operation_context.h
similarity index 92%
rename from storage/browser/fileapi/file_system_operation_context.h
rename to storage/browser/file_system/file_system_operation_context.h
index dbaeffe..993d868 100644
--- a/storage/browser/fileapi/file_system_operation_context.h
+++ b/storage/browser/file_system/file_system_operation_context.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_CONTEXT_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_CONTEXT_H_
 
 #include <stdint.h>
 
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "base/supports_user_data.h"
 #include "base/threading/thread_checker.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/browser/quota/quota_limit_type.h"
 
 namespace base {
@@ -97,4 +97,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_CONTEXT_H_
diff --git a/storage/browser/fileapi/file_system_operation_impl.cc b/storage/browser/file_system/file_system_operation_impl.cc
similarity index 97%
rename from storage/browser/fileapi/file_system_operation_impl.cc
rename to storage/browser/file_system/file_system_operation_impl.cc
index 408d2d0..82bbc7d7 100644
--- a/storage/browser/fileapi/file_system_operation_impl.cc
+++ b/storage/browser/file_system/file_system_operation_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_operation_impl.h"
+#include "storage/browser/file_system/file_system_operation_impl.h"
 
 #include <stdint.h>
 
@@ -18,14 +18,14 @@
 #include "net/base/escape.h"
 #include "net/url_request/url_request.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/async_file_util.h"
-#include "storage/browser/fileapi/copy_or_move_operation_delegate.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/remove_operation_delegate.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/async_file_util.h"
+#include "storage/browser/file_system/copy_or_move_operation_delegate.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/remove_operation_delegate.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
diff --git a/storage/browser/fileapi/file_system_operation_impl.h b/storage/browser/file_system/file_system_operation_impl.h
similarity index 94%
rename from storage/browser/fileapi/file_system_operation_impl.h
rename to storage/browser/file_system/file_system_operation_impl.h
index 73847d6c..425b0aa 100644
--- a/storage/browser/fileapi/file_system_operation_impl.h
+++ b/storage/browser/file_system/file_system_operation_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_IMPL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_IMPL_H_
 
 #include <stdint.h>
 
@@ -15,10 +15,10 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "storage/browser/blob/scoped_file.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/file_writer_delegate.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/file_writer_delegate.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
 
 namespace storage {
@@ -209,4 +209,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_IMPL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_IMPL_H_
diff --git a/storage/browser/fileapi/file_system_operation_impl_unittest.cc b/storage/browser/file_system/file_system_operation_impl_unittest.cc
similarity index 95%
rename from storage/browser/fileapi/file_system_operation_impl_unittest.cc
rename to storage/browser/file_system/file_system_operation_impl_unittest.cc
index c35425b..e5bc93d 100644
--- a/storage/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/storage/browser/file_system/file_system_operation_impl_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_operation_impl.h"
+#include "storage/browser/file_system/file_system_operation_impl.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -25,11 +25,11 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/browser/test/async_file_test_helper.h"
@@ -54,8 +54,7 @@
 namespace content {
 
 // Test class for FileSystemOperationImpl.
-class FileSystemOperationImplTest
-    : public testing::Test {
+class FileSystemOperationImplTest : public testing::Test {
  public:
   FileSystemOperationImplTest()
       : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}
@@ -108,8 +107,7 @@
   }
 
   MockQuotaManagerProxy* quota_manager_proxy() {
-    return static_cast<MockQuotaManagerProxy*>(
-        quota_manager_proxy_.get());
+    return static_cast<MockQuotaManagerProxy*>(quota_manager_proxy_.get());
   }
 
   storage::FileSystemFileUtil* file_util() {
@@ -152,8 +150,7 @@
     FileSystemURL url = URLForPath(path);
     bool created = false;
     EXPECT_EQ(base::File::FILE_OK,
-              file_util()->EnsureFileExists(NewContext().get(),
-                                            url, &created));
+              file_util()->EnsureFileExists(NewContext().get(), url, &created));
     EXPECT_TRUE(created);
     return url;
   }
@@ -244,7 +241,7 @@
 
   int64_t GetDataSizeOnDisk() {
     return sandbox_file_system_.ComputeCurrentOriginUsage() -
-        sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
+           sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
   }
 
   void GetUsageAndQuota(int64_t* usage, int64_t* quota) {
@@ -261,8 +258,8 @@
     int64_t base_usage;
     GetUsageAndQuota(&base_usage, nullptr);
 
-    AsyncFileTestHelper::CreateFile(
-        sandbox_file_system_.file_system_context(), url);
+    AsyncFileTestHelper::CreateFile(sandbox_file_system_.file_system_context(),
+                                    url);
     EXPECT_EQ(base::File::FILE_OK, Remove(url, false /* recursive */));
 
     change_observer()->ResetCount();
@@ -302,9 +299,7 @@
     base::RunLoop run_loop;
     update_observer_.Enable();
     operation_runner()->Move(
-        src,
-        dest,
-        option,
+        src, dest, option,
         RecordStatusCallback(run_loop.QuitClosure(), &status));
     run_loop.Run();
     update_observer_.Disable();
@@ -379,9 +374,7 @@
     base::RunLoop run_loop;
     update_observer_.Enable();
     operation_runner()->CreateDirectory(
-        url,
-        exclusive,
-        recursive,
+        url, exclusive, recursive,
         RecordStatusCallback(run_loop.QuitClosure(), &status));
     run_loop.Run();
     update_observer_.Disable();
@@ -450,9 +443,7 @@
     base::RunLoop run_loop;
     update_observer_.Enable();
     operation_runner()->TouchFile(
-        url,
-        last_access_time,
-        last_modified_time,
+        url, last_access_time, last_modified_time,
         RecordStatusCallback(run_loop.QuitClosure(), &status));
     run_loop.Run();
     update_observer_.Disable();
@@ -541,8 +532,7 @@
   // Dest. parent path does not exist.
   FileSystemURL src_dir(CreateDirectory("src"));
   EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
-            Move(src_dir,
-                 URLForPath("nonexistent/deset"),
+            Move(src_dir, URLForPath("nonexistent/deset"),
                  FileSystemOperation::OPTION_NONE));
   EXPECT_TRUE(change_observer()->HasNoChange());
 }
@@ -565,9 +555,8 @@
 TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcFileAndNew) {
   FileSystemURL src_file(CreateFile("src"));
 
-  EXPECT_EQ(
-      base::File::FILE_OK,
-      Move(src_file, URLForPath("new"), FileSystemOperation::OPTION_NONE));
+  EXPECT_EQ(base::File::FILE_OK, Move(src_file, URLForPath("new"),
+                                      FileSystemOperation::OPTION_NONE));
   EXPECT_TRUE(FileExists("new"));
 
   EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count());
@@ -596,9 +585,8 @@
   FileSystemURL src_dir(CreateDirectory("src"));
   FileSystemURL dest_dir(CreateDirectory("dest"));
 
-  EXPECT_EQ(
-      base::File::FILE_OK,
-      Move(src_dir, URLForPath("dest/new"), FileSystemOperation::OPTION_NONE));
+  EXPECT_EQ(base::File::FILE_OK, Move(src_dir, URLForPath("dest/new"),
+                                      FileSystemOperation::OPTION_NONE));
   EXPECT_FALSE(DirectoryExists("src"));
   EXPECT_TRUE(DirectoryExists("dest/new"));
 
@@ -697,8 +685,7 @@
   FileSystemURL src_dir(CreateDirectory("src"));
 
   EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
-            Copy(src_dir,
-                 URLForPath("nonexistent/dest"),
+            Copy(src_dir, URLForPath("nonexistent/dest"),
                  FileSystemOperation::OPTION_NONE));
   EXPECT_TRUE(change_observer()->HasNoChange());
 }
@@ -737,9 +724,8 @@
 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndNew) {
   FileSystemURL src_file(CreateFile("src"));
 
-  EXPECT_EQ(
-      base::File::FILE_OK,
-      Copy(src_file, URLForPath("new"), FileSystemOperation::OPTION_NONE));
+  EXPECT_EQ(base::File::FILE_OK, Copy(src_file, URLForPath("new"),
+                                      FileSystemOperation::OPTION_NONE));
   EXPECT_TRUE(FileExists("new"));
   EXPECT_EQ(4, quota_manager_proxy()->notify_storage_accessed_count());
 
@@ -831,9 +817,8 @@
   GetUsageAndQuota(&before_usage, nullptr);
 
   // Check that the file copied and corresponding usage increased.
-  EXPECT_EQ(
-      base::File::FILE_OK,
-      CopyInForeignFile(src_local_disk_file_path, URLForPath("dest/file")));
+  EXPECT_EQ(base::File::FILE_OK, CopyInForeignFile(src_local_disk_file_path,
+                                                   URLForPath("dest/file")));
 
   EXPECT_EQ(1, change_observer()->create_file_count());
   EXPECT_TRUE(FileExists("dest/file"));
@@ -843,8 +828,8 @@
 
   // Compare contents of src and copied file.
   char buffer[100];
-  EXPECT_EQ(data_size, base::ReadFile(PlatformPath("dest/file"),
-                                      buffer, data_size));
+  EXPECT_EQ(data_size,
+            base::ReadFile(PlatformPath("dest/file"), buffer, data_size));
   for (int i = 0; i < data_size; ++i)
     EXPECT_EQ(test_data[i], buffer[i]);
 }
@@ -896,8 +881,7 @@
   EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
 }
 
-TEST_F(FileSystemOperationImplTest,
-       TestCreateDirFailureDestParentDoesntExist) {
+TEST_F(FileSystemOperationImplTest, TestCreateDirFailureDestParentDoesntExist) {
   // Dest. parent path does not exist.
   EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
             CreateDirectory(URLForPath("nonexistent/dir"), false, false));
@@ -1084,8 +1068,7 @@
 
   char test_data[] = "test data";
   int data_size = static_cast<int>(sizeof(test_data));
-  EXPECT_EQ(data_size,
-            base::WriteFile(platform_path, test_data, data_size));
+  EXPECT_EQ(data_size, base::WriteFile(platform_path, test_data, data_size));
 
   // Check that its length is the size of the data written.
   EXPECT_EQ(
@@ -1164,8 +1147,8 @@
   const base::Time last_accessed = info.last_accessed;
 
   const base::Time new_modified_time = base::Time::UnixEpoch();
-  const base::Time new_accessed_time = new_modified_time +
-      base::TimeDelta::FromHours(77);
+  const base::Time new_accessed_time =
+      new_modified_time + base::TimeDelta::FromHours(77);
   ASSERT_NE(last_modified, new_modified_time);
   ASSERT_NE(last_accessed, new_accessed_time);
 
@@ -1203,8 +1186,7 @@
   EXPECT_EQ(nullptr, shareable_file_ref());
 }
 
-TEST_F(FileSystemOperationImplTest,
-       TestMoveSuccessSrcDirRecursiveWithQuota) {
+TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirRecursiveWithQuota) {
   FileSystemURL src(CreateDirectory("src"));
   int64_t src_path_cost = GetUsage();
 
@@ -1236,12 +1218,10 @@
   EXPECT_TRUE(FileExists("dest/dir/file2"));
 
   EXPECT_EQ(all_file_size, GetDataSizeOnDisk());
-  EXPECT_EQ(all_file_size + total_path_cost - src_path_cost,
-            GetUsage());
+  EXPECT_EQ(all_file_size + total_path_cost - src_path_cost, GetUsage());
 }
 
-TEST_F(FileSystemOperationImplTest,
-       TestCopySuccessSrcDirRecursiveWithQuota) {
+TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursiveWithQuota) {
   FileSystemURL src(CreateDirectory("src"));
   FileSystemURL dest1(CreateDirectory("dest1"));
   FileSystemURL dest2(CreateDirectory("dest2"));
diff --git a/storage/browser/fileapi/file_system_operation_impl_write_unittest.cc b/storage/browser/file_system/file_system_operation_impl_write_unittest.cc
similarity index 97%
rename from storage/browser/fileapi/file_system_operation_impl_write_unittest.cc
rename to storage/browser/file_system/file_system_operation_impl_write_unittest.cc
index 0544c90..696d18f2 100644
--- a/storage/browser/fileapi/file_system_operation_impl_write_unittest.cc
+++ b/storage/browser/file_system/file_system_operation_impl_write_unittest.cc
@@ -17,11 +17,11 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "net/url_request/url_request.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/local_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/local_file_util.h"
 #include "storage/browser/test/mock_blob_util.h"
 #include "storage/browser/test/mock_file_change_observer.h"
 #include "storage/browser/test/mock_quota_manager.h"
diff --git a/storage/browser/fileapi/file_system_operation_runner.cc b/storage/browser/file_system/file_system_operation_runner.cc
similarity index 98%
rename from storage/browser/fileapi/file_system_operation_runner.cc
rename to storage/browser/file_system/file_system_operation_runner.cc
index fb4ae7b..991cfb7 100644
--- a/storage/browser/fileapi/file_system_operation_runner.cc
+++ b/storage/browser/file_system/file_system_operation_runner.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 
 #include <stdint.h>
 
@@ -18,10 +18,10 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "net/url_request/url_request_context.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_writer_delegate.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_writer_delegate.h"
 
 namespace storage {
 
@@ -393,8 +393,7 @@
       (base::File::FLAG_CREATE | base::File::FLAG_OPEN_ALWAYS |
        base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_OPEN_TRUNCATED |
        base::File::FLAG_WRITE | base::File::FLAG_EXCLUSIVE_WRITE |
-       base::File::FLAG_DELETE_ON_CLOSE |
-       base::File::FLAG_WRITE_ATTRIBUTES)) {
+       base::File::FLAG_DELETE_ON_CLOSE | base::File::FLAG_WRITE_ATTRIBUTES)) {
     PrepareForWrite(id, url);
   } else {
     PrepareForRead(id, url);
diff --git a/storage/browser/fileapi/file_system_operation_runner.h b/storage/browser/file_system/file_system_operation_runner.h
similarity index 97%
rename from storage/browser/fileapi/file_system_operation_runner.h
rename to storage/browser/file_system/file_system_operation_runner.h
index c221ef5..8d1a47c 100644
--- a/storage/browser/fileapi/file_system_operation_runner.h
+++ b/storage/browser/file_system/file_system_operation_runner.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_RUNNER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_RUNNER_H_
 
 #include <stdint.h>
 
@@ -19,8 +19,8 @@
 #include "base/util/type_safety/pass_key.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "storage/browser/blob/blob_data_handle.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 
@@ -331,4 +331,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPERATION_RUNNER_H_
diff --git a/storage/browser/fileapi/file_system_options.cc b/storage/browser/file_system/file_system_options.cc
similarity index 92%
rename from storage/browser/fileapi/file_system_options.cc
rename to storage/browser/file_system/file_system_options.cc
index 8160497c..dcbbe00 100644
--- a/storage/browser/fileapi/file_system_options.cc
+++ b/storage/browser/file_system/file_system_options.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_options.h"
+#include "storage/browser/file_system/file_system_options.h"
 
 namespace storage {
 
diff --git a/storage/browser/fileapi/file_system_options.h b/storage/browser/file_system/file_system_options.h
similarity index 88%
rename from storage/browser/fileapi/file_system_options.h
rename to storage/browser/file_system/file_system_options.h
index a1d52d20..a20f81b 100644
--- a/storage/browser/fileapi/file_system_options.h
+++ b/storage/browser/file_system/file_system_options.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPTIONS_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPTIONS_H_
 
 #include <string>
 #include <vector>
@@ -16,10 +16,7 @@
 // This object is copyable.
 class COMPONENT_EXPORT(STORAGE_BROWSER) FileSystemOptions {
  public:
-  enum ProfileMode {
-    PROFILE_MODE_NORMAL = 0,
-    PROFILE_MODE_INCOGNITO
-  };
+  enum ProfileMode { PROFILE_MODE_NORMAL = 0, PROFILE_MODE_INCOGNITO };
 
   // |profile_mode| specifies if the profile (for this filesystem)
   // is running in incognito mode (PROFILE_MODE_INCOGNITO) or no
@@ -58,4 +55,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_OPTIONS_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_OPTIONS_H_
diff --git a/storage/browser/fileapi/file_system_quota_client.cc b/storage/browser/file_system/file_system_quota_client.cc
similarity index 96%
rename from storage/browser/fileapi/file_system_quota_client.cc
rename to storage/browser/file_system/file_system_quota_client.cc
index 3862616..aed76eb4 100644
--- a/storage/browser/fileapi/file_system_quota_client.cc
+++ b/storage/browser/file_system/file_system_quota_client.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_quota_client.h"
+#include "storage/browser/file_system/file_system_quota_client.h"
 
 #include <algorithm>
 #include <memory>
@@ -14,9 +14,9 @@
 #include "base/sequenced_task_runner.h"
 #include "base/single_thread_task_runner.h"
 #include "base/task_runner_util.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
 #include "url/gurl.h"
diff --git a/storage/browser/fileapi/file_system_quota_client.h b/storage/browser/file_system/file_system_quota_client.h
similarity index 89%
rename from storage/browser/fileapi/file_system_quota_client.h
rename to storage/browser/file_system/file_system_quota_client.h
index 8e9f02ada..64da761 100644
--- a/storage/browser/fileapi/file_system_quota_client.h
+++ b/storage/browser/file_system/file_system_quota_client.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_CLIENT_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_CLIENT_H_
 
 #include <set>
 #include <string>
@@ -14,7 +14,7 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
 #include "storage/browser/quota/quota_client.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
@@ -67,4 +67,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_CLIENT_H_
diff --git a/storage/browser/fileapi/file_system_quota_client_unittest.cc b/storage/browser/file_system/file_system_quota_client_unittest.cc
similarity index 89%
rename from storage/browser/fileapi/file_system_quota_client_unittest.cc
rename to storage/browser/file_system/file_system_quota_client_unittest.cc
index 7600558..3434797f 100644
--- a/storage/browser/fileapi/file_system_quota_client_unittest.cc
+++ b/storage/browser/file_system/file_system_quota_client_unittest.cc
@@ -13,10 +13,10 @@
 #include "base/run_loop.h"
 #include "base/stl_util.h"
 #include "base/test/task_environment.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_quota_client.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_quota_client.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/common/fileapi/file_system_types.h"
@@ -148,8 +148,8 @@
     if (result != base::File::FILE_OK)
       return false;
 
-    result = AsyncFileTestHelper::TruncateFile(
-        file_system_context_.get(), url, file_size);
+    result = AsyncFileTestHelper::TruncateFile(file_system_context_.get(), url,
+                                               file_size);
     return result == base::File::FILE_OK;
   }
 
@@ -159,20 +159,20 @@
     for (int i = 0; i < num_files; i++) {
       base::FilePath path = base::FilePath().AppendASCII(files[i].name);
       if (files[i].isDirectory) {
-        ASSERT_TRUE(CreateFileSystemDirectory(
-            path, files[i].origin_url, files[i].type));
+        ASSERT_TRUE(CreateFileSystemDirectory(path, files[i].origin_url,
+                                              files[i].type));
         if (path.empty()) {
           // Create the usage cache.
           // HACK--we always create the root [an empty path] first.  If we
           // create it later, this will fail due to a quota mismatch.  If we
           // call this before we create the root, it succeeds, but hasn't
           // actually created the cache.
-          ASSERT_EQ(0, GetOriginUsage(
-              quota_client, files[i].origin_url, files[i].type));
+          ASSERT_EQ(0, GetOriginUsage(quota_client, files[i].origin_url,
+                                      files[i].type));
         }
       } else {
-        ASSERT_TRUE(CreateFileSystemFile(
-            path, files[i].size, files[i].origin_url, files[i].type));
+        ASSERT_TRUE(CreateFileSystemFile(path, files[i].size,
+                                         files[i].origin_url, files[i].type));
       }
     }
   }
@@ -273,7 +273,7 @@
 
   for (int i = 0; i < 2; i++) {
     EXPECT_EQ(4921 + file_paths_cost,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
   }
 }
 
@@ -290,7 +290,7 @@
 
   for (int i = 0; i < 2; i++) {
     EXPECT_EQ(10310 + 41 + file_paths_cost,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
   }
 }
 
@@ -308,7 +308,7 @@
 
   for (int i = 0; i < 2; i++) {
     EXPECT_EQ(file_paths_cost,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
   }
 }
 
@@ -326,7 +326,7 @@
 
   for (int i = 0; i < 2; i++) {
     EXPECT_EQ(11921 + 4814 + file_paths_cost,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
   }
 }
 
@@ -352,9 +352,9 @@
 
   for (int i = 0; i < 2; i++) {
     EXPECT_EQ(133 + 14 + file_paths_cost_temporary,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
     EXPECT_EQ(193 + 9 + file_paths_cost_persistent,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kPersistent));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kPersistent));
   }
 }
 
@@ -394,13 +394,13 @@
 
   for (int i = 0; i < 2; i++) {
     EXPECT_EQ(1331 + 134 + file_paths_cost_temporary1,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
     EXPECT_EQ(1903 + 19 + file_paths_cost_persistent1,
-        GetOriginUsage(quota_client.get(), kDummyURL1, kPersistent));
+              GetOriginUsage(quota_client.get(), kDummyURL1, kPersistent));
     EXPECT_EQ(1319 + 113 + file_paths_cost_temporary2,
-        GetOriginUsage(quota_client.get(), kDummyURL2, kTemporary));
+              GetOriginUsage(quota_client.get(), kDummyURL2, kTemporary));
     EXPECT_EQ(2013 + 18 + file_paths_cost_persistent2,
-        GetOriginUsage(quota_client.get(), kDummyURL2, kPersistent));
+              GetOriginUsage(quota_client.get(), kDummyURL2, kPersistent));
   }
 }
 
@@ -529,33 +529,24 @@
   base::RunLoop().RunUntilIdle();
   EXPECT_EQ(blink::mojom::QuotaStatusCode::kOk, status());
 
-  EXPECT_EQ(0, GetOriginUsage(
-      quota_client.get(), "http://foo.com/", kTemporary));
-  EXPECT_EQ(0, GetOriginUsage(
-      quota_client.get(), "http://bar.com/", kPersistent));
-  EXPECT_EQ(0, GetOriginUsage(
-      quota_client.get(), "http://buz.com/", kTemporary));
+  EXPECT_EQ(0,
+            GetOriginUsage(quota_client.get(), "http://foo.com/", kTemporary));
+  EXPECT_EQ(0,
+            GetOriginUsage(quota_client.get(), "http://bar.com/", kPersistent));
+  EXPECT_EQ(0,
+            GetOriginUsage(quota_client.get(), "http://buz.com/", kTemporary));
 
   EXPECT_EQ(2 + file_paths_cost_temporary_foo_https,
-            GetOriginUsage(quota_client.get(),
-                           "https://foo.com/",
-                           kTemporary));
+            GetOriginUsage(quota_client.get(), "https://foo.com/", kTemporary));
   EXPECT_EQ(4 + file_paths_cost_persistent_foo,
-            GetOriginUsage(quota_client.get(),
-                           "http://foo.com/",
-                           kPersistent));
+            GetOriginUsage(quota_client.get(), "http://foo.com/", kPersistent));
   EXPECT_EQ(8 + file_paths_cost_temporary_bar,
-            GetOriginUsage(quota_client.get(),
-                           "http://bar.com/",
-                           kTemporary));
-  EXPECT_EQ(32 + file_paths_cost_persistent_bar_https,
-            GetOriginUsage(quota_client.get(),
-                           "https://bar.com/",
-                           kPersistent));
+            GetOriginUsage(quota_client.get(), "http://bar.com/", kTemporary));
+  EXPECT_EQ(
+      32 + file_paths_cost_persistent_bar_https,
+      GetOriginUsage(quota_client.get(), "https://bar.com/", kPersistent));
   EXPECT_EQ(64 + file_paths_cost_temporary_bar_https,
-            GetOriginUsage(quota_client.get(),
-                           "https://bar.com/",
-                           kTemporary));
+            GetOriginUsage(quota_client.get(), "https://bar.com/", kTemporary));
 }
 
 }  // namespace content
diff --git a/storage/browser/fileapi/file_system_quota_util.h b/storage/browser/file_system/file_system_quota_util.h
similarity index 86%
rename from storage/browser/fileapi/file_system_quota_util.h
rename to storage/browser/file_system/file_system_quota_util.h
index cbca215..1b28fb3 100644
--- a/storage/browser/fileapi/file_system_quota_util.h
+++ b/storage/browser/file_system/file_system_quota_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_UTIL_H_
 
 #include <stdint.h>
 
@@ -57,11 +57,10 @@
 
   // Creates new reservation object for the origin and the type.
   virtual scoped_refptr<QuotaReservation>
-      CreateQuotaReservationOnFileTaskRunner(
-          const GURL& origin_url,
-          FileSystemType type) = 0;
+  CreateQuotaReservationOnFileTaskRunner(const GURL& origin_url,
+                                         FileSystemType type) = 0;
 };
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_UTIL_H_
diff --git a/storage/browser/fileapi/file_system_url.cc b/storage/browser/file_system/file_system_url.cc
similarity index 91%
rename from storage/browser/fileapi/file_system_url.cc
rename to storage/browser/file_system/file_system_url.cc
index e28b1f8..7883020 100644
--- a/storage/browser/fileapi/file_system_url.cc
+++ b/storage/browser/file_system/file_system_url.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 #include <sstream>
 
@@ -13,9 +13,7 @@
 
 namespace storage {
 
-namespace {
-
-}  // namespace
+namespace {}  // namespace
 
 FileSystemURL::FileSystemURL()
     : is_null_(true),
@@ -52,14 +50,8 @@
     const base::FilePath& cracked_path,
     const std::string& filesystem_id,
     const FileSystemMountOption& mount_option) {
-  return FileSystemURL(origin,
-                       mount_type,
-                       virtual_path,
-                       mount_filesystem_id,
-                       cracked_type,
-                       cracked_path,
-                       filesystem_id,
-                       mount_option);
+  return FileSystemURL(origin, mount_type, virtual_path, mount_filesystem_id,
+                       cracked_type, cracked_path, filesystem_id, mount_option);
 }
 
 FileSystemURL::FileSystemURL(const GURL& url)
@@ -149,13 +141,11 @@
 }
 
 bool FileSystemURL::IsParent(const FileSystemURL& child) const {
-  return IsInSameFileSystem(child) &&
-         path().IsParent(child.path());
+  return IsInSameFileSystem(child) && path().IsParent(child.path());
 }
 
 bool FileSystemURL::IsInSameFileSystem(const FileSystemURL& other) const {
-  return origin() == other.origin() &&
-         type() == other.type() &&
+  return origin() == other.origin() && type() == other.type() &&
          filesystem_id() == other.filesystem_id();
 }
 
diff --git a/storage/browser/fileapi/file_system_url.h b/storage/browser/file_system/file_system_url.h
similarity index 95%
rename from storage/browser/fileapi/file_system_url.h
rename to storage/browser/file_system/file_system_url.h
index f6b8813..ba12c28 100644
--- a/storage/browser/fileapi/file_system_url.h
+++ b/storage/browser/file_system/file_system_url.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_URL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_URL_H_
 
 #include <set>
 #include <string>
@@ -146,12 +146,10 @@
 
   bool operator==(const FileSystemURL& that) const;
 
-  bool operator!=(const FileSystemURL& that) const {
-    return !(*this == that);
-  }
+  bool operator!=(const FileSystemURL& that) const { return !(*this == that); }
 
   struct COMPONENT_EXPORT(STORAGE_BROWSER) Comparator {
-    bool operator() (const FileSystemURL& lhs, const FileSystemURL& rhs) const;
+    bool operator()(const FileSystemURL& lhs, const FileSystemURL& rhs) const;
   };
 
  private:
@@ -199,4 +197,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_URL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_URL_H_
diff --git a/storage/browser/fileapi/file_system_url_unittest.cc b/storage/browser/file_system/file_system_url_unittest.cc
similarity index 77%
rename from storage/browser/fileapi/file_system_url_unittest.cc
rename to storage/browser/file_system/file_system_url_unittest.cc
index dca590c..54f86ea 100644
--- a/storage/browser/fileapi/file_system_url_unittest.cc
+++ b/storage/browser/file_system/file_system_url_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 #include <stddef.h>
 
@@ -50,7 +50,7 @@
 
 TEST(FileSystemURLTest, ParsePersistent) {
   FileSystemURL url = CreateFileSystemURL(
-     "filesystem:http://chromium.org/persistent/directory/file");
+      "filesystem:http://chromium.org/persistent/directory/file");
   ASSERT_TRUE(url.is_valid());
   EXPECT_EQ("http://chromium.org/", url.origin().GetURL().spec());
   EXPECT_EQ(kFileSystemTypePersistent, url.type());
@@ -95,10 +95,10 @@
 }
 
 TEST(FileSystemURLTest, RejectBadType) {
-  EXPECT_FALSE(CreateFileSystemURL(
-      "filesystem:http://c.org/foobar/file").is_valid());
-  EXPECT_FALSE(CreateFileSystemURL(
-      "filesystem:http://c.org/temporaryfoo/file").is_valid());
+  EXPECT_FALSE(
+      CreateFileSystemURL("filesystem:http://c.org/foobar/file").is_valid());
+  EXPECT_FALSE(CreateFileSystemURL("filesystem:http://c.org/temporaryfoo/file")
+                   .is_valid());
 }
 
 TEST(FileSystemURLTest, RejectMalformedURL) {
@@ -115,8 +115,7 @@
       GURL("filesystem:http://chromium.org/temporary/dir b/file a"),
       GURL("filesystem:http://chromium.org/temporary/dir aa/file b"),
       GURL("filesystem:http://chromium.com/temporary/dir a/file a"),
-      GURL("filesystem:https://chromium.org/temporary/dir a/file a")
-  };
+      GURL("filesystem:https://chromium.org/temporary/dir a/file a")};
 
   FileSystemURL::Comparator compare;
   for (size_t i = 0; i < base::size(urls); ++i) {
@@ -137,49 +136,52 @@
 }
 
 TEST(FileSystemURLTest, IsParent) {
-  const std::string root1 = GetFileSystemRootURI(
-      GURL("http://example.com"), kFileSystemTypeTemporary).spec();
-  const std::string root2 = GetFileSystemRootURI(
-      GURL("http://example.com"), kFileSystemTypePersistent).spec();
-  const std::string root3 = GetFileSystemRootURI(
-      GURL("http://chromium.org"), kFileSystemTypeTemporary).spec();
+  const std::string root1 =
+      GetFileSystemRootURI(GURL("http://example.com"), kFileSystemTypeTemporary)
+          .spec();
+  const std::string root2 = GetFileSystemRootURI(GURL("http://example.com"),
+                                                 kFileSystemTypePersistent)
+                                .spec();
+  const std::string root3 = GetFileSystemRootURI(GURL("http://chromium.org"),
+                                                 kFileSystemTypeTemporary)
+                                .spec();
 
   const std::string parent("dir");
   const std::string child("dir/child");
   const std::string other("other");
 
   // True cases.
-  EXPECT_TRUE(CreateFileSystemURL(root1 + parent).IsParent(
-      CreateFileSystemURL(root1 + child)));
-  EXPECT_TRUE(CreateFileSystemURL(root2 + parent).IsParent(
-      CreateFileSystemURL(root2 + child)));
+  EXPECT_TRUE(CreateFileSystemURL(root1 + parent)
+                  .IsParent(CreateFileSystemURL(root1 + child)));
+  EXPECT_TRUE(CreateFileSystemURL(root2 + parent)
+                  .IsParent(CreateFileSystemURL(root2 + child)));
 
   // False cases: the path is not a child.
-  EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent(
-      CreateFileSystemURL(root1 + other)));
-  EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent(
-      CreateFileSystemURL(root1 + parent)));
-  EXPECT_FALSE(CreateFileSystemURL(root1 + child).IsParent(
-      CreateFileSystemURL(root1 + parent)));
+  EXPECT_FALSE(CreateFileSystemURL(root1 + parent)
+                   .IsParent(CreateFileSystemURL(root1 + other)));
+  EXPECT_FALSE(CreateFileSystemURL(root1 + parent)
+                   .IsParent(CreateFileSystemURL(root1 + parent)));
+  EXPECT_FALSE(CreateFileSystemURL(root1 + child)
+                   .IsParent(CreateFileSystemURL(root1 + parent)));
 
   // False case: different types.
-  EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent(
-      CreateFileSystemURL(root2 + child)));
+  EXPECT_FALSE(CreateFileSystemURL(root1 + parent)
+                   .IsParent(CreateFileSystemURL(root2 + child)));
 
   // False case: different origins.
-  EXPECT_FALSE(CreateFileSystemURL(root1 + parent).IsParent(
-      CreateFileSystemURL(root3 + child)));
+  EXPECT_FALSE(CreateFileSystemURL(root1 + parent)
+                   .IsParent(CreateFileSystemURL(root3 + child)));
 }
 
 TEST(FileSystemURLTest, ToGURL) {
   EXPECT_TRUE(FileSystemURL().ToGURL().is_empty());
   const char* kTestURL[] = {
-    "filesystem:http://chromium.org/persistent/directory/file0",
-    "filesystem:http://chromium.org/temporary/directory/file1",
-    "filesystem:http://chromium.org/isolated/directory/file2",
-    "filesystem:http://chromium.org/external/directory/file2",
-    "filesystem:http://chromium.org/test/directory/file3",
-    "filesystem:http://chromium.org/test/plus%2B/space%20/colon%3A",
+      "filesystem:http://chromium.org/persistent/directory/file0",
+      "filesystem:http://chromium.org/temporary/directory/file1",
+      "filesystem:http://chromium.org/isolated/directory/file2",
+      "filesystem:http://chromium.org/external/directory/file2",
+      "filesystem:http://chromium.org/test/directory/file3",
+      "filesystem:http://chromium.org/test/plus%2B/space%20/colon%3A",
   };
 
   for (const char* url : kTestURL)
@@ -192,9 +194,9 @@
 
   const FileSystemURL kURL1 = FileSystemURL::CreateForTest(
       url::Origin::Create(kOrigin), kFileSystemTypeTemporary, kPath);
-  EXPECT_EQ("filesystem:http://example.com/temporary/" +
-            NormalizedUTF8Path(kPath),
-            kURL1.DebugString());
+  EXPECT_EQ(
+      "filesystem:http://example.com/temporary/" + NormalizedUTF8Path(kPath),
+      kURL1.DebugString());
 }
 
 TEST(FileSystemURLTest, IsInSameFileSystem) {
diff --git a/storage/browser/fileapi/file_system_usage_cache.cc b/storage/browser/file_system/file_system_usage_cache.cc
similarity index 96%
rename from storage/browser/fileapi/file_system_usage_cache.cc
rename to storage/browser/file_system/file_system_usage_cache.cc
index c62c12e..387490fa 100644
--- a/storage/browser/fileapi/file_system_usage_cache.cc
+++ b/storage/browser/file_system/file_system_usage_cache.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_usage_cache.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -182,7 +182,7 @@
   DCHECK(dirty_out);
   DCHECK(usage_out);
   char buffer[kUsageFileSize];
-  const char *header;
+  const char* header;
   if (usage_file_path.empty() ||
       !ReadBytes(usage_file_path, buffer, kUsageFileSize))
     return false;
@@ -192,15 +192,12 @@
   int64_t usage = 0;
 
   if (!iter.ReadBytes(&header, kUsageFileHeaderSize) ||
-      !iter.ReadBool(is_valid) ||
-      !iter.ReadUInt32(&dirty) ||
+      !iter.ReadBool(is_valid) || !iter.ReadUInt32(&dirty) ||
       !iter.ReadInt64(&usage))
     return false;
 
-  if (header[0] != kUsageFileHeader[0] ||
-      header[1] != kUsageFileHeader[1] ||
-      header[2] != kUsageFileHeader[2] ||
-      header[3] != kUsageFileHeader[3])
+  if (header[0] != kUsageFileHeader[0] || header[1] != kUsageFileHeader[1] ||
+      header[2] != kUsageFileHeader[2] || header[3] != kUsageFileHeader[3])
     return false;
 
   *dirty_out = dirty;
diff --git a/storage/browser/fileapi/file_system_usage_cache.h b/storage/browser/file_system/file_system_usage_cache.h
similarity index 94%
rename from storage/browser/fileapi/file_system_usage_cache.h
rename to storage/browser/file_system/file_system_usage_cache.h
index a9fa200..f46901a 100644
--- a/storage/browser/fileapi/file_system_usage_cache.h
+++ b/storage/browser/file_system/file_system_usage_cache.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_USAGE_CACHE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_USAGE_CACHE_H_
 
 #include <stdint.h>
 
@@ -108,4 +108,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_USAGE_CACHE_H_
diff --git a/storage/browser/fileapi/file_system_usage_cache_unittest.cc b/storage/browser/file_system/file_system_usage_cache_unittest.cc
similarity index 98%
rename from storage/browser/fileapi/file_system_usage_cache_unittest.cc
rename to storage/browser/file_system/file_system_usage_cache_unittest.cc
index 6144fee..b17439f 100644
--- a/storage/browser/fileapi/file_system_usage_cache_unittest.cc
+++ b/storage/browser/file_system/file_system_usage_cache_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_system_usage_cache.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
 
 #include <stdint.h>
 
diff --git a/storage/browser/fileapi/file_writer_delegate.cc b/storage/browser/file_system/file_writer_delegate.cc
similarity index 97%
rename from storage/browser/fileapi/file_writer_delegate.cc
rename to storage/browser/file_system/file_writer_delegate.cc
index 5d55919..620b6d7 100644
--- a/storage/browser/fileapi/file_writer_delegate.cc
+++ b/storage/browser/file_system/file_writer_delegate.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/file_writer_delegate.h"
+#include "storage/browser/file_system/file_writer_delegate.h"
 
 #include <stdint.h>
 
@@ -17,8 +17,8 @@
 #include "base/threading/thread_restrictions.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/storage/browser/fileapi/file_writer_delegate.h b/storage/browser/file_system/file_writer_delegate.h
similarity index 94%
rename from storage/browser/fileapi/file_writer_delegate.h
rename to storage/browser/file_system/file_writer_delegate.h
index 4e245e1..3f83b4e 100644
--- a/storage/browser/fileapi/file_writer_delegate.h
+++ b/storage/browser/file_system/file_writer_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_FILE_WRITER_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_FILE_WRITER_DELEGATE_H_
 
 #include <stdint.h>
 
@@ -108,4 +108,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_FILE_WRITER_DELEGATE_H_
diff --git a/storage/browser/fileapi/file_writer_delegate_unittest.cc b/storage/browser/file_system/file_writer_delegate_unittest.cc
similarity index 95%
rename from storage/browser/fileapi/file_writer_delegate_unittest.cc
rename to storage/browser/file_system/file_writer_delegate_unittest.cc
index 99e861e..65d687d 100644
--- a/storage/browser/fileapi/file_writer_delegate_unittest.cc
+++ b/storage/browser/file_system/file_writer_delegate_unittest.cc
@@ -30,10 +30,10 @@
 #include "net/url_request/url_request_status.h"
 #include "storage/browser/blob/blob_data_builder.h"
 #include "storage/browser/blob/blob_storage_context.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/file_writer_delegate.h"
-#include "storage/browser/fileapi/sandbox_file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/file_writer_delegate.h"
+#include "storage/browser/file_system/sandbox_file_stream_writer.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
@@ -89,7 +89,7 @@
   FileWriterDelegate::WriteProgressStatus write_status_;
 };
 
-}  // namespace (anonymous)
+}  // namespace
 
 class FileWriterDelegateTest : public PlatformTest {
  public:
@@ -102,8 +102,8 @@
 
   int64_t usage() {
     return file_system_context_->GetQuotaUtil(kFileSystemType)
-        ->GetOriginUsageOnFileTaskRunner(
-              file_system_context_.get(), kOrigin, kFileSystemType);
+        ->GetOriginUsageOnFileTaskRunner(file_system_context_.get(), kOrigin,
+                                         kFileSystemType);
   }
 
   int64_t GetFileSizeOnDisk(const char* test_file_path) {
@@ -114,8 +114,8 @@
     FileSystemURL url = GetFileSystemURL(test_file_path);
     base::File::Info file_info;
     EXPECT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::GetMetadata(
-                  file_system_context_.get(), url, &file_info));
+              AsyncFileTestHelper::GetMetadata(file_system_context_.get(), url,
+                                               &file_info));
     return file_info.size;
   }
 
diff --git a/storage/browser/fileapi/isolated_context.cc b/storage/browser/file_system/isolated_context.cc
similarity index 99%
rename from storage/browser/fileapi/isolated_context.cc
rename to storage/browser/file_system/isolated_context.cc
index acff276..b0655f9f 100644
--- a/storage/browser/fileapi/isolated_context.cc
+++ b/storage/browser/file_system/isolated_context.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/isolated_context.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -15,7 +15,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 
diff --git a/storage/browser/fileapi/isolated_context.h b/storage/browser/file_system/isolated_context.h
similarity index 97%
rename from storage/browser/fileapi/isolated_context.h
rename to storage/browser/file_system/isolated_context.h
index b29feae..c0fada2 100644
--- a/storage/browser/fileapi/isolated_context.h
+++ b/storage/browser/file_system/isolated_context.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_
-#define STORAGE_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_ISOLATED_CONTEXT_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_ISOLATED_CONTEXT_H_
 
 #include <map>
 #include <set>
@@ -16,7 +16,7 @@
 #include "base/macros.h"
 #include "base/memory/singleton.h"
 #include "base/synchronization/lock.h"
-#include "storage/browser/fileapi/mount_points.h"
+#include "storage/browser/file_system/mount_points.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace storage {
@@ -215,4 +215,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_ISOLATED_CONTEXT_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_ISOLATED_CONTEXT_H_
diff --git a/storage/browser/fileapi/isolated_context_unittest.cc b/storage/browser/file_system/isolated_context_unittest.cc
similarity index 80%
rename from storage/browser/fileapi/isolated_context_unittest.cc
rename to storage/browser/file_system/isolated_context_unittest.cc
index 6582748..8798710 100644
--- a/storage/browser/fileapi/isolated_context_unittest.cc
+++ b/storage/browser/file_system/isolated_context_unittest.cc
@@ -9,8 +9,8 @@
 #include "base/logging.h"
 #include "base/macros.h"
 #include "base/stl_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #define FPL(x) FILE_PATH_LITERAL(x)
@@ -35,18 +35,18 @@
 namespace {
 
 const base::FilePath kTestPaths[] = {
-  base::FilePath(DRIVE FPL("/a/b.txt")),
-  base::FilePath(DRIVE FPL("/c/d/e")),
-  base::FilePath(DRIVE FPL("/h/")),
-  base::FilePath(DRIVE FPL("/")),
+    base::FilePath(DRIVE FPL("/a/b.txt")),
+    base::FilePath(DRIVE FPL("/c/d/e")),
+    base::FilePath(DRIVE FPL("/h/")),
+    base::FilePath(DRIVE FPL("/")),
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
-  base::FilePath(DRIVE FPL("\\foo\\bar")),
-  base::FilePath(DRIVE FPL("\\")),
+    base::FilePath(DRIVE FPL("\\foo\\bar")),
+    base::FilePath(DRIVE FPL("\\")),
 #endif
-  // For duplicated base name test.
-  base::FilePath(DRIVE FPL("/")),
-  base::FilePath(DRIVE FPL("/f/e")),
-  base::FilePath(DRIVE FPL("/f/b.txt")),
+    // For duplicated base name test.
+    base::FilePath(DRIVE FPL("/")),
+    base::FilePath(DRIVE FPL("/f/e")),
+    base::FilePath(DRIVE FPL("/f/b.txt")),
 };
 
 }  // namespace
@@ -100,8 +100,8 @@
   // register in SetUp() by RegisterDraggedFileSystem) is properly cracked as
   // a valid virtual path in the isolated filesystem.
   for (size_t i = 0; i < base::size(kTestPaths); ++i) {
-    base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_)
-        .AppendASCII(names_[i]);
+    base::FilePath virtual_path =
+        isolated_context()->CreateVirtualRootPath(id_).AppendASCII(names_[i]);
     std::string cracked_id;
     base::FilePath cracked_path;
     std::string cracked_inner_id;
@@ -185,27 +185,28 @@
     base::FilePath::StringType path;
     bool valid;
   } relatives[] = {
-    { FPL("foo"), true },
-    { FPL("foo/bar"), true },
-    { FPL(".."), false },
-    { FPL("foo/.."), false },
-    { FPL("foo/../bar"), false },
+    {FPL("foo"), true},
+    {FPL("foo/bar"), true},
+    {FPL(".."), false},
+    {FPL("foo/.."), false},
+    {FPL("foo/../bar"), false},
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
-# define SHOULD_FAIL_WITH_WIN_SEPARATORS false
+#define SHOULD_FAIL_WITH_WIN_SEPARATORS false
 #else
-# define SHOULD_FAIL_WITH_WIN_SEPARATORS true
+#define SHOULD_FAIL_WITH_WIN_SEPARATORS true
 #endif
-    { FPL("foo\\..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS },
-    { FPL("foo/..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS },
+    {FPL("foo\\..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS},
+    {FPL("foo/..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS},
   };
 
   for (size_t i = 0; i < base::size(kTestPaths); ++i) {
     for (size_t j = 0; j < base::size(relatives); ++j) {
-      SCOPED_TRACE(testing::Message() << "Testing "
-                   << kTestPaths[i].value() << " " << relatives[j].path);
-      base::FilePath virtual_path =
-          isolated_context()->CreateVirtualRootPath(id_).AppendASCII(
-              names_[i]).Append(relatives[j].path);
+      SCOPED_TRACE(testing::Message() << "Testing " << kTestPaths[i].value()
+                                      << " " << relatives[j].path);
+      base::FilePath virtual_path = isolated_context()
+                                        ->CreateVirtualRootPath(id_)
+                                        .AppendASCII(names_[i])
+                                        .Append(relatives[j].path);
       std::string cracked_id;
       base::FilePath cracked_path;
       storage::FileSystemType cracked_type;
@@ -220,8 +221,10 @@
       ASSERT_TRUE(isolated_context()->CrackVirtualPath(
           virtual_path, &cracked_id, &cracked_type, &cracked_inner_id,
           &cracked_path, &cracked_option));
-      ASSERT_EQ(kTestPaths[i].Append(relatives[j].path)
-                    .NormalizePathSeparators().value(),
+      ASSERT_EQ(kTestPaths[i]
+                    .Append(relatives[j].path)
+                    .NormalizePathSeparators()
+                    .value(),
                 cracked_path.value());
       ASSERT_EQ(id_, cracked_id);
       ASSERT_EQ(kFileSystemTypeDragged, cracked_type);
@@ -235,27 +238,28 @@
     base::FilePath::StringType path;
     bool valid;
   } relatives[] = {
-    { FPL("foo"), true },
-    { FPL("foo/bar"), true },
-    { FPL(".."), false },
-    { FPL("foo/.."), false },
-    { FPL("foo/../bar"), false },
+    {FPL("foo"), true},
+    {FPL("foo/bar"), true},
+    {FPL(".."), false},
+    {FPL("foo/.."), false},
+    {FPL("foo/../bar"), false},
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
-# define SHOULD_FAIL_WITH_WIN_SEPARATORS false
+#define SHOULD_FAIL_WITH_WIN_SEPARATORS false
 #else
-# define SHOULD_FAIL_WITH_WIN_SEPARATORS true
+#define SHOULD_FAIL_WITH_WIN_SEPARATORS true
 #endif
-    { FPL("foo\\..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS },
-    { FPL("foo/..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS },
+    {FPL("foo\\..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS},
+    {FPL("foo/..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS},
   };
 
   for (size_t i = 0; i < base::size(kTestPaths); ++i) {
     for (size_t j = 0; j < base::size(relatives); ++j) {
-      SCOPED_TRACE(testing::Message() << "Testing "
-                   << kTestPaths[i].value() << " " << relatives[j].path);
-      base::FilePath virtual_path =
-          isolated_context()->CreateVirtualRootPath(id_).AppendASCII(
-              names_[i]).Append(relatives[j].path);
+      SCOPED_TRACE(testing::Message() << "Testing " << kTestPaths[i].value()
+                                      << " " << relatives[j].path);
+      base::FilePath virtual_path = isolated_context()
+                                        ->CreateVirtualRootPath(id_)
+                                        .AppendASCII(names_[i])
+                                        .Append(relatives[j].path);
 
       FileSystemURL cracked = isolated_context()->CreateCrackedFileSystemURL(
           url::Origin::Create(GURL("http://chromium.org")),
@@ -266,8 +270,10 @@
       if (!relatives[j].valid)
         continue;
       ASSERT_EQ("http://chromium.org", cracked.origin().Serialize());
-      ASSERT_EQ(kTestPaths[i].Append(relatives[j].path)
-                    .NormalizePathSeparators().value(),
+      ASSERT_EQ(kTestPaths[i]
+                    .Append(relatives[j].path)
+                    .NormalizePathSeparators()
+                    .value(),
                 cracked.path().value());
       ASSERT_EQ(virtual_path.NormalizePathSeparators(), cracked.virtual_path());
       ASSERT_EQ(id_, cracked.filesystem_id());
@@ -294,8 +300,8 @@
 
   // Trying to crack "/foo" should fail (because "foo" is not the one
   // included in the kTestPaths).
-  virtual_path = isolated_context()->CreateVirtualRootPath(
-      id_).AppendASCII("foo");
+  virtual_path =
+      isolated_context()->CreateVirtualRootPath(id_).AppendASCII("foo");
   ASSERT_FALSE(isolated_context()->CrackVirtualPath(
       virtual_path, &cracked_id, nullptr, nullptr, &cracked_path,
       &cracked_option));
@@ -335,8 +341,7 @@
       storage::kFileSystemTypeIsolated, "_", base::FilePath());
   std::string relative_fsid =
       isolated_context()->RegisterFileSystemForVirtualPath(
-          storage::kFileSystemTypeIsolated,
-          "_",
+          storage::kFileSystemTypeIsolated, "_",
           base::FilePath(FPL("relpath")));
   ASSERT_FALSE(empty_fsid.empty());
   ASSERT_FALSE(relative_fsid.empty());
@@ -350,9 +355,10 @@
   base::FilePath test_virtual_path =
       base::FilePath().AppendASCII("virtualdir").AppendASCII("virtualfile.txt");
 
-  base::FilePath whole_virtual_path =
-      isolated_context()->CreateVirtualRootPath(database_fsid)
-          .AppendASCII("_").Append(test_virtual_path);
+  base::FilePath whole_virtual_path = isolated_context()
+                                          ->CreateVirtualRootPath(database_fsid)
+                                          .AppendASCII("_")
+                                          .Append(test_virtual_path);
 
   std::string cracked_id;
   base::FilePath cracked_path;
diff --git a/storage/browser/fileapi/isolated_file_system_backend.cc b/storage/browser/file_system/isolated_file_system_backend.cc
similarity index 83%
rename from storage/browser/fileapi/isolated_file_system_backend.cc
rename to storage/browser/file_system/isolated_file_system_backend.cc
index f884769..74086cf2 100644
--- a/storage/browser/fileapi/isolated_file_system_backend.cc
+++ b/storage/browser/file_system/isolated_file_system_backend.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/isolated_file_system_backend.h"
+#include "storage/browser/file_system/isolated_file_system_backend.h"
 
 #include <stdint.h>
 
@@ -14,18 +14,18 @@
 #include "base/logging.h"
 #include "base/sequenced_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/dragged_file_util.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/native_file_util.h"
-#include "storage/browser/fileapi/transient_file_util.h"
-#include "storage/browser/fileapi/watcher_manager.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/dragged_file_util.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/native_file_util.h"
+#include "storage/browser/file_system/transient_file_util.h"
+#include "storage/browser/file_system/watcher_manager.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 
@@ -38,8 +38,7 @@
       use_for_type_platform_app_(use_for_type_platform_app),
       isolated_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())),
       dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())),
-      transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) {
-}
+      transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) {}
 
 IsolatedFileSystemBackend::~IsolatedFileSystemBackend() = default;
 
@@ -58,8 +57,7 @@
   }
 }
 
-void IsolatedFileSystemBackend::Initialize(FileSystemContext* context) {
-}
+void IsolatedFileSystemBackend::Initialize(FileSystemContext* context) {}
 
 void IsolatedFileSystemBackend::ResolveURL(const FileSystemURL& url,
                                            OpenFileSystemMode mode,
@@ -92,7 +90,8 @@
 
 CopyOrMoveFileValidatorFactory*
 IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
-    FileSystemType type, base::File::Error* error_code) {
+    FileSystemType type,
+    base::File::Error* error_code) {
   DCHECK(error_code);
   *error_code = base::File::FILE_OK;
   return nullptr;
diff --git a/storage/browser/fileapi/isolated_file_system_backend.h b/storage/browser/file_system/isolated_file_system_backend.h
similarity index 88%
rename from storage/browser/fileapi/isolated_file_system_backend.h
rename to storage/browser/file_system/isolated_file_system_backend.h
index 2ab4072..33a6fb3 100644
--- a/storage/browser/fileapi/isolated_file_system_backend.h
+++ b/storage/browser/file_system/isolated_file_system_backend.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_
-#define STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_ISOLATED_FILE_SYSTEM_BACKEND_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_ISOLATED_FILE_SYSTEM_BACKEND_H_
 
 #include <stdint.h>
 
 #include <memory>
 
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace storage {
 
@@ -74,4 +74,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_ISOLATED_FILE_SYSTEM_BACKEND_H_
diff --git a/storage/browser/fileapi/local_file_stream_reader.cc b/storage/browser/file_system/local_file_stream_reader.cc
similarity index 94%
rename from storage/browser/fileapi/local_file_stream_reader.cc
rename to storage/browser/file_system/local_file_stream_reader.cc
index d06277a4..78d3ad19 100644
--- a/storage/browser/fileapi/local_file_stream_reader.cc
+++ b/storage/browser/file_system/local_file_stream_reader.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/local_file_stream_reader.h"
+#include "storage/browser/file_system/local_file_stream_reader.h"
 
 #include <stdint.h>
 
@@ -23,9 +23,8 @@
 
 namespace {
 
-const int kOpenFlagsForRead = base::File::FLAG_OPEN |
-                              base::File::FLAG_READ |
-                              base::File::FLAG_ASYNC;
+const int kOpenFlagsForRead =
+    base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_ASYNC;
 
 struct GetFileInfoResults {
   base::File::Error error;
@@ -134,8 +133,7 @@
     std::move(callback_).Run(result);
 }
 
-void LocalFileStreamReader::DidOpenFileStream(
-    int result) {
+void LocalFileStreamReader::DidOpenFileStream(int result) {
   if (result != net::OK) {
     std::move(callback_).Run(result);
     return;
@@ -148,8 +146,7 @@
   }
 }
 
-void LocalFileStreamReader::DidSeekFileStream(
-    int64_t seek_result) {
+void LocalFileStreamReader::DidSeekFileStream(int64_t seek_result) {
   if (seek_result < 0) {
     std::move(callback_).Run(static_cast<int>(seek_result));
     return;
diff --git a/storage/browser/fileapi/local_file_stream_reader.h b/storage/browser/file_system/local_file_stream_reader.h
similarity index 90%
rename from storage/browser/fileapi/local_file_stream_reader.h
rename to storage/browser/file_system/local_file_stream_reader.h
index ecd1b493..a5e27654 100644
--- a/storage/browser/fileapi/local_file_stream_reader.h
+++ b/storage/browser/file_system/local_file_stream_reader.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_BLOB_LOCAL_FILE_STREAM_READER_H_
-#define STORAGE_BROWSER_BLOB_LOCAL_FILE_STREAM_READER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_STREAM_READER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_STREAM_READER_H_
 
 #include <stdint.h>
 
@@ -16,7 +16,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_reader.h"
 
 namespace base {
 class TaskRunner;
@@ -82,4 +82,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_BLOB_LOCAL_FILE_STREAM_READER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_STREAM_READER_H_
diff --git a/storage/browser/fileapi/local_file_stream_reader_unittest.cc b/storage/browser/file_system/local_file_stream_reader_unittest.cc
similarity index 95%
rename from storage/browser/fileapi/local_file_stream_reader_unittest.cc
rename to storage/browser/file_system/local_file_stream_reader_unittest.cc
index 55d3050..52742e2 100644
--- a/storage/browser/fileapi/local_file_stream_reader_unittest.cc
+++ b/storage/browser/file_system/local_file_stream_reader_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/local_file_stream_reader.h"
+#include "storage/browser/file_system/local_file_stream_reader.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -26,7 +26,7 @@
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "net/base/test_completion_callback.h"
-#include "storage/browser/fileapi/file_stream_test_utils.h"
+#include "storage/browser/file_system/file_stream_test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using storage::LocalFileStreamReader;
@@ -38,7 +38,9 @@
 const char kTestData[] = "0123456789";
 const int kTestDataSize = base::size(kTestData) - 1;
 
-void NeverCalled(int) { ADD_FAILURE(); }
+void NeverCalled(int) {
+  ADD_FAILURE();
+}
 
 void QuitLoop() {
   base::RunLoop::QuitCurrentWhenIdleDeprecated();
@@ -72,17 +74,13 @@
       const base::FilePath& path,
       int64_t initial_offset,
       const base::Time& expected_modification_time) {
-    return new LocalFileStreamReader(
-            file_task_runner(),
-            path,
-            initial_offset,
-            expected_modification_time);
+    return new LocalFileStreamReader(file_task_runner(), path, initial_offset,
+                                     expected_modification_time);
   }
 
   void TouchTestFile(base::TimeDelta delta) {
     base::Time new_modified_time = test_file_modification_time() + delta;
-    ASSERT_TRUE(base::TouchFile(test_path(),
-                                test_file_modification_time(),
+    ASSERT_TRUE(base::TouchFile(test_path(), test_file_modification_time(),
                                 new_modified_time));
   }
 
diff --git a/storage/browser/fileapi/local_file_stream_writer.cc b/storage/browser/file_system/local_file_stream_writer.cc
similarity index 92%
rename from storage/browser/fileapi/local_file_stream_writer.cc
rename to storage/browser/file_system/local_file_stream_writer.cc
index ed3af07..b2ddacf 100644
--- a/storage/browser/fileapi/local_file_stream_writer.cc
+++ b/storage/browser/file_system/local_file_stream_writer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/local_file_stream_writer.h"
+#include "storage/browser/file_system/local_file_stream_writer.h"
 
 #include <stdint.h>
 
@@ -16,12 +16,10 @@
 
 namespace {
 
-const int kOpenFlagsForWrite = base::File::FLAG_OPEN |
-                               base::File::FLAG_WRITE |
-                               base::File::FLAG_ASYNC;
-const int kCreateFlagsForWrite = base::File::FLAG_CREATE |
-                                 base::File::FLAG_WRITE |
-                                 base::File::FLAG_ASYNC;
+const int kOpenFlagsForWrite =
+    base::File::FLAG_OPEN | base::File::FLAG_WRITE | base::File::FLAG_ASYNC;
+const int kCreateFlagsForWrite =
+    base::File::FLAG_CREATE | base::File::FLAG_WRITE | base::File::FLAG_ASYNC;
 
 }  // namespace
 
@@ -106,12 +104,12 @@
 
   int open_flags = 0;
   switch (open_or_create_) {
-  case OPEN_EXISTING_FILE:
-    open_flags = kOpenFlagsForWrite;
-    break;
-  case CREATE_NEW_FILE:
-    open_flags = kCreateFlagsForWrite;
-    break;
+    case OPEN_EXISTING_FILE:
+      open_flags = kOpenFlagsForWrite;
+      break;
+    case CREATE_NEW_FILE:
+      open_flags = kCreateFlagsForWrite;
+      break;
   }
 
   return stream_impl_->Open(
diff --git a/storage/browser/fileapi/local_file_stream_writer.h b/storage/browser/file_system/local_file_stream_writer.h
similarity index 91%
rename from storage/browser/fileapi/local_file_stream_writer.h
rename to storage/browser/file_system/local_file_stream_writer.h
index 6e1d832d..f13d32c 100644
--- a/storage/browser/fileapi/local_file_stream_writer.h
+++ b/storage/browser/file_system/local_file_stream_writer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_
-#define STORAGE_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_STREAM_WRITER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_STREAM_WRITER_H_
 
 #include <stdint.h>
 
@@ -17,7 +17,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "base/task_runner.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
+#include "storage/browser/file_system/file_stream_writer.h"
 
 namespace content {
 class LocalFileStreamWriterTest;
@@ -93,4 +93,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_STREAM_WRITER_H_
diff --git a/storage/browser/fileapi/local_file_stream_writer_unittest.cc b/storage/browser/file_system/local_file_stream_writer_unittest.cc
similarity index 94%
rename from storage/browser/fileapi/local_file_stream_writer_unittest.cc
rename to storage/browser/file_system/local_file_stream_writer_unittest.cc
index 5eb2afc..2b63d2b0 100644
--- a/storage/browser/fileapi/local_file_stream_writer_unittest.cc
+++ b/storage/browser/file_system/local_file_stream_writer_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/local_file_stream_writer.h"
+#include "storage/browser/file_system/local_file_stream_writer.h"
 
 #include <stdint.h>
 
@@ -20,7 +20,7 @@
 #include "base/threading/thread.h"
 #include "net/base/io_buffer.h"
 #include "net/base/test_completion_callback.h"
-#include "storage/browser/fileapi/file_stream_test_utils.h"
+#include "storage/browser/file_system/file_stream_test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using storage::FileStreamWriter;
@@ -56,7 +56,7 @@
   }
 
   base::FilePath CreateFileWithContent(const std::string& name,
-                                 const std::string& data) {
+                                       const std::string& data) {
     base::FilePath path = Path(name);
     base::WriteFile(path, data.c_str(), data.size());
     return path;
@@ -69,7 +69,7 @@
   LocalFileStreamWriter* CreateWriter(const base::FilePath& path,
                                       int64_t offset) {
     return new LocalFileStreamWriter(file_task_runner(), path, offset,
-        FileStreamWriter::OPEN_EXISTING_FILE);
+                                     FileStreamWriter::OPEN_EXISTING_FILE);
   }
 
  private:
diff --git a/storage/browser/fileapi/local_file_util.cc b/storage/browser/file_system/local_file_util.cc
similarity index 86%
rename from storage/browser/fileapi/local_file_util.cc
rename to storage/browser/file_system/local_file_util.cc
index a1cc69e5..0ea6116 100644
--- a/storage/browser/fileapi/local_file_util.cc
+++ b/storage/browser/file_system/local_file_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/local_file_util.h"
+#include "storage/browser/file_system/local_file_util.h"
 
 #include <stdint.h>
 
@@ -11,11 +11,11 @@
 #include "base/files/file_enumerator.h"
 #include "base/files/file_util.h"
 #include "base/memory/ptr_util.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "url/gurl.h"
@@ -76,9 +76,9 @@
 
 LocalFileUtil::~LocalFileUtil() = default;
 
-base::File LocalFileUtil::CreateOrOpen(
-    FileSystemOperationContext* context,
-    const FileSystemURL& url, int file_flags) {
+base::File LocalFileUtil::CreateOrOpen(FileSystemOperationContext* context,
+                                       const FileSystemURL& url,
+                                       int file_flags) {
   base::FilePath file_path;
   base::File::Error error = GetLocalFilePath(context, url, &file_path);
   if (error != base::File::FILE_OK)
@@ -135,8 +135,7 @@
                                     const FileSystemURL& root_url,
                                     bool recursive) {
   base::FilePath file_path;
-  if (GetLocalFilePath(context, root_url, &file_path) !=
-      base::File::FILE_OK) {
+  if (GetLocalFilePath(context, root_url, &file_path) != base::File::FILE_OK) {
     return base::WrapUnique(new EmptyFileEnumerator);
   }
   return std::make_unique<LocalFileEnumerator>(
@@ -158,11 +157,10 @@
   return base::File::FILE_OK;
 }
 
-base::File::Error LocalFileUtil::Touch(
-    FileSystemOperationContext* context,
-    const FileSystemURL& url,
-    const base::Time& last_access_time,
-    const base::Time& last_modified_time) {
+base::File::Error LocalFileUtil::Touch(FileSystemOperationContext* context,
+                                       const FileSystemURL& url,
+                                       const base::Time& last_access_time,
+                                       const base::Time& last_modified_time) {
   base::FilePath file_path;
   base::File::Error error = GetLocalFilePath(context, url, &file_path);
   if (error != base::File::FILE_OK)
@@ -197,9 +195,7 @@
     return error;
 
   return NativeFileUtil::CopyOrMoveFile(
-      src_file_path,
-      dest_file_path,
-      option,
+      src_file_path, dest_file_path, option,
       storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy));
 }
 
@@ -216,16 +212,13 @@
   if (error != base::File::FILE_OK)
     return error;
   return NativeFileUtil::CopyOrMoveFile(
-      src_file_path,
-      dest_file_path,
-      FileSystemOperation::OPTION_NONE,
+      src_file_path, dest_file_path, FileSystemOperation::OPTION_NONE,
       storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url,
                                                             true /* copy */));
 }
 
-base::File::Error LocalFileUtil::DeleteFile(
-    FileSystemOperationContext* context,
-    const FileSystemURL& url) {
+base::File::Error LocalFileUtil::DeleteFile(FileSystemOperationContext* context,
+                                            const FileSystemURL& url) {
   base::FilePath file_path;
   base::File::Error error = GetLocalFilePath(context, url, &file_path);
   if (error != base::File::FILE_OK)
diff --git a/storage/browser/fileapi/local_file_util.h b/storage/browser/file_system/local_file_util.h
similarity index 94%
rename from storage/browser/fileapi/local_file_util.h
rename to storage/browser/file_system/local_file_util.h
index 96b1b9a2..8a654e9 100644
--- a/storage/browser/fileapi/local_file_util.h
+++ b/storage/browser/file_system/local_file_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_UTIL_H_
 
 #include <stdint.h>
 
@@ -13,7 +13,7 @@
 #include "base/component_export.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_file_util.h"
 
 namespace base {
 class Time;
@@ -96,4 +96,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_LOCAL_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_LOCAL_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/local_file_util_unittest.cc b/storage/browser/file_system/local_file_util_unittest.cc
similarity index 78%
rename from storage/browser/fileapi/local_file_util_unittest.cc
rename to storage/browser/file_system/local_file_util_unittest.cc
index c9bfbb6..7a9469e 100644
--- a/storage/browser/fileapi/local_file_util_unittest.cc
+++ b/storage/browser/file_system/local_file_util_unittest.cc
@@ -17,12 +17,12 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/task_environment.h"
 #include "build/build_config.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/local_file_util.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/local_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/common/fileapi/file_system_types.h"
@@ -79,19 +79,19 @@
         kOrigin, kFileSystemType, base::FilePath().FromUTF8Unsafe(file_name));
   }
 
-  base::FilePath LocalPath(const char *file_name) {
+  base::FilePath LocalPath(const char* file_name) {
     base::FilePath path;
     std::unique_ptr<FileSystemOperationContext> context(NewContext());
     file_util()->GetLocalFilePath(context.get(), CreateURL(file_name), &path);
     return path;
   }
 
-  bool FileExists(const char *file_name) {
+  bool FileExists(const char* file_name) {
     return base::PathExists(LocalPath(file_name)) &&
-        !base::DirectoryExists(LocalPath(file_name));
+           !base::DirectoryExists(LocalPath(file_name));
   }
 
-  bool DirectoryExists(const char *file_name) {
+  bool DirectoryExists(const char* file_name) {
     return base::DirectoryExists(LocalPath(file_name));
   }
 
@@ -102,19 +102,18 @@
   }
 
   base::File CreateFile(const char* file_name) {
-    int file_flags = base::File::FLAG_CREATE |
-                     base::File::FLAG_WRITE | base::File::FLAG_ASYNC;
+    int file_flags = base::File::FLAG_CREATE | base::File::FLAG_WRITE |
+                     base::File::FLAG_ASYNC;
 
     std::unique_ptr<FileSystemOperationContext> context(NewContext());
     return file_util()->CreateOrOpen(context.get(), CreateURL(file_name),
                                      file_flags);
   }
 
-  base::File::Error EnsureFileExists(const char* file_name,
-                                     bool* created) {
+  base::File::Error EnsureFileExists(const char* file_name, bool* created) {
     std::unique_ptr<FileSystemOperationContext> context(NewContext());
-    return file_util()->EnsureFileExists(context.get(),
-                                         CreateURL(file_name), created);
+    return file_util()->EnsureFileExists(context.get(), CreateURL(file_name),
+                                         created);
   }
 
   FileSystemContext* file_system_context() {
@@ -130,7 +129,7 @@
 };
 
 TEST_F(LocalFileUtilTest, CreateAndClose) {
-  const char *file_name = "test_file";
+  const char* file_name = "test_file";
   base::File file = CreateFile(file_name);
   ASSERT_TRUE(file.IsValid());
   ASSERT_TRUE(file.created());
@@ -145,14 +144,14 @@
 #if defined(OS_POSIX)
 TEST_F(LocalFileUtilTest, CreateFailForSymlink) {
   // Create symlink target file.
-  const char *target_name = "symlink_target";
+  const char* target_name = "symlink_target";
   base::File target_file = CreateFile(target_name);
   ASSERT_TRUE(target_file.IsValid());
   ASSERT_TRUE(target_file.created());
   base::FilePath target_path = LocalPath(target_name);
 
   // Create symlink where target must be real file.
-  const char *symlink_name = "symlink_file";
+  const char* symlink_name = "symlink_file";
   base::FilePath symlink_path = LocalPath(symlink_name);
   ASSERT_TRUE(base::CreateSymbolicLink(target_path, symlink_path));
   ASSERT_TRUE(FileExists(symlink_name));
@@ -168,7 +167,7 @@
 #endif
 
 TEST_F(LocalFileUtilTest, EnsureFileExists) {
-  const char *file_name = "foobar";
+  const char* file_name = "foobar";
   bool created;
   ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(file_name, &created));
   ASSERT_TRUE(created);
@@ -181,7 +180,7 @@
 }
 
 TEST_F(LocalFileUtilTest, TouchFile) {
-  const char *file_name = "test_file";
+  const char* file_name = "test_file";
   base::File file = CreateFile(file_name);
   ASSERT_TRUE(file.IsValid());
   ASSERT_TRUE(file.created());
@@ -197,7 +196,7 @@
 
   EXPECT_EQ(base::File::FILE_OK,
             file_util()->Touch(context.get(), CreateURL(file_name),
-                              new_accessed, new_modified));
+                               new_accessed, new_modified));
 
   ASSERT_TRUE(base::GetFileInfo(LocalPath(file_name), &info));
   EXPECT_EQ(new_accessed, info.last_accessed);
@@ -205,13 +204,12 @@
 }
 
 TEST_F(LocalFileUtilTest, TouchDirectory) {
-  const char *dir_name = "test_dir";
+  const char* dir_name = "test_dir";
   std::unique_ptr<FileSystemOperationContext> context(NewContext());
   ASSERT_EQ(base::File::FILE_OK,
-            file_util()->CreateDirectory(context.get(),
-                                        CreateURL(dir_name),
-                                        false /* exclusive */,
-                                        false /* recursive */));
+            file_util()->CreateDirectory(context.get(), CreateURL(dir_name),
+                                         false /* exclusive */,
+                                         false /* recursive */));
 
   base::File::Info info;
   ASSERT_TRUE(base::GetFileInfo(LocalPath(dir_name), &info));
@@ -221,8 +219,8 @@
       info.last_modified + base::TimeDelta::FromHours(5);
 
   EXPECT_EQ(base::File::FILE_OK,
-            file_util()->Touch(context.get(), CreateURL(dir_name),
-                              new_accessed, new_modified));
+            file_util()->Touch(context.get(), CreateURL(dir_name), new_accessed,
+                               new_modified));
 
   ASSERT_TRUE(base::GetFileInfo(LocalPath(dir_name), &info));
   EXPECT_EQ(new_accessed, info.last_accessed);
@@ -230,7 +228,7 @@
 }
 
 TEST_F(LocalFileUtilTest, Truncate) {
-  const char *file_name = "truncated";
+  const char* file_name = "truncated";
   bool created;
   ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(file_name, &created));
   ASSERT_TRUE(created);
@@ -246,9 +244,9 @@
 }
 
 TEST_F(LocalFileUtilTest, CopyFile) {
-  const char *from_file = "fromfile";
-  const char *to_file1 = "tofile1";
-  const char *to_file2 = "tofile2";
+  const char* from_file = "fromfile";
+  const char* to_file1 = "tofile1";
+  const char* to_file2 = "tofile2";
   bool created;
   ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(from_file, &created));
   ASSERT_TRUE(created);
@@ -261,16 +259,16 @@
   EXPECT_TRUE(FileExists(from_file));
   EXPECT_EQ(1020, GetSize(from_file));
 
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::Copy(file_system_context(),
-                                      CreateURL(from_file),
-                                      CreateURL(to_file1)));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      AsyncFileTestHelper::Copy(file_system_context(), CreateURL(from_file),
+                                CreateURL(to_file1)));
 
   context.reset(NewContext());
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::Copy(file_system_context(),
-                                      CreateURL(from_file),
-                                      CreateURL(to_file2)));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      AsyncFileTestHelper::Copy(file_system_context(), CreateURL(from_file),
+                                CreateURL(to_file2)));
 
   EXPECT_TRUE(FileExists(from_file));
   EXPECT_EQ(1020, GetSize(from_file));
@@ -281,10 +279,10 @@
 }
 
 TEST_F(LocalFileUtilTest, CopyDirectory) {
-  const char *from_dir = "fromdir";
-  const char *from_file = "fromdir/fromfile";
-  const char *to_dir = "todir";
-  const char *to_file = "todir/fromfile";
+  const char* from_dir = "fromdir";
+  const char* from_file = "fromdir/fromfile";
+  const char* to_dir = "todir";
+  const char* to_file = "todir/fromfile";
   bool created;
   std::unique_ptr<FileSystemOperationContext> context;
 
@@ -318,8 +316,8 @@
 }
 
 TEST_F(LocalFileUtilTest, MoveFile) {
-  const char *from_file = "fromfile";
-  const char *to_file = "tofile";
+  const char* from_file = "fromfile";
+  const char* to_file = "tofile";
   bool created;
   ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(from_file, &created));
   ASSERT_TRUE(created);
@@ -333,10 +331,9 @@
   EXPECT_EQ(1020, GetSize(from_file));
 
   context.reset(NewContext());
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::Move(file_system_context(),
-                                      CreateURL(from_file),
-                                      CreateURL(to_file)));
+  ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::Move(
+                                     file_system_context(),
+                                     CreateURL(from_file), CreateURL(to_file)));
 
   EXPECT_FALSE(FileExists(from_file));
   EXPECT_TRUE(FileExists(to_file));
@@ -344,10 +341,10 @@
 }
 
 TEST_F(LocalFileUtilTest, MoveDirectory) {
-  const char *from_dir = "fromdir";
-  const char *from_file = "fromdir/fromfile";
-  const char *to_dir = "todir";
-  const char *to_file = "todir/fromfile";
+  const char* from_dir = "fromdir";
+  const char* from_file = "fromdir/fromfile";
+  const char* to_dir = "todir";
+  const char* to_file = "todir/fromfile";
   bool created;
   std::unique_ptr<FileSystemOperationContext> context;
 
@@ -370,8 +367,7 @@
   context.reset(NewContext());
   ASSERT_EQ(base::File::FILE_OK,
             AsyncFileTestHelper::Move(file_system_context(),
-                                      CreateURL(from_dir),
-                                      CreateURL(to_dir)));
+                                      CreateURL(from_dir), CreateURL(to_dir)));
 
   EXPECT_FALSE(DirectoryExists(from_dir));
   EXPECT_TRUE(DirectoryExists(to_dir));
diff --git a/storage/browser/fileapi/memory_file_stream_reader.cc b/storage/browser/file_system/memory_file_stream_reader.cc
similarity index 96%
rename from storage/browser/fileapi/memory_file_stream_reader.cc
rename to storage/browser/file_system/memory_file_stream_reader.cc
index af8098c..f5d895c6 100644
--- a/storage/browser/fileapi/memory_file_stream_reader.cc
+++ b/storage/browser/file_system/memory_file_stream_reader.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/memory_file_stream_reader.h"
+#include "storage/browser/file_system/memory_file_stream_reader.h"
 
 #include <memory>
 #include <utility>
diff --git a/storage/browser/fileapi/memory_file_stream_reader.h b/storage/browser/file_system/memory_file_stream_reader.h
similarity index 79%
rename from storage/browser/fileapi/memory_file_stream_reader.h
rename to storage/browser/file_system/memory_file_stream_reader.h
index ae9aeb7b..909db6b 100644
--- a/storage/browser/fileapi/memory_file_stream_reader.h
+++ b/storage/browser/file_system/memory_file_stream_reader.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_MEMORY_FILE_STREAM_READER_H_
-#define STORAGE_BROWSER_FILEAPI_MEMORY_FILE_STREAM_READER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_MEMORY_FILE_STREAM_READER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_MEMORY_FILE_STREAM_READER_H_
 
 #include "base/component_export.h"
 #include "base/files/file.h"
@@ -11,8 +11,8 @@
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "net/base/completion_once_callback.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
 
 namespace storage {
 
@@ -48,4 +48,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_MEMORY_FILE_STREAM_READER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_MEMORY_FILE_STREAM_READER_H_
diff --git a/storage/browser/fileapi/memory_file_stream_reader_unittest.cc b/storage/browser/file_system/memory_file_stream_reader_unittest.cc
similarity index 96%
rename from storage/browser/fileapi/memory_file_stream_reader_unittest.cc
rename to storage/browser/file_system/memory_file_stream_reader_unittest.cc
index cf04849..a7a50f8 100644
--- a/storage/browser/fileapi/memory_file_stream_reader_unittest.cc
+++ b/storage/browser/file_system/memory_file_stream_reader_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/memory_file_stream_reader.h"
+#include "storage/browser/file_system/memory_file_stream_reader.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -19,9 +19,9 @@
 #include "base/macros.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_test_utils.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_test_utils.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace storage {
diff --git a/storage/browser/fileapi/memory_file_stream_writer.cc b/storage/browser/file_system/memory_file_stream_writer.cc
similarity index 96%
rename from storage/browser/fileapi/memory_file_stream_writer.cc
rename to storage/browser/file_system/memory_file_stream_writer.cc
index 37f1e6d..5cde62e 100644
--- a/storage/browser/fileapi/memory_file_stream_writer.cc
+++ b/storage/browser/file_system/memory_file_stream_writer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/memory_file_stream_writer.h"
+#include "storage/browser/file_system/memory_file_stream_writer.h"
 
 #include <memory>
 #include <utility>
diff --git a/storage/browser/fileapi/memory_file_stream_writer.h b/storage/browser/file_system/memory_file_stream_writer.h
similarity index 78%
rename from storage/browser/fileapi/memory_file_stream_writer.h
rename to storage/browser/file_system/memory_file_stream_writer.h
index 0d518f6..1e33dff 100644
--- a/storage/browser/fileapi/memory_file_stream_writer.h
+++ b/storage/browser/file_system/memory_file_stream_writer.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_MEMORY_FILE_STREAM_WRITER_H_
-#define STORAGE_BROWSER_FILEAPI_MEMORY_FILE_STREAM_WRITER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_MEMORY_FILE_STREAM_WRITER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_MEMORY_FILE_STREAM_WRITER_H_
 
 #include "base/callback.h"
 #include "base/component_export.h"
 #include "base/files/file_path.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
 
 namespace storage {
 
@@ -45,4 +45,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_MEMORY_FILE_STREAM_WRITER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_MEMORY_FILE_STREAM_WRITER_H_
diff --git a/storage/browser/fileapi/memory_file_stream_writer_unittest.cc b/storage/browser/file_system/memory_file_stream_writer_unittest.cc
similarity index 95%
rename from storage/browser/fileapi/memory_file_stream_writer_unittest.cc
rename to storage/browser/file_system/memory_file_stream_writer_unittest.cc
index b2f8b270..9e38d77 100644
--- a/storage/browser/fileapi/memory_file_stream_writer_unittest.cc
+++ b/storage/browser/file_system/memory_file_stream_writer_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/memory_file_stream_writer.h"
+#include "storage/browser/file_system/memory_file_stream_writer.h"
 
 #include <stdint.h>
 
@@ -15,9 +15,9 @@
 #include "base/files/scoped_temp_dir.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_stream_test_utils.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/file_stream_test_utils.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace storage {
diff --git a/storage/browser/fileapi/mount_points.cc b/storage/browser/file_system/mount_points.cc
similarity index 61%
rename from storage/browser/fileapi/mount_points.cc
rename to storage/browser/file_system/mount_points.cc
index d8782a3..c78a6c96 100644
--- a/storage/browser/fileapi/mount_points.cc
+++ b/storage/browser/file_system/mount_points.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/mount_points.h"
+#include "storage/browser/file_system/mount_points.h"
 
 namespace storage {
 
 MountPoints::MountPointInfo::MountPointInfo() = default;
-MountPoints::MountPointInfo::MountPointInfo(
-    const std::string& name, const base::FilePath& path)
+MountPoints::MountPointInfo::MountPointInfo(const std::string& name,
+                                            const base::FilePath& path)
     : name(name), path(path) {}
 
 }  // namespace storage
diff --git a/storage/browser/fileapi/mount_points.h b/storage/browser/file_system/mount_points.h
similarity index 95%
rename from storage/browser/fileapi/mount_points.h
rename to storage/browser/file_system/mount_points.h
index 7a36e5b..ef8a82f 100644
--- a/storage/browser/fileapi/mount_points.h
+++ b/storage/browser/file_system/mount_points.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_MOUNT_POINTS_H_
-#define STORAGE_BROWSER_FILEAPI_MOUNT_POINTS_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_MOUNT_POINTS_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_MOUNT_POINTS_H_
 
 #include <string>
 #include <vector>
@@ -21,7 +21,7 @@
 namespace storage {
 class FileSystemMountOption;
 class FileSystemURL;
-}
+}  // namespace storage
 
 namespace storage {
 
@@ -108,4 +108,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_MOUNT_POINTS_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_MOUNT_POINTS_H_
diff --git a/storage/browser/fileapi/native_file_util.cc b/storage/browser/file_system/native_file_util.cc
similarity index 84%
rename from storage/browser/fileapi/native_file_util.cc
rename to storage/browser/file_system/native_file_util.cc
index fe6ef36..11457606 100644
--- a/storage/browser/fileapi/native_file_util.cc
+++ b/storage/browser/file_system/native_file_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 
 #include <stdint.h>
 
@@ -11,8 +11,8 @@
 #include "base/files/file_enumerator.h"
 #include "base/files/file_util.h"
 #include "build/build_config.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/common/fileapi/file_system_mount_option.h"
 
 namespace storage {
@@ -25,17 +25,17 @@
 // TODO(benchan): Find a better place outside webkit to host this function.
 bool SetPlatformSpecificDirectoryPermissions(const base::FilePath& dir_path) {
 #if defined(OS_CHROMEOS)
-    // System daemons on Chrome OS may run as a user different than the Chrome
-    // process but need to access files under the directories created here.
-    // Because of that, grant the execute permission on the created directory
-    // to group and other users.
-    if (HANDLE_EINTR(chmod(dir_path.value().c_str(),
-                           S_IRWXU | S_IXGRP | S_IXOTH)) != 0) {
-      return false;
-    }
+  // System daemons on Chrome OS may run as a user different than the Chrome
+  // process but need to access files under the directories created here.
+  // Because of that, grant the execute permission on the created directory
+  // to group and other users.
+  if (HANDLE_EINTR(
+          chmod(dir_path.value().c_str(), S_IRWXU | S_IXGRP | S_IXOTH)) != 0) {
+    return false;
+  }
 #endif
-    // Keep the directory permissions unchanged on non-Chrome OS platforms.
-    return true;
+  // Keep the directory permissions unchanged on non-Chrome OS platforms.
+  return true;
 }
 
 // Copies a file |from| to |to|, and ensure the written content is synced to
@@ -61,7 +61,7 @@
       return false;
     if (bytes_read == 0)
       break;
-    for (int bytes_written = 0; bytes_written < bytes_read; ) {
+    for (int bytes_written = 0; bytes_written < bytes_read;) {
       int bytes_written_partial = outfile.WriteAtCurrentPos(
           &buffer[bytes_written], bytes_read - bytes_written);
       if (bytes_written_partial < 0)
@@ -82,8 +82,7 @@
   NativeFileEnumerator(const base::FilePath& root_path,
                        bool recursive,
                        int file_type)
-    : file_enum_(root_path, recursive, file_type) {
-  }
+      : file_enum_(root_path, recursive, file_type) {}
 
   ~NativeFileEnumerator() override = default;
 
@@ -117,7 +116,8 @@
 }
 
 NativeFileUtil::CopyOrMoveMode NativeFileUtil::CopyOrMoveModeForDestination(
-    const FileSystemURL& dest_url, bool copy) {
+    const FileSystemURL& dest_url,
+    bool copy) {
   if (copy) {
     return dest_url.mount_option().flush_policy() ==
                    FlushPolicy::FLUSH_ON_COMPLETION
@@ -141,9 +141,8 @@
   return base::File(path, file_flags);
 }
 
-base::File::Error NativeFileUtil::EnsureFileExists(
-    const base::FilePath& path,
-    bool* created) {
+base::File::Error NativeFileUtil::EnsureFileExists(const base::FilePath& path,
+                                                   bool* created) {
   if (!base::DirectoryExists(path.DirName()))
     // If its parent does not exist, should return NOT_FOUND error.
     return base::File::FILE_ERROR_NOT_FOUND;
@@ -168,10 +167,9 @@
   return error_code;
 }
 
-base::File::Error NativeFileUtil::CreateDirectory(
-    const base::FilePath& path,
-    bool exclusive,
-    bool recursive) {
+base::File::Error NativeFileUtil::CreateDirectory(const base::FilePath& path,
+                                                  bool exclusive,
+                                                  bool recursive) {
   // If parent dir of file doesn't exist.
   if (!recursive && !base::PathExists(path.DirName()))
     return base::File::FILE_ERROR_NOT_FOUND;
@@ -191,15 +189,14 @@
     // Since some file systems don't support permission setting, we do not treat
     // an error from the function as the failure of copying. Just log it.
     LOG(WARNING) << "Setting directory permission failed: "
-        << path.AsUTF8Unsafe();
+                 << path.AsUTF8Unsafe();
   }
 
   return base::File::FILE_OK;
 }
 
-base::File::Error NativeFileUtil::GetFileInfo(
-    const base::FilePath& path,
-    base::File::Info* file_info) {
+base::File::Error NativeFileUtil::GetFileInfo(const base::FilePath& path,
+                                              base::File::Info* file_info) {
   if (!base::PathExists(path))
     return base::File::FILE_ERROR_NOT_FOUND;
 
@@ -216,10 +213,9 @@
       base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES);
 }
 
-base::File::Error NativeFileUtil::Touch(
-    const base::FilePath& path,
-    const base::Time& last_access_time,
-    const base::Time& last_modified_time) {
+base::File::Error NativeFileUtil::Touch(const base::FilePath& path,
+                                        const base::Time& last_access_time,
+                                        const base::Time& last_modified_time) {
   if (!base::TouchFile(path, last_access_time, last_modified_time))
     return base::File::FILE_ERROR_FAILED;
   return base::File::FILE_OK;
@@ -260,8 +256,7 @@
   base::Time last_modified = info.last_modified;
 
   error = NativeFileUtil::GetFileInfo(dest_path, &info);
-  if (error != base::File::FILE_OK &&
-      error != base::File::FILE_ERROR_NOT_FOUND)
+  if (error != base::File::FILE_OK && error != base::File::FILE_ERROR_NOT_FOUND)
     return error;
   if (error == base::File::FILE_OK) {
     if (info.is_directory != src_is_directory)
diff --git a/storage/browser/fileapi/native_file_util.h b/storage/browser/file_system/native_file_util.h
similarity index 85%
rename from storage/browser/fileapi/native_file_util.h
rename to storage/browser/file_system/native_file_util.h
index 5dc9e1d4..c71349d 100644
--- a/storage/browser/fileapi/native_file_util.h
+++ b/storage/browser/file_system/native_file_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_NATIVE_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_NATIVE_FILE_UTIL_H_
 
 #include <stdint.h>
 
@@ -13,7 +13,7 @@
 #include "base/files/file.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_file_util.h"
 
 namespace base {
 class Time;
@@ -27,20 +27,17 @@
 //
 // For the error checks it performs please see the comment for
 // FileSystemFileUtil interface
-// (storage/browser/fileapi/file_system_file_util.h).
+// (storage/browser/file_system/file_system_file_util.h).
 //
 // Note that all the methods of this class are static and this does NOT
 // inherit from FileSystemFileUtil.
 class COMPONENT_EXPORT(STORAGE_BROWSER) NativeFileUtil {
  public:
-  enum CopyOrMoveMode {
-    COPY_NOSYNC,
-    COPY_SYNC,
-    MOVE
-  };
+  enum CopyOrMoveMode { COPY_NOSYNC, COPY_SYNC, MOVE };
 
   static CopyOrMoveMode CopyOrMoveModeForDestination(
-      const FileSystemURL& dest_url, bool copy);
+      const FileSystemURL& dest_url,
+      bool copy);
 
   static base::File CreateOrOpen(const base::FilePath& path, int file_flags);
   static base::File::Error EnsureFileExists(const base::FilePath& path,
@@ -72,4 +69,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_NATIVE_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/native_file_util_unittest.cc b/storage/browser/file_system/native_file_util_unittest.cc
similarity index 90%
rename from storage/browser/fileapi/native_file_util_unittest.cc
rename to storage/browser/file_system/native_file_util_unittest.cc
index 52282196..047abb1 100644
--- a/storage/browser/fileapi/native_file_util_unittest.cc
+++ b/storage/browser/file_system/native_file_util_unittest.cc
@@ -13,7 +13,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/macros.h"
 #include "build/build_config.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using storage::FileSystemFileUtil;
@@ -36,8 +36,7 @@
   }
 
   bool FileExists(const base::FilePath& path) {
-    return base::PathExists(path) &&
-           !base::DirectoryExists(path);
+    return base::PathExists(path) && !base::DirectoryExists(path);
   }
 
   int64_t GetSize(const base::FilePath& path) {
@@ -70,8 +69,7 @@
   ASSERT_FALSE(file.created());
   file.Close();
 
-  ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::DeleteFile(file_name));
+  ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::DeleteFile(file_name));
   EXPECT_FALSE(base::PathExists(file_name));
   EXPECT_FALSE(NativeFileUtil::PathExists(file_name));
 }
@@ -94,20 +92,17 @@
 TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) {
   base::FilePath dir_name = Path("test_dir");
   ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::CreateDirectory(dir_name,
-                                            false /* exclusive */,
+            NativeFileUtil::CreateDirectory(dir_name, false /* exclusive */,
                                             false /* recursive */));
 
   EXPECT_TRUE(NativeFileUtil::DirectoryExists(dir_name));
   EXPECT_TRUE(base::DirectoryExists(dir_name));
 
   ASSERT_EQ(base::File::FILE_ERROR_EXISTS,
-            NativeFileUtil::CreateDirectory(dir_name,
-                                            true /* exclusive */,
+            NativeFileUtil::CreateDirectory(dir_name, true /* exclusive */,
                                             false /* recursive */));
 
-  ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::DeleteDirectory(dir_name));
+  ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::DeleteDirectory(dir_name));
   EXPECT_FALSE(base::DirectoryExists(dir_name));
   EXPECT_FALSE(NativeFileUtil::DirectoryExists(dir_name));
 }
@@ -140,8 +135,7 @@
       info.last_modified + base::TimeDelta::FromHours(5);
 
   EXPECT_EQ(base::File::FILE_OK,
-            NativeFileUtil::Touch(file_name,
-                                  new_accessed, new_modified));
+            NativeFileUtil::Touch(file_name, new_accessed, new_modified));
 
   ASSERT_TRUE(base::GetFileInfo(file_name, &info));
   EXPECT_EQ(new_accessed, info.last_accessed);
@@ -202,8 +196,7 @@
             NativeFileUtil::EnsureFileExists(file_name, &created));
   ASSERT_TRUE(created);
 
-  ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::Truncate(file_name, 1020));
+  ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Truncate(file_name, 1020));
 
   EXPECT_TRUE(FileExists(file_name));
   EXPECT_EQ(1020, GetSize(file_name));
@@ -220,8 +213,7 @@
             NativeFileUtil::EnsureFileExists(from_file, &created));
   ASSERT_TRUE(created);
 
-  ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::Truncate(from_file, 1020));
+  ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Truncate(from_file, 1020));
 
   EXPECT_TRUE(FileExists(from_file));
   EXPECT_EQ(1020, GetSize(from_file));
@@ -246,19 +238,18 @@
             NativeFileUtil::CreateDirectory(dir, false, false));
   ASSERT_TRUE(base::DirectoryExists(dir));
   base::FilePath to_dir_file = dir.AppendASCII("file");
-  ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::CopyOrMoveFile(
-                from_file, to_dir_file,
-                FileSystemOperation::OPTION_NONE, nosync));
+  ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::CopyOrMoveFile(
+                                     from_file, to_dir_file,
+                                     FileSystemOperation::OPTION_NONE, nosync));
   EXPECT_TRUE(FileExists(to_dir_file));
   EXPECT_EQ(1020, GetSize(to_dir_file));
 
   // Following tests are error checking.
   // Source doesn't exist.
-  EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
-            NativeFileUtil::CopyOrMoveFile(
-                Path("nonexists"), Path("file"),
-                FileSystemOperation::OPTION_NONE, nosync));
+  EXPECT_EQ(
+      base::File::FILE_ERROR_NOT_FOUND,
+      NativeFileUtil::CopyOrMoveFile(Path("nonexists"), Path("file"),
+                                     FileSystemOperation::OPTION_NONE, nosync));
 
   // Source is not a file.
   EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE,
@@ -312,20 +303,19 @@
             NativeFileUtil::CreateDirectory(dir, false, false));
   ASSERT_TRUE(base::DirectoryExists(dir));
   base::FilePath to_dir_file = dir.AppendASCII("file");
-  ASSERT_EQ(base::File::FILE_OK,
-            NativeFileUtil::CopyOrMoveFile(
-                from_file, to_dir_file,
-                FileSystemOperation::OPTION_NONE, move));
+  ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::CopyOrMoveFile(
+                                     from_file, to_dir_file,
+                                     FileSystemOperation::OPTION_NONE, move));
   EXPECT_FALSE(FileExists(from_file));
   EXPECT_TRUE(FileExists(to_dir_file));
   EXPECT_EQ(1020, GetSize(to_dir_file));
 
   // Following is error checking.
   // Source doesn't exist.
-  EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
-            NativeFileUtil::CopyOrMoveFile(
-                Path("nonexists"), Path("file"),
-                FileSystemOperation::OPTION_NONE, move));
+  EXPECT_EQ(
+      base::File::FILE_ERROR_NOT_FOUND,
+      NativeFileUtil::CopyOrMoveFile(Path("nonexists"), Path("file"),
+                                     FileSystemOperation::OPTION_NONE, move));
 
   base::FilePath dir2 = Path("dir2");
   ASSERT_EQ(base::File::FILE_OK,
diff --git a/storage/browser/fileapi/obfuscated_file_util.cc b/storage/browser/file_system/obfuscated_file_util.cc
similarity index 90%
rename from storage/browser/fileapi/obfuscated_file_util.cc
rename to storage/browser/file_system/obfuscated_file_util.cc
index fe268d7..e57b7cd 100644
--- a/storage/browser/fileapi/obfuscated_file_util.cc
+++ b/storage/browser/file_system/obfuscated_file_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/obfuscated_file_util.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -22,15 +22,15 @@
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/obfuscated_file_util_disk_delegate.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
-#include "storage/browser/fileapi/sandbox_isolated_origin_database.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
-#include "storage/browser/fileapi/sandbox_prioritized_origin_database.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/obfuscated_file_util_disk_delegate.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_isolated_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_prioritized_origin_database.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/database/database_identifier.h"
 #include "storage/common/fileapi/file_system_util.h"
@@ -53,10 +53,9 @@
 using FileId = SandboxDirectoryDatabase::FileId;
 using FileInfo = SandboxDirectoryDatabase::FileInfo;
 
-void InitFileInfo(
-    SandboxDirectoryDatabase::FileInfo* file_info,
-    SandboxDirectoryDatabase::FileId parent_id,
-    const base::FilePath::StringType& file_name) {
+void InitFileInfo(SandboxDirectoryDatabase::FileInfo* file_info,
+                  SandboxDirectoryDatabase::FileId parent_id,
+                  const base::FilePath::StringType& file_name) {
   DCHECK(file_info);
   file_info->parent_id = parent_id;
   file_info->name = file_name;
@@ -113,12 +112,11 @@
 class ObfuscatedFileEnumerator final
     : public FileSystemFileUtil::AbstractFileEnumerator {
  public:
-  ObfuscatedFileEnumerator(
-      SandboxDirectoryDatabase* db,
-      FileSystemOperationContext* context,
-      ObfuscatedFileUtil* obfuscated_file_util,
-      const FileSystemURL& root_url,
-      bool recursive)
+  ObfuscatedFileEnumerator(SandboxDirectoryDatabase* db,
+                           FileSystemOperationContext* context,
+                           ObfuscatedFileUtil* obfuscated_file_util,
+                           const FileSystemURL& root_url,
+                           bool recursive)
       : db_(db),
         context_(context),
         obfuscated_file_util_(obfuscated_file_util),
@@ -131,7 +129,7 @@
     if (!db_->GetFileWithPath(root_virtual_path, &file_id))
       return;
 
-    FileRecord record = { file_id, root_virtual_path };
+    FileRecord record = {file_id, root_virtual_path};
     recurse_queue_.push(record);
   }
 
@@ -150,14 +148,14 @@
 
       base::FilePath platform_file_path;
       error = obfuscated_file_util_->GetFileInfoInternal(
-          db_, context_, root_url_, current_file_id_,
-          &file_info, &current_platform_file_info_, &platform_file_path);
+          db_, context_, root_url_, current_file_id_, &file_info,
+          &current_platform_file_info_, &platform_file_path);
     } while (error != base::File::FILE_OK);
 
     base::FilePath virtual_path =
         current_parent_virtual_path_.Append(file_info.name);
     if (recursive_ && file_info.is_directory()) {
-      FileRecord record = { current_file_id_, virtual_path };
+      FileRecord record = {current_file_id_, virtual_path};
       recurse_queue_.push(record);
     }
     return virtual_path;
@@ -294,9 +292,9 @@
   DropDatabases();
 }
 
-base::File ObfuscatedFileUtil::CreateOrOpen(
-    FileSystemOperationContext* context,
-    const FileSystemURL& url, int file_flags) {
+base::File ObfuscatedFileUtil::CreateOrOpen(FileSystemOperationContext* context,
+                                            const FileSystemURL& url,
+                                            int file_flags) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   base::File file = CreateOrOpenInternal(context, url, file_flags);
   if (file.IsValid() && file_flags & base::File::FLAG_WRITE &&
@@ -492,8 +490,7 @@
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   base::File::Info file_info;
   base::FilePath local_path;
-  base::File::Error error =
-      GetFileInfo(context, url, &file_info, &local_path);
+  base::File::Error error = GetFileInfo(context, url, &file_info, &local_path);
   if (error != base::File::FILE_OK)
     return error;
 
@@ -528,15 +525,14 @@
     return base::File::FILE_ERROR_NOT_FOUND;
 
   FileId dest_file_id;
-  bool overwrite = db->GetFileWithPath(dest_url.path(),
-                                       &dest_file_id);
+  bool overwrite = db->GetFileWithPath(dest_url.path(), &dest_file_id);
 
   FileInfo src_file_info;
   base::File::Info src_platform_file_info;
   base::FilePath src_local_path;
-  base::File::Error error = GetFileInfoInternal(
-      db, context, src_url, src_file_id,
-      &src_file_info, &src_platform_file_info, &src_local_path);
+  base::File::Error error =
+      GetFileInfoInternal(db, context, src_url, src_file_id, &src_file_info,
+                          &src_platform_file_info, &src_local_path);
   if (error != base::File::FILE_OK)
     return error;
   if (src_file_info.is_directory())
@@ -544,11 +540,11 @@
 
   FileInfo dest_file_info;
   base::File::Info dest_platform_file_info;  // overwrite case only
-  base::FilePath dest_local_path;  // overwrite case only
+  base::FilePath dest_local_path;            // overwrite case only
   if (overwrite) {
     base::File::Error error = GetFileInfoInternal(
-        db, context, dest_url, dest_file_id,
-        &dest_file_info, &dest_platform_file_info, &dest_local_path);
+        db, context, dest_url, dest_file_id, &dest_file_info,
+        &dest_platform_file_info, &dest_local_path);
     if (error == base::File::FILE_ERROR_NOT_FOUND)
       overwrite = false;  // fallback to non-overwrite case
     else if (error != base::File::FILE_OK)
@@ -565,8 +561,7 @@
 
     dest_file_info = src_file_info;
     dest_file_info.parent_id = dest_parent_id;
-    dest_file_info.name =
-        VirtualPath::BaseName(dest_url.path()).value();
+    dest_file_info.name = VirtualPath::BaseName(dest_url.path()).value();
   }
 
   int64_t growth = 0;
@@ -662,16 +657,15 @@
     return base::File::FILE_ERROR_NOT_FOUND;
 
   FileId dest_file_id;
-  bool overwrite = db->GetFileWithPath(dest_url.path(),
-                                       &dest_file_id);
+  bool overwrite = db->GetFileWithPath(dest_url.path(), &dest_file_id);
 
   FileInfo dest_file_info;
   base::File::Info dest_platform_file_info;  // overwrite case only
   if (overwrite) {
     base::FilePath dest_local_path;
     base::File::Error error = GetFileInfoInternal(
-        db, context, dest_url, dest_file_id,
-        &dest_file_info, &dest_platform_file_info, &dest_local_path);
+        db, context, dest_url, dest_file_id, &dest_file_info,
+        &dest_platform_file_info, &dest_local_path);
     if (error == base::File::FILE_ERROR_NOT_FOUND)
       overwrite = false;  // fallback to non-overwrite case
     else if (error != base::File::FILE_OK)
@@ -743,8 +737,7 @@
   base::FilePath local_path;
   base::File::Error error = GetFileInfoInternal(
       db, context, url, file_id, &file_info, &platform_file_info, &local_path);
-  if (error != base::File::FILE_ERROR_NOT_FOUND &&
-      error != base::File::FILE_OK)
+  if (error != base::File::FILE_ERROR_NOT_FOUND && error != base::File::FILE_OK)
     return error;
 
   if (file_info.is_directory())
@@ -825,15 +818,14 @@
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   SandboxDirectoryDatabase* db = GetDirectoryDatabase(root_url, false);
   if (!db) {
-    return std::unique_ptr<AbstractFileEnumerator>(new EmptyFileEnumerator());
+    return base::WrapUnique(new EmptyFileEnumerator);
   }
-  return std::unique_ptr<AbstractFileEnumerator>(
-      new ObfuscatedFileEnumerator(db, context, this, root_url, recursive));
+  return std::make_unique<ObfuscatedFileEnumerator>(
+      db, context, this, root_url, recursive);
 }
 
-bool ObfuscatedFileUtil::IsDirectoryEmpty(
-    FileSystemOperationContext* context,
-    const FileSystemURL& url) {
+bool ObfuscatedFileUtil::IsDirectoryEmpty(FileSystemOperationContext* context,
+                                          const FileSystemURL& url) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, false);
   if (!db)
@@ -873,9 +865,8 @@
       (!create || delegate_->CreateDirectory(path, false /* exclusive */,
                                              true /* recursive */) !=
                       base::File::FILE_OK)) {
-    error = create ?
-          base::File::FILE_ERROR_FAILED :
-          base::File::FILE_ERROR_NOT_FOUND;
+    error = create ? base::File::FILE_ERROR_FAILED
+                   : base::File::FILE_ERROR_NOT_FOUND;
   }
 
   if (error_code)
@@ -1009,8 +1000,8 @@
     if (!base::Contains(known_type_strings_, type_string))
       continue;
     base::File::Error error = base::File::FILE_ERROR_FAILED;
-    base::FilePath path = GetDirectoryForOriginAndType(
-        origin, type_string, false, &error);
+    base::FilePath path =
+        GetDirectoryForOriginAndType(origin, type_string, false, &error);
     if (error != base::File::FILE_OK)
       continue;
     std::unique_ptr<SandboxDirectoryDatabase> db =
@@ -1092,13 +1083,14 @@
 base::File ObfuscatedFileUtil::CreateAndOpenFile(
     FileSystemOperationContext* context,
     const FileSystemURL& dest_url,
-    FileInfo* dest_file_info, int file_flags) {
+    FileInfo* dest_file_info,
+    int file_flags) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   SandboxDirectoryDatabase* db = GetDirectoryDatabase(dest_url, true);
 
   base::FilePath root, dest_local_path;
-  base::File::Error error = GenerateNewLocalPath(db, context, dest_url, &root,
-                                                 &dest_local_path);
+  base::File::Error error =
+      GenerateNewLocalPath(db, context, dest_url, &root, &dest_local_path);
   if (error != base::File::FILE_OK)
     return base::File(error);
 
@@ -1140,8 +1132,8 @@
   SandboxDirectoryDatabase* db = GetDirectoryDatabase(dest_url, true);
 
   base::FilePath root, dest_local_path;
-  base::File::Error error = GenerateNewLocalPath(db, context, dest_url, &root,
-                                                 &dest_local_path);
+  base::File::Error error =
+      GenerateNewLocalPath(db, context, dest_url, &root, &dest_local_path);
   if (error != base::File::FILE_OK)
     return error;
 
@@ -1185,8 +1177,8 @@
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   // This removes the root, including the trailing slash, leaving a relative
   // path.
-  dest_file_info->data_path = base::FilePath(
-      local_path.value().substr(root.value().length() + 1));
+  dest_file_info->data_path =
+      base::FilePath(local_path.value().substr(root.value().length() + 1));
 
   FileId file_id;
   base::File::Error error = db->AddFileInfo(*dest_file_info, &file_id);
@@ -1198,7 +1190,8 @@
 }
 
 base::FilePath ObfuscatedFileUtil::DataPathToLocalPath(
-    const FileSystemURL& url, const base::FilePath& data_path) {
+    const FileSystemURL& url,
+    const base::FilePath& data_path) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   base::File::Error error = base::File::FILE_OK;
   base::FilePath root = GetDirectoryForURL(url, false, &error);
@@ -1208,10 +1201,11 @@
 }
 
 std::string ObfuscatedFileUtil::GetDirectoryDatabaseKey(
-    const GURL& origin, const std::string& type_string) {
+    const GURL& origin,
+    const std::string& type_string) {
   // For isolated origin we just use a type string as a key.
   return storage::GetIdentifierFromOrigin(origin) +
-      kDirectoryDatabaseKeySeparator + type_string;
+         kDirectoryDatabaseKeySeparator + type_string;
 }
 
 // TODO(ericu): How to do the whole validation-without-creation thing?
@@ -1219,7 +1213,8 @@
 // Ah, in that case don't even get here?
 // Still doesn't answer the quota issue, though.
 SandboxDirectoryDatabase* ObfuscatedFileUtil::GetDirectoryDatabase(
-    const FileSystemURL& url, bool create) {
+    const FileSystemURL& url,
+    bool create) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
 
   std::string key = GetDirectoryDatabaseKey(url.origin().GetURL(),
@@ -1236,8 +1231,8 @@
   base::File::Error error = base::File::FILE_OK;
   base::FilePath path = GetDirectoryForURL(url, create, &error);
   if (error != base::File::FILE_OK) {
-    LOG(WARNING) << "Failed to get origin+type directory: "
-                 << url.DebugString() << " error:" << error;
+    LOG(WARNING) << "Failed to get origin+type directory: " << url.DebugString()
+                 << " error:" << error;
     return nullptr;
   }
   MarkUsed();
@@ -1247,13 +1242,14 @@
 }
 
 base::FilePath ObfuscatedFileUtil::GetDirectoryForOrigin(
-    const GURL& origin, bool create, base::File::Error* error_code) {
+    const GURL& origin,
+    bool create,
+    base::File::Error* error_code) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   if (!InitOriginDatabase(origin, create)) {
     if (error_code) {
-      *error_code = create ?
-          base::File::FILE_ERROR_FAILED :
-          base::File::FILE_ERROR_NOT_FOUND;
+      *error_code = create ? base::File::FILE_ERROR_FAILED
+                           : base::File::FILE_ERROR_NOT_FOUND;
     }
     return base::FilePath();
   }
@@ -1288,9 +1284,8 @@
                                               true /* recursive */) !=
                        base::File::FILE_OK) {
       if (error_code)
-        *error_code = create ?
-            base::File::FILE_ERROR_FAILED :
-            base::File::FILE_ERROR_NOT_FOUND;
+        *error_code = create ? base::File::FILE_ERROR_FAILED
+                             : base::File::FILE_ERROR_NOT_FOUND;
       return base::FilePath();
     }
   }
@@ -1365,8 +1360,7 @@
   const std::string isolated_origin_string =
       storage::GetIdentifierFromOrigin(origin_hint);
 
-  prioritized_origin_database->InitializePrimaryOrigin(
-      isolated_origin_string);
+  prioritized_origin_database->InitializePrimaryOrigin(isolated_origin_string);
 
   return true;
 }
@@ -1390,8 +1384,8 @@
 
   // We use the third- and fourth-to-last digits as the directory.
   int64_t directory_number = number % 10000 / 100;
-  base::FilePath new_local_path = root->AppendASCII(
-      base::StringPrintf("%02" PRId64, directory_number));
+  base::FilePath new_local_path =
+      root->AppendASCII(base::StringPrintf("%02" PRId64, directory_number));
 
   error = delegate_->CreateDirectory(new_local_path, false /* exclusive */,
                                      false /* recursive */);
@@ -1405,19 +1399,22 @@
 
 base::File ObfuscatedFileUtil::CreateOrOpenInternal(
     FileSystemOperationContext* context,
-    const FileSystemURL& url, int file_flags) {
+    const FileSystemURL& url,
+    int file_flags) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
-  DCHECK(!(file_flags & (base::File::FLAG_DELETE_ON_CLOSE |
-        base::File::FLAG_HIDDEN | base::File::FLAG_EXCLUSIVE_READ |
-        base::File::FLAG_EXCLUSIVE_WRITE)));
+  DCHECK(
+      !(file_flags &
+        (base::File::FLAG_DELETE_ON_CLOSE | base::File::FLAG_HIDDEN |
+         base::File::FLAG_EXCLUSIVE_READ | base::File::FLAG_EXCLUSIVE_WRITE)));
   SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, true);
   if (!db)
     return base::File(base::File::FILE_ERROR_FAILED);
   FileId file_id;
   if (!db->GetFileWithPath(url.path(), &file_id)) {
     // The file doesn't exist.
-    if (!(file_flags & (base::File::FLAG_CREATE |
-        base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_OPEN_ALWAYS))) {
+    if (!(file_flags &
+          (base::File::FLAG_CREATE | base::File::FLAG_CREATE_ALWAYS |
+           base::File::FLAG_OPEN_ALWAYS))) {
       return base::File(base::File::FILE_ERROR_NOT_FOUND);
     }
     FileId parent_id;
@@ -1453,8 +1450,8 @@
     return base::File(base::File::FILE_ERROR_NOT_A_FILE);
 
   int64_t delta = 0;
-  if (file_flags & (base::File::FLAG_CREATE_ALWAYS |
-                    base::File::FLAG_OPEN_TRUNCATED)) {
+  if (file_flags &
+      (base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_OPEN_TRUNCATED)) {
     // The file exists and we're truncating.
     delta = -platform_file_info.size;
     AllocateQuota(context, delta);
@@ -1483,7 +1480,7 @@
 
 bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) {
   return special_storage_policy_.get() &&
-      special_storage_policy_->HasIsolatedStorage(origin);
+         special_storage_policy_->HasIsolatedStorage(origin);
 }
 
 }  // namespace storage
diff --git a/storage/browser/fileapi/obfuscated_file_util.h b/storage/browser/file_system/obfuscated_file_util.h
similarity index 81%
rename from storage/browser/fileapi/obfuscated_file_util.h
rename to storage/browser/file_system/obfuscated_file_util.h
index 2d004f5..143cd602 100644
--- a/storage/browser/fileapi/obfuscated_file_util.h
+++ b/storage/browser/file_system/obfuscated_file_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_H_
 
 #include <stdint.h>
 
@@ -21,17 +21,17 @@
 #include "base/sequence_checker.h"
 #include "base/timer/timer.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/obfuscated_file_util_delegate.h"
-#include "storage/browser/fileapi/sandbox_directory_database.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/obfuscated_file_util_delegate.h"
+#include "storage/browser/file_system/sandbox_directory_database.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace content {
 class ObfuscatedFileUtilTest;
 class QuotaBackendImplTest;
-}
+}  // namespace content
 
 namespace storage {
 class SpecialStoragePolicy;
@@ -156,9 +156,8 @@
       base::FilePath* platform_path) override;
 
   // Returns true if the directory |url| is empty.
-  bool IsDirectoryEmpty(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url);
+  bool IsDirectoryEmpty(FileSystemOperationContext* context,
+                        const FileSystemURL& url);
 
   // Gets the topmost directory specific to this origin and type.  This will
   // contain both the directory database's files and all the backing file
@@ -169,18 +168,16 @@
   // there is a file system error (e.g. the directory doesn't exist on disk and
   // |create| is false). Callers should always check |error_code| to make sure
   // the returned path is usable.
-  base::FilePath GetDirectoryForOriginAndType(
-      const GURL& origin,
-      const std::string& type_string,
-      bool create,
-      base::File::Error* error_code);
+  base::FilePath GetDirectoryForOriginAndType(const GURL& origin,
+                                              const std::string& type_string,
+                                              bool create,
+                                              base::File::Error* error_code);
 
   // Deletes the topmost directory specific to this origin and type.  This will
   // delete its directory database.
   // Deletes the topmost origin directory if |type_string| is empty.
-  bool DeleteDirectoryForOriginAndType(
-      const GURL& origin,
-      const std::string& type_string);
+  bool DeleteDirectoryForOriginAndType(const GURL& origin,
+                                       const std::string& type_string);
 
   // Frees resources used by an origin's filesystem.
   void CloseFileSystemForOriginAndType(const GURL& origin,
@@ -234,33 +231,30 @@
       leveldb::Env* env_override,
       bool is_incognito);
 
-  base::FilePath GetDirectoryForURL(
-      const FileSystemURL& url,
-      bool create,
-      base::File::Error* error_code);
+  base::FilePath GetDirectoryForURL(const FileSystemURL& url,
+                                    bool create,
+                                    base::File::Error* error_code);
 
   // This just calls get_type_string_for_url_ callback that is given in ctor.
   std::string CallGetTypeStringForURL(const FileSystemURL& url);
 
-  base::File::Error GetFileInfoInternal(
-      SandboxDirectoryDatabase* db,
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      FileId file_id,
-      FileInfo* local_info,
-      base::File::Info* file_info,
-      base::FilePath* platform_file_path);
+  base::File::Error GetFileInfoInternal(SandboxDirectoryDatabase* db,
+                                        FileSystemOperationContext* context,
+                                        const FileSystemURL& url,
+                                        FileId file_id,
+                                        FileInfo* local_info,
+                                        base::File::Info* file_info,
+                                        base::FilePath* platform_file_path);
 
   // Creates a new file, both the underlying backing file and the entry in the
   // database.  |dest_file_info| is an in-out parameter.  Supply the name and
   // parent_id; data_path is ignored.  On success, data_path will
   // always be set to the relative path [from the root of the type-specific
   // filesystem directory] of a NEW backing file.  Returns the new file.
-  base::File CreateAndOpenFile(
-      FileSystemOperationContext* context,
-      const FileSystemURL& dest_url,
-      FileInfo* dest_file_info,
-      int file_flags);
+  base::File CreateAndOpenFile(FileSystemOperationContext* context,
+                               const FileSystemURL& dest_url,
+                               FileInfo* dest_file_info,
+                               int file_flags);
 
   // The same as CreateAndOpenFile except that a file is not returned and if a
   // path is provided in |source_path|, it will be used as a source from which
@@ -274,18 +268,16 @@
                                FileInfo* dest_file_info);
 
   // Updates |db| and |dest_file_info| at the end of creating a new file.
-  base::File::Error CommitCreateFile(
-    const base::FilePath& root,
-    const base::FilePath& local_path,
-    SandboxDirectoryDatabase* db,
-    FileInfo* dest_file_info);
+  base::File::Error CommitCreateFile(const base::FilePath& root,
+                                     const base::FilePath& local_path,
+                                     SandboxDirectoryDatabase* db,
+                                     FileInfo* dest_file_info);
 
   // This converts from a relative path [as is stored in the FileInfo.data_path
   // field] to an absolute platform path that can be given to the native
   // filesystem.
-  base::FilePath DataPathToLocalPath(
-      const FileSystemURL& url,
-      const base::FilePath& data_file_path);
+  base::FilePath DataPathToLocalPath(const FileSystemURL& url,
+                                     const base::FilePath& data_file_path);
 
   std::string GetDirectoryDatabaseKey(const GURL& origin,
                                       const std::string& type_string);
@@ -313,17 +305,15 @@
   // for initializing database if it's not empty.
   bool InitOriginDatabase(const GURL& origin_hint, bool create);
 
-  base::File::Error GenerateNewLocalPath(
-      SandboxDirectoryDatabase* db,
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      base::FilePath* root,
-      base::FilePath* local_path);
+  base::File::Error GenerateNewLocalPath(SandboxDirectoryDatabase* db,
+                                         FileSystemOperationContext* context,
+                                         const FileSystemURL& url,
+                                         base::FilePath* root,
+                                         base::FilePath* local_path);
 
-  base::File CreateOrOpenInternal(
-      FileSystemOperationContext* context,
-      const FileSystemURL& url,
-      int file_flags);
+  base::File CreateOrOpenInternal(FileSystemOperationContext* context,
+                                  const FileSystemURL& url,
+                                  int file_flags);
 
   bool HasIsolatedStorage(const GURL& origin);
 
@@ -354,4 +344,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/obfuscated_file_util_delegate.h b/storage/browser/file_system/obfuscated_file_util_delegate.h
similarity index 90%
rename from storage/browser/fileapi/obfuscated_file_util_delegate.h
rename to storage/browser/file_system/obfuscated_file_util_delegate.h
index 722d79d..17d31f6c 100644
--- a/storage/browser/fileapi/obfuscated_file_util_delegate.h
+++ b/storage/browser/file_system/obfuscated_file_util_delegate.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_DELEGATE_H_
 
 #include "base/component_export.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 
 namespace storage {
 
@@ -61,4 +61,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_DELEGATE_H_
diff --git a/storage/browser/fileapi/obfuscated_file_util_disk_delegate.cc b/storage/browser/file_system/obfuscated_file_util_disk_delegate.cc
similarity index 95%
rename from storage/browser/fileapi/obfuscated_file_util_disk_delegate.cc
rename to storage/browser/file_system/obfuscated_file_util_disk_delegate.cc
index 84d415b..e689099 100644
--- a/storage/browser/fileapi/obfuscated_file_util_disk_delegate.cc
+++ b/storage/browser/file_system/obfuscated_file_util_disk_delegate.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/obfuscated_file_util_disk_delegate.h"
+#include "storage/browser/file_system/obfuscated_file_util_disk_delegate.h"
 
 #include "base/files/file_util.h"
-#include "storage/browser/fileapi/native_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
 
 namespace storage {
 
diff --git a/storage/browser/fileapi/obfuscated_file_util_disk_delegate.h b/storage/browser/file_system/obfuscated_file_util_disk_delegate.h
similarity index 87%
rename from storage/browser/fileapi/obfuscated_file_util_disk_delegate.h
rename to storage/browser/file_system/obfuscated_file_util_disk_delegate.h
index ebb81a40..44b83fb 100644
--- a/storage/browser/fileapi/obfuscated_file_util_disk_delegate.h
+++ b/storage/browser/file_system/obfuscated_file_util_disk_delegate.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_DISK_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_DISK_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_DISK_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_DISK_DELEGATE_H_
 
 #include "base/component_export.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/native_file_util.h"
-#include "storage/browser/fileapi/obfuscated_file_util_delegate.h"
+#include "storage/browser/file_system/native_file_util.h"
+#include "storage/browser/file_system/obfuscated_file_util_delegate.h"
 
 namespace storage {
 
@@ -61,4 +61,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_DISK_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_DISK_DELEGATE_H_
diff --git a/storage/browser/fileapi/obfuscated_file_util_memory_delegate.cc b/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc
similarity index 99%
rename from storage/browser/fileapi/obfuscated_file_util_memory_delegate.cc
rename to storage/browser/file_system/obfuscated_file_util_memory_delegate.cc
index 19d2fc7..5919d1f 100644
--- a/storage/browser/fileapi/obfuscated_file_util_memory_delegate.cc
+++ b/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
 
 #include <utility>
 
diff --git a/storage/browser/fileapi/obfuscated_file_util_memory_delegate.h b/storage/browser/file_system/obfuscated_file_util_memory_delegate.h
similarity index 93%
rename from storage/browser/fileapi/obfuscated_file_util_memory_delegate.h
rename to storage/browser/file_system/obfuscated_file_util_memory_delegate.h
index 1cac768..4dd25b4 100644
--- a/storage/browser/fileapi/obfuscated_file_util_memory_delegate.h
+++ b/storage/browser/file_system/obfuscated_file_util_memory_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_MEMORY_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_MEMORY_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_MEMORY_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_MEMORY_DELEGATE_H_
 
 #include <map>
 #include <memory>
@@ -16,8 +16,8 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
-#include "storage/browser/fileapi/native_file_util.h"
-#include "storage/browser/fileapi/obfuscated_file_util_delegate.h"
+#include "storage/browser/file_system/native_file_util.h"
+#include "storage/browser/file_system/obfuscated_file_util_delegate.h"
 
 namespace storage {
 
@@ -139,4 +139,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_MEMORY_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_OBFUSCATED_FILE_UTIL_MEMORY_DELEGATE_H_
diff --git a/storage/browser/fileapi/obfuscated_file_util_memory_delegate_unittest.cc b/storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc
similarity index 99%
rename from storage/browser/fileapi/obfuscated_file_util_memory_delegate_unittest.cc
rename to storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc
index dff4215..dbde9cc 100644
--- a/storage/browser/fileapi/obfuscated_file_util_memory_delegate_unittest.cc
+++ b/storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
 
 #include <memory>
 
diff --git a/storage/browser/fileapi/obfuscated_file_util_unittest.cc b/storage/browser/file_system/obfuscated_file_util_unittest.cc
similarity index 84%
rename from storage/browser/fileapi/obfuscated_file_util_unittest.cc
rename to storage/browser/file_system/obfuscated_file_util_unittest.cc
index 1c4e70e..ed92961 100644
--- a/storage/browser/fileapi/obfuscated_file_util_unittest.cc
+++ b/storage/browser/file_system/obfuscated_file_util_unittest.cc
@@ -26,20 +26,20 @@
 #include "build/build_config.h"
 #include "components/services/filesystem/public/mojom/types.mojom.h"
 #include "net/base/io_buffer.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
-#include "storage/browser/fileapi/sandbox_directory_database.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
-#include "storage/browser/fileapi/sandbox_isolated_origin_database.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/sandbox_directory_database.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/sandbox_isolated_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/browser/test/async_file_test_helper.h"
-#include "storage/browser/test/fileapi_test_file_set.h"
+#include "storage/browser/test/file_system_test_file_set.h"
 #include "storage/browser/test/mock_file_change_observer.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/sandbox_file_system_test_helper.h"
@@ -60,11 +60,11 @@
 using storage::FileSystemOperation;
 using storage::FileSystemOperationContext;
 using storage::FileSystemURL;
+using storage::kFileSystemTypePersistent;
+using storage::kFileSystemTypeTemporary;
 using storage::ObfuscatedFileUtil;
 using storage::SandboxDirectoryDatabase;
 using storage::SandboxIsolatedOriginDatabase;
-using storage::kFileSystemTypeTemporary;
-using storage::kFileSystemTypePersistent;
 
 namespace content {
 
@@ -92,26 +92,26 @@
 };
 
 const CopyMoveTestCaseRecord kCopyMoveTestCases[] = {
-  // This is the combinatoric set of:
-  //  rename vs. same-name
-  //  different directory vs. same directory
-  //  overwrite vs. no-overwrite
-  //  copy vs. move
-  //  We can never be called with source and destination paths identical, so
-  //  those cases are omitted.
-  {true, "dir0/file0", "dir0/file1", false},
-  {false, "dir0/file0", "dir0/file1", false},
-  {true, "dir0/file0", "dir0/file1", true},
-  {false, "dir0/file0", "dir0/file1", true},
+    // This is the combinatoric set of:
+    //  rename vs. same-name
+    //  different directory vs. same directory
+    //  overwrite vs. no-overwrite
+    //  copy vs. move
+    //  We can never be called with source and destination paths identical, so
+    //  those cases are omitted.
+    {true, "dir0/file0", "dir0/file1", false},
+    {false, "dir0/file0", "dir0/file1", false},
+    {true, "dir0/file0", "dir0/file1", true},
+    {false, "dir0/file0", "dir0/file1", true},
 
-  {true, "dir0/file0", "dir1/file0", false},
-  {false, "dir0/file0", "dir1/file0", false},
-  {true, "dir0/file0", "dir1/file0", true},
-  {false, "dir0/file0", "dir1/file0", true},
-  {true, "dir0/file0", "dir1/file1", false},
-  {false, "dir0/file0", "dir1/file1", false},
-  {true, "dir0/file0", "dir1/file1", true},
-  {false, "dir0/file0", "dir1/file1", true},
+    {true, "dir0/file0", "dir1/file0", false},
+    {false, "dir0/file0", "dir1/file0", false},
+    {true, "dir0/file0", "dir1/file0", true},
+    {false, "dir0/file0", "dir1/file0", true},
+    {true, "dir0/file0", "dir1/file1", false},
+    {false, "dir0/file0", "dir1/file1", false},
+    {true, "dir0/file0", "dir1/file1", true},
+    {false, "dir0/file0", "dir1/file1", true},
 };
 
 struct OriginEnumerationTestRecord {
@@ -121,31 +121,29 @@
 };
 
 const OriginEnumerationTestRecord kOriginEnumerationTestRecords[] = {
-  {"http://example.com/", false, true},
-  {"http://example1.com/", true, false},
-  {"https://example1.com/", true, true},
-  {"file:///", false, true},
-  {"http://example.com:8000/", false, true},
+    {"http://example.com/", false, true},
+    {"http://example1.com/", true, false},
+    {"https://example1.com/", true, true},
+    {"file:///", false, true},
+    {"http://example.com:8000/", false, true},
 };
 
-FileSystemURL FileSystemURLAppend(
-    const FileSystemURL& url, const base::FilePath::StringType& child) {
-  return FileSystemURL::CreateForTest(
-      url.origin(), url.mount_type(), url.virtual_path().Append(child));
+FileSystemURL FileSystemURLAppend(const FileSystemURL& url,
+                                  const base::FilePath::StringType& child) {
+  return FileSystemURL::CreateForTest(url.origin(), url.mount_type(),
+                                      url.virtual_path().Append(child));
 }
 
-FileSystemURL FileSystemURLAppendUTF8(
-    const FileSystemURL& url, const std::string& child) {
+FileSystemURL FileSystemURLAppendUTF8(const FileSystemURL& url,
+                                      const std::string& child) {
   return FileSystemURL::CreateForTest(
-      url.origin(),
-      url.mount_type(),
+      url.origin(), url.mount_type(),
       url.virtual_path().Append(base::FilePath::FromUTF8Unsafe(child)));
 }
 
 FileSystemURL FileSystemURLDirName(const FileSystemURL& url) {
   return FileSystemURL::CreateForTest(
-      url.origin(),
-      url.mount_type(),
+      url.origin(), url.mount_type(),
       storage::VirtualPath::DirName(url.virtual_path()));
 }
 
@@ -285,19 +283,15 @@
 
   const base::FilePath& test_directory() const { return data_dir_.GetPath(); }
 
-  const GURL& origin() const {
-    return origin_;
-  }
+  const GURL& origin() const { return origin_; }
 
   storage::FileSystemType type() const { return type_; }
 
-  std::string type_string() const {
-    return GetTypeString(type_);
-  }
+  std::string type_string() const { return GetTypeString(type_); }
 
   int64_t ComputeTotalFileSize() {
     return sandbox_file_system_.ComputeCurrentOriginUsage() -
-        sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
+           sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
   }
 
   void GetUsageFromQuotaManager() {
@@ -320,16 +314,18 @@
   int64_t SizeInUsageFile() {
     task_environment_.RunUntilIdle();
     int64_t usage = 0;
-    return usage_cache()->GetUsage(
-        sandbox_file_system_.GetUsageCachePath(), &usage) ? usage : -1;
+    return usage_cache()->GetUsage(sandbox_file_system_.GetUsageCachePath(),
+                                   &usage)
+               ? usage
+               : -1;
   }
 
   bool PathExists(const FileSystemURL& url) {
     std::unique_ptr<FileSystemOperationContext> context(NewContext(nullptr));
     base::File::Info file_info;
     base::FilePath platform_path;
-    base::File::Error error = ofu()->GetFileInfo(
-        context.get(), url, &file_info, &platform_path);
+    base::File::Error error =
+        ofu()->GetFileInfo(context.get(), url, &file_info, &platform_path);
     return error == base::File::FILE_OK;
   }
 
@@ -422,8 +418,7 @@
     EXPECT_EQ(length * 2, GetPathSize(url));
 
     context.reset(NewContext(nullptr));
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->Truncate(context.get(), url, 0));
+    EXPECT_EQ(base::File::FILE_OK, ofu()->Truncate(context.get(), url, 0));
     EXPECT_EQ(0, GetPathSize(url));
   }
 
@@ -463,14 +458,11 @@
       Check();
     }
 
-    FileSystemOperationContext* context() {
-      return context_.get();
-    }
+    FileSystemOperationContext* context() { return context_.get(); }
 
    private:
     void Check() {
-      ASSERT_EQ(expected_usage_,
-                sandbox_file_system_->GetCachedOriginUsage());
+      ASSERT_EQ(expected_usage_, sandbox_file_system_->GetCachedOriginUsage());
     }
 
     std::unique_ptr<FileSystemOperationContext> context_;
@@ -495,10 +487,9 @@
                               &sandbox_file_system_, usage, this));
   }
 
-  void FillTestDirectory(
-      const FileSystemURL& root_url,
-      std::set<base::FilePath::StringType>* files,
-      std::set<base::FilePath::StringType>* directories) {
+  void FillTestDirectory(const FileSystemURL& root_url,
+                         std::set<base::FilePath::StringType>* files,
+                         std::set<base::FilePath::StringType>* directories) {
     std::unique_ptr<FileSystemOperationContext> context;
     std::vector<filesystem::mojom::DirectoryEntry> entries;
     EXPECT_EQ(base::File::FILE_OK,
@@ -544,8 +535,8 @@
     std::vector<filesystem::mojom::DirectoryEntry> entries;
     context.reset(NewContext(nullptr));
     EXPECT_EQ(base::File::FILE_OK,
-              AsyncFileTestHelper::ReadDirectory(
-                  file_system_context(), root_url, &entries));
+              AsyncFileTestHelper::ReadDirectory(file_system_context(),
+                                                 root_url, &entries));
     EXPECT_EQ(files.size() + directories.size(), entries.size());
     EXPECT_TRUE(change_observer()->HasNoChange());
     for (const filesystem::mojom::DirectoryEntry& entry : entries) {
@@ -567,16 +558,16 @@
     base::Time last_modified_time = base::Time::Now();
 
     std::unique_ptr<FileSystemOperationContext> context(NewContext(nullptr));
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->Touch(context.get(), url, last_access_time,
-                           last_modified_time));
+    EXPECT_EQ(
+        base::File::FILE_OK,
+        ofu()->Touch(context.get(), url, last_access_time, last_modified_time));
     // Currently we fire no change notifications for Touch.
     EXPECT_TRUE(change_observer()->HasNoChange());
     base::FilePath local_path;
     base::File::Info file_info;
     context.reset(NewContext(nullptr));
-    EXPECT_EQ(base::File::FILE_OK, ofu()->GetFileInfo(
-        context.get(), url, &file_info, &local_path));
+    EXPECT_EQ(base::File::FILE_OK,
+              ofu()->GetFileInfo(context.get(), url, &file_info, &local_path));
     // We compare as time_t here to lower our resolution, to avoid false
     // negatives caused by conversion to the local filesystem's native
     // representation and back.
@@ -585,9 +576,9 @@
     context.reset(NewContext(nullptr));
     last_modified_time += base::TimeDelta::FromHours(1);
     last_access_time += base::TimeDelta::FromHours(14);
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->Touch(context.get(), url, last_access_time,
-                           last_modified_time));
+    EXPECT_EQ(
+        base::File::FILE_OK,
+        ofu()->Touch(context.get(), url, last_access_time, last_modified_time));
     EXPECT_TRUE(change_observer()->HasNoChange());
     context.reset(NewContext(nullptr));
     EXPECT_EQ(base::File::FILE_OK,
@@ -632,16 +623,15 @@
       // Verify that file creation requires sufficient quota for the path.
       context.reset(NewContext(nullptr));
       context->set_allowed_bytes_growth(path_cost + src_file_length - 1);
-      EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
-                ofu()->CopyInForeignFile(context.get(),
-                                         src_file_path, dest_url));
+      EXPECT_EQ(
+          base::File::FILE_ERROR_NO_SPACE,
+          ofu()->CopyInForeignFile(context.get(), src_file_path, dest_url));
     }
 
     context.reset(NewContext(nullptr));
     context->set_allowed_bytes_growth(path_cost + src_file_length);
     EXPECT_EQ(base::File::FILE_OK,
-              ofu()->CopyInForeignFile(context.get(),
-                                       src_file_path, dest_url));
+              ofu()->CopyInForeignFile(context.get(), src_file_path, dest_url));
 
     EXPECT_TRUE(PathExists(dest_url));
     EXPECT_FALSE(DirectoryExists(dest_url));
@@ -649,15 +639,13 @@
     context.reset(NewContext(nullptr));
     base::File::Info file_info;
     base::FilePath data_path;
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->GetFileInfo(context.get(), dest_url, &file_info,
-                                 &data_path));
+    EXPECT_EQ(base::File::FILE_OK, ofu()->GetFileInfo(context.get(), dest_url,
+                                                      &file_info, &data_path));
     EXPECT_NE(data_path, src_file_path);
     EXPECT_TRUE(PathExists(dest_url));
     EXPECT_EQ(src_file_length, GetPathSize(dest_url));
 
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->DeleteFile(context.get(), dest_url));
+    EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), dest_url));
   }
 
   void ClearTimestamp(const FileSystemURL& url) {
@@ -705,19 +693,17 @@
               ofu()->EnsureFileExists(context.get(), src_file_url, &created));
     if (overwrite) {
       context.reset(NewContext(nullptr));
-      EXPECT_EQ(base::File::FILE_OK,
-                ofu()->EnsureFileExists(context.get(),
-                                        dest_file_url, &created));
+      EXPECT_EQ(
+          base::File::FILE_OK,
+          ofu()->EnsureFileExists(context.get(), dest_file_url, &created));
     }
 
     ClearTimestamp(src_dir_url);
     ClearTimestamp(dest_dir_url);
     context.reset(NewContext(nullptr));
     EXPECT_EQ(base::File::FILE_OK,
-              ofu()->CopyOrMoveFile(context.get(),
-                                    src_file_url, dest_file_url,
-                                    FileSystemOperation::OPTION_NONE,
-                                    copy));
+              ofu()->CopyOrMoveFile(context.get(), src_file_url, dest_file_url,
+                                    FileSystemOperation::OPTION_NONE, copy));
     if (copy)
       EXPECT_EQ(base::Time(), GetModifiedTime(src_dir_url));
     else
@@ -799,7 +785,7 @@
 
   int64_t ComputeCurrentUsage() {
     return sandbox_file_system_.ComputeCurrentOriginUsage() -
-        sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
+           sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
   }
 
   FileSystemContext* file_system_context() {
@@ -897,8 +883,7 @@
   context.reset(NewContext(nullptr));
   bool exclusive = true;
   bool recursive = true;
-  FileSystemURL directory_url = CreateURLFromUTF8(
-      "series/of/directories");
+  FileSystemURL directory_url = CreateURLFromUTF8("series/of/directories");
   url = FileSystemURLAppendUTF8(directory_url, "file name");
   EXPECT_EQ(base::File::FILE_OK,
             ofu()->CreateDirectory(context.get(), directory_url, exclusive,
@@ -973,8 +958,7 @@
 
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(url))->context(),
-                url, &created));
+                AllowUsageIncrease(PathCost(url))->context(), url, &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(0, ComputeTotalFileSize());
 
@@ -987,8 +971,7 @@
   ASSERT_EQ(0, ComputeTotalFileSize());
 
   EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
-            ofu()->Truncate(DisallowUsageIncrease(1021)->context(),
-                            url, 1021));
+            ofu()->Truncate(DisallowUsageIncrease(1021)->context(), url, 1021));
   ASSERT_EQ(0, ComputeTotalFileSize());
 
   EXPECT_EQ(base::File::FILE_OK,
@@ -1115,14 +1098,13 @@
   EXPECT_TRUE(DirectoryExists(FileSystemURLDirName(url)));
 
   context.reset(NewContext(nullptr));
-  EXPECT_FALSE(ofu()->IsDirectoryEmpty(context.get(),
-                                       FileSystemURLDirName(url)));
+  EXPECT_FALSE(
+      ofu()->IsDirectoryEmpty(context.get(), FileSystemURLDirName(url)));
 
   // Can't remove a non-empty directory.
   context.reset(NewContext(nullptr));
   EXPECT_EQ(base::File::FILE_ERROR_NOT_EMPTY,
-            ofu()->DeleteDirectory(context.get(),
-                                   FileSystemURLDirName(url)));
+            ofu()->DeleteDirectory(context.get(), FileSystemURLDirName(url)));
   EXPECT_TRUE(change_observer()->HasNoChange());
 
   base::File::Info file_info;
@@ -1153,7 +1135,7 @@
   EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteDirectory(context.get(), url));
   EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
   EXPECT_EQ(ObfuscatedFileUtil::ComputeFilePathCost(url.path()),
-      context->allowed_bytes_growth());
+            context->allowed_bytes_growth());
 
   url = CreateURLFromUTF8("foo/bop");
 
@@ -1251,9 +1233,9 @@
   ASSERT_TRUE(created);
 
   std::vector<filesystem::mojom::DirectoryEntry> entries;
-  EXPECT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
-            AsyncFileTestHelper::ReadDirectory(file_system_context(), url,
-                                               &entries));
+  EXPECT_EQ(
+      base::File::FILE_ERROR_NOT_A_DIRECTORY,
+      AsyncFileTestHelper::ReadDirectory(file_system_context(), url, &entries));
 
   EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), url));
 }
@@ -1266,9 +1248,9 @@
   base::Time last_modified_time = base::Time::Now();
 
   // It's not there yet.
-  EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
-            ofu()->Touch(context.get(), url, last_access_time,
-                         last_modified_time));
+  EXPECT_EQ(
+      base::File::FILE_ERROR_NOT_FOUND,
+      ofu()->Touch(context.get(), url, last_access_time, last_modified_time));
 
   // OK, now create it.
   context.reset(NewContext(nullptr));
@@ -1345,10 +1327,10 @@
   bool exclusive = true;
   bool recursive = true;
   context.reset(NewContext(nullptr));
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CreateDirectory(context.get(),
-                FileSystemURLDirName(source_url),
-                exclusive, recursive));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->CreateDirectory(context.get(), FileSystemURLDirName(source_url),
+                             exclusive, recursive));
   EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count());
   is_copy_not_move = false;
   EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
@@ -1372,14 +1354,13 @@
   for (size_t i = 0; i < base::size(kCopyMoveTestCases); ++i) {
     SCOPED_TRACE(testing::Message() << "kCopyMoveTestCase " << i);
     const CopyMoveTestCaseRecord& test_case = kCopyMoveTestCases[i];
-    SCOPED_TRACE(testing::Message() << "\t is_copy_not_move " <<
-      test_case.is_copy_not_move);
-    SCOPED_TRACE(testing::Message() << "\t source_path " <<
-      test_case.source_path);
-    SCOPED_TRACE(testing::Message() << "\t dest_path " <<
-      test_case.dest_path);
-    SCOPED_TRACE(testing::Message() << "\t cause_overwrite " <<
-      test_case.cause_overwrite);
+    SCOPED_TRACE(testing::Message()
+                 << "\t is_copy_not_move " << test_case.is_copy_not_move);
+    SCOPED_TRACE(testing::Message()
+                 << "\t source_path " << test_case.source_path);
+    SCOPED_TRACE(testing::Message() << "\t dest_path " << test_case.dest_path);
+    SCOPED_TRACE(testing::Message()
+                 << "\t cause_overwrite " << test_case.cause_overwrite);
     std::unique_ptr<FileSystemOperationContext> context(NewContext(nullptr));
 
     bool exclusive = false;
@@ -1388,15 +1369,15 @@
     FileSystemURL dest_url = CreateURLFromUTF8(test_case.dest_path);
 
     context.reset(NewContext(nullptr));
-    ASSERT_EQ(base::File::FILE_OK,
-              ofu()->CreateDirectory(context.get(),
-                                     FileSystemURLDirName(source_url),
-                                     exclusive, recursive));
+    ASSERT_EQ(
+        base::File::FILE_OK,
+        ofu()->CreateDirectory(context.get(), FileSystemURLDirName(source_url),
+                               exclusive, recursive));
     context.reset(NewContext(nullptr));
-    ASSERT_EQ(base::File::FILE_OK,
-              ofu()->CreateDirectory(context.get(),
-                                     FileSystemURLDirName(dest_url),
-                                     exclusive, recursive));
+    ASSERT_EQ(
+        base::File::FILE_OK,
+        ofu()->CreateDirectory(context.get(), FileSystemURLDirName(dest_url),
+                               exclusive, recursive));
 
     bool created = false;
     context.reset(NewContext(nullptr));
@@ -1444,13 +1425,11 @@
     }
     base::File::Info file_info;
     base::FilePath local_path;
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->GetFileInfo(context.get(), dest_url, &file_info,
-                                 &local_path));
+    EXPECT_EQ(base::File::FILE_OK, ofu()->GetFileInfo(context.get(), dest_url,
+                                                      &file_info, &local_path));
     EXPECT_EQ(kSourceLength, file_info.size);
 
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->DeleteFile(context.get(), dest_url));
+    EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), dest_url));
   }
 }
 
@@ -1532,12 +1511,10 @@
   bool recursive = false;
   FileSystemURL dir_url = CreateURLFromUTF8("directory path");
   context.reset(NewContext(nullptr));
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CreateDirectory(context.get(), dir_url, exclusive,
-                                   recursive));
+  ASSERT_EQ(base::File::FILE_OK, ofu()->CreateDirectory(context.get(), dir_url,
+                                                        exclusive, recursive));
 
-  FileSystemURL dest_url = FileSystemURLAppend(
-      dir_url, src_url.path().value());
+  FileSystemURL dest_url = FileSystemURLAppend(dir_url, src_url.path().value());
 
   bool is_copy = false;
   int64_t allowed_bytes_growth = -1000;  // Over quota, this should still work.
@@ -1558,10 +1535,9 @@
   EXPECT_EQ(base::File::FILE_OK,
             ofu()->CopyOrMoveFile(context.get(), src_url, dest_url,
                                   FileSystemOperation::OPTION_NONE, is_copy));
-  EXPECT_EQ(
-      allowed_bytes_growth +
-          ObfuscatedFileUtil::ComputeFilePathCost(src_url.path()),
-      context->allowed_bytes_growth());
+  EXPECT_EQ(allowed_bytes_growth +
+                ObfuscatedFileUtil::ComputeFilePathCost(src_url.path()),
+            context->allowed_bytes_growth());
 }
 
 TEST_P(ObfuscatedFileUtilTest, TestCopyInForeignFile) {
@@ -1574,9 +1550,8 @@
   FileSystemURL src_url = CreateURLFromUTF8("source dir");
   bool exclusive = true;
   bool recursive = false;
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CreateDirectory(context.get(), src_url, exclusive,
-                                   recursive));
+  ASSERT_EQ(base::File::FILE_OK, ofu()->CreateDirectory(context.get(), src_url,
+                                                        exclusive, recursive));
 
   std::set<base::FilePath::StringType> files;
   std::set<base::FilePath::StringType> directories;
@@ -1585,17 +1560,16 @@
   FileSystemURL dest_url = CreateURLFromUTF8("destination dir");
 
   EXPECT_FALSE(DirectoryExists(dest_url));
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::Copy(
-                file_system_context(), src_url, dest_url));
+  ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::Copy(
+                                     file_system_context(), src_url, dest_url));
 
   ValidateTestDirectory(dest_url, files, directories);
   EXPECT_TRUE(DirectoryExists(src_url));
   EXPECT_TRUE(DirectoryExists(dest_url));
   recursive = true;
-  ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::Remove(
-                file_system_context(), dest_url, recursive));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      AsyncFileTestHelper::Remove(file_system_context(), dest_url, recursive));
   EXPECT_FALSE(DirectoryExists(dest_url));
 }
 
@@ -1616,8 +1590,8 @@
   origins_expected.insert(origin());
 
   for (size_t i = 0; i < base::size(kOriginEnumerationTestRecords); ++i) {
-    SCOPED_TRACE(testing::Message() <<
-        "Validating kOriginEnumerationTestRecords " << i);
+    SCOPED_TRACE(testing::Message()
+                 << "Validating kOriginEnumerationTestRecords " << i);
     const OriginEnumerationTestRecord& record =
         kOriginEnumerationTestRecords[i];
     GURL origin_url(record.origin_url);
@@ -1628,11 +1602,10 @@
       std::unique_ptr<FileSystemOperationContext> context(
           NewContext(file_system.get()));
       bool created = false;
-      ASSERT_EQ(base::File::FILE_OK,
-                ofu()->EnsureFileExists(
-                    context.get(),
-                    file_system->CreateURLFromUTF8("file"),
-                    &created));
+      ASSERT_EQ(
+          base::File::FILE_OK,
+          ofu()->EnsureFileExists(
+              context.get(), file_system->CreateURLFromUTF8("file"), &created));
       EXPECT_TRUE(created);
     }
     if (record.has_persistent) {
@@ -1641,11 +1614,10 @@
       std::unique_ptr<FileSystemOperationContext> context(
           NewContext(file_system.get()));
       bool created = false;
-      ASSERT_EQ(base::File::FILE_OK,
-                ofu()->EnsureFileExists(
-                    context.get(),
-                    file_system->CreateURLFromUTF8("file"),
-                    &created));
+      ASSERT_EQ(
+          base::File::FILE_OK,
+          ofu()->EnsureFileExists(
+              context.get(), file_system->CreateURLFromUTF8("file"), &created));
       EXPECT_TRUE(created);
     }
   }
@@ -1662,26 +1634,26 @@
         continue;
       found = true;
       EXPECT_EQ(record.has_temporary,
-          HasFileSystemType(enumerator.get(), kFileSystemTypeTemporary));
+                HasFileSystemType(enumerator.get(), kFileSystemTypeTemporary));
       EXPECT_EQ(record.has_persistent,
-          HasFileSystemType(enumerator.get(), kFileSystemTypePersistent));
+                HasFileSystemType(enumerator.get(), kFileSystemTypePersistent));
     }
     // Deal with the default filesystem created by the test helper.
     if (!found && origin_url == origin()) {
       ASSERT_TRUE(type() == kFileSystemTypeTemporary);
-      EXPECT_TRUE(HasFileSystemType(enumerator.get(),
-                                    kFileSystemTypeTemporary));
-      EXPECT_FALSE(HasFileSystemType(enumerator.get(),
-                                     kFileSystemTypePersistent));
+      EXPECT_TRUE(
+          HasFileSystemType(enumerator.get(), kFileSystemTypeTemporary));
+      EXPECT_FALSE(
+          HasFileSystemType(enumerator.get(), kFileSystemTypePersistent));
       found = true;
     }
     EXPECT_TRUE(found);
   }
 
   std::set<GURL> diff;
-  std::set_symmetric_difference(origins_expected.begin(),
-      origins_expected.end(), origins_found.begin(), origins_found.end(),
-      inserter(diff, diff.begin()));
+  std::set_symmetric_difference(
+      origins_expected.begin(), origins_expected.end(), origins_found.begin(),
+      origins_found.end(), inserter(diff, diff.begin()));
   EXPECT_TRUE(diff.empty());
 }
 
@@ -1692,8 +1664,7 @@
 
   for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
     SCOPED_TRACE(testing::Message() << "Creating kRegularTestCase " << i);
-    const FileSystemTestCaseRecord& test_case =
-        kRegularFileSystemTestCases[i];
+    const FileSystemTestCaseRecord& test_case = kRegularFileSystemTestCases[i];
     base::FilePath file_path(test_case.path);
     expected_quota += ObfuscatedFileUtil::ComputeFilePathCost(file_path);
     if (test_case.is_directory) {
@@ -1746,12 +1717,10 @@
             ofu()->EnsureFileExists(context.get(), kPath1, &created));
   EXPECT_TRUE(created);
   context.reset(NewContext(nullptr));
-  EXPECT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(context.get(), kPath1, 10));
+  EXPECT_EQ(base::File::FILE_OK, ofu()->Truncate(context.get(), kPath1, 10));
   context.reset(NewContext(nullptr));
   EXPECT_EQ(base::File::FILE_OK,
-            ofu()->GetFileInfo(
-                context.get(), kPath1, &file_info, &data_path));
+            ofu()->GetFileInfo(context.get(), kPath1, &file_info, &data_path));
   EXPECT_EQ(10, file_info.size);
 
   // Destroy database to make inconsistency between database and filesystem.
@@ -1765,8 +1734,7 @@
   EXPECT_TRUE(created);
   context.reset(NewContext(nullptr));
   EXPECT_EQ(base::File::FILE_OK,
-            ofu()->GetFileInfo(
-                context.get(), kPath1, &file_info, &data_path));
+            ofu()->GetFileInfo(context.get(), kPath1, &file_info, &data_path));
   EXPECT_EQ(0, file_info.size);
 
   // Make another broken file to |kPath2|.
@@ -1782,17 +1750,17 @@
   context.reset(NewContext(nullptr));
   EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
             ofu()->Touch(context.get(), kPath1, base::Time::Now(),
-                           base::Time::Now()));
+                         base::Time::Now()));
   EXPECT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(context.get(), kPath1, &created));
   EXPECT_TRUE(created);
 
   // Copy from sound |kPath1| to broken |kPath2|.
   context.reset(NewContext(nullptr));
-  EXPECT_EQ(base::File::FILE_OK,
-            ofu()->CopyOrMoveFile(context.get(), kPath1, kPath2,
-                                  FileSystemOperation::OPTION_NONE,
-                                  true /* copy */));
+  EXPECT_EQ(
+      base::File::FILE_OK,
+      ofu()->CopyOrMoveFile(context.get(), kPath1, kPath2,
+                            FileSystemOperation::OPTION_NONE, true /* copy */));
 
   ofu()->DestroyDirectoryDatabase(origin(), type_string());
   context.reset(NewContext(nullptr));
@@ -1805,11 +1773,9 @@
 }
 
 TEST_P(ObfuscatedFileUtilTest, TestIncompleteDirectoryReading) {
-  const FileSystemURL kPath[] = {
-    CreateURLFromUTF8("foo"),
-    CreateURLFromUTF8("bar"),
-    CreateURLFromUTF8("baz")
-  };
+  const FileSystemURL kPath[] = {CreateURLFromUTF8("foo"),
+                                 CreateURLFromUTF8("bar"),
+                                 CreateURLFromUTF8("baz")};
   const FileSystemURL empty_path = CreateURL(base::FilePath());
   std::unique_ptr<FileSystemOperationContext> context;
 
@@ -1823,16 +1789,16 @@
 
   std::vector<filesystem::mojom::DirectoryEntry> entries;
   EXPECT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::ReadDirectory(
-                file_system_context(), empty_path, &entries));
+            AsyncFileTestHelper::ReadDirectory(file_system_context(),
+                                               empty_path, &entries));
   EXPECT_EQ(3u, entries.size());
 
   EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), kPath[0]));
 
   entries.clear();
   EXPECT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::ReadDirectory(
-                file_system_context(), empty_path, &entries));
+            AsyncFileTestHelper::ReadDirectory(file_system_context(),
+                                               empty_path, &entries));
   EXPECT_EQ(base::size(kPath) - 1, entries.size());
 }
 
@@ -1929,8 +1895,8 @@
   ClearTimestamp(dir_url);
   context.reset(NewContext(nullptr));
   EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
-            ofu()->CreateDirectory(context.get(), url,
-                                   true /* exclusive */, true /* recursive */));
+            ofu()->CreateDirectory(context.get(), url, true /* exclusive */,
+                                   true /* recursive */));
   EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
 
   // CopyInForeignFile, create case.
@@ -1961,8 +1927,7 @@
             ofu()->CreateDirectory(context.get(), dir_url, false, false));
 
   // DeleteFile, delete case.
-  FileSystemURL url = FileSystemURLAppendUTF8(
-      dir_url, "DeleteFile_file");
+  FileSystemURL url = FileSystemURLAppendUTF8(dir_url, "DeleteFile_file");
   bool created = false;
   context.reset(NewContext(nullptr));
   EXPECT_EQ(base::File::FILE_OK,
@@ -1971,8 +1936,7 @@
 
   ClearTimestamp(dir_url);
   context.reset(NewContext(nullptr));
-  EXPECT_EQ(base::File::FILE_OK,
-            ofu()->DeleteFile(context.get(), url));
+  EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), url));
   EXPECT_NE(base::Time(), GetModifiedTime(dir_url));
 
   // fail case.
@@ -2002,8 +1966,7 @@
 
   // delete case.
   context.reset(NewContext(nullptr));
-  EXPECT_EQ(base::File::FILE_OK,
-            ofu()->DeleteFile(context.get(), file_path));
+  EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), file_path));
 
   ClearTimestamp(dir_url);
   context.reset(NewContext(nullptr));
@@ -2012,14 +1975,13 @@
 }
 
 TEST_P(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) {
-  TestDirectoryTimestampHelper(
-      CreateURLFromUTF8("copy overwrite"), true, true);
-  TestDirectoryTimestampHelper(
-      CreateURLFromUTF8("copy non-overwrite"), true, false);
-  TestDirectoryTimestampHelper(
-      CreateURLFromUTF8("move overwrite"), false, true);
-  TestDirectoryTimestampHelper(
-      CreateURLFromUTF8("move non-overwrite"), false, false);
+  TestDirectoryTimestampHelper(CreateURLFromUTF8("copy overwrite"), true, true);
+  TestDirectoryTimestampHelper(CreateURLFromUTF8("copy non-overwrite"), true,
+                               false);
+  TestDirectoryTimestampHelper(CreateURLFromUTF8("move overwrite"), false,
+                               true);
+  TestDirectoryTimestampHelper(CreateURLFromUTF8("move non-overwrite"), false,
+                               false);
 }
 
 TEST_P(ObfuscatedFileUtilTest, TestFileEnumeratorTimestamp) {
@@ -2063,13 +2025,12 @@
     context.reset(NewContext(nullptr));
     base::File::Info file_info;
     base::FilePath file_path;
-    EXPECT_EQ(base::File::FILE_OK,
-              ofu()->GetFileInfo(context.get(),
-                                 FileSystemURL::CreateForTest(
-                                     dir.origin(),
-                                     dir.mount_type(),
-                                     file_path_each),
-                                 &file_info, &file_path));
+    EXPECT_EQ(
+        base::File::FILE_OK,
+        ofu()->GetFileInfo(context.get(),
+                           FileSystemURL::CreateForTest(
+                               dir.origin(), dir.mount_type(), file_path_each),
+                           &file_info, &file_path));
     EXPECT_EQ(file_info.is_directory, file_enum->IsDirectory());
     EXPECT_EQ(file_info.last_modified, file_enum->LastModifiedTime());
     EXPECT_EQ(file_info.size, file_enum->Size());
@@ -2094,8 +2055,8 @@
   int64_t expected_total_file_size = 0;
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(from_file))->context(),
-                from_file, &created));
+                AllowUsageIncrease(PathCost(from_file))->context(), from_file,
+                &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
@@ -2109,36 +2070,33 @@
   int64_t from_file_size = 1020;
   expected_total_file_size += from_file_size;
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(from_file_size)->context(),
-                from_file, from_file_size));
+            ofu()->Truncate(AllowUsageIncrease(from_file_size)->context(),
+                            from_file, from_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t obstacle_file_size = 1;
   expected_total_file_size += obstacle_file_size;
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(obstacle_file_size)->context(),
-                obstacle_file, obstacle_file_size));
+            ofu()->Truncate(AllowUsageIncrease(obstacle_file_size)->context(),
+                            obstacle_file, obstacle_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t to_file1_size = from_file_size;
   expected_total_file_size += to_file1_size;
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CopyOrMoveFile(
-                AllowUsageIncrease(
-                    PathCost(to_file1) + to_file1_size)->context(),
-                from_file, to_file1,
-                FileSystemOperation::OPTION_NONE,
-                true /* copy */));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->CopyOrMoveFile(
+          AllowUsageIncrease(PathCost(to_file1) + to_file1_size)->context(),
+          from_file, to_file1, FileSystemOperation::OPTION_NONE,
+          true /* copy */));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
-  ASSERT_EQ(base::File::FILE_ERROR_NO_SPACE,
-            ofu()->CopyOrMoveFile(
-                DisallowUsageIncrease(
-                    PathCost(to_file2) + from_file_size)->context(),
-                from_file, to_file2, FileSystemOperation::OPTION_NONE,
-                true /* copy */));
+  ASSERT_EQ(
+      base::File::FILE_ERROR_NO_SPACE,
+      ofu()->CopyOrMoveFile(
+          DisallowUsageIncrease(PathCost(to_file2) + from_file_size)->context(),
+          from_file, to_file2, FileSystemOperation::OPTION_NONE,
+          true /* copy */));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t old_obstacle_file_size = obstacle_file_size;
@@ -2146,21 +2104,20 @@
   expected_total_file_size += obstacle_file_size - old_obstacle_file_size;
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->CopyOrMoveFile(
-                AllowUsageIncrease(
-                    obstacle_file_size - old_obstacle_file_size)->context(),
-                from_file, obstacle_file,
-                FileSystemOperation::OPTION_NONE,
+                AllowUsageIncrease(obstacle_file_size - old_obstacle_file_size)
+                    ->context(),
+                from_file, obstacle_file, FileSystemOperation::OPTION_NONE,
                 true /* copy */));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t old_from_file_size = from_file_size;
   from_file_size = old_from_file_size - 1;
   expected_total_file_size += from_file_size - old_from_file_size;
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(
-                    from_file_size - old_from_file_size)->context(),
-                from_file, from_file_size));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->Truncate(
+          AllowUsageIncrease(from_file_size - old_from_file_size)->context(),
+          from_file, from_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   // quota exceeded
@@ -2173,11 +2130,9 @@
     helper->context()->set_allowed_bytes_growth(
         helper->context()->allowed_bytes_growth() - 1);
     ASSERT_EQ(base::File::FILE_OK,
-              ofu()->CopyOrMoveFile(
-                  helper->context(),
-                  from_file, obstacle_file,
-                  FileSystemOperation::OPTION_NONE,
-                  true /* copy */));
+              ofu()->CopyOrMoveFile(helper->context(), from_file, obstacle_file,
+                                    FileSystemOperation::OPTION_NONE,
+                                    true /* copy */));
     ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
   }
 }
@@ -2191,33 +2146,31 @@
   int64_t expected_total_file_size = 0;
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(from_file))->context(),
-                from_file, &created));
+                AllowUsageIncrease(PathCost(from_file))->context(), from_file,
+                &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t from_file_size = 1020;
   expected_total_file_size += from_file_size;
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(from_file_size)->context(),
-                from_file, from_file_size));
+            ofu()->Truncate(AllowUsageIncrease(from_file_size)->context(),
+                            from_file, from_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   from_file_size = 0;
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->CopyOrMoveFile(
-                AllowUsageIncrease(-PathCost(from_file) +
-                                   PathCost(to_file))->context(),
-                from_file, to_file,
-                FileSystemOperation::OPTION_NONE,
+                AllowUsageIncrease(-PathCost(from_file) + PathCost(to_file))
+                    ->context(),
+                from_file, to_file, FileSystemOperation::OPTION_NONE,
                 false /* move */));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(from_file))->context(),
-                from_file, &created));
+                AllowUsageIncrease(PathCost(from_file))->context(), from_file,
+                &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
@@ -2231,45 +2184,42 @@
   from_file_size = 1020;
   expected_total_file_size += from_file_size;
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(from_file_size)->context(),
-                from_file, from_file_size));
+            ofu()->Truncate(AllowUsageIncrease(from_file_size)->context(),
+                            from_file, from_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t obstacle_file_size = 1;
   expected_total_file_size += obstacle_file_size;
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(1)->context(),
-                obstacle_file, obstacle_file_size));
+            ofu()->Truncate(AllowUsageIncrease(1)->context(), obstacle_file,
+                            obstacle_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   int64_t old_obstacle_file_size = obstacle_file_size;
   obstacle_file_size = from_file_size;
   from_file_size = 0;
   expected_total_file_size -= old_obstacle_file_size;
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CopyOrMoveFile(
-                AllowUsageIncrease(
-                    -old_obstacle_file_size - PathCost(from_file))->context(),
-                from_file, obstacle_file,
-                FileSystemOperation::OPTION_NONE,
-                false /* move */));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->CopyOrMoveFile(
+          AllowUsageIncrease(-old_obstacle_file_size - PathCost(from_file))
+              ->context(),
+          from_file, obstacle_file, FileSystemOperation::OPTION_NONE,
+          false /* move */));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(from_file))->context(),
-                from_file, &created));
+                AllowUsageIncrease(PathCost(from_file))->context(), from_file,
+                &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   from_file_size = 10;
   expected_total_file_size += from_file_size;
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(from_file_size)->context(),
-                from_file, from_file_size));
+            ofu()->Truncate(AllowUsageIncrease(from_file_size)->context(),
+                            from_file, from_file_size));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
 
   // quota exceeded even after operation
@@ -2280,10 +2230,9 @@
   std::unique_ptr<FileSystemOperationContext> context =
       LimitedContext(-old_obstacle_file_size - PathCost(from_file) - 1);
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CopyOrMoveFile(
-                context.get(), from_file, obstacle_file,
-                FileSystemOperation::OPTION_NONE,
-                false /* move */));
+            ofu()->CopyOrMoveFile(context.get(), from_file, obstacle_file,
+                                  FileSystemOperation::OPTION_NONE,
+                                  false /* move */));
   ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
   context.reset();
 }
@@ -2297,58 +2246,49 @@
 
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(file))->context(),
-                file, &created));
+                AllowUsageIncrease(PathCost(file))->context(), file, &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(0, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->CreateDirectory(
-                AllowUsageIncrease(PathCost(dir))->context(),
-                dir, false, false));
+            ofu()->CreateDirectory(AllowUsageIncrease(PathCost(dir))->context(),
+                                   dir, false, false));
   ASSERT_EQ(0, ComputeTotalFileSize());
 
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(dfile1))->context(),
-                dfile1, &created));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->EnsureFileExists(AllowUsageIncrease(PathCost(dfile1))->context(),
+                              dfile1, &created));
+  ASSERT_TRUE(created);
+  ASSERT_EQ(0, ComputeTotalFileSize());
+
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->EnsureFileExists(AllowUsageIncrease(PathCost(dfile2))->context(),
+                              dfile2, &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(0, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(dfile2))->context(),
-                dfile2, &created));
-  ASSERT_TRUE(created);
-  ASSERT_EQ(0, ComputeTotalFileSize());
-
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(340)->context(),
-                file, 340));
+            ofu()->Truncate(AllowUsageIncrease(340)->context(), file, 340));
   ASSERT_EQ(340, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(1020)->context(),
-                dfile1, 1020));
+            ofu()->Truncate(AllowUsageIncrease(1020)->context(), dfile1, 1020));
   ASSERT_EQ(1360, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(120)->context(),
-                dfile2, 120));
+            ofu()->Truncate(AllowUsageIncrease(120)->context(), dfile2, 120));
   ASSERT_EQ(1480, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->DeleteFile(
-                AllowUsageIncrease(-PathCost(file) - 340)->context(),
-                file));
+                AllowUsageIncrease(-PathCost(file) - 340)->context(), file));
   ASSERT_EQ(1140, ComputeTotalFileSize());
 
   ASSERT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::Remove(
-                file_system_context(), dir, true /* recursive */));
+            AsyncFileTestHelper::Remove(file_system_context(), dir,
+                                        true /* recursive */));
   ASSERT_EQ(0, ComputeTotalFileSize());
 }
 
@@ -2359,8 +2299,7 @@
   // Creating a file.
   ASSERT_EQ(base::File::FILE_OK,
             ofu()->EnsureFileExists(
-                AllowUsageIncrease(PathCost(url))->context(),
-                url, &created));
+                AllowUsageIncrease(PathCost(url))->context(), url, &created));
   ASSERT_TRUE(created);
   ASSERT_EQ(0, ComputeTotalFileSize());
 
@@ -2371,9 +2310,9 @@
   ASSERT_EQ(0, ComputeTotalFileSize());
 
   const int length = 33;
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(length)->context(), url, length));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->Truncate(AllowUsageIncrease(length)->context(), url, length));
   ASSERT_EQ(length, ComputeTotalFileSize());
 
   // TODO(https://crbug.com/936722): After CreateOrOpen is modified to return
@@ -2392,15 +2331,15 @@
   file.Close();
 
   // Extending the file again.
-  ASSERT_EQ(base::File::FILE_OK,
-            ofu()->Truncate(
-                AllowUsageIncrease(length)->context(), url, length));
+  ASSERT_EQ(
+      base::File::FILE_OK,
+      ofu()->Truncate(AllowUsageIncrease(length)->context(), url, length));
   ASSERT_EQ(length, ComputeTotalFileSize());
 
   // Opening it with TRUNCATED flag, which should truncate the file size.
   file = ofu()->CreateOrOpen(
-             AllowUsageIncrease(-length)->context(), url,
-             base::File::FLAG_OPEN_TRUNCATED | base::File::FLAG_WRITE);
+      AllowUsageIncrease(-length)->context(), url,
+      base::File::FLAG_OPEN_TRUNCATED | base::File::FLAG_WRITE);
   ASSERT_TRUE(file.IsValid());
   ASSERT_EQ(0, ComputeTotalFileSize());
   file.Close();
@@ -2435,11 +2374,10 @@
             ofu()->EnsureFileExists(UnlimitedContext().get(), path_in_file,
                                     &created));
 
-  ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
-            ofu()->CreateDirectory(UnlimitedContext().get(),
-                                   path_in_file,
-                                   false /* exclusive */,
-                                   false /* recursive */));
+  ASSERT_EQ(
+      base::File::FILE_ERROR_NOT_A_DIRECTORY,
+      ofu()->CreateDirectory(UnlimitedContext().get(), path_in_file,
+                             false /* exclusive */, false /* recursive */));
 }
 
 TEST_P(ObfuscatedFileUtilTest, CreateDirectory_NotADirectoryInRecursive) {
@@ -2453,16 +2391,14 @@
             ofu()->EnsureFileExists(UnlimitedContext().get(), file, &created));
   ASSERT_TRUE(created);
 
-  ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
-            ofu()->CreateDirectory(UnlimitedContext().get(),
-                                   path_in_file,
-                                   false /* exclusive */,
-                                   true /* recursive */));
-  ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
-            ofu()->CreateDirectory(UnlimitedContext().get(),
-                                   path_in_file_in_file,
-                                   false /* exclusive */,
-                                   true /* recursive */));
+  ASSERT_EQ(
+      base::File::FILE_ERROR_NOT_A_DIRECTORY,
+      ofu()->CreateDirectory(UnlimitedContext().get(), path_in_file,
+                             false /* exclusive */, true /* recursive */));
+  ASSERT_EQ(
+      base::File::FILE_ERROR_NOT_A_DIRECTORY,
+      ofu()->CreateDirectory(UnlimitedContext().get(), path_in_file_in_file,
+                             false /* exclusive */, true /* recursive */));
 }
 
 TEST_P(ObfuscatedFileUtilTest, DeleteDirectoryForOriginAndType) {
diff --git a/storage/browser/fileapi/open_file_system_mode.h b/storage/browser/file_system/open_file_system_mode.h
similarity index 76%
rename from storage/browser/fileapi/open_file_system_mode.h
rename to storage/browser/file_system/open_file_system_mode.h
index 03943fda..1051094 100644
--- a/storage/browser/fileapi/open_file_system_mode.h
+++ b/storage/browser/file_system/open_file_system_mode.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_OPEN_FILE_SYSTEM_MODE_H_
-#define STORAGE_BROWSER_FILEAPI_OPEN_FILE_SYSTEM_MODE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_OPEN_FILE_SYSTEM_MODE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_OPEN_FILE_SYSTEM_MODE_H_
 
 namespace storage {
 
@@ -19,4 +19,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_OPEN_FILE_SYSTEM_MODE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_OPEN_FILE_SYSTEM_MODE_H_
diff --git a/storage/browser/fileapi/plugin_private_file_system_backend.cc b/storage/browser/file_system/plugin_private_file_system_backend.cc
similarity index 92%
rename from storage/browser/fileapi/plugin_private_file_system_backend.cc
rename to storage/browser/file_system/plugin_private_file_system_backend.cc
index 81b61d5..a25ac1f3 100644
--- a/storage/browser/fileapi/plugin_private_file_system_backend.cc
+++ b/storage/browser/file_system/plugin_private_file_system_backend.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/plugin_private_file_system_backend.h"
+#include "storage/browser/file_system/plugin_private_file_system_backend.h"
 
 #include <stdint.h>
 
@@ -18,17 +18,17 @@
 #include "base/task_runner_util.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "net/base/url_util.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
-#include "storage/browser/fileapi/sandbox_file_stream_writer.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
+#include "storage/browser/file_system/sandbox_file_stream_writer.h"
 #include "storage/common/fileapi/file_system_util.h"
 
 namespace storage {
@@ -84,8 +84,8 @@
     OpenFileSystemMode mode) {
   base::File::Error error = base::File::FILE_ERROR_FAILED;
   const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
-  file_util->GetDirectoryForOriginAndType(
-      origin_url, plugin_id, create, &error);
+  file_util->GetDirectoryForOriginAndType(origin_url, plugin_id, create,
+                                          &error);
   if (error == base::File::FILE_OK)
     plugin_map->RegisterFileSystem(filesystem_id, plugin_id);
   return error;
@@ -144,8 +144,7 @@
   return type == kFileSystemTypePluginPrivate;
 }
 
-void PluginPrivateFileSystemBackend::Initialize(FileSystemContext* context) {
-}
+void PluginPrivateFileSystemBackend::Initialize(FileSystemContext* context) {}
 
 void PluginPrivateFileSystemBackend::ResolveURL(
     const FileSystemURL& url,
@@ -158,8 +157,8 @@
                                 base::File::FILE_ERROR_SECURITY));
 }
 
-AsyncFileUtil*
-PluginPrivateFileSystemBackend::GetAsyncFileUtil(FileSystemType type) {
+AsyncFileUtil* PluginPrivateFileSystemBackend::GetAsyncFileUtil(
+    FileSystemType type) {
   return file_util_.get();
 }
 
diff --git a/storage/browser/fileapi/plugin_private_file_system_backend.h b/storage/browser/file_system/plugin_private_file_system_backend.h
similarity index 92%
rename from storage/browser/fileapi/plugin_private_file_system_backend.h
rename to storage/browser/file_system/plugin_private_file_system_backend.h
index 79c83c3..16e9d4e 100644
--- a/storage/browser/fileapi/plugin_private_file_system_backend.h
+++ b/storage/browser/file_system/plugin_private_file_system_backend.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
-#define STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
 
 #include <stdint.h>
 
@@ -15,10 +15,10 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_options.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_options.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace base {
 class SequencedTaskRunner;
@@ -153,4 +153,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
diff --git a/storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc b/storage/browser/file_system/plugin_private_file_system_backend_unittest.cc
similarity index 94%
rename from storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc
rename to storage/browser/file_system/plugin_private_file_system_backend_unittest.cc
index 7ea42e2..2dd0463 100644
--- a/storage/browser/fileapi/plugin_private_file_system_backend_unittest.cc
+++ b/storage/browser/file_system/plugin_private_file_system_backend_unittest.cc
@@ -9,10 +9,10 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/run_loop.h"
 #include "base/test/task_environment.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/plugin_private_file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/plugin_private_file_system_backend.h"
 #include "storage/browser/test/async_file_test_helper.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "storage/browser/test/test_file_system_options.h"
@@ -35,8 +35,7 @@
 const storage::FileSystemType kType = storage::kFileSystemTypePluginPrivate;
 const std::string kRootName = "pluginprivate";
 
-void DidOpenFileSystem(base::File::Error* error_out,
-                       base::File::Error error) {
+void DidOpenFileSystem(base::File::Error* error_out, base::File::Error error) {
   *error_out = error;
 }
 
@@ -102,9 +101,8 @@
   base::FilePath platform_path;
   EXPECT_EQ(base::File::FILE_OK,
             AsyncFileTestHelper::CreateFile(context_.get(), file));
-  EXPECT_EQ(base::File::FILE_OK,
-            AsyncFileTestHelper::GetPlatformPath(context_.get(), file,
-                                                 &platform_path));
+  EXPECT_EQ(base::File::FILE_OK, AsyncFileTestHelper::GetPlatformPath(
+                                     context_.get(), file, &platform_path));
   EXPECT_TRUE(base_path().AppendASCII("000").AppendASCII(kPlugin1).IsParent(
       platform_path));
 }
diff --git a/storage/browser/fileapi/quota/open_file_handle.cc b/storage/browser/file_system/quota/open_file_handle.cc
similarity index 84%
rename from storage/browser/fileapi/quota/open_file_handle.cc
rename to storage/browser/file_system/quota/open_file_handle.cc
index dd809c5..19711f3 100644
--- a/storage/browser/fileapi/quota/open_file_handle.cc
+++ b/storage/browser/file_system/quota/open_file_handle.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/open_file_handle.h"
+#include "storage/browser/file_system/quota/open_file_handle.h"
 
 #include <stdint.h>
 
-#include "storage/browser/fileapi/quota/open_file_handle_context.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/open_file_handle_context.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
 
 namespace storage {
 
@@ -49,8 +49,7 @@
 
 OpenFileHandle::OpenFileHandle(QuotaReservation* reservation,
                                OpenFileHandleContext* context)
-    : reservation_(reservation),
-      context_(context) {
+    : reservation_(reservation), context_(context) {
   DCHECK(sequence_checker_.CalledOnValidSequence());
 }
 
diff --git a/storage/browser/fileapi/quota/open_file_handle.h b/storage/browser/file_system/quota/open_file_handle.h
similarity index 88%
rename from storage/browser/fileapi/quota/open_file_handle.h
rename to storage/browser/file_system/quota/open_file_handle.h
index d142e3c..cfbeea32 100644
--- a/storage/browser/fileapi/quota/open_file_handle.h
+++ b/storage/browser/file_system/quota/open_file_handle.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_QUOTA_OPEN_FILE_HANDLE_H_
-#define STORAGE_BROWSER_FILEAPI_QUOTA_OPEN_FILE_HANDLE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_H_
 
 #include <stdint.h>
 
@@ -56,8 +56,7 @@
  private:
   friend class QuotaReservationBuffer;
 
-  OpenFileHandle(QuotaReservation* reservation,
-                 OpenFileHandleContext* context);
+  OpenFileHandle(QuotaReservation* reservation, OpenFileHandleContext* context);
 
   scoped_refptr<QuotaReservation> reservation_;
   scoped_refptr<OpenFileHandleContext> context_;
@@ -69,4 +68,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_QUOTA_OPEN_FILE_HANDLE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_H_
diff --git a/storage/browser/fileapi/quota/open_file_handle_context.cc b/storage/browser/file_system/quota/open_file_handle_context.cc
similarity index 89%
rename from storage/browser/fileapi/quota/open_file_handle_context.cc
rename to storage/browser/file_system/quota/open_file_handle_context.cc
index 911a2f96..fe1c965 100644
--- a/storage/browser/fileapi/quota/open_file_handle_context.cc
+++ b/storage/browser/file_system/quota/open_file_handle_context.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/open_file_handle_context.h"
+#include "storage/browser/file_system/quota/open_file_handle_context.h"
 
 #include <stdint.h>
 
 #include "base/files/file_util.h"
-#include "storage/browser/fileapi/quota/quota_reservation_buffer.h"
+#include "storage/browser/file_system/quota/quota_reservation_buffer.h"
 
 namespace storage {
 
@@ -66,8 +66,8 @@
   int64_t reserved_quota_consumption =
       std::max(GetEstimatedFileSize(), file_size) - initial_file_size_;
 
-  reservation_buffer_->CommitFileGrowth(
-      reserved_quota_consumption, usage_delta);
+  reservation_buffer_->CommitFileGrowth(reserved_quota_consumption,
+                                        usage_delta);
   reservation_buffer_->DetachOpenFileHandleContext(this);
 }
 
diff --git a/storage/browser/fileapi/quota/open_file_handle_context.h b/storage/browser/file_system/quota/open_file_handle_context.h
similarity index 84%
rename from storage/browser/fileapi/quota/open_file_handle_context.h
rename to storage/browser/file_system/quota/open_file_handle_context.h
index 9729137..65cb1e80 100644
--- a/storage/browser/fileapi/quota/open_file_handle_context.h
+++ b/storage/browser/file_system/quota/open_file_handle_context.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_OPEN_FILE_HANDLE_CONTEXT_H_
-#define STORAGE_BROWSER_FILEAPI_OPEN_FILE_HANDLE_CONTEXT_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_CONTEXT_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_CONTEXT_H_
 
 #include <stdint.h>
 
@@ -34,9 +34,7 @@
 
   void AddAppendModeWriteAmount(int64_t amount);
 
-  const base::FilePath& platform_path() const {
-    return platform_path_;
-  }
+  const base::FilePath& platform_path() const { return platform_path_; }
 
   int64_t GetEstimatedFileSize() const;
   int64_t GetMaxWrittenOffset() const;
@@ -59,4 +57,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_OPEN_FILE_HANDLE_CONTEXT_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_OPEN_FILE_HANDLE_CONTEXT_H_
diff --git a/storage/browser/fileapi/quota/quota_backend_impl.cc b/storage/browser/file_system/quota/quota_backend_impl.cc
similarity index 94%
rename from storage/browser/fileapi/quota/quota_backend_impl.cc
rename to storage/browser/file_system/quota/quota_backend_impl.cc
index 656495d..0c83b3fe 100644
--- a/storage/browser/fileapi/quota/quota_backend_impl.cc
+++ b/storage/browser/file_system/quota/quota_backend_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/quota_backend_impl.h"
+#include "storage/browser/file_system/quota/quota_backend_impl.h"
 
 #include <stdint.h>
 
@@ -13,7 +13,7 @@
 #include "base/logging.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/sequenced_task_runner.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
 #include "storage/browser/quota/quota_client.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/common/fileapi/file_system_util.h"
@@ -129,10 +129,8 @@
   if (std::move(callback).Run(base::File::FILE_OK, normalized_info.delta))
     return;
   // The requester could not accept the reserved quota. Revert it.
-  ReserveQuotaInternal(
-      QuotaReservationInfo(normalized_info.origin,
-                           normalized_info.type,
-                           -normalized_info.delta));
+  ReserveQuotaInternal(QuotaReservationInfo(
+      normalized_info.origin, normalized_info.type, -normalized_info.delta));
 }
 
 void QuotaBackendImpl::ReserveQuotaInternal(const QuotaReservationInfo& info) {
diff --git a/storage/browser/fileapi/quota/quota_backend_impl.h b/storage/browser/file_system/quota/quota_backend_impl.h
similarity index 88%
rename from storage/browser/fileapi/quota/quota_backend_impl.h
rename to storage/browser/file_system/quota/quota_backend_impl.h
index dcbc8be7..a4c3fa0 100644
--- a/storage/browser/fileapi/quota/quota_backend_impl.h
+++ b/storage/browser/file_system/quota/quota_backend_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_
-#define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_BACKEND_IMPL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_BACKEND_IMPL_H_
 
 #include <stdint.h>
 
@@ -11,8 +11,8 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/quota/quota_reservation_manager.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
 #include "url/origin.h"
 
@@ -78,8 +78,7 @@
                                           int64_t usage,
                                           int64_t quota);
 
-  void ReserveQuotaInternal(
-      const QuotaReservationInfo& info);
+  void ReserveQuotaInternal(const QuotaReservationInfo& info);
   base::File::Error GetUsageCachePath(const url::Origin& origin,
                                       FileSystemType type,
                                       base::FilePath* usage_file_path);
@@ -99,4 +98,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_BACKEND_IMPL_H_
diff --git a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc b/storage/browser/file_system/quota/quota_backend_impl_unittest.cc
similarity index 97%
rename from storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
rename to storage/browser/file_system/quota/quota_backend_impl_unittest.cc
index 285b50d..0613aaaa 100644
--- a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
+++ b/storage/browser/file_system/quota/quota_backend_impl_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/quota_backend_impl.h"
+#include "storage/browser/file_system/quota/quota_backend_impl.h"
 
 #include <stdint.h>
 
@@ -16,8 +16,8 @@
 #include "base/test/scoped_feature_list.h"
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
diff --git a/storage/browser/fileapi/quota/quota_reservation.cc b/storage/browser/file_system/quota/quota_reservation.cc
similarity index 91%
rename from storage/browser/fileapi/quota/quota_reservation.cc
rename to storage/browser/file_system/quota/quota_reservation.cc
index 959ff87..f11340f 100644
--- a/storage/browser/fileapi/quota/quota_reservation.cc
+++ b/storage/browser/file_system/quota/quota_reservation.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
 
 #include <stdint.h>
 
@@ -10,8 +10,8 @@
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "storage/browser/fileapi/quota/open_file_handle.h"
-#include "storage/browser/fileapi/quota/quota_reservation_buffer.h"
+#include "storage/browser/file_system/quota/open_file_handle.h"
+#include "storage/browser/file_system/quota/quota_reservation_buffer.h"
 
 namespace storage {
 
@@ -87,8 +87,8 @@
   DCHECK(sequence_checker_.CalledOnValidSequence());
 
   if (remaining_quota_ && reservation_manager()) {
-    reservation_manager()->ReleaseReservedQuota(
-        origin(), type(), remaining_quota_);
+    reservation_manager()->ReleaseReservedQuota(origin(), type(),
+                                                remaining_quota_);
   }
 }
 
diff --git a/storage/browser/fileapi/quota/quota_reservation.h b/storage/browser/file_system/quota/quota_reservation.h
similarity index 92%
rename from storage/browser/fileapi/quota/quota_reservation.h
rename to storage/browser/file_system/quota/quota_reservation.h
index 2a5606b..7f2f7837 100644
--- a/storage/browser/fileapi/quota/quota_reservation.h
+++ b/storage/browser/file_system/quota/quota_reservation.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
-#define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_H_
 
 #include <stdint.h>
 
@@ -15,7 +15,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
+#include "storage/browser/file_system/quota/quota_reservation_manager.h"
 #include "storage/common/fileapi/file_system_types.h"
 
 namespace url {
@@ -98,4 +98,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_H_
diff --git a/storage/browser/fileapi/quota/quota_reservation_buffer.cc b/storage/browser/file_system/quota/quota_reservation_buffer.cc
similarity index 88%
rename from storage/browser/fileapi/quota/quota_reservation_buffer.cc
rename to storage/browser/file_system/quota/quota_reservation_buffer.cc
index 697c6141..2bc9f1ef 100644
--- a/storage/browser/fileapi/quota/quota_reservation_buffer.cc
+++ b/storage/browser/file_system/quota/quota_reservation_buffer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/quota_reservation_buffer.h"
+#include "storage/browser/file_system/quota/quota_reservation_buffer.h"
 
 #include <stdint.h>
 
@@ -11,9 +11,9 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/memory/ptr_util.h"
-#include "storage/browser/fileapi/quota/open_file_handle.h"
-#include "storage/browser/fileapi/quota/open_file_handle_context.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/open_file_handle.h"
+#include "storage/browser/file_system/quota/open_file_handle_context.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
 
 namespace storage {
 
@@ -61,8 +61,8 @@
     }
 
     reserved_quota_ -= reserved_quota_consumption;
-    reservation_manager_->ReleaseReservedQuota(
-        origin_, type_, reserved_quota_consumption);
+    reservation_manager_->ReleaseReservedQuota(origin_, type_,
+                                               reserved_quota_consumption);
   }
 }
 
diff --git a/storage/browser/fileapi/quota/quota_reservation_buffer.h b/storage/browser/file_system/quota/quota_reservation_buffer.h
similarity index 92%
rename from storage/browser/fileapi/quota/quota_reservation_buffer.h
rename to storage/browser/file_system/quota/quota_reservation_buffer.h
index d18bd36..351ad7a 100644
--- a/storage/browser/fileapi/quota/quota_reservation_buffer.h
+++ b/storage/browser/file_system/quota/quota_reservation_buffer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_BUFFER_H_
-#define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_BUFFER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_BUFFER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_BUFFER_H_
 
 #include <stdint.h>
 
@@ -83,4 +83,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_BUFFER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_BUFFER_H_
diff --git a/storage/browser/fileapi/quota/quota_reservation_manager.cc b/storage/browser/file_system/quota/quota_reservation_manager.cc
similarity index 89%
rename from storage/browser/fileapi/quota/quota_reservation_manager.cc
rename to storage/browser/file_system/quota/quota_reservation_manager.cc
index 7cb0ca5..e4b18044 100644
--- a/storage/browser/fileapi/quota/quota_reservation_manager.cc
+++ b/storage/browser/file_system/quota/quota_reservation_manager.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
+#include "storage/browser/file_system/quota/quota_reservation_manager.h"
 
 #include <stdint.h>
 
@@ -10,8 +10,8 @@
 #include <utility>
 
 #include "base/callback.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
-#include "storage/browser/fileapi/quota/quota_reservation_buffer.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/quota_reservation_buffer.h"
 
 namespace storage {
 
@@ -67,8 +67,8 @@
   QuotaReservationBuffer** buffer =
       &reservation_buffers_[std::make_pair(origin, type)];
   if (!*buffer) {
-    *buffer = new QuotaReservationBuffer(
-        weak_ptr_factory_.GetWeakPtr(), origin, type);
+    *buffer = new QuotaReservationBuffer(weak_ptr_factory_.GetWeakPtr(), origin,
+                                         type);
   }
   return base::WrapRefCounted(*buffer);
 }
diff --git a/storage/browser/fileapi/quota/quota_reservation_manager.h b/storage/browser/file_system/quota/quota_reservation_manager.h
similarity index 95%
rename from storage/browser/fileapi/quota/quota_reservation_manager.h
rename to storage/browser/file_system/quota/quota_reservation_manager.h
index 3f243ad..bb4fe0c 100644
--- a/storage/browser/fileapi/quota/quota_reservation_manager.h
+++ b/storage/browser/file_system/quota/quota_reservation_manager.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_
-#define STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_MANAGER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_MANAGER_H_
 
 #include <stdint.h>
 
@@ -127,4 +127,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_QUOTA_QUOTA_RESERVATION_MANAGER_H_
diff --git a/storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc b/storage/browser/file_system/quota/quota_reservation_manager_unittest.cc
similarity index 97%
rename from storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc
rename to storage/browser/file_system/quota/quota_reservation_manager_unittest.cc
index c4a930b..52259f4 100644
--- a/storage/browser/fileapi/quota/quota_reservation_manager_unittest.cc
+++ b/storage/browser/file_system/quota/quota_reservation_manager_unittest.cc
@@ -18,9 +18,9 @@
 #include "base/single_thread_task_runner.h"
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/quota/open_file_handle.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
-#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
+#include "storage/browser/file_system/quota/open_file_handle.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/quota_reservation_manager.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 #include "url/origin.h"
diff --git a/storage/browser/fileapi/recursive_operation_delegate.cc b/storage/browser/file_system/recursive_operation_delegate.cc
similarity index 92%
rename from storage/browser/fileapi/recursive_operation_delegate.cc
rename to storage/browser/file_system/recursive_operation_delegate.cc
index 0b250bbb..952b733 100644
--- a/storage/browser/fileapi/recursive_operation_delegate.cc
+++ b/storage/browser/file_system/recursive_operation_delegate.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/recursive_operation_delegate.h"
+#include "storage/browser/file_system/recursive_operation_delegate.h"
 
 #include <stddef.h>
 
@@ -10,8 +10,8 @@
 #include "base/containers/queue.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 
 namespace storage {
 
@@ -20,8 +20,7 @@
     : file_system_context_(file_system_context),
       canceled_(false),
       error_behavior_(FileSystemOperation::ERROR_BEHAVIOR_ABORT),
-      failed_some_operations_(false) {
-}
+      failed_some_operations_(false) {}
 
 RecursiveOperationDelegate::~RecursiveOperationDelegate() = default;
 
@@ -53,12 +52,10 @@
   return file_system_context_->operation_runner();
 }
 
-void RecursiveOperationDelegate::OnCancel() {
-}
+void RecursiveOperationDelegate::OnCancel() {}
 
-void RecursiveOperationDelegate::DidTryProcessFile(
-    const FileSystemURL& root,
-    base::File::Error error) {
+void RecursiveOperationDelegate::DidTryProcessFile(const FileSystemURL& root,
+                                                   base::File::Error error) {
   DCHECK(pending_directory_stack_.empty());
   DCHECK(pending_files_.empty());
 
@@ -84,8 +81,7 @@
                           AsWeakPtr()));
 }
 
-void RecursiveOperationDelegate::DidProcessDirectory(
-    base::File::Error error) {
+void RecursiveOperationDelegate::DidProcessDirectory(base::File::Error error) {
   DCHECK(pending_files_.empty());
   DCHECK(!pending_directory_stack_.empty());
   DCHECK(!pending_directory_stack_.top().empty());
diff --git a/storage/browser/fileapi/recursive_operation_delegate.h b/storage/browser/file_system/recursive_operation_delegate.h
similarity index 92%
rename from storage/browser/fileapi/recursive_operation_delegate.h
rename to storage/browser/file_system/recursive_operation_delegate.h
index 177c37f..f9c9058 100644
--- a/storage/browser/fileapi/recursive_operation_delegate.h
+++ b/storage/browser/file_system/recursive_operation_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_RECURSIVE_OPERATION_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_RECURSIVE_OPERATION_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_RECURSIVE_OPERATION_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_RECURSIVE_OPERATION_DELEGATE_H_
 
 #include "base/callback.h"
 #include "base/component_export.h"
@@ -11,8 +11,8 @@
 #include "base/containers/stack.h"
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace storage {
 
@@ -126,8 +126,7 @@
 
  private:
   void TryProcessFile(const FileSystemURL& root);
-  void DidTryProcessFile(const FileSystemURL& root,
-                         base::File::Error error);
+  void DidTryProcessFile(const FileSystemURL& root, base::File::Error error);
   void ProcessNextDirectory();
   void DidProcessDirectory(base::File::Error error);
   void DidReadDirectory(const FileSystemURL& parent,
@@ -156,4 +155,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_RECURSIVE_OPERATION_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_RECURSIVE_OPERATION_DELEGATE_H_
diff --git a/storage/browser/fileapi/recursive_operation_delegate_unittest.cc b/storage/browser/file_system/recursive_operation_delegate_unittest.cc
similarity index 94%
rename from storage/browser/fileapi/recursive_operation_delegate_unittest.cc
rename to storage/browser/file_system/recursive_operation_delegate_unittest.cc
index 0f66f5e..a44e6bd 100644
--- a/storage/browser/fileapi/recursive_operation_delegate_unittest.cc
+++ b/storage/browser/file_system/recursive_operation_delegate_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/recursive_operation_delegate.h"
+#include "storage/browser/file_system/recursive_operation_delegate.h"
 
 #include <memory>
 #include <vector>
@@ -17,9 +17,9 @@
 #include "base/single_thread_task_runner.h"
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 #include "storage/browser/test/sandbox_file_system_test_helper.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -33,11 +33,7 @@
 class LoggingRecursiveOperation : public storage::RecursiveOperationDelegate {
  public:
   struct LogEntry {
-    enum Type {
-      PROCESS_FILE,
-      PROCESS_DIRECTORY,
-      POST_PROCESS_DIRECTORY
-    };
+    enum Type { PROCESS_FILE, PROCESS_DIRECTORY, POST_PROCESS_DIRECTORY };
     Type type;
     FileSystemURL url;
   };
@@ -125,8 +121,7 @@
   DISALLOW_COPY_AND_ASSIGN(LoggingRecursiveOperation);
 };
 
-void ReportStatus(base::File::Error* out_error,
-                  base::File::Error error) {
+void ReportStatus(base::File::Error* out_error, base::File::Error error) {
   DCHECK(out_error);
   *out_error = error;
 }
@@ -176,8 +171,7 @@
     FileSystemURL url = URLForPath(path);
     bool created = false;
     EXPECT_EQ(base::File::FILE_OK,
-              file_util()->EnsureFileExists(NewContext().get(),
-                                            url, &created));
+              file_util()->EnsureFileExists(NewContext().get(), url, &created));
     EXPECT_TRUE(created);
     return url;
   }
@@ -260,10 +254,9 @@
             log_entries[4].type);
   EXPECT_EQ(LoggingRecursiveOperation::LogEntry::PROCESS_FILE,
             log_entries[5].type);
-  EXPECT_TRUE((src_file2 == log_entries[4].url &&
-               src_file3 == log_entries[5].url) ||
-              (src_file3 == log_entries[4].url &&
-               src_file2 == log_entries[5].url));
+  EXPECT_TRUE(
+      (src_file2 == log_entries[4].url && src_file3 == log_entries[5].url) ||
+      (src_file3 == log_entries[4].url && src_file2 == log_entries[5].url));
 
   EXPECT_EQ(LoggingRecursiveOperation::LogEntry::POST_PROCESS_DIRECTORY,
             log_entries[6].type);
diff --git a/storage/browser/fileapi/remove_operation_delegate.cc b/storage/browser/file_system/remove_operation_delegate.cc
similarity index 93%
rename from storage/browser/fileapi/remove_operation_delegate.cc
rename to storage/browser/file_system/remove_operation_delegate.cc
index 3f925ee..3472032 100644
--- a/storage/browser/fileapi/remove_operation_delegate.cc
+++ b/storage/browser/file_system/remove_operation_delegate.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/remove_operation_delegate.h"
+#include "storage/browser/file_system/remove_operation_delegate.h"
 
 #include "base/bind.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
 
 namespace storage {
 
diff --git a/storage/browser/fileapi/remove_operation_delegate.h b/storage/browser/file_system/remove_operation_delegate.h
similarity index 84%
rename from storage/browser/fileapi/remove_operation_delegate.h
rename to storage/browser/file_system/remove_operation_delegate.h
index afd7c45..c96eb69 100644
--- a/storage/browser/fileapi/remove_operation_delegate.h
+++ b/storage/browser/file_system/remove_operation_delegate.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_REMOVE_OPERATION_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_REMOVE_OPERATION_DELEGATE_H_
 
 #include "base/macros.h"
-#include "storage/browser/fileapi/recursive_operation_delegate.h"
+#include "storage/browser/file_system/recursive_operation_delegate.h"
 
 namespace storage {
 
@@ -43,4 +43,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_REMOVE_OPERATION_DELEGATE_H_
diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/file_system/sandbox_directory_database.cc
similarity index 90%
rename from storage/browser/fileapi/sandbox_directory_database.cc
rename to storage/browser/file_system/sandbox_directory_database.cc
index 797934d..f985567 100644
--- a/storage/browser/fileapi/sandbox_directory_database.cc
+++ b/storage/browser/file_system/sandbox_directory_database.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_directory_database.h"
+#include "storage/browser/file_system/sandbox_directory_database.h"
 
 #include <math.h>
 #include <stddef.h>
@@ -22,7 +22,7 @@
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/leveldatabase/env_chromium.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
@@ -56,10 +56,8 @@
   std::string name;
   int64_t internal_time;
 
-  if (iter.ReadInt64(&info->parent_id) &&
-      iter.ReadString(&data_path) &&
-      iter.ReadString(&name) &&
-      iter.ReadInt64(&internal_time)) {
+  if (iter.ReadInt64(&info->parent_id) && iter.ReadString(&data_path) &&
+      iter.ReadString(&name) && iter.ReadInt64(&internal_time)) {
     info->data_path = storage::StringToFilePath(data_path);
     info->name = storage::StringToFilePath(name).value();
     info->modification_time = base::Time::FromInternalValue(internal_time);
@@ -150,7 +148,7 @@
 
   bool IsFileSystemConsistent() {
     return IsDatabaseEmpty() ||
-        (ScanDatabase() && ScanDirectory() && ScanHierarchy());
+           (ScanDatabase() && ScanDirectory() && ScanHierarchy());
   }
 
  private:
@@ -258,8 +256,8 @@
 
         // Ensure the backing file exists as a normal file.
         base::File::Info platform_file_info;
-        if (!base::GetFileInfo(
-                path_.Append(file_info.data_path), &platform_file_info) ||
+        if (!base::GetFileInfo(path_.Append(file_info.data_path),
+                               &platform_file_info) ||
             platform_file_info.is_directory ||
             platform_file_info.is_symbolic_link) {
           // leveldb::Iterator iterates a snapshot of the database.
@@ -345,8 +343,7 @@
   FileInfo file_info;
   if (!dir_db_->GetFileInfo(0, &file_info))
     return false;
-  if (file_info.parent_id != 0 ||
-      !file_info.is_directory())
+  if (file_info.parent_id != 0 || !file_info.is_directory())
     return false;
 
   while (!directories.empty()) {
@@ -385,8 +382,8 @@
 
   // Check if we've visited all database entries.
   return num_directories_in_db_ == visited_directories &&
-      num_files_in_db_ == visited_files &&
-      num_hierarchy_links_in_db_ == visited_links;
+         num_files_in_db_ == visited_files &&
+         num_hierarchy_links_in_db_ == visited_links;
 }
 
 // Returns true if the given |data_path| contains no parent references ("..")
@@ -414,8 +411,7 @@
 
 namespace storage {
 
-SandboxDirectoryDatabase::FileInfo::FileInfo() : parent_id(0) {
-}
+SandboxDirectoryDatabase::FileInfo::FileInfo() : parent_id(0) {}
 
 SandboxDirectoryDatabase::FileInfo::~FileInfo() = default;
 
@@ -423,8 +419,7 @@
     const base::FilePath& filesystem_data_directory,
     leveldb::Env* env_override)
     : filesystem_data_directory_(filesystem_data_directory),
-      env_override_(env_override) {
-}
+      env_override_(env_override) {}
 
 SandboxDirectoryDatabase::~SandboxDirectoryDatabase() = default;
 
@@ -452,8 +447,8 @@
   return false;
 }
 
-bool SandboxDirectoryDatabase::GetFileWithPath(
-    const base::FilePath& path, FileId* file_id) {
+bool SandboxDirectoryDatabase::GetFileWithPath(const base::FilePath& path,
+                                               FileId* file_id) {
   FileId local_id = 0;
   for (const auto& path_component : VirtualPath::GetComponents(path)) {
     if (path_component == FILE_PATH_LITERAL("/"))
@@ -465,8 +460,8 @@
   return true;
 }
 
-bool SandboxDirectoryDatabase::ListChildren(
-    FileId parent_id, std::vector<FileId>* children) {
+bool SandboxDirectoryDatabase::ListChildren(FileId parent_id,
+                                            std::vector<FileId>* children) {
   // Check to add later: fail if parent is a file, at least in debug builds.
   if (!Init(REPAIR_ON_CORRUPTION))
     return false;
@@ -477,9 +472,9 @@
       db_->NewIterator(leveldb::ReadOptions()));
   iter->Seek(child_key_prefix);
   children->clear();
-  while (iter->Valid() && base::StartsWith(iter->key().ToString(),
-                                           child_key_prefix,
-                                           base::CompareCase::SENSITIVE)) {
+  while (iter->Valid() &&
+         base::StartsWith(iter->key().ToString(), child_key_prefix,
+                          base::CompareCase::SENSITIVE)) {
     std::string child_id_string = iter->value().ToString();
     FileId child_id;
     if (!base::StringToInt64(child_id_string, &child_id)) {
@@ -526,8 +521,8 @@
   return false;
 }
 
-base::File::Error SandboxDirectoryDatabase::AddFileInfo(
-    const FileInfo& info, FileId* file_id) {
+base::File::Error SandboxDirectoryDatabase::AddFileInfo(const FileInfo& info,
+                                                        FileId* file_id) {
   if (!Init(REPAIR_ON_CORRUPTION))
     return base::File::FILE_ERROR_FAILED;
   DCHECK(file_id);
@@ -585,8 +580,8 @@
   return true;
 }
 
-bool SandboxDirectoryDatabase::UpdateFileInfo(
-    FileId file_id, const FileInfo& new_info) {
+bool SandboxDirectoryDatabase::UpdateFileInfo(FileId file_id,
+                                              const FileInfo& new_info) {
   // TODO(ericu): We should also check to see that this doesn't create a loop,
   // but perhaps only in a debug build.
   if (!Init(REPAIR_ON_CORRUPTION))
@@ -620,18 +615,18 @@
 }
 
 bool SandboxDirectoryDatabase::UpdateModificationTime(
-    FileId file_id, const base::Time& modification_time) {
+    FileId file_id,
+    const base::Time& modification_time) {
   FileInfo info;
   if (!GetFileInfo(file_id, &info))
     return false;
   info.modification_time = modification_time;
   base::Pickle pickle;
   PickleFromFileInfo(info, &pickle);
-  leveldb::Status status = db_->Put(
-      leveldb::WriteOptions(),
-      GetFileLookupKey(file_id),
-      leveldb::Slice(reinterpret_cast<const char *>(pickle.data()),
-                     pickle.size()));
+  leveldb::Status status =
+      db_->Put(leveldb::WriteOptions(), GetFileLookupKey(file_id),
+               leveldb::Slice(reinterpret_cast<const char*>(pickle.data()),
+                              pickle.size()));
   if (!status.ok()) {
     HandleError(FROM_HERE, status);
     return false;
@@ -639,8 +634,8 @@
   return true;
 }
 
-bool SandboxDirectoryDatabase::OverwritingMoveFile(
-    FileId src_file_id, FileId dest_file_id) {
+bool SandboxDirectoryDatabase::OverwritingMoveFile(FileId src_file_id,
+                                                   FileId dest_file_id) {
   FileInfo src_file_info;
   FileInfo dest_file_info;
 
@@ -658,10 +653,9 @@
     return false;
   base::Pickle pickle;
   PickleFromFileInfo(dest_file_info, &pickle);
-  batch.Put(
-      GetFileLookupKey(dest_file_id),
-      leveldb::Slice(reinterpret_cast<const char *>(pickle.data()),
-                     pickle.size()));
+  batch.Put(GetFileLookupKey(dest_file_id),
+            leveldb::Slice(reinterpret_cast<const char*>(pickle.data()),
+                           pickle.size()));
   leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch);
   if (!status.ok()) {
     HandleError(FROM_HERE, status);
@@ -706,17 +700,16 @@
 
 bool SandboxDirectoryDatabase::DestroyDatabase() {
   db_.reset();
-  const std::string path =
-      FilePathToString(filesystem_data_directory_.Append(
-          kDirectoryDatabaseName));
+  const std::string path = FilePathToString(
+      filesystem_data_directory_.Append(kDirectoryDatabaseName));
   leveldb_env::Options options;
   if (env_override_)
     options.env = env_override_;
   leveldb::Status status = leveldb::DestroyDB(path, options);
   if (status.ok())
     return true;
-  LOG(WARNING) << "Failed to destroy a database with status " <<
-      status.ToString();
+  LOG(WARNING) << "Failed to destroy a database with status "
+               << status.ToString();
   return false;
 }
 
@@ -724,9 +717,8 @@
   if (db_)
     return true;
 
-  std::string path =
-      FilePathToString(filesystem_data_directory_.Append(
-          kDirectoryDatabaseName));
+  std::string path = FilePathToString(
+      filesystem_data_directory_.Append(kDirectoryDatabaseName));
   leveldb_env::Options options;
   options.max_open_files = 0;  // Use minimum.
   options.create_if_missing = true;
@@ -811,8 +803,7 @@
   return helper.IsFileSystemConsistent();
 }
 
-void SandboxDirectoryDatabase::ReportInitStatus(
-    const leveldb::Status& status) {
+void SandboxDirectoryDatabase::ReportInitStatus(const leveldb::Status& status) {
   base::Time now = base::Time::Now();
   const base::TimeDelta minimum_interval =
       base::TimeDelta::FromHours(kSandboxDirectoryMinimumReportIntervalHours);
@@ -897,8 +888,9 @@
 }
 
 // This does very few safety checks!
-bool SandboxDirectoryDatabase::AddFileInfoHelper(
-    const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch) {
+bool SandboxDirectoryDatabase::AddFileInfoHelper(const FileInfo& info,
+                                                 FileId file_id,
+                                                 leveldb::WriteBatch* batch) {
   if (!VerifyDataPath(info.data_path)) {
     LOG(ERROR) << "Invalid data path is given: " << info.data_path.value();
     return false;
@@ -914,16 +906,16 @@
   }
   base::Pickle pickle;
   PickleFromFileInfo(info, &pickle);
-  batch->Put(
-      id_string,
-      leveldb::Slice(reinterpret_cast<const char *>(pickle.data()),
-                     pickle.size()));
+  batch->Put(id_string,
+             leveldb::Slice(reinterpret_cast<const char*>(pickle.data()),
+                            pickle.size()));
   return true;
 }
 
 // This does very few safety checks!
 bool SandboxDirectoryDatabase::RemoveFileInfoHelper(
-    FileId file_id, leveldb::WriteBatch* batch) {
+    FileId file_id,
+    leveldb::WriteBatch* batch) {
   DCHECK(file_id);  // You can't remove the root, ever.  Just delete the DB.
   FileInfo info;
   if (!GetFileInfo(file_id, &info))
@@ -945,8 +937,8 @@
 
 void SandboxDirectoryDatabase::HandleError(const base::Location& from_here,
                                            const leveldb::Status& status) {
-  LOG(ERROR) << "SandboxDirectoryDatabase failed at: "
-             << from_here.ToString() << " with error: " << status.ToString();
+  LOG(ERROR) << "SandboxDirectoryDatabase failed at: " << from_here.ToString()
+             << " with error: " << status.ToString();
   db_.reset();
 }
 
diff --git a/storage/browser/fileapi/sandbox_directory_database.h b/storage/browser/file_system/sandbox_directory_database.h
similarity index 83%
rename from storage/browser/fileapi/sandbox_directory_database.h
rename to storage/browser/file_system/sandbox_directory_database.h
index e8b74bf..f87d0da 100644
--- a/storage/browser/fileapi/sandbox_directory_database.h
+++ b/storage/browser/file_system/sandbox_directory_database.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_DIRECTORY_DATABASE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_DIRECTORY_DATABASE_H_
 
 #include <stdint.h>
 
@@ -30,7 +30,7 @@
 class Env;
 class Status;
 class WriteBatch;
-}
+}  // namespace leveldb
 
 namespace storage {
 
@@ -51,9 +51,7 @@
     FileInfo();
     ~FileInfo();
 
-    bool is_directory() const {
-      return data_path.empty();
-    }
+    bool is_directory() const { return data_path.empty(); }
 
     FileId parent_id;
     base::FilePath data_path;
@@ -64,15 +62,13 @@
     base::Time modification_time;
   };
 
-  SandboxDirectoryDatabase(
-      const base::FilePath& filesystem_data_directory,
-      leveldb::Env* env_override);
+  SandboxDirectoryDatabase(const base::FilePath& filesystem_data_directory,
+                           leveldb::Env* env_override);
   ~SandboxDirectoryDatabase();
 
-  bool GetChildWithName(
-      FileId parent_id,
-      const base::FilePath::StringType& name,
-      FileId* child_id);
+  bool GetChildWithName(FileId parent_id,
+                        const base::FilePath::StringType& name,
+                        FileId* child_id);
   bool GetFileWithPath(const base::FilePath& path, FileId* file_id);
   // ListChildren will succeed, returning 0 children, if parent_id doesn't
   // exist.
@@ -84,8 +80,8 @@
   // and renames.  If you just want to update the modification_time, use
   // UpdateModificationTime.
   bool UpdateFileInfo(FileId file_id, const FileInfo& info);
-  bool UpdateModificationTime(
-      FileId file_id, const base::Time& modification_time);
+  bool UpdateModificationTime(FileId file_id,
+                              const base::Time& modification_time);
   // This is used for an overwriting move of a file [not a directory] on top of
   // another file [also not a directory]; we need to alter two files' info in a
   // single transaction to avoid weird backing file references in the event of a
@@ -120,8 +116,9 @@
   void ReportInitStatus(const leveldb::Status& status);
   bool StoreDefaultValues();
   bool GetLastFileId(FileId* file_id);
-  bool AddFileInfoHelper(
-      const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch);
+  bool AddFileInfoHelper(const FileInfo& info,
+                         FileId file_id,
+                         leveldb::WriteBatch* batch);
   bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch);
   // Close the database. Before this, all iterators associated with the database
   // must be deleted.
@@ -137,4 +134,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_DIRECTORY_DATABASE_H_
diff --git a/storage/browser/fileapi/sandbox_directory_database_unittest.cc b/storage/browser/file_system/sandbox_directory_database_unittest.cc
similarity index 95%
rename from storage/browser/fileapi/sandbox_directory_database_unittest.cc
rename to storage/browser/file_system/sandbox_directory_database_unittest.cc
index 110eabd6..c85dd93 100644
--- a/storage/browser/fileapi/sandbox_directory_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_directory_database_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_directory_database.h"
+#include "storage/browser/file_system/sandbox_directory_database.h"
 
 #include <math.h>
 #include <stddef.h>
@@ -43,9 +43,7 @@
     InitDatabase();
   }
 
-  SandboxDirectoryDatabase* db() {
-    return db_.get();
-  }
+  SandboxDirectoryDatabase* db() { return db_.get(); }
 
   void InitDatabase() {
     // Call CloseDatabase() to avoid having multiple database instances for
@@ -54,12 +52,10 @@
     db_.reset(new SandboxDirectoryDatabase(path(), nullptr));
   }
 
-  void CloseDatabase() {
-    db_.reset();
-  }
+  void CloseDatabase() { db_.reset(); }
 
-  base::File::Error AddFileInfo(
-      FileId parent_id, const base::FilePath::StringType& name) {
+  base::File::Error AddFileInfo(FileId parent_id,
+                                const base::FilePath::StringType& name) {
     FileId file_id;
     FileInfo info;
     info.parent_id = parent_id;
@@ -390,9 +386,8 @@
   EXPECT_EQ(info0.name, info1.name);
   EXPECT_EQ(info0.parent_id, info1.parent_id);
   EXPECT_EQ(info0.data_path, info1.data_path);
-  EXPECT_EQ(
-      floor(info0.modification_time.ToDoubleT()),
-      info1.modification_time.ToDoubleT());
+  EXPECT_EQ(floor(info0.modification_time.ToDoubleT()),
+            info1.modification_time.ToDoubleT());
 
   EXPECT_TRUE(db()->UpdateModificationTime(file_id, base::Time::UnixEpoch()));
   EXPECT_TRUE(db()->GetFileInfo(file_id, &info1));
@@ -400,9 +395,8 @@
   EXPECT_EQ(info0.parent_id, info1.parent_id);
   EXPECT_EQ(info0.data_path, info1.data_path);
   EXPECT_NE(info0.modification_time, info1.modification_time);
-  EXPECT_EQ(
-      info1.modification_time.ToDoubleT(),
-      floor(base::Time::UnixEpoch().ToDoubleT()));
+  EXPECT_EQ(info1.modification_time.ToDoubleT(),
+            floor(base::Time::UnixEpoch().ToDoubleT()));
 
   EXPECT_FALSE(db()->UpdateModificationTime(999, base::Time::UnixEpoch()));
 }
@@ -421,9 +415,8 @@
   EXPECT_EQ(info0.parent_id, info1.parent_id);
   EXPECT_EQ(info0.data_path, info1.data_path);
   EXPECT_EQ(info0.name, info1.name);
-  EXPECT_EQ(
-      floor(info0.modification_time.ToDoubleT()),
-      info1.modification_time.ToDoubleT());
+  EXPECT_EQ(floor(info0.modification_time.ToDoubleT()),
+            info1.modification_time.ToDoubleT());
 }
 
 TEST_F(SandboxDirectoryDatabaseTest, TestOverwritingMoveFileSrcDirectory) {
@@ -535,8 +528,7 @@
   EXPECT_TRUE(db()->IsFileSystemConsistent());
 }
 
-TEST_F(SandboxDirectoryDatabaseTest,
-       TestConsistencyCheck_BackingMultiEntry) {
+TEST_F(SandboxDirectoryDatabaseTest, TestConsistencyCheck_BackingMultiEntry) {
   const base::FilePath::CharType kBackingFileName[] = FPL("the celeb");
   CreateFile(0, FPL("foo"), kBackingFileName, nullptr);
 
@@ -621,8 +613,8 @@
   const base::FilePath kDatabaseDirectory =
       path().Append(kDirectoryDatabaseName);
   CloseDatabase();
-  CorruptDatabase(kDatabaseDirectory, leveldb::kDescriptorFile,
-                  0, std::numeric_limits<size_t>::max());
+  CorruptDatabase(kDatabaseDirectory, leveldb::kDescriptorFile, 0,
+                  std::numeric_limits<size_t>::max());
   InitDatabase();
   EXPECT_FALSE(db()->IsFileSystemConsistent());
 
@@ -642,10 +634,9 @@
   const base::FilePath kDatabaseDirectory =
       path().Append(kDirectoryDatabaseName);
   CloseDatabase();
-  CorruptDatabase(kDatabaseDirectory, leveldb::kDescriptorFile,
-                  0, std::numeric_limits<size_t>::max());
-  CorruptDatabase(kDatabaseDirectory, leveldb::kLogFile,
-                  -1, 1);
+  CorruptDatabase(kDatabaseDirectory, leveldb::kDescriptorFile, 0,
+                  std::numeric_limits<size_t>::max());
+  CorruptDatabase(kDatabaseDirectory, leveldb::kLogFile, -1, 1);
   InitDatabase();
   EXPECT_FALSE(db()->IsFileSystemConsistent());
 
diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.cc b/storage/browser/file_system/sandbox_file_stream_writer.cc
similarity index 92%
rename from storage/browser/fileapi/sandbox_file_stream_writer.cc
rename to storage/browser/file_system/sandbox_file_stream_writer.cc
index 10257d3..38a00589 100644
--- a/storage/browser/fileapi/sandbox_file_stream_writer.cc
+++ b/storage/browser/file_system/sandbox_file_stream_writer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_file_stream_writer.h"
+#include "storage/browser/file_system/sandbox_file_stream_writer.h"
 
 #include <stdint.h>
 
@@ -15,12 +15,12 @@
 #include "base/sequenced_task_runner.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
-#include "storage/browser/fileapi/plugin_private_file_system_backend.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/plugin_private_file_system_backend.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/common/fileapi/file_system_util.h"
 
@@ -208,8 +208,8 @@
     std::move(write_callback_).Run(init_status);
     return;
   }
-  allowed_bytes_to_write_ = AdjustQuotaForOverlap(
-      allowed_bytes_to_write_, initial_offset_, file_size_);
+  allowed_bytes_to_write_ = AdjustQuotaForOverlap(allowed_bytes_to_write_,
+                                                  initial_offset_, file_size_);
   const int result = WriteInternal(buf, buf_len);
   if (result != net::ERR_IO_PENDING)
     std::move(write_callback_).Run(result);
diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.h b/storage/browser/file_system/sandbox_file_stream_writer.h
similarity index 88%
rename from storage/browser/fileapi/sandbox_file_stream_writer.h
rename to storage/browser/file_system/sandbox_file_stream_writer.h
index 44647fb..b658565 100644
--- a/storage/browser/fileapi/sandbox_file_stream_writer.h
+++ b/storage/browser/file_system/sandbox_file_stream_writer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_STREAM_WRITER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_STREAM_WRITER_H_
 
 #include <stdint.h>
 
@@ -14,9 +14,9 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
 #include "url/gurl.h"
@@ -93,4 +93,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_STREAM_WRITER_H_
diff --git a/storage/browser/fileapi/sandbox_file_system_backend.cc b/storage/browser/file_system/sandbox_file_system_backend.cc
similarity index 83%
rename from storage/browser/fileapi/sandbox_file_system_backend.cc
rename to storage/browser/file_system/sandbox_file_system_backend.cc
index e6e58337..b170e84 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 
 #include <stdint.h>
 
@@ -14,17 +14,17 @@
 #include "base/logging.h"
 #include "base/metrics/histogram.h"
 #include "base/task_runner_util.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_stream_writer.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_options.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/sandbox_quota_observer.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_stream_writer.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_options.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/sandbox_quota_observer.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
@@ -42,8 +42,7 @@
 SandboxFileSystemBackend::~SandboxFileSystemBackend() = default;
 
 bool SandboxFileSystemBackend::CanHandleType(FileSystemType type) const {
-  return type == kFileSystemTypeTemporary ||
-         type == kFileSystemTypePersistent;
+  return type == kFileSystemTypeTemporary || type == kFileSystemTypePersistent;
 }
 
 void SandboxFileSystemBackend::Initialize(FileSystemContext* context) {
@@ -77,8 +76,7 @@
       GetFileSystemRootURI(url.origin().GetURL(), url.type()));
 }
 
-AsyncFileUtil* SandboxFileSystemBackend::GetAsyncFileUtil(
-    FileSystemType type) {
+AsyncFileUtil* SandboxFileSystemBackend::GetAsyncFileUtil(FileSystemType type) {
   DCHECK(delegate_);
   return delegate_->file_util();
 }
@@ -141,8 +139,8 @@
     FileSystemContext* context) const {
   DCHECK(CanHandleType(url.type()));
   DCHECK(delegate_);
-  return delegate_->CreateFileStreamReader(
-      url, offset, expected_modification_time, context);
+  return delegate_->CreateFileStreamReader(url, offset,
+                                           expected_modification_time, context);
 }
 
 std::unique_ptr<storage::FileStreamWriter>
diff --git a/storage/browser/fileapi/sandbox_file_system_backend.h b/storage/browser/file_system/sandbox_file_system_backend.h
similarity index 85%
rename from storage/browser/fileapi/sandbox_file_system_backend.h
rename to storage/browser/file_system/sandbox_file_system_backend.h
index b5acfdb..58ace83c 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend.h
+++ b/storage/browser/file_system/sandbox_file_system_backend.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_SYSTEM_BACKEND_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_SYSTEM_BACKEND_H_
 
 #include <stdint.h>
 
@@ -16,10 +16,10 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/browser/quota/special_storage_policy.h"
 
 namespace storage {
@@ -82,4 +82,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_SYSTEM_BACKEND_H_
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc b/storage/browser/file_system/sandbox_file_system_backend_delegate.cc
similarity index 91%
rename from storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
rename to storage/browser/file_system/sandbox_file_system_backend_delegate.cc
index 7ff6192f..4b12d9c 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend_delegate.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -19,20 +19,20 @@
 #include "base/stl_util.h"
 #include "base/task_runner_util.h"
 #include "net/base/url_util.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/obfuscated_file_util_memory_delegate.h"
-#include "storage/browser/fileapi/quota/quota_backend_impl.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
-#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
-#include "storage/browser/fileapi/sandbox_file_stream_writer.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
-#include "storage/browser/fileapi/sandbox_quota_observer.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
+#include "storage/browser/file_system/quota/quota_backend_impl.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
+#include "storage/browser/file_system/quota/quota_reservation_manager.h"
+#include "storage/browser/file_system/sandbox_file_stream_writer.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_quota_observer.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "url/origin.h"
@@ -73,12 +73,14 @@
 // Restricted names.
 // http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions
 const base::FilePath::CharType* const kRestrictedNames[] = {
-  FILE_PATH_LITERAL("."), FILE_PATH_LITERAL(".."),
+    FILE_PATH_LITERAL("."),
+    FILE_PATH_LITERAL(".."),
 };
 
 // Restricted chars.
 const base::FilePath::CharType kRestrictedChars[] = {
-  FILE_PATH_LITERAL('/'), FILE_PATH_LITERAL('\\'),
+    FILE_PATH_LITERAL('/'),
+    FILE_PATH_LITERAL('\\'),
 };
 
 std::string GetTypeStringForURL(const FileSystemURL& url) {
@@ -120,11 +122,10 @@
   DCHECK(error_ptr);
   const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
   file_util->GetDirectoryForOriginAndType(
-      origin_url, SandboxFileSystemBackendDelegate::GetTypeString(type),
-      create, error_ptr);
+      origin_url, SandboxFileSystemBackendDelegate::GetTypeString(type), create,
+      error_ptr);
   if (*error_ptr != base::File::FILE_OK) {
-    UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel,
-                              kCreateDirectoryError,
+    UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, kCreateDirectoryError,
                               kFileSystemErrorMax);
   } else {
     UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, kOK, kFileSystemErrorMax);
@@ -155,8 +156,8 @@
 }  // namespace
 
 const base::FilePath::CharType
-SandboxFileSystemBackendDelegate::kFileSystemDirectory[] =
-    FILE_PATH_LITERAL("File System");
+    SandboxFileSystemBackendDelegate::kFileSystemDirectory[] =
+        FILE_PATH_LITERAL("File System");
 
 // static
 std::string SandboxFileSystemBackendDelegate::GetTypeString(
@@ -200,11 +201,10 @@
                                                obfuscated_file_util(),
                                                usage_cache())),
       quota_reservation_manager_(new QuotaReservationManager(
-          std::unique_ptr<QuotaReservationManager::QuotaBackend>(
-              new QuotaBackendImpl(file_task_runner_.get(),
-                                   obfuscated_file_util(),
-                                   usage_cache(),
-                                   quota_manager_proxy)))),
+          std::make_unique<QuotaBackendImpl>(file_task_runner_.get(),
+                                             obfuscated_file_util(),
+                                             usage_cache(),
+                                             quota_manager_proxy))),
       special_storage_policy_(special_storage_policy),
       file_system_options_(file_system_options),
       is_filesystem_opened_(false) {
@@ -298,7 +298,7 @@
     base::File::Error* error_code) const {
   if (!IsAccessValid(url)) {
     *error_code = base::File::FILE_ERROR_SECURITY;
-    return std::unique_ptr<FileSystemOperationContext>();
+    return nullptr;
   }
 
   const UpdateObserverList* update_observers = GetUpdateObservers(url.type());
@@ -333,11 +333,11 @@
     FileSystemContext* context,
     FileSystemType type) const {
   if (!IsAccessValid(url))
-    return std::unique_ptr<FileStreamWriter>();
+    return nullptr;
   const UpdateObserverList* observers = GetUpdateObservers(type);
   DCHECK(observers);
-  return std::unique_ptr<FileStreamWriter>(
-      new SandboxFileStreamWriter(context, url, offset, *observers));
+  return std::make_unique<SandboxFileStreamWriter>(
+      context, url, offset, *observers);
 }
 
 base::File::Error
@@ -372,7 +372,8 @@
 }
 
 void SandboxFileSystemBackendDelegate::GetOriginsForTypeOnFileTaskRunner(
-    FileSystemType type, std::set<GURL>* origins) {
+    FileSystemType type,
+    std::set<GURL>* origins) {
   DCHECK(file_task_runner_->RunsTasksInCurrentSequence());
   DCHECK(origins);
   std::unique_ptr<OriginEnumerator> enumerator(CreateOriginEnumerator());
@@ -394,7 +395,8 @@
 }
 
 void SandboxFileSystemBackendDelegate::GetOriginsForHostOnFileTaskRunner(
-    FileSystemType type, const std::string& host,
+    FileSystemType type,
+    const std::string& host,
     std::set<GURL>* origins) {
   DCHECK(file_task_runner_->RunsTasksInCurrentSequence());
   DCHECK(origins);
@@ -585,8 +587,7 @@
     return url.inner_url() && IsAllowedScheme(*url.inner_url());
 
   for (size_t i = 0;
-       i < file_system_options_.additional_allowed_schemes().size();
-       ++i) {
+       i < file_system_options_.additional_allowed_schemes().size(); ++i) {
     if (url.SchemeIs(
             file_system_options_.additional_allowed_schemes()[i].c_str()))
       return true;
@@ -627,8 +628,8 @@
     const GURL& origin,
     FileSystemType type) {
   FileSystemOperationContext operation_context(context);
-  FileSystemURL url = context->CreateCrackedFileSystemURL(
-      origin, type, base::FilePath());
+  FileSystemURL url =
+      context->CreateCrackedFileSystemURL(origin, type, base::FilePath());
   std::unique_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator(
       obfuscated_file_util()->CreateFileEnumerator(&operation_context, url,
                                                    true));
@@ -654,13 +655,11 @@
   }
 
 #define REPORT(report_value)                                            \
-  UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailLabel,                 \
-                            (report_value),                             \
+  UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailLabel, (report_value), \
                             kFileSystemErrorMax);                       \
   if (!throttled) {                                                     \
     UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailNonThrottledLabel,   \
-                              (report_value),                           \
-                              kFileSystemErrorMax);                     \
+                              (report_value), kFileSystemErrorMax);     \
   }
 
   switch (error_code) {
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate.h b/storage/browser/file_system/sandbox_file_system_backend_delegate.h
similarity index 89%
rename from storage/browser/fileapi/sandbox_file_system_backend_delegate.h
rename to storage/browser/file_system/sandbox_file_system_backend_delegate.h
index 8e8fba4..fb9f600 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend_delegate.h
+++ b/storage/browser/file_system/sandbox_file_system_backend_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_
 
 #include <stdint.h>
 
@@ -20,10 +20,10 @@
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_options.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_options.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace base {
 class SequencedTaskRunner;
@@ -32,7 +32,7 @@
 namespace content {
 class SandboxFileSystemBackendDelegateTest;
 class SandboxFileSystemTestHelper;
-}
+}  // namespace content
 
 namespace leveldb {
 class Env;
@@ -41,7 +41,7 @@
 namespace storage {
 class QuotaManagerProxy;
 class SpecialStoragePolicy;
-}
+}  // namespace storage
 
 namespace storage {
 class FileStreamReader;
@@ -106,10 +106,9 @@
   // the 'unique' part.)
   // Returns an empty path if the given type is invalid.
   // This method can only be called on the file thread.
-  base::FilePath GetBaseDirectoryForOriginAndType(
-      const GURL& origin_url,
-      FileSystemType type,
-      bool create);
+  base::FilePath GetBaseDirectoryForOriginAndType(const GURL& origin_url,
+                                                  FileSystemType type,
+                                                  bool create);
 
   // FileSystemBackend helpers.
   void OpenFileSystem(const GURL& origin_url,
@@ -176,10 +175,8 @@
   // Registers quota observer for file updates on filesystem of |type|.
   void RegisterQuotaUpdateObserver(FileSystemType type);
 
-  void InvalidateUsageCache(const GURL& origin_url,
-                            FileSystemType type);
-  void StickyInvalidateUsageCache(const GURL& origin_url,
-                                  FileSystemType type);
+  void InvalidateUsageCache(const GURL& origin_url, FileSystemType type);
+  void StickyInvalidateUsageCache(const GURL& origin_url, FileSystemType type);
 
   void CollectOpenFileSystemMetrics(base::File::Error error_code);
 
@@ -224,9 +221,8 @@
   bool IsAllowedScheme(const GURL& url) const;
 
   // Returns a path to the usage cache file.
-  base::FilePath GetUsageCachePathForOriginAndType(
-      const GURL& origin_url,
-      FileSystemType type);
+  base::FilePath GetUsageCachePathForOriginAndType(const GURL& origin_url,
+                                                   FileSystemType type);
 
   // Returns a path to the usage cache file (static version).
   static base::FilePath GetUsageCachePathForOriginAndType(
@@ -274,4 +270,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_FILE_SYSTEM_BACKEND_DELEGATE_H_
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc b/storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc
similarity index 97%
rename from storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
rename to storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc
index 7037631..acca05e 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 
 #include <memory>
 
@@ -12,7 +12,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/test/mock_quota_manager_proxy.h"
 #include "storage/browser/test/test_file_system_options.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/storage/browser/fileapi/sandbox_file_system_backend_unittest.cc b/storage/browser/file_system/sandbox_file_system_backend_unittest.cc
similarity index 79%
rename from storage/browser/fileapi/sandbox_file_system_backend_unittest.cc
rename to storage/browser/file_system/sandbox_file_system_backend_unittest.cc
index 2a353dd8..fec19d3 100644
--- a/storage/browser/fileapi/sandbox_file_system_backend_unittest.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 
 #include <stddef.h>
 
@@ -17,9 +17,9 @@
 #include "base/stl_util.h"
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 #include "storage/browser/test/test_file_system_options.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -32,9 +32,9 @@
 
 // PS stands for path separator.
 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
-#define PS  "\\"
+#define PS "\\"
 #else
-#define PS  "/"
+#define PS "/"
 #endif
 
 namespace content {
@@ -46,14 +46,14 @@
   const char* origin_url;
   const char* expected_path;
 } kRootPathTestCases[] = {
-      {storage::kFileSystemTypeTemporary, "http://foo:1/", "000" PS "t"},
-      {storage::kFileSystemTypePersistent, "http://foo:1/", "000" PS "p"},
-      {storage::kFileSystemTypeTemporary, "http://bar.com/", "001" PS "t"},
-      {storage::kFileSystemTypePersistent, "http://bar.com/", "001" PS "p"},
-      {storage::kFileSystemTypeTemporary, "https://foo:2/", "002" PS "t"},
-      {storage::kFileSystemTypePersistent, "https://foo:2/", "002" PS "p"},
-      {storage::kFileSystemTypeTemporary, "https://bar.com/", "003" PS "t"},
-      {storage::kFileSystemTypePersistent, "https://bar.com/", "003" PS "p"},
+    {storage::kFileSystemTypeTemporary, "http://foo:1/", "000" PS "t"},
+    {storage::kFileSystemTypePersistent, "http://foo:1/", "000" PS "p"},
+    {storage::kFileSystemTypeTemporary, "http://bar.com/", "001" PS "t"},
+    {storage::kFileSystemTypePersistent, "http://bar.com/", "001" PS "p"},
+    {storage::kFileSystemTypeTemporary, "https://foo:2/", "002" PS "t"},
+    {storage::kFileSystemTypePersistent, "https://foo:2/", "002" PS "p"},
+    {storage::kFileSystemTypeTemporary, "https://bar.com/", "003" PS "t"},
+    {storage::kFileSystemTypePersistent, "https://bar.com/", "003" PS "p"},
 };
 
 const struct RootPathFileURITest {
@@ -101,8 +101,8 @@
 
   void CreateOriginTypeDirectory(const GURL& origin,
                                  storage::FileSystemType type) {
-    base::FilePath target = delegate_->
-        GetBaseDirectoryForOriginAndType(origin, type, true);
+    base::FilePath target =
+        delegate_->GetBaseDirectoryForOriginAndType(origin, type, true);
     ASSERT_TRUE(!target.empty());
     ASSERT_TRUE(base::DirectoryExists(target));
   }
@@ -120,8 +120,8 @@
     if (error != base::File::FILE_OK)
       return false;
     base::FilePath returned_root_path =
-        delegate_->GetBaseDirectoryForOriginAndType(
-            origin_url, type, false /* create */);
+        delegate_->GetBaseDirectoryForOriginAndType(origin_url, type,
+                                                    false /* create */);
     if (root_path)
       *root_path = returned_root_path;
     return !returned_root_path.empty();
@@ -149,16 +149,14 @@
 TEST_F(SandboxFileSystemBackendTest, EnumerateOrigins) {
   SetUpNewBackend(CreateAllowFileAccessOptions());
   const char* temporary_origins[] = {
-    "http://www.bar.com/",
-    "http://www.foo.com/",
-    "http://www.foo.com:1/",
-    "http://www.example.com:8080/",
-    "http://www.google.com:80/",
+      "http://www.bar.com/",       "http://www.foo.com/",
+      "http://www.foo.com:1/",     "http://www.example.com:8080/",
+      "http://www.google.com:80/",
   };
   const char* persistent_origins[] = {
-    "http://www.bar.com/",
-    "http://www.foo.com:8080/",
-    "http://www.foo.com:80/",
+      "http://www.bar.com/",
+      "http://www.foo.com:8080/",
+      "http://www.foo.com:80/",
   };
   size_t temporary_size = base::size(temporary_origins);
   size_t persistent_size = base::size(persistent_origins);
@@ -203,16 +201,15 @@
   // Create a new root directory.
   for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) {
     SCOPED_TRACE(testing::Message() << "RootPath (create) #" << i << " "
-                 << kRootPathTestCases[i].expected_path);
+                                    << kRootPathTestCases[i].expected_path);
 
     base::FilePath root_path;
-    EXPECT_TRUE(GetRootPath(GURL(kRootPathTestCases[i].origin_url),
-                            kRootPathTestCases[i].type,
-                            storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
-                            &root_path));
+    EXPECT_TRUE(GetRootPath(
+        GURL(kRootPathTestCases[i].origin_url), kRootPathTestCases[i].type,
+        storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, &root_path));
 
-    base::FilePath expected = file_system_path().AppendASCII(
-        kRootPathTestCases[i].expected_path);
+    base::FilePath expected =
+        file_system_path().AppendASCII(kRootPathTestCases[i].expected_path);
     EXPECT_EQ(expected.value(), root_path.value());
     EXPECT_TRUE(base::DirectoryExists(root_path));
     ASSERT_TRUE(returned_root_path.size() > i);
@@ -223,13 +220,12 @@
   // same directory.
   for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) {
     SCOPED_TRACE(testing::Message() << "RootPath (get) #" << i << " "
-                 << kRootPathTestCases[i].expected_path);
+                                    << kRootPathTestCases[i].expected_path);
 
     base::FilePath root_path;
-    EXPECT_TRUE(GetRootPath(GURL(kRootPathTestCases[i].origin_url),
-                            kRootPathTestCases[i].type,
-                            storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
-                            &root_path));
+    EXPECT_TRUE(GetRootPath(
+        GURL(kRootPathTestCases[i].origin_url), kRootPathTestCases[i].type,
+        storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, &root_path));
     ASSERT_TRUE(returned_root_path.size() > i);
     EXPECT_EQ(returned_root_path[i].value(), root_path.value());
   }
@@ -244,15 +240,13 @@
   GURL origin_url("http://foo.com:1/");
 
   base::FilePath root_path1;
-  EXPECT_TRUE(GetRootPath(origin_url,
-                          storage::kFileSystemTypeTemporary,
+  EXPECT_TRUE(GetRootPath(origin_url, storage::kFileSystemTypeTemporary,
                           storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
                           &root_path1));
 
   SetUpNewBackend(CreateDisallowFileAccessOptions());
   base::FilePath root_path2;
-  EXPECT_TRUE(GetRootPath(origin_url,
-                          storage::kFileSystemTypeTemporary,
+  EXPECT_TRUE(GetRootPath(origin_url, storage::kFileSystemTypeTemporary,
                           storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
                           &root_path2));
 
@@ -265,7 +259,7 @@
   // Try to get a root directory without creating.
   for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) {
     SCOPED_TRACE(testing::Message() << "RootPath (create=false) #" << i << " "
-                 << kRootPathTestCases[i].expected_path);
+                                    << kRootPathTestCases[i].expected_path);
     EXPECT_FALSE(GetRootPath(
         GURL(kRootPathTestCases[i].origin_url), kRootPathTestCases[i].type,
         storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, nullptr));
@@ -278,7 +272,7 @@
   // Try to get a root directory.
   for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) {
     SCOPED_TRACE(testing::Message() << "RootPath (incognito) #" << i << " "
-                 << kRootPathTestCases[i].expected_path);
+                                    << kRootPathTestCases[i].expected_path);
     EXPECT_EQ(
         kRootPathTestCases[i].type == storage::kFileSystemTypeTemporary,
         GetRootPath(GURL(kRootPathTestCases[i].origin_url),
@@ -290,8 +284,9 @@
 TEST_F(SandboxFileSystemBackendTest, GetRootPathFileURI) {
   SetUpNewBackend(CreateDisallowFileAccessOptions());
   for (size_t i = 0; i < base::size(kRootPathFileURITestCases); ++i) {
-    SCOPED_TRACE(testing::Message() << "RootPathFileURI (disallow) #"
-                 << i << " " << kRootPathFileURITestCases[i].expected_path);
+    SCOPED_TRACE(testing::Message()
+                 << "RootPathFileURI (disallow) #" << i << " "
+                 << kRootPathFileURITestCases[i].expected_path);
     EXPECT_FALSE(GetRootPath(GURL(kRootPathFileURITestCases[i].origin_url),
                              kRootPathFileURITestCases[i].type,
                              storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
@@ -302,8 +297,9 @@
 TEST_F(SandboxFileSystemBackendTest, GetRootPathFileURIWithAllowFlag) {
   SetUpNewBackend(CreateAllowFileAccessOptions());
   for (size_t i = 0; i < base::size(kRootPathFileURITestCases); ++i) {
-    SCOPED_TRACE(testing::Message() << "RootPathFileURI (allow) #"
-                 << i << " " << kRootPathFileURITestCases[i].expected_path);
+    SCOPED_TRACE(testing::Message()
+                 << "RootPathFileURI (allow) #" << i << " "
+                 << kRootPathFileURITestCases[i].expected_path);
     base::FilePath root_path;
     EXPECT_TRUE(GetRootPath(GURL(kRootPathFileURITestCases[i].origin_url),
                             kRootPathFileURITestCases[i].type,
diff --git a/storage/browser/fileapi/sandbox_isolated_origin_database.cc b/storage/browser/file_system/sandbox_isolated_origin_database.cc
similarity index 81%
rename from storage/browser/fileapi/sandbox_isolated_origin_database.cc
rename to storage/browser/file_system/sandbox_isolated_origin_database.cc
index db9448d..7be75269 100644
--- a/storage/browser/fileapi/sandbox_isolated_origin_database.cc
+++ b/storage/browser/file_system/sandbox_isolated_origin_database.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_isolated_origin_database.h"
+#include "storage/browser/file_system/sandbox_isolated_origin_database.h"
 
 #include "base/files/file_util.h"
 #include "base/logging.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 
 namespace storage {
 
@@ -20,13 +20,13 @@
 
 SandboxIsolatedOriginDatabase::~SandboxIsolatedOriginDatabase() = default;
 
-bool SandboxIsolatedOriginDatabase::HasOriginPath(
-    const std::string& origin) {
+bool SandboxIsolatedOriginDatabase::HasOriginPath(const std::string& origin) {
   return (origin_ == origin);
 }
 
 bool SandboxIsolatedOriginDatabase::GetPathForOrigin(
-    const std::string& origin, base::FilePath* directory) {
+    const std::string& origin,
+    base::FilePath* directory) {
   if (origin != origin_)
     return false;
   *directory = origin_directory_;
diff --git a/storage/browser/fileapi/sandbox_isolated_origin_database.h b/storage/browser/file_system/sandbox_isolated_origin_database.h
similarity index 74%
rename from storage/browser/fileapi/sandbox_isolated_origin_database.h
rename to storage/browser/file_system/sandbox_isolated_origin_database.h
index 6238860d..5700d72 100644
--- a/storage/browser/fileapi/sandbox_isolated_origin_database.h
+++ b/storage/browser/file_system/sandbox_isolated_origin_database.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_
 
 #include <string>
 #include <vector>
 
 #include "base/component_export.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/sandbox_origin_database_interface.h"
+#include "storage/browser/file_system/sandbox_origin_database_interface.h"
 
 namespace storage {
 
@@ -23,10 +23,9 @@
 
   // Initialize this database for |origin| which makes GetPathForOrigin return
   // |origin_directory| (in |file_system_directory|).
-  SandboxIsolatedOriginDatabase(
-      const std::string& origin,
-      const base::FilePath& file_system_directory,
-      const base::FilePath& origin_directory);
+  SandboxIsolatedOriginDatabase(const std::string& origin,
+                                const base::FilePath& file_system_directory,
+                                const base::FilePath& origin_directory);
   ~SandboxIsolatedOriginDatabase() override;
 
   // SandboxOriginDatabaseInterface overrides.
@@ -50,4 +49,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_
diff --git a/storage/browser/fileapi/sandbox_isolated_origin_database_unittest.cc b/storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc
similarity index 89%
rename from storage/browser/fileapi/sandbox_isolated_origin_database_unittest.cc
rename to storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc
index 2b9bd74..68ac77b 100644
--- a/storage/browser/fileapi/sandbox_isolated_origin_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "storage/browser/file_system/sandbox_isolated_origin_database.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
-#include "storage/browser/fileapi/sandbox_isolated_origin_database.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using storage::SandboxIsolatedOriginDatabase;
diff --git a/storage/browser/fileapi/sandbox_origin_database.cc b/storage/browser/file_system/sandbox_origin_database.cc
similarity index 93%
rename from storage/browser/fileapi/sandbox_origin_database.cc
rename to storage/browser/file_system/sandbox_origin_database.cc
index 51d41a8..7e5a6186 100644
--- a/storage/browser/fileapi/sandbox_origin_database.cc
+++ b/storage/browser/file_system/sandbox_origin_database.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 
 #include <stdint.h>
 
@@ -67,8 +67,7 @@
     const base::FilePath& file_system_directory,
     leveldb::Env* env_override)
     : file_system_directory_(file_system_directory),
-      env_override_(env_override) {
-}
+      env_override_(env_override) {}
 
 SandboxOriginDatabase::~SandboxOriginDatabase() = default;
 
@@ -144,8 +143,7 @@
 
   // See if the repaired entries match with what we have on disk.
   std::set<base::FilePath> directories;
-  base::FileEnumerator file_enum(file_system_directory_,
-                                 false /* recursive */,
+  base::FileEnumerator file_enum(file_system_directory_, false /* recursive */,
                                  base::FileEnumerator::DIRECTORIES);
   base::FilePath path_each;
   while (!(path_each = file_enum.Next()).empty())
@@ -190,8 +188,8 @@
 void SandboxOriginDatabase::HandleError(const base::Location& from_here,
                                         const leveldb::Status& status) {
   db_.reset();
-  LOG(ERROR) << "SandboxOriginDatabase failed at: "
-             << from_here.ToString() << " with error: " << status.ToString();
+  LOG(ERROR) << "SandboxOriginDatabase failed at: " << from_here.ToString()
+             << " with error: " << status.ToString();
 }
 
 void SandboxOriginDatabase::ReportInitStatus(const leveldb::Status& status) {
@@ -238,8 +236,8 @@
   return false;
 }
 
-bool SandboxOriginDatabase::GetPathForOrigin(
-    const std::string& origin, base::FilePath* directory) {
+bool SandboxOriginDatabase::GetPathForOrigin(const std::string& origin,
+                                             base::FilePath* directory) {
   if (!Init(CREATE_IF_NONEXISTENT, REPAIR_ON_CORRUPTION))
     return false;
   DCHECK(directory);
@@ -283,8 +281,7 @@
   return false;
 }
 
-bool SandboxOriginDatabase::ListAllOrigins(
-    std::vector<OriginRecord>* origins) {
+bool SandboxOriginDatabase::ListAllOrigins(std::vector<OriginRecord>* origins) {
   DCHECK(origins);
   if (!Init(CREATE_IF_NONEXISTENT, REPAIR_ON_CORRUPTION)) {
     origins->clear();
@@ -295,11 +292,11 @@
   std::string origin_key_prefix = OriginToOriginKey(std::string());
   iter->Seek(origin_key_prefix);
   origins->clear();
-  while (iter->Valid() && base::StartsWith(iter->key().ToString(),
-                                           origin_key_prefix,
-                                           base::CompareCase::SENSITIVE)) {
+  while (iter->Valid() &&
+         base::StartsWith(iter->key().ToString(), origin_key_prefix,
+                          base::CompareCase::SENSITIVE)) {
     std::string origin =
-      iter->key().ToString().substr(origin_key_prefix.length());
+        iter->key().ToString().substr(origin_key_prefix.length());
     base::FilePath path = StringToFilePath(iter->value().ToString());
     origins->push_back(OriginRecord(origin, path));
     iter->Next();
diff --git a/storage/browser/fileapi/sandbox_origin_database.h b/storage/browser/file_system/sandbox_origin_database.h
similarity index 88%
rename from storage/browser/fileapi/sandbox_origin_database.h
rename to storage/browser/file_system/sandbox_origin_database.h
index ff9767f..fa3bd8a 100644
--- a/storage/browser/fileapi/sandbox_origin_database.h
+++ b/storage/browser/file_system/sandbox_origin_database.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ORIGIN_DATABASE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ORIGIN_DATABASE_H_
 
 #include <memory>
 #include <string>
@@ -12,13 +12,13 @@
 #include "base/component_export.h"
 #include "base/macros.h"
 #include "base/time/time.h"
-#include "storage/browser/fileapi/sandbox_origin_database_interface.h"
+#include "storage/browser/file_system/sandbox_origin_database_interface.h"
 
 namespace leveldb {
 class DB;
 class Env;
 class Status;
-}
+}  // namespace leveldb
 
 namespace base {
 class Location;
@@ -79,4 +79,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ORIGIN_DATABASE_H_
diff --git a/storage/browser/fileapi/sandbox_origin_database_interface.cc b/storage/browser/file_system/sandbox_origin_database_interface.cc
similarity index 69%
rename from storage/browser/fileapi/sandbox_origin_database_interface.cc
rename to storage/browser/file_system/sandbox_origin_database_interface.cc
index b276451..6d756bc 100644
--- a/storage/browser/fileapi/sandbox_origin_database_interface.cc
+++ b/storage/browser/file_system/sandbox_origin_database_interface.cc
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_origin_database_interface.h"
+#include "storage/browser/file_system/sandbox_origin_database_interface.h"
 
 namespace storage {
 
 SandboxOriginDatabaseInterface::OriginRecord::OriginRecord() = default;
 
 SandboxOriginDatabaseInterface::OriginRecord::OriginRecord(
-    const std::string& origin_in, const base::FilePath& path_in)
-    : origin(origin_in), path(path_in) {
-}
+    const std::string& origin_in,
+    const base::FilePath& path_in)
+    : origin(origin_in), path(path_in) {}
 
 SandboxOriginDatabaseInterface::OriginRecord::~OriginRecord() = default;
 
diff --git a/storage/browser/fileapi/sandbox_origin_database_interface.h b/storage/browser/file_system/sandbox_origin_database_interface.h
similarity index 88%
rename from storage/browser/fileapi/sandbox_origin_database_interface.h
rename to storage/browser/file_system/sandbox_origin_database_interface.h
index 4d4611a..478cfdac 100644
--- a/storage/browser/fileapi/sandbox_origin_database_interface.h
+++ b/storage/browser/file_system/sandbox_origin_database_interface.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
 
 #include <string>
 #include <vector>
@@ -55,4 +55,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
diff --git a/storage/browser/fileapi/sandbox_origin_database_unittest.cc b/storage/browser/file_system/sandbox_origin_database_unittest.cc
similarity index 95%
rename from storage/browser/fileapi/sandbox_origin_database_unittest.cc
rename to storage/browser/file_system/sandbox_origin_database_unittest.cc
index 50aa92c9..b34c01a5 100644
--- a/storage/browser/fileapi/sandbox_origin_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_origin_database_unittest.cc
@@ -17,7 +17,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/macros.h"
 #include "base/stl_util.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 #include "storage/browser/test/sandbox_database_test_helper.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -206,11 +206,8 @@
   EXPECT_TRUE(base::CreateDirectory(kFSDir));
 
   const std::string kOrigins[] = {
-    "foo.example.com",
-    "bar.example.com",
-    "baz.example.com",
-    "hoge.example.com",
-    "fuga.example.com",
+      "foo.example.com",  "bar.example.com",  "baz.example.com",
+      "hoge.example.com", "fuga.example.com",
   };
 
   std::unique_ptr<SandboxOriginDatabase> database(
@@ -238,8 +235,8 @@
   // Corrupt database itself and last log entry to drop last 1 database
   // operation.  The database should detect the corruption and should recover
   // its consistency after recovery.
-  CorruptDatabase(kDBDir, leveldb::kDescriptorFile,
-                  0, std::numeric_limits<size_t>::max());
+  CorruptDatabase(kDBDir, leveldb::kDescriptorFile, 0,
+                  std::numeric_limits<size_t>::max());
   CorruptDatabase(kDBDir, leveldb::kLogFile, -1, 1);
 
   base::FilePath path;
@@ -263,13 +260,9 @@
 
 TEST(SandboxOriginDatabaseTest, DatabaseRecoveryForMissingDBFileTest) {
   const leveldb::FileType kLevelDBFileTypes[] = {
-    leveldb::kLogFile,
-    leveldb::kDBLockFile,
-    leveldb::kTableFile,
-    leveldb::kDescriptorFile,
-    leveldb::kCurrentFile,
-    leveldb::kTempFile,
-    leveldb::kInfoLogFile,
+      leveldb::kLogFile,        leveldb::kDBLockFile,  leveldb::kTableFile,
+      leveldb::kDescriptorFile, leveldb::kCurrentFile, leveldb::kTempFile,
+      leveldb::kInfoLogFile,
   };
 
   for (const auto& file_type : kLevelDBFileTypes) {
diff --git a/storage/browser/fileapi/sandbox_prioritized_origin_database.cc b/storage/browser/file_system/sandbox_prioritized_origin_database.cc
similarity index 86%
rename from storage/browser/fileapi/sandbox_prioritized_origin_database.cc
rename to storage/browser/file_system/sandbox_prioritized_origin_database.cc
index dc1eba1..b98f940 100644
--- a/storage/browser/fileapi/sandbox_prioritized_origin_database.cc
+++ b/storage/browser/file_system/sandbox_prioritized_origin_database.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_prioritized_origin_database.h"
+#include "storage/browser/file_system/sandbox_prioritized_origin_database.h"
 
 #include "base/files/file.h"
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/pickle.h"
-#include "storage/browser/fileapi/sandbox_isolated_origin_database.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
+#include "storage/browser/file_system/sandbox_isolated_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 #include "third_party/leveldatabase/leveldb_chrome.h"
 
 namespace storage {
@@ -38,8 +38,7 @@
   return true;
 }
 
-bool ReadPrimaryOriginFile(const base::FilePath& path,
-                           std::string* origin) {
+bool ReadPrimaryOriginFile(const base::FilePath& path, std::string* origin) {
   std::string buffer;
   if (!base::ReadFileToString(path, &buffer))
     return false;
@@ -55,9 +54,7 @@
     leveldb::Env* env_override)
     : file_system_directory_(file_system_directory),
       env_override_(env_override),
-      primary_origin_file_(
-          file_system_directory_.Append(kPrimaryOriginFile)) {
-}
+      primary_origin_file_(file_system_directory_.Append(kPrimaryOriginFile)) {}
 
 SandboxPrioritizedOriginDatabase::~SandboxPrioritizedOriginDatabase() = default;
 
@@ -68,11 +65,8 @@
   if (!primary_origin_database_ && !is_in_memory) {
     if (!MaybeLoadPrimaryOrigin() && ResetPrimaryOrigin(origin)) {
       MaybeMigrateDatabase(origin);
-      primary_origin_database_.reset(
-          new SandboxIsolatedOriginDatabase(
-              origin,
-              file_system_directory_,
-              base::FilePath(kPrimaryDirectory)));
+      primary_origin_database_.reset(new SandboxIsolatedOriginDatabase(
+          origin, file_system_directory_, base::FilePath(kPrimaryDirectory)));
       return true;
     }
   }
@@ -102,7 +96,8 @@
 }
 
 bool SandboxPrioritizedOriginDatabase::GetPathForOrigin(
-    const std::string& origin, base::FilePath* directory) {
+    const std::string& origin,
+    base::FilePath* directory) {
   MaybeInitializeDatabases(true);
   if (primary_origin_database_ &&
       primary_origin_database_->GetPathForOrigin(origin, directory))
@@ -156,11 +151,8 @@
   std::string saved_origin;
   if (!ReadPrimaryOriginFile(primary_origin_file_, &saved_origin))
     return false;
-  primary_origin_database_.reset(
-      new SandboxIsolatedOriginDatabase(
-          saved_origin,
-          file_system_directory_,
-          base::FilePath(kPrimaryDirectory)));
+  primary_origin_database_.reset(new SandboxIsolatedOriginDatabase(
+      saved_origin, file_system_directory_, base::FilePath(kPrimaryDirectory)));
   return true;
 }
 
@@ -206,8 +198,7 @@
   }
 }
 
-void SandboxPrioritizedOriginDatabase::MaybeInitializeDatabases(
-    bool create) {
+void SandboxPrioritizedOriginDatabase::MaybeInitializeDatabases(bool create) {
   MaybeLoadPrimaryOrigin();
   MaybeInitializeNonPrimaryDatabase(create);
 }
@@ -217,8 +208,8 @@
   if (origin_database_)
     return;
 
-  origin_database_.reset(new SandboxOriginDatabase(file_system_directory_,
-                                                   env_override_));
+  origin_database_.reset(
+      new SandboxOriginDatabase(file_system_directory_, env_override_));
   if (!create && !base::DirectoryExists(origin_database_->GetDatabasePath())) {
     origin_database_.reset();
     return;
diff --git a/storage/browser/fileapi/sandbox_prioritized_origin_database.h b/storage/browser/file_system/sandbox_prioritized_origin_database.h
similarity index 88%
rename from storage/browser/fileapi/sandbox_prioritized_origin_database.h
rename to storage/browser/file_system/sandbox_prioritized_origin_database.h
index 55ed294..d848ea7 100644
--- a/storage/browser/fileapi/sandbox_prioritized_origin_database.h
+++ b/storage/browser/file_system/sandbox_prioritized_origin_database.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
 
 #include <memory>
 #include <string>
@@ -12,7 +12,7 @@
 #include "base/component_export.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/sandbox_origin_database_interface.h"
+#include "storage/browser/file_system/sandbox_origin_database_interface.h"
 
 namespace leveldb {
 class Env;
@@ -76,4 +76,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
diff --git a/storage/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc b/storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc
similarity index 92%
rename from storage/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc
rename to storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc
index 5e1a106e..da1bf9ab 100644
--- a/storage/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "storage/browser/file_system/sandbox_prioritized_origin_database.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
-#include "storage/browser/fileapi/sandbox_origin_database.h"
-#include "storage/browser/fileapi/sandbox_prioritized_origin_database.h"
+#include "storage/browser/file_system/sandbox_origin_database.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using storage::SandboxOriginDatabase;
@@ -42,10 +42,8 @@
   std::vector<SandboxOriginDatabaseInterface::OriginRecord> origins;
   database.ListAllOrigins(&origins);
   ASSERT_EQ(2U, origins.size());
-  EXPECT_TRUE(origins[0].origin == kOrigin1 ||
-              origins[1].origin == kOrigin1);
-  EXPECT_TRUE(origins[0].origin == kOrigin2 ||
-              origins[1].origin == kOrigin2);
+  EXPECT_TRUE(origins[0].origin == kOrigin1 || origins[1].origin == kOrigin1);
+  EXPECT_TRUE(origins[0].origin == kOrigin2 || origins[1].origin == kOrigin2);
   EXPECT_NE(origins[0].path, origins[1].path);
 
   // Try remove path for kOrigin1.
@@ -197,15 +195,15 @@
   std::string origin_db_data;
   base::FilePath dir_db_path = dir.GetPath().Append(path1);
   EXPECT_TRUE(base::PathExists(dir_db_path.AppendASCII("dummy")));
-  EXPECT_TRUE(base::ReadFileToString(
-      dir_db_path.AppendASCII("dummy"), &origin_db_data));
+  EXPECT_TRUE(base::ReadFileToString(dir_db_path.AppendASCII("dummy"),
+                                     &origin_db_data));
   EXPECT_EQ(kFakeDirectoryData1, origin_db_data);
 
   origin_db_data.clear();
   dir_db_path = dir.GetPath().Append(path2);
   EXPECT_TRUE(base::PathExists(dir_db_path.AppendASCII("dummy")));
-  EXPECT_TRUE(base::ReadFileToString(
-      dir_db_path.AppendASCII("dummy"), &origin_db_data));
+  EXPECT_TRUE(base::ReadFileToString(dir_db_path.AppendASCII("dummy"),
+                                     &origin_db_data));
   EXPECT_EQ(kFakeDirectoryData2, origin_db_data);
 
   // After the migration the kOrigin1 directory database path must be gone.
diff --git a/storage/browser/fileapi/sandbox_quota_observer.cc b/storage/browser/file_system/sandbox_quota_observer.cc
similarity index 87%
rename from storage/browser/fileapi/sandbox_quota_observer.cc
rename to storage/browser/file_system/sandbox_quota_observer.cc
index 9347190..6623ea9 100644
--- a/storage/browser/fileapi/sandbox_quota_observer.cc
+++ b/storage/browser/file_system/sandbox_quota_observer.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/sandbox_quota_observer.h"
+#include "storage/browser/file_system/sandbox_quota_observer.h"
 
 #include <stdint.h>
 
 #include "base/bind.h"
 #include "base/sequenced_task_runner.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
 #include "storage/browser/quota/quota_client.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/common/fileapi/file_system_util.h"
@@ -24,8 +24,7 @@
     : quota_manager_proxy_(quota_manager_proxy),
       update_notify_runner_(update_notify_runner),
       sandbox_file_util_(sandbox_file_util),
-      file_system_usage_cache_(file_system_usage_cache) {
-}
+      file_system_usage_cache_(file_system_usage_cache) {}
 
 SandboxQuotaObserver::~SandboxQuotaObserver() = default;
 
@@ -84,10 +83,9 @@
   }
 }
 
-void SandboxQuotaObserver::SetUsageCacheEnabled(
-    const GURL& origin,
-    FileSystemType type,
-    bool enabled) {
+void SandboxQuotaObserver::SetUsageCacheEnabled(const GURL& origin,
+                                                FileSystemType type,
+                                                bool enabled) {
   if (quota_manager_proxy_.get()) {
     quota_manager_proxy_->SetUsageCacheEnabled(
         storage::QuotaClient::kFileSystem, url::Origin::Create(origin),
@@ -103,8 +101,7 @@
       SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
           sandbox_file_util_, url.origin().GetURL(), url.type(), &error);
   if (error != base::File::FILE_OK) {
-    LOG(WARNING) << "Could not get usage cache path for: "
-                 << url.DebugString();
+    LOG(WARNING) << "Could not get usage cache path for: " << url.DebugString();
     return base::FilePath();
   }
   return path;
diff --git a/storage/browser/fileapi/sandbox_quota_observer.h b/storage/browser/file_system/sandbox_quota_observer.h
similarity index 83%
rename from storage/browser/fileapi/sandbox_quota_observer.h
rename to storage/browser/file_system/sandbox_quota_observer.h
index a5b63c2..ed78a53 100644
--- a/storage/browser/fileapi/sandbox_quota_observer.h
+++ b/storage/browser/file_system/sandbox_quota_observer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_
-#define STORAGE_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_QUOTA_OBSERVER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_QUOTA_OBSERVER_H_
 
 #include <stdint.h>
 
@@ -15,8 +15,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/timer/timer.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_url.h"
 
 namespace base {
 class SequencedTaskRunner;
@@ -32,9 +32,8 @@
 class FileSystemURL;
 class ObfuscatedFileUtil;
 
-class SandboxQuotaObserver
-    : public FileUpdateObserver,
-      public FileAccessObserver {
+class SandboxQuotaObserver : public FileUpdateObserver,
+                             public FileAccessObserver {
  public:
   SandboxQuotaObserver(storage::QuotaManagerProxy* quota_manager_proxy,
                        base::SequencedTaskRunner* update_notify_runner,
@@ -78,4 +77,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_SANDBOX_QUOTA_OBSERVER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_SANDBOX_QUOTA_OBSERVER_H_
diff --git a/storage/browser/fileapi/task_runner_bound_observer_list.h b/storage/browser/file_system/task_runner_bound_observer_list.h
similarity index 92%
rename from storage/browser/fileapi/task_runner_bound_observer_list.h
rename to storage/browser/file_system/task_runner_bound_observer_list.h
index 4dad36c4..d5cd1d7f 100644
--- a/storage/browser/fileapi/task_runner_bound_observer_list.h
+++ b/storage/browser/file_system/task_runner_bound_observer_list.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
-#define STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
 
 #include <map>
 #include <utility>
@@ -80,4 +80,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
diff --git a/storage/browser/fileapi/transient_file_util.cc b/storage/browser/file_system/transient_file_util.cc
similarity index 77%
rename from storage/browser/fileapi/transient_file_util.cc
rename to storage/browser/file_system/transient_file_util.cc
index fd0a24f..d67ee1c 100644
--- a/storage/browser/fileapi/transient_file_util.cc
+++ b/storage/browser/file_system/transient_file_util.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/fileapi/transient_file_util.h"
+#include "storage/browser/file_system/transient_file_util.h"
 
 #include <string>
 
 #include "base/bind.h"
 #include "base/files/file_path.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/isolated_context.h"
 
 using storage::ScopedFile;
 
@@ -42,10 +42,8 @@
   DCHECK(!platform_path->empty());
   DCHECK(!url.filesystem_id().empty());
 
-  ScopedFile scoped_file(
-      *platform_path,
-      ScopedFile::DELETE_ON_SCOPE_OUT,
-      context->task_runner());
+  ScopedFile scoped_file(*platform_path, ScopedFile::DELETE_ON_SCOPE_OUT,
+                         context->task_runner());
   scoped_file.AddScopeOutCallback(
       base::BindOnce(&RevokeFileSystem, url.filesystem_id()), nullptr);
 
diff --git a/storage/browser/fileapi/transient_file_util.h b/storage/browser/file_system/transient_file_util.h
similarity index 77%
rename from storage/browser/fileapi/transient_file_util.h
rename to storage/browser/file_system/transient_file_util.h
index a24b8d70..836e73c 100644
--- a/storage/browser/fileapi/transient_file_util.h
+++ b/storage/browser/file_system/transient_file_util.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_TRANSIENT_FILE_UTIL_H_
-#define STORAGE_BROWSER_FILEAPI_TRANSIENT_FILE_UTIL_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_TRANSIENT_FILE_UTIL_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_TRANSIENT_FILE_UTIL_H_
 
 #include <memory>
 
 #include "base/component_export.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/local_file_util.h"
+#include "storage/browser/file_system/local_file_util.h"
 
 namespace storage {
 
@@ -35,4 +35,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_TRANSIENT_FILE_UTIL_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_TRANSIENT_FILE_UTIL_H_
diff --git a/storage/browser/fileapi/transient_file_util_unittest.cc b/storage/browser/file_system/transient_file_util_unittest.cc
similarity index 93%
rename from storage/browser/fileapi/transient_file_util_unittest.cc
rename to storage/browser/file_system/transient_file_util_unittest.cc
index b44e731..cadd03b 100644
--- a/storage/browser/fileapi/transient_file_util_unittest.cc
+++ b/storage/browser/file_system/transient_file_util_unittest.cc
@@ -11,10 +11,10 @@
 #include "base/run_loop.h"
 #include "base/test/task_environment.h"
 #include "storage/browser/blob/scoped_file.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/isolated_context.h"
-#include "storage/browser/fileapi/transient_file_util.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/isolated_context.h"
+#include "storage/browser/file_system/transient_file_util.h"
 #include "storage/browser/test/test_file_system_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/storage/browser/fileapi/watcher_manager.h b/storage/browser/file_system/watcher_manager.h
similarity index 91%
rename from storage/browser/fileapi/watcher_manager.h
rename to storage/browser/file_system/watcher_manager.h
index 8f3b6bd4..ddbe255 100644
--- a/storage/browser/fileapi/watcher_manager.h
+++ b/storage/browser/file_system/watcher_manager.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef STORAGE_BROWSER_FILEAPI_WATCHER_MANAGER_H_
-#define STORAGE_BROWSER_FILEAPI_WATCHER_MANAGER_H_
+#ifndef STORAGE_BROWSER_FILE_SYSTEM_WATCHER_MANAGER_H_
+#define STORAGE_BROWSER_FILE_SYSTEM_WATCHER_MANAGER_H_
 
 #include <vector>
 
@@ -56,4 +56,4 @@
 
 }  // namespace storage
 
-#endif  // STORAGE_BROWSER_FILEAPI_WATCHER_MANAGER_H_
+#endif  // STORAGE_BROWSER_FILE_SYSTEM_WATCHER_MANAGER_H_
diff --git a/storage/browser/test/async_file_test_helper.cc b/storage/browser/test/async_file_test_helper.cc
index 1e31dad..30b0e1d 100644
--- a/storage/browser/test/async_file_test_helper.cc
+++ b/storage/browser/test/async_file_test_helper.cc
@@ -8,10 +8,10 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/run_loop.h"
 #include "storage/browser/blob/shareable_file_reference.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/storage/browser/test/async_file_test_helper.h b/storage/browser/test/async_file_test_helper.h
index 8f3fa7e..bd6cae5 100644
--- a/storage/browser/test/async_file_test_helper.h
+++ b/storage/browser/test/async_file_test_helper.h
@@ -8,7 +8,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "storage/browser/fileapi/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
 
diff --git a/storage/browser/test/fileapi_test_file_set.cc b/storage/browser/test/file_system_test_file_set.cc
similarity index 62%
rename from storage/browser/test/fileapi_test_file_set.cc
rename to storage/browser/test/file_system_test_file_set.cc
index 37917384..8959580 100644
--- a/storage/browser/test/fileapi_test_file_set.cc
+++ b/storage/browser/test/file_system_test_file_set.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "storage/browser/test/fileapi_test_file_set.h"
+#include "storage/browser/test/file_system_test_file_set.h"
 
 #include <stdint.h>
 
@@ -20,24 +20,24 @@
 namespace content {
 
 const FileSystemTestCaseRecord kRegularFileSystemTestCases[] = {
-  {true, FILE_PATH_LITERAL("dir a"), 0},
-  {true, FILE_PATH_LITERAL("dir a/dir A"), 0},
-  {true, FILE_PATH_LITERAL("dir a/dir d"), 0},
-  {true, FILE_PATH_LITERAL("dir a/dir d/dir e"), 0},
-  {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir f"), 0},
-  {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g"), 0},
-  {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir h"), 0},
-  {true, FILE_PATH_LITERAL("dir b"), 0},
-  {true, FILE_PATH_LITERAL("dir b/dir a"), 0},
-  {true, FILE_PATH_LITERAL("dir c"), 0},
-  {false, FILE_PATH_LITERAL("file 0"), 38},
-  {false, FILE_PATH_LITERAL("file 2"), 60},
-  {false, FILE_PATH_LITERAL("file 3"), 0},
-  {false, FILE_PATH_LITERAL("dir a/file 0"), 39},
-  {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 0"), 40},
-  {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 1"), 41},
-  {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 2"), 42},
-  {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 3"), 50},
+    {true, FILE_PATH_LITERAL("dir a"), 0},
+    {true, FILE_PATH_LITERAL("dir a/dir A"), 0},
+    {true, FILE_PATH_LITERAL("dir a/dir d"), 0},
+    {true, FILE_PATH_LITERAL("dir a/dir d/dir e"), 0},
+    {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir f"), 0},
+    {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g"), 0},
+    {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir h"), 0},
+    {true, FILE_PATH_LITERAL("dir b"), 0},
+    {true, FILE_PATH_LITERAL("dir b/dir a"), 0},
+    {true, FILE_PATH_LITERAL("dir c"), 0},
+    {false, FILE_PATH_LITERAL("file 0"), 38},
+    {false, FILE_PATH_LITERAL("file 2"), 60},
+    {false, FILE_PATH_LITERAL("file 3"), 0},
+    {false, FILE_PATH_LITERAL("dir a/file 0"), 39},
+    {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 0"), 40},
+    {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 1"), 41},
+    {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 2"), 42},
+    {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 3"), 50},
 };
 
 const size_t kRegularFileSystemTestCaseSize =
@@ -61,7 +61,6 @@
   }
 }
 
-
 void SetUpRegularFileSystemTestCases(const base::FilePath& root_path) {
   for (size_t i = 0; i < base::size(kRegularFileSystemTestCases); ++i) {
     SCOPED_TRACE(testing::Message() << "Creating kRegularTestCases " << i);
diff --git a/storage/browser/test/fileapi_test_file_set.h b/storage/browser/test/file_system_test_file_set.h
similarity index 84%
rename from storage/browser/test/fileapi_test_file_set.h
rename to storage/browser/test/file_system_test_file_set.h
index 80be674..f98e0d73 100644
--- a/storage/browser/test/fileapi_test_file_set.h
+++ b/storage/browser/test/file_system_test_file_set.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CONTENT_TEST_FILEAPI_TEST_FILE_SET_H_
-#define CONTENT_TEST_FILEAPI_TEST_FILE_SET_H_
+#ifndef STORAGE_BROWSER_TEST_FILE_SYSTEM_TEST_FILE_SET_H_
+#define STORAGE_BROWSER_TEST_FILE_SYSTEM_TEST_FILE_SET_H_
 
 #include <stddef.h>
 #include <stdint.h>
@@ -36,4 +36,4 @@
 
 }  // namespace content
 
-#endif  // CONTENT_TEST_FILEAPI_TEST_FILE_SET_H_
+#endif  // STORAGE_BROWSER_TEST_FILE_SYSTEM_TEST_FILE_SET_H_
diff --git a/storage/browser/test/mock_file_change_observer.h b/storage/browser/test/mock_file_change_observer.h
index cd39b24f..1b95cfd 100644
--- a/storage/browser/test/mock_file_change_observer.h
+++ b/storage/browser/test/mock_file_change_observer.h
@@ -7,9 +7,9 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace storage {
 
diff --git a/storage/browser/test/mock_file_update_observer.h b/storage/browser/test/mock_file_update_observer.h
index fb8e70581..eb9c624 100644
--- a/storage/browser/test/mock_file_update_observer.h
+++ b/storage/browser/test/mock_file_update_observer.h
@@ -11,9 +11,9 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace storage {
 
diff --git a/storage/browser/test/sandbox_file_system_test_helper.cc b/storage/browser/test/sandbox_file_system_test_helper.cc
index 0646423..77a880c 100644
--- a/storage/browser/test/sandbox_file_system_test_helper.cc
+++ b/storage/browser/test/sandbox_file_system_test_helper.cc
@@ -8,14 +8,14 @@
 
 #include "base/files/file_util.h"
 #include "base/run_loop.h"
-#include "storage/browser/fileapi/file_system_context.h"
-#include "storage/browser/fileapi/file_system_file_util.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_operation_runner.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/obfuscated_file_util.h"
-#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
+#include "storage/browser/file_system/file_system_file_util.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_operation_runner.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/obfuscated_file_util.h"
+#include "storage/browser/file_system/sandbox_file_system_backend.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_context.h"
diff --git a/storage/browser/test/sandbox_file_system_test_helper.h b/storage/browser/test/sandbox_file_system_test_helper.h
index cf1712e..d7c5409 100644
--- a/storage/browser/test/sandbox_file_system_test_helper.h
+++ b/storage/browser/test/sandbox_file_system_test_helper.h
@@ -11,9 +11,9 @@
 
 #include "base/files/file_path.h"
 #include "base/memory/ref_counted.h"
-#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/browser/fileapi/file_system_usage_cache.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/file_system_url.h"
+#include "storage/browser/file_system/file_system_usage_cache.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 #include "storage/common/fileapi/file_system_types.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
diff --git a/storage/browser/test/test_file_system_backend.cc b/storage/browser/test/test_file_system_backend.cc
index 9b461607..6d409f8 100644
--- a/storage/browser/test/test_file_system_backend.cc
+++ b/storage/browser/test/test_file_system_backend.cc
@@ -16,16 +16,16 @@
 #include "base/observer_list.h"
 #include "base/sequenced_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/copy_or_move_file_validator.h"
-#include "storage/browser/fileapi/file_observers.h"
-#include "storage/browser/fileapi/file_stream_reader.h"
-#include "storage/browser/fileapi/file_system_operation.h"
-#include "storage/browser/fileapi/file_system_operation_context.h"
-#include "storage/browser/fileapi/file_system_quota_util.h"
-#include "storage/browser/fileapi/local_file_util.h"
-#include "storage/browser/fileapi/native_file_util.h"
-#include "storage/browser/fileapi/quota/quota_reservation.h"
-#include "storage/browser/fileapi/sandbox_file_stream_writer.h"
+#include "storage/browser/file_system/copy_or_move_file_validator.h"
+#include "storage/browser/file_system/file_observers.h"
+#include "storage/browser/file_system/file_stream_reader.h"
+#include "storage/browser/file_system/file_system_operation.h"
+#include "storage/browser/file_system/file_system_operation_context.h"
+#include "storage/browser/file_system/file_system_quota_util.h"
+#include "storage/browser/file_system/local_file_util.h"
+#include "storage/browser/file_system/native_file_util.h"
+#include "storage/browser/file_system/quota/quota_reservation.h"
+#include "storage/browser/file_system/sandbox_file_stream_writer.h"
 #include "storage/browser/quota/quota_manager.h"
 #include "storage/common/fileapi/file_system_util.h"
 
diff --git a/storage/browser/test/test_file_system_backend.h b/storage/browser/test/test_file_system_backend.h
index 197dd0b..e370218a 100644
--- a/storage/browser/test/test_file_system_backend.h
+++ b/storage/browser/test/test_file_system_backend.h
@@ -12,9 +12,9 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "storage/browser/fileapi/async_file_util_adapter.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
+#include "storage/browser/file_system/async_file_util_adapter.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/task_runner_bound_observer_list.h"
 
 namespace base {
 class SequencedTaskRunner;
diff --git a/storage/browser/test/test_file_system_context.cc b/storage/browser/test/test_file_system_context.cc
index 62768a0f..796b2fe 100644
--- a/storage/browser/test/test_file_system_context.cc
+++ b/storage/browser/test/test_file_system_context.cc
@@ -8,9 +8,9 @@
 #include <utility>
 
 #include "base/threading/thread_task_runner_handle.h"
-#include "storage/browser/fileapi/external_mount_points.h"
-#include "storage/browser/fileapi/file_system_backend.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/external_mount_points.h"
+#include "storage/browser/file_system/file_system_backend.h"
+#include "storage/browser/file_system/file_system_context.h"
 #include "storage/browser/test/mock_special_storage_policy.h"
 #include "storage/browser/test/test_file_system_backend.h"
 #include "storage/browser/test/test_file_system_options.h"
diff --git a/storage/browser/test/test_file_system_context.h b/storage/browser/test/test_file_system_context.h
index 00e2bbfc..0d9b58c 100644
--- a/storage/browser/test/test_file_system_context.h
+++ b/storage/browser/test/test_file_system_context.h
@@ -7,7 +7,7 @@
 
 #include "base/files/file_path.h"
 #include "base/single_thread_task_runner.h"
-#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/file_system/file_system_context.h"
 
 namespace storage {
 class QuotaManagerProxy;
diff --git a/storage/browser/test/test_file_system_options.h b/storage/browser/test/test_file_system_options.h
index aa44df5..b33b5c95 100644
--- a/storage/browser/test/test_file_system_options.h
+++ b/storage/browser/test/test_file_system_options.h
@@ -5,7 +5,7 @@
 #ifndef STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_OPTIONS_H_
 #define STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_OPTIONS_H_
 
-#include "storage/browser/fileapi/file_system_options.h"
+#include "storage/browser/file_system/file_system_options.h"
 
 namespace content {
 
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index 1682304..70b77cf8 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1020,17 +1020,17 @@
   },
   "devtools_closure_compile": {
     "args": [
-      "../../third_party/blink/renderer/devtools/scripts/compile_frontend.py",
+      "../../third_party/devtools-frontend/src/scripts/compile_frontend.py",
     ],
-    "label": "//third_party/blink/renderer/devtools:devtools_closure_compile",
+    "label": "//third_party/devtools-frontend/src:devtools_closure_compile",
     "script": "//testing/scripts/run_devtools_check.py",
     "type": "script",
   },
   "devtools_eslint": {
     "args": [
-      "../../third_party/blink/renderer/devtools/scripts/lint_javascript.py",
+      "../../third_party/devtools-frontend/src/scripts/lint_javascript.py",
     ],
-    "label": "//third_party/blink/renderer/devtools:devtools_eslint",
+    "label": "//third_party/devtools-frontend/src:devtools_eslint",
     "script": "//testing/scripts/run_devtools_check.py",
     "type": "script",
   },
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index d384517e..0e0f2cb 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -1419,6 +1419,22 @@
             ]
         }
     ],
+    "BoostThreadPriorityOnLibraryLoadingAndBackgroundMode": [
+        {
+            "platforms": [
+                "windows"
+            ],
+            "experiments": [
+                {
+                    "name": "BoostPriorityAndBackgroundThreadMode",
+                    "enable_features": [
+                        "BoostThreadPriorityOnLibraryLoading",
+                        "WindowsThreadModeBackground"
+                    ]
+                }
+            ]
+        }
+    ],
     "BrowserBlacklist": [
         {
             "platforms": [
diff --git a/third_party/.gitignore b/third_party/.gitignore
index e68cb6d..ef8f7bd 100644
--- a/third_party/.gitignore
+++ b/third_party/.gitignore
@@ -66,6 +66,7 @@
 /dav1d/libdav1d
 /dawn
 /depot_tools
+/devtools-frontend/src
 /devtools-node-modules
 /directxsdk
 /dom_distiller_js/dist
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn
index e00ffea..4d72a2f5 100644
--- a/third_party/blink/public/BUILD.gn
+++ b/third_party/blink/public/BUILD.gn
@@ -577,7 +577,7 @@
 }
 
 if (external_devtools_frontend) {
-  devtools_frontend_path = "//third_party/devtools-frontend"
+  devtools_frontend_path = "//third_party/devtools-frontend/src"
 } else {
   devtools_frontend_path = "//third_party/blink/renderer/devtools"
 }
diff --git a/third_party/blink/public/public_features.gni b/third_party/blink/public/public_features.gni
index c4834ef..f596ba7 100644
--- a/third_party/blink/public/public_features.gni
+++ b/third_party/blink/public/public_features.gni
@@ -13,7 +13,7 @@
 
   # If external_devtools_frontend is set to true, use DevTools frontend that is
   # pulled as external dependency.
-  external_devtools_frontend = false
+  external_devtools_frontend = true
 }
 
 # Unhandled Tap enable means Contextual Search aka Tap to Search.
diff --git a/third_party/blink/renderer/bindings/modules/BUILD.gn b/third_party/blink/renderer/bindings/modules/BUILD.gn
index 0f17d1f..b4a1566 100644
--- a/third_party/blink/renderer/bindings/modules/BUILD.gn
+++ b/third_party/blink/renderer/bindings/modules/BUILD.gn
@@ -39,8 +39,8 @@
     "//third_party/blink/renderer/modules/mediarecorder/blob_event.idl",
     "//third_party/blink/renderer/modules/mediastream/media_stream_event.idl",
     "//third_party/blink/renderer/modules/mediastream/media_stream_track_event.idl",
-    "//third_party/blink/renderer/modules/nfc/nfc_error_event.idl",
-    "//third_party/blink/renderer/modules/nfc/nfc_reading_event.idl",
+    "//third_party/blink/renderer/modules/nfc/ndef_error_event.idl",
+    "//third_party/blink/renderer/modules/nfc/ndef_reading_event.idl",
     "//third_party/blink/renderer/modules/notifications/notification_event.idl",
     "//third_party/blink/renderer/modules/payments/abort_payment_event.idl",
     "//third_party/blink/renderer/modules/payments/can_make_payment_event.idl",
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py b/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
index 68bacee..0d4c79a 100644
--- a/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
+++ b/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py
@@ -14,6 +14,26 @@
 from .mako_renderer import MakoRenderer
 
 
+class Likeliness(object):
+    """
+    Represents how much likely a code node will be executed.
+
+    Used in SymbolScopeNode in order to determine where SymbolDefinitionNodes
+    should be inserted.  Likeliness level can change only at SymbolScopeNode.
+
+    Relational operators are supported, and it's guaranteed to be:
+      NEVER < UNLIKELY < LIKELY < ALWAYS
+    """
+
+    class Level(int):
+        pass
+
+    NEVER = Level(0)
+    UNLIKELY = Level(1)
+    LIKELY = Level(2)
+    ALWAYS = Level(3)
+
+
 class CodeNode(object):
     """
     This is the base class of all code fragment nodes.
@@ -39,7 +59,7 @@
         def __init__(self):
             # Symbols used in generated code, but not yet defined.  See also
             # SymbolNode.
-            self.code_symbols_used = {}
+            self.undefined_code_symbols = set()
 
     class _LooseFormatter(string.Formatter):
         def get_value(self, key, args, kwargs):
@@ -198,7 +218,13 @@
         2. the outer CodeNode, or
         3. None (as this is a top-level node)
         """
-        return self.prev or self.outer
+        if self.prev is not None:
+            prev = self.prev
+            while isinstance(prev, SymbolScopeNode) and prev:
+                prev = prev[-1]
+            return prev
+        else:
+            return self.outer
 
     @property
     def template_vars(self):
@@ -255,11 +281,24 @@
             return self.upstream.is_code_symbol_defined(symbol_node)
         return False
 
-    def on_code_symbol_used(self, symbol_node):
+    def on_undefined_code_symbol_found(self, symbol_node):
         """Receives a report of use of an undefined symbol node."""
         assert isinstance(symbol_node, SymbolNode)
         state = self.current_render_state
-        state.code_symbols_used[symbol_node.name] = symbol_node
+        state.undefined_code_symbols.add(symbol_node)
+
+    def likeliness_of_undefined_code_symbol_usage(self, symbol_node):
+        """
+        Returns how much likely the given |symbol_node| will be used inside this
+        code node.  The likeliness is relative to the closest outer
+        SymbolScopeNode.
+        """
+        assert isinstance(symbol_node, SymbolNode)
+        state = self.last_render_state
+        if symbol_node in state.undefined_code_symbols:
+            return Likeliness.ALWAYS
+        else:
+            return Likeliness.NEVER
 
 
 class LiteralNode(CodeNode):
@@ -301,22 +340,29 @@
     Represents a sequence of nodes.
     """
 
-    def __init__(self, code_nodes=None, separator="\n", renderer=None):
+    def __init__(self,
+                 code_nodes=None,
+                 separator=" ",
+                 separator_last="",
+                 renderer=None):
         assert isinstance(separator, str)
+        assert isinstance(separator_last, str)
 
         element_nodes_gensym = CodeNode.gensym()
         element_nodes = []
         template_text = CodeNode.format_template(
             """\
 % for node in {element_nodes}:
-${node}\\
+${node | trim}\\
 % if not loop.last:
 {separator}\\
 % endif
 % endfor
+{separator_last}\\
 """,
             element_nodes=element_nodes_gensym,
-            separator=separator)
+            separator=separator,
+            separator_last=separator_last)
         template_vars = {element_nodes_gensym: element_nodes}
 
         CodeNode.__init__(
@@ -414,7 +460,7 @@
 
             def constructor(symbol_node):
                 return SymbolDefinitionNode(
-                    symbol_node, template_text=template_text)
+                    symbol_node=symbol_node, template_text=template_text)
 
             self._definition_node_constructor = constructor
         else:
@@ -424,7 +470,7 @@
         if not renderer.last_caller.is_code_symbol_defined(self):
             for caller in renderer.callers:
                 assert isinstance(caller, CodeNode)
-                caller.on_code_symbol_used(self)
+                caller.on_undefined_code_symbol_found(self)
 
         return self.name
 
@@ -478,19 +524,86 @@
     insert corresponding SymbolDefinitionNodes appropriately.
     """
 
+    def __init__(self, code_nodes=None, renderer=None):
+        SequenceNode.__init__(
+            self,
+            code_nodes=code_nodes,
+            separator="\n",
+            separator_last="\n",
+            renderer=renderer)
+
     def _render(self, renderer, last_render_state):
         # Sort nodes in order to render reproducible results.
         symbol_nodes = sorted(
-            last_render_state.code_symbols_used.itervalues(),
+            last_render_state.undefined_code_symbols,
             key=lambda symbol_node: symbol_node.name)
         for symbol_node in symbol_nodes:
-            self._insert_symbol_definition(symbol_node)
+            if not self.is_code_symbol_defined(symbol_node):
+                self._insert_symbol_definition(symbol_node)
 
         return super(SymbolScopeNode, self)._render(
             renderer=renderer, last_render_state=last_render_state)
 
     def _insert_symbol_definition(self, symbol_node):
-        self.insert(0, symbol_node.create_definition_node())
+        def likeliness_at(code_node):
+            return code_node.likeliness_of_undefined_code_symbol_usage(
+                symbol_node)
+
+        def count_by_likeliness(symbol_scope_node, likeliness_cap, counts):
+            for node in symbol_scope_node:
+                if isinstance(node, SymbolScopeNode):
+                    likeliness_cap = count_by_likeliness(
+                        node, likeliness_cap, counts)
+                    continue
+
+                likeliness = min(likeliness_cap, likeliness_at(node))
+                counts.setdefault(likeliness, 0)
+                counts[likeliness] += 1
+
+                # Count conditional use in exit branches.  We'll delegate the
+                # symbol definition to the exit branches if appropriate.
+                if (isinstance(node, ConditionalExitNode)
+                        and Likeliness.NEVER < likeliness_at(node)
+                        and likeliness_at(node) < Likeliness.ALWAYS):
+                    counts.setdefault(EXIT_BRANCH_COUNT_KEY, 0)
+                    counts[EXIT_BRANCH_COUNT_KEY] += 1
+
+                if isinstance(node, LikelyExitNode):
+                    likeliness_cap = min(likeliness_cap, Likeliness.UNLIKELY)
+                if isinstance(node, UnlikelyExitNode):
+                    likeliness_cap = min(likeliness_cap, Likeliness.LIKELY)
+
+            return likeliness_cap
+
+        def insert_right_before_first_use(symbol_scope_node):
+            for index, node in enumerate(symbol_scope_node):
+                if isinstance(node, SymbolScopeNode):
+                    did_insert = insert_right_before_first_use(node)
+                    if did_insert:
+                        return True
+                elif Likeliness.NEVER < likeliness_at(node):
+                    symbol_scope_node.insert(
+                        index, symbol_node.create_definition_node())
+                    return True
+            return False
+
+        counts = {}
+        EXIT_BRANCH_COUNT_KEY = "exit_branch"
+        count_by_likeliness(self, Likeliness.ALWAYS, counts)
+        non_exit_uses = sum([
+            counts.get(Likeliness.UNLIKELY, 0),
+            counts.get(Likeliness.LIKELY, 0),
+            counts.get(Likeliness.ALWAYS, 0),
+            -counts.get(EXIT_BRANCH_COUNT_KEY, 0)
+        ])
+        assert non_exit_uses >= 0
+
+        if non_exit_uses == 0:
+            # Do nothing and let descendant SymbolScopeNodes do the work.
+            return
+
+        did_insert = insert_right_before_first_use(self)
+        assert did_insert
 
     def register_code_symbol(self, symbol_node):
         """Registers a SymbolNode and makes it available in this scope."""
@@ -500,3 +613,178 @@
     def register_code_symbols(self, symbol_nodes):
         for symbol_node in symbol_nodes:
             self.register_code_symbol(symbol_node)
+
+
+class ConditionalNode(CodeNode):
+    """
+    This is the base class of code nodes that directly contain conditional
+    execution.  Not all the code nodes inside this node will be executed.
+    """
+
+
+class CaseBranchNode(ConditionalNode):
+    """
+    Represents a set of nodes that will be conditionally executed.
+
+    This node mostly follows the concept of 'cond' in Lisp, which is a chain of
+    if - else if - else if - ... - else.
+    """
+
+    def __init__(self, clause_nodes):
+        # clause_nodes = [
+        #   (conditional_node1, body_node1, likeliness1),
+        #   (conditional_node2, body_node2, likeliness2),
+        #   ...,
+        #   (None, body_nodeN, likelinessN),  # Corresponds to 'else { ... }'
+        # ]
+        assert False
+
+
+class ConditionalExitNode(ConditionalNode):
+    """
+    Represents a conditional node that always exits whenever the condition
+    meets.  It's not supposed that the body node does not exit.  Equivalent to
+
+      if (CONDITIONAL) { BODY }
+
+    where BODY ends with a return statement.
+    """
+
+    def __init__(self, cond, body, body_likeliness, renderer=None):
+        assert isinstance(cond, CodeNode)
+        assert isinstance(body, SymbolScopeNode)
+        assert isinstance(body_likeliness, Likeliness.Level)
+
+        gensyms = {
+            "conditional": CodeNode.gensym(),
+            "body": CodeNode.gensym(),
+        }
+        template_text = CodeNode.format_template(
+            """\
+if (${{{conditional}}}) {{
+  ${{{body} | trim}}
+}}
+""", **gensyms)
+        template_vars = {
+            gensyms["conditional"]: cond,
+            gensyms["body"]: body,
+        }
+
+        ConditionalNode.__init__(
+            self,
+            template_text=template_text,
+            template_vars=template_vars,
+            renderer=renderer)
+
+        self._cond_node = cond
+        self._body_node = body
+        self._body_likeliness = body_likeliness
+
+    def likeliness_of_undefined_code_symbol_usage(self, symbol_node):
+        assert isinstance(symbol_node, SymbolNode)
+
+        def likeliness_at(code_node):
+            return code_node.likeliness_of_undefined_code_symbol_usage(
+                symbol_node)
+
+        return max(
+            likeliness_at(self._cond_node),
+            min(self._body_likeliness, likeliness_at(self._body_node)))
+
+
+class LikelyExitNode(ConditionalExitNode):
+    """
+    Represents a conditional exit node where it's likely that the condition
+    meets.
+    """
+
+    def __init__(self, cond, body):
+        ConditionalExitNode.__init__(
+            self, cond=cond, body=body, body_likeliness=Likeliness.LIKELY)
+
+
+class UnlikelyExitNode(ConditionalExitNode):
+    """
+    Represents a conditional exit node where it's unlikely that the condition
+    meets.
+    """
+
+    def __init__(self, cond, body):
+        ConditionalExitNode.__init__(
+            self, cond=cond, body=body, body_likeliness=Likeliness.UNLIKELY)
+
+
+class FunctionDefinitionNode(CodeNode):
+    """Represents a function definition."""
+
+    def __init__(self,
+                 name,
+                 arg_decls,
+                 return_type,
+                 local_vars=None,
+                 body=None,
+                 comment=None,
+                 renderer=None):
+        """
+        Args:
+            name: Function name node, which may include nested-name-specifier
+                (i.e. 'namespace_name::' and/or 'type_name::').
+            arg_decls: List of argument declaration nodes.
+            return_type: Return type node.
+            local_vars: List of SymbolNodes that can be used in the function
+                body.
+            body: Function body node (of type SymbolScopeNode).
+            comment: Function header comment node.
+        """
+        assert isinstance(name, CodeNode)
+        assert isinstance(arg_decls, (list, tuple))
+        assert all(isinstance(arg_decl, CodeNode) for arg_decl in arg_decls)
+        assert isinstance(return_type, CodeNode)
+        if local_vars is None:
+            local_vars = []
+        assert isinstance(local_vars, (list, tuple))
+        assert all(
+            isinstance(local_var, SymbolNode) for local_var in local_vars)
+        if body is None:
+            body = SymbolScopeNode()
+        assert isinstance(body, CodeNode)
+        if comment is None:
+            comment = LiteralNode("")
+        assert isinstance(comment, CodeNode)
+
+        gensyms = {
+            "name": CodeNode.gensym(),
+            "arg_decls": CodeNode.gensym(),
+            "return_type": CodeNode.gensym(),
+            "body": CodeNode.gensym(),
+            "comment": CodeNode.gensym(),
+        }
+
+        template_text = CodeNode.format_template(
+            """\
+${{{comment} | trim}}
+${{{return_type}}} ${{{name}}}(${{{arg_decls}}}) {{
+  ${{{body} | trim}}
+}}
+""", **gensyms)
+        template_vars = {
+            gensyms["name"]: name,
+            gensyms["arg_decls"]: SequenceNode(arg_decls, separator=", "),
+            gensyms["return_type"]: return_type,
+            gensyms["body"]: body,
+            gensyms["comment"]: comment,
+        }
+
+        CodeNode.__init__(
+            self,
+            template_text=template_text,
+            template_vars=template_vars,
+            renderer=renderer)
+
+        self._body_node = body
+
+        self._body_node.register_code_symbols(local_vars)
+
+    @property
+    def body(self):
+        return self._body_node
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/code_node_test.py b/third_party/blink/renderer/bindings/scripts/bind_gen/code_node_test.py
index 831213e..0b6340b9 100644
--- a/third_party/blink/renderer/bindings/scripts/bind_gen/code_node_test.py
+++ b/third_party/blink/renderer/bindings/scripts/bind_gen/code_node_test.py
@@ -4,11 +4,14 @@
 
 import unittest
 
+from .code_node import FunctionDefinitionNode
+from .code_node import LikelyExitNode
 from .code_node import LiteralNode
 from .code_node import SequenceNode
 from .code_node import SymbolNode
 from .code_node import SymbolScopeNode
 from .code_node import TextNode
+from .code_node import UnlikelyExitNode
 from .mako_renderer import MakoRenderer
 
 
@@ -22,8 +25,9 @@
         return current
 
     def assertRenderResult(self, node, expected):
-        def simplify(s):
-            return " ".join(s.split())
+        def simplify(text):
+            return "\n".join(
+                [" ".join(line.split()) for line in text.split("\n")])
 
         actual = simplify(self.render(node))
         expected = simplify(expected)
@@ -61,7 +65,7 @@
         work just same as Python built-in list.
         """
         renderer = MakoRenderer()
-        root = SequenceNode(renderer=renderer)
+        root = SequenceNode(separator=",", renderer=renderer)
         root.extend([
             LiteralNode("2"),
             LiteralNode("4"),
@@ -70,13 +74,13 @@
         root.insert(0, LiteralNode("1"))
         root.insert(100, LiteralNode("5"))
         root.append(LiteralNode("6"))
-        self.assertRenderResult(root, "1 2 3 4 5 6")
+        self.assertRenderResult(root, "1,2,3,4,5,6")
 
     def test_nested_sequence(self):
         """Tests nested SequenceNodes."""
         renderer = MakoRenderer()
-        root = SequenceNode(renderer=renderer)
-        nested = SequenceNode()
+        root = SequenceNode(separator=",", renderer=renderer)
+        nested = SequenceNode(separator=",")
         nested.extend([
             LiteralNode("2"),
             LiteralNode("3"),
@@ -87,7 +91,7 @@
             nested,
             LiteralNode("5"),
         ])
-        self.assertRenderResult(root, "1 2 3 4 5")
+        self.assertRenderResult(root, "1,2,3,4,5")
 
     def test_symbol_definition_chains(self):
         """
@@ -108,11 +112,170 @@
         root.append(TextNode("(void)${var1};"))
 
         self.assertRenderResult(
-            root, """
+            root, """\
 int var5 = 2;
+int var2 = var5;
 int var4 = 1;
 int var3 = var4;
-int var2 = var5;
 int var1 = var2 + var3;
 (void)var1;
-        """)
+""")
+
+    def test_symbol_definition_with_exit_branches(self):
+        renderer = MakoRenderer()
+        root = SymbolScopeNode(renderer=renderer)
+
+        root.register_code_symbols([
+            SymbolNode("var1", "int ${var1} = 1;"),
+            SymbolNode("var2", "int ${var2} = 2;"),
+            SymbolNode("var3", "int ${var3} = 3;"),
+            SymbolNode("var4", "int ${var4} = 4;"),
+            SymbolNode("var5", "int ${var5} = 5;"),
+            SymbolNode("var6", "int ${var6} = 6;"),
+        ])
+
+        root.extend([
+            TextNode("${var1};"),
+            UnlikelyExitNode(
+                cond=TextNode("${var2}"),
+                body=SymbolScopeNode([
+                    TextNode("${var3};"),
+                    TextNode("return ${var4};"),
+                ])),
+            LikelyExitNode(
+                cond=TextNode("${var5}"),
+                body=SymbolScopeNode([
+                    TextNode("return ${var6};"),
+                ])),
+            TextNode("${var3};"),
+        ])
+
+        self.assertRenderResult(
+            root, """\
+int var1 = 1;
+var1;
+int var2 = 2;
+int var3 = 3;
+if (var2) {
+  var3;
+  int var4 = 4;
+  return var4;
+}
+int var5 = 5;
+if (var5) {
+  int var6 = 6;
+  return var6;
+}
+var3;
+""")
+
+    def test_symbol_definition_with_nested_exit_branches(self):
+        renderer = MakoRenderer()
+        root = SymbolScopeNode(renderer=renderer)
+
+        root.register_code_symbols([
+            SymbolNode("var1", "int ${var1} = 1;"),
+            SymbolNode("var2", "int ${var2} = 2;"),
+            SymbolNode("var3", "int ${var3} = 3;"),
+            SymbolNode("var4", "int ${var4} = 4;"),
+            SymbolNode("var5", "int ${var5} = 5;"),
+            SymbolNode("var6", "int ${var6} = 6;"),
+        ])
+
+        root.extend([
+            UnlikelyExitNode(
+                cond=LiteralNode("false"),
+                body=SymbolScopeNode([
+                    UnlikelyExitNode(
+                        cond=LiteralNode("false"),
+                        body=SymbolScopeNode([
+                            TextNode("return ${var1};"),
+                        ])),
+                    LiteralNode("return;"),
+                ])),
+            LikelyExitNode(
+                cond=LiteralNode("true"),
+                body=SymbolScopeNode([
+                    LikelyExitNode(
+                        cond=LiteralNode("true"),
+                        body=SymbolScopeNode([
+                            TextNode("return ${var2};"),
+                        ])),
+                    LiteralNode("return;"),
+                ])),
+        ])
+
+        self.assertRenderResult(
+            root, """\
+if (false) {
+  if (false) {
+    int var1 = 1;
+    return var1;
+  }
+  return;
+}
+if (true) {
+  if (true) {
+    int var2 = 2;
+    return var2;
+  }
+  return;
+}
+""")
+
+    def test_function_definition_minimum(self):
+        renderer = MakoRenderer()
+        root = FunctionDefinitionNode(
+            name=LiteralNode("blink::bindings::func"),
+            arg_decls=[],
+            return_type=LiteralNode("void"),
+            renderer=renderer)
+
+        self.assertRenderResult(root, """\
+
+void blink::bindings::func() {
+
+}
+""")
+
+    def test_function_definition_full(self):
+        renderer = MakoRenderer()
+
+        local_vars = [
+            SymbolNode("var1", "int ${var1} = 1;"),
+            SymbolNode("var2", "int ${var2} = 2;"),
+        ]
+
+        func_body = SymbolScopeNode([
+            UnlikelyExitNode(
+                cond=TextNode("${var1}"),
+                body=SymbolScopeNode([TextNode("return ${var1};")])),
+            TextNode("return ${var2};"),
+        ])
+
+        root = FunctionDefinitionNode(
+            name=LiteralNode("blink::bindings::func"),
+            arg_decls=[LiteralNode("int arg1"),
+                       LiteralNode("int arg2")],
+            return_type=LiteralNode("void"),
+            local_vars=local_vars,
+            body=func_body,
+            comment=LiteralNode("""\
+// comment1
+// comment2
+"""),
+            renderer=renderer)
+
+        self.assertRenderResult(
+            root, """\
+// comment1
+// comment2
+void blink::bindings::func(int arg1, int arg2) {
+  int var1 = 1;
+  if (var1) {
+    return var1;
+  }
+  int var2 = 2;
+  return var2;
+}
+""")
diff --git a/third_party/blink/renderer/bindings/scripts/v8_attributes.py b/third_party/blink/renderer/bindings/scripts/v8_attributes.py
index 8a5c5dc4..8268d74 100644
--- a/third_party/blink/renderer/bindings/scripts/v8_attributes.py
+++ b/third_party/blink/renderer/bindings/scripts/v8_attributes.py
@@ -49,6 +49,7 @@
 from v8_utilities import (cpp_name_or_partial, capitalize, cpp_name, has_extended_attribute,
                           has_extended_attribute_value, scoped_name, strip_suffix,
                           uncapitalize, extended_attribute_value_as_list, is_unforgeable)
+from blinkbuild.name_style_converter import NameStyleConverter
 
 
 def attribute_context(interface, attribute, interfaces, component_info):
@@ -109,17 +110,50 @@
     is_save_same_object = (
         'SameObject' in attribute.extended_attributes and
         'SaveSameObject' in attribute.extended_attributes)
-    if is_save_same_object:
-        includes.add('platform/bindings/v8_private_property.h')
-
-    cached_attribute_validation_method = extended_attributes.get('CachedAttribute')
-    keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute)
-    if cached_attribute_validation_method or keep_alive_for_gc:
-        includes.add('platform/bindings/v8_private_property.h')
 
     # [CachedAccessor]
     is_cached_accessor = 'CachedAccessor' in extended_attributes
-    if is_cached_accessor:
+
+    # [LenientSetter]
+    is_lenient_setter = 'LenientSetter' in extended_attributes
+
+    # [CachedAttribute]
+    cached_attribute_validation_method = extended_attributes.get('CachedAttribute')
+
+    keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute)
+
+    does_generate_getter = (
+        not has_custom_getter(attribute) and
+        not constructor_type
+    )
+    does_generate_setter = (
+        has_setter(interface, attribute) and
+        not (has_custom_setter(attribute) or is_lenient_setter)
+    )
+
+    use_private_property_in_getter = (
+        does_generate_getter and (
+            cached_attribute_validation_method or
+            is_save_same_object or
+            keep_alive_for_gc
+        )
+    )
+    use_private_property_in_setter = (
+        does_generate_setter and
+        cached_attribute_validation_method
+    )
+    private_property_is_shared_between_getter_and_setter = (
+        use_private_property_in_getter and
+        use_private_property_in_setter
+    )
+    private_property_key_name = create_private_property_key_name(attribute)
+
+    does_use_private_property = (
+        use_private_property_in_getter or
+        use_private_property_in_setter or
+        is_cached_accessor
+    )
+    if does_use_private_property:
         includes.add('platform/bindings/v8_private_property.h')
 
     # [LogActivity]
@@ -143,6 +177,7 @@
         'activity_logging_world_list_for_getter': v8_utilities.activity_logging_world_list(attribute, 'Getter'),  # [ActivityLogging]
         'activity_logging_world_list_for_setter': v8_utilities.activity_logging_world_list(attribute, 'Setter'),  # [ActivityLogging]
         'activity_logging_world_check': v8_utilities.activity_logging_world_check(attribute),  # [ActivityLogging]
+        'cached_accessor_name': '%s%sCachedAccessor' % (interface.name, attribute.name.capitalize()),
         'cached_attribute_validation_method': cached_attribute_validation_method,
         'camel_case_name': NameStyleConverter(attribute.name).to_upper_camel_case(),
         'constructor_type': constructor_type,
@@ -150,8 +185,9 @@
         'cpp_name': cpp_name(attribute),
         'cpp_type': idl_type.cpp_type,
         'cpp_type_initializer': idl_type.cpp_type_initializer,
-        'high_entropy': high_entropy,
         'deprecate_as': deprecate_as,
+        'does_generate_getter': does_generate_getter,
+        'does_generate_setter': does_generate_setter,
         'enum_type': idl_type.enum_type,
         'enum_values': idl_type.enum_values,
         'exposed_test': v8_utilities.exposed(attribute, interface),  # [Exposed]
@@ -164,6 +200,7 @@
         'has_custom_setter': has_custom_setter(attribute),
         'has_promise_type': idl_type.name == 'Promise',
         'has_setter': has_setter(interface, attribute),
+        'high_entropy': high_entropy,
         'idl_type': str(idl_type),
         'is_cached_accessor': is_cached_accessor,
         'is_call_with_execution_context': has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'),
@@ -179,7 +216,7 @@
             extended_attributes['RaisesException'] in (None, 'Getter'),
         'is_keep_alive_for_gc': keep_alive_for_gc,
         'is_lazy_data_attribute': is_lazy_data_attribute,
-        'is_lenient_setter': 'LenientSetter' in extended_attributes,
+        'is_lenient_setter': is_lenient_setter,
         'is_lenient_this': 'LenientThis' in extended_attributes,
         'is_nullable': idl_type.is_nullable,
         'is_explicit_nullable': idl_type.is_explicit_nullable,
@@ -195,14 +232,15 @@
         'is_static': attribute.is_static,
         'is_url': 'URL' in extended_attributes,
         'is_unforgeable': is_unforgeable(attribute),
+        'measure_as': measure_as,
+        'name': attribute.name,
         'on_instance': v8_utilities.on_instance(interface, attribute),
         'on_interface': v8_utilities.on_interface(interface, attribute),
         'on_prototype': v8_utilities.on_prototype(interface, attribute),
         'origin_trial_feature_name':
             v8_utilities.origin_trial_feature_name(attribute, runtime_features),  # [RuntimeEnabled] for origin trial
-        'use_output_parameter_for_result': idl_type.use_output_parameter_for_result,
-        'measure_as': measure_as,
-        'name': attribute.name,
+        'private_property_is_shared_between_getter_and_setter': private_property_is_shared_between_getter_and_setter,
+        'private_property_key_name': private_property_key_name,
         'property_attributes': property_attributes(interface, attribute),
         'reflect_empty': extended_attributes.get('ReflectEmpty'),
         'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
@@ -211,7 +249,7 @@
         'runtime_enabled_feature_name':
             v8_utilities.runtime_enabled_feature_name(attribute, runtime_features),  # [RuntimeEnabled] if not in origin trial
         'secure_context_test': v8_utilities.secure_context(attribute, interface),  # [SecureContext]
-        'cached_accessor_name': '%s%sCachedAccessor' % (interface.name, attribute.name.capitalize()),
+        'use_output_parameter_for_result': idl_type.use_output_parameter_for_result,
         'world_suffixes': (
             ['', 'ForMainWorld']
             if 'PerWorldBindings' in extended_attributes
@@ -239,6 +277,10 @@
     return context
 
 
+def create_private_property_key_name(attribute):
+    return NameStyleConverter(attribute.name + '_private_property_key').to_snake_case()
+
+
 def runtime_call_stats_context(interface, attribute, context):
     includes.add('platform/bindings/runtime_call_stats.h')
     generic_counter_name = 'Blink_' + v8_utilities.cpp_name(interface) + '_' + attribute.name
diff --git a/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl b/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl
index 204de5f..56f401f 100644
--- a/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl
+++ b/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl
@@ -79,8 +79,13 @@
   V8PrivateProperty::Symbol property_symbol =
       V8PrivateProperty::GetHistoryStateSymbol(info.GetIsolate());
   {% else %}
+  {% if not attribute.private_property_is_shared_between_getter_and_setter %}
+  static int {{attribute.private_property_key_name}};
+
+  {% endif %}
   V8PrivateProperty::Symbol property_symbol =
       V8PrivateProperty::GetSymbol(info.GetIsolate(),
+          &{{attribute.private_property_key_name}},
           "{{cpp_class}}#{{attribute.camel_case_name}}");
   {% endif %}
   if (!static_cast<const {{cpp_class}}*>(impl)->{{attribute.cached_attribute_validation_method}}()) {
@@ -472,7 +477,9 @@
   // [CachedAttribute]
   // Invalidate the cached value.
   V8PrivateProperty::GetSymbol(
-      isolate, "{{cpp_class}}#{{attribute.camel_case_name}}")
+      isolate,
+      &{{attribute.private_property_key_name}},
+      "{{cpp_class}}#{{attribute.camel_case_name}}")
       .DeleteProperty(holder, v8::Undefined(isolate));
   {% endif %}
   {% endif %}{# attribute.is_put_forwards #}
diff --git a/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl b/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl
index 5702a47..80842b4 100644
--- a/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl
+++ b/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl
@@ -86,15 +86,19 @@
 
 {##############################################################################}
 {# Attributes #}
-{% from 'attributes.cc.tmpl' import attribute_getter,
-       attribute_setter,
+{% from 'attributes.cc.tmpl' import attribute_getter, attribute_setter,
        with context %}
 {% for attribute in attributes %}
 {% for world_suffix in attribute.world_suffixes %}
-{% if not attribute.has_custom_getter and not attribute.constructor_type %}
+{% if attribute.private_property_is_shared_between_getter_and_setter %}
+// Define a private property key shared between getter and setter.
+static int {{attribute.private_property_key_name}};
+{% endif %}
+
+{% if attribute.does_generate_getter %}
 {{attribute_getter(attribute, world_suffix)}}
 {% endif %}
-{% if attribute.has_setter and not (attribute.has_custom_setter or attribute.is_lenient_setter) %}
+{% if attribute.does_generate_setter %}
 {{attribute_setter(attribute, world_suffix)}}
 {% endif %}
 {% endfor %}
diff --git a/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl b/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl
index 7d28ca2..8b8907a 100644
--- a/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl
+++ b/third_party/blink/renderer/bindings/tests/idls/core/test_object.idl
@@ -135,6 +135,7 @@
     [LogActivity=SetterOnly, LogAllWorlds] attribute long activityLoggingSetterForAllWorldsLongAttribute;
     [CachedAttribute=isValueDirty] attribute any cachedAttributeAnyAttribute;
     [CachedAttribute=isFrozenArrayDirty] attribute FrozenArray<DOMString> cachedArrayAttribute;
+    [CachedAttribute=isStringDirty] readonly attribute DOMString readonlyCachedAttribute;
     [CachedAttribute=isStringDirty] attribute DOMString? cachedStringOrNoneAttribute;
     [CallWith=ExecutionContext] attribute any callWithExecutionContextAnyAttribute;
     [CallWith=ScriptState] attribute any callWithScriptStateAnyAttribute;
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc
index c045d29..7d53e6f 100644
--- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc
+++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.cc
@@ -1992,6 +1992,9 @@
   impl->setActivityLoggingSetterForAllWorldsLongAttribute(cpp_value);
 }
 
+// Define a private property key shared between getter and setter.
+static int cached_attribute_any_attribute_private_property_key;
+
 static void CachedAttributeAnyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
   v8::Local<v8::Object> holder = info.Holder();
 
@@ -2000,6 +2003,7 @@
   // [CachedAttribute]
   V8PrivateProperty::Symbol property_symbol =
       V8PrivateProperty::GetSymbol(info.GetIsolate(),
+          &cached_attribute_any_attribute_private_property_key,
           "TestObject#CachedAttributeAnyAttribute");
   if (!static_cast<const TestObject*>(impl)->isValueDirty()) {
     v8::Local<v8::Value> v8_value;
@@ -2036,10 +2040,15 @@
   // [CachedAttribute]
   // Invalidate the cached value.
   V8PrivateProperty::GetSymbol(
-      isolate, "TestObject#CachedAttributeAnyAttribute")
+      isolate,
+      &cached_attribute_any_attribute_private_property_key,
+      "TestObject#CachedAttributeAnyAttribute")
       .DeleteProperty(holder, v8::Undefined(isolate));
 }
 
+// Define a private property key shared between getter and setter.
+static int cached_array_attribute_private_property_key;
+
 static void CachedArrayAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
   v8::Local<v8::Object> holder = info.Holder();
 
@@ -2048,6 +2057,7 @@
   // [CachedAttribute]
   V8PrivateProperty::Symbol property_symbol =
       V8PrivateProperty::GetSymbol(info.GetIsolate(),
+          &cached_array_attribute_private_property_key,
           "TestObject#CachedArrayAttribute");
   if (!static_cast<const TestObject*>(impl)->isFrozenArrayDirty()) {
     v8::Local<v8::Value> v8_value;
@@ -2088,10 +2098,44 @@
   // [CachedAttribute]
   // Invalidate the cached value.
   V8PrivateProperty::GetSymbol(
-      isolate, "TestObject#CachedArrayAttribute")
+      isolate,
+      &cached_array_attribute_private_property_key,
+      "TestObject#CachedArrayAttribute")
       .DeleteProperty(holder, v8::Undefined(isolate));
 }
 
+static void ReadonlyCachedAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
+  v8::Local<v8::Object> holder = info.Holder();
+
+  TestObject* impl = V8TestObject::ToImpl(holder);
+
+  // [CachedAttribute]
+  static int readonly_cached_attribute_private_property_key;
+
+  V8PrivateProperty::Symbol property_symbol =
+      V8PrivateProperty::GetSymbol(info.GetIsolate(),
+          &readonly_cached_attribute_private_property_key,
+          "TestObject#ReadonlyCachedAttribute");
+  if (!static_cast<const TestObject*>(impl)->isStringDirty()) {
+    v8::Local<v8::Value> v8_value;
+    if (property_symbol.GetOrUndefined(holder).ToLocal(&v8_value) && !v8_value->IsUndefined()) {
+      V8SetReturnValue(info, v8_value);
+      return;
+    }
+  }
+
+  String cpp_value(impl->readonlyCachedAttribute());
+
+  // [CachedAttribute]
+  v8::Local<v8::Value> v8_value(V8String(info.GetIsolate(), cpp_value));
+  property_symbol.Set(holder, v8_value);
+
+  V8SetReturnValue(info, v8_value);
+}
+
+// Define a private property key shared between getter and setter.
+static int cached_string_or_none_attribute_private_property_key;
+
 static void CachedStringOrNoneAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
   v8::Local<v8::Object> holder = info.Holder();
 
@@ -2100,6 +2144,7 @@
   // [CachedAttribute]
   V8PrivateProperty::Symbol property_symbol =
       V8PrivateProperty::GetSymbol(info.GetIsolate(),
+          &cached_string_or_none_attribute_private_property_key,
           "TestObject#CachedStringOrNoneAttribute");
   if (!static_cast<const TestObject*>(impl)->isStringDirty()) {
     v8::Local<v8::Value> v8_value;
@@ -2138,7 +2183,9 @@
   // [CachedAttribute]
   // Invalidate the cached value.
   V8PrivateProperty::GetSymbol(
-      isolate, "TestObject#CachedStringOrNoneAttribute")
+      isolate,
+      &cached_string_or_none_attribute_private_property_key,
+      "TestObject#CachedStringOrNoneAttribute")
       .DeleteProperty(holder, v8::Undefined(isolate));
 }
 
@@ -3100,6 +3147,9 @@
   impl->setRaisesExceptionTestInterfaceEmptyAttribute(cpp_value, exception_state);
 }
 
+// Define a private property key shared between getter and setter.
+static int cached_attribute_raises_exception_getter_any_attribute_private_property_key;
+
 static void CachedAttributeRaisesExceptionGetterAnyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
   v8::Local<v8::Object> holder = info.Holder();
 
@@ -3108,6 +3158,7 @@
   // [CachedAttribute]
   V8PrivateProperty::Symbol property_symbol =
       V8PrivateProperty::GetSymbol(info.GetIsolate(),
+          &cached_attribute_raises_exception_getter_any_attribute_private_property_key,
           "TestObject#CachedAttributeRaisesExceptionGetterAnyAttribute");
   if (!static_cast<const TestObject*>(impl)->isValueDirty()) {
     v8::Local<v8::Value> v8_value;
@@ -3151,7 +3202,9 @@
   // [CachedAttribute]
   // Invalidate the cached value.
   V8PrivateProperty::GetSymbol(
-      isolate, "TestObject#CachedAttributeRaisesExceptionGetterAnyAttribute")
+      isolate,
+      &cached_attribute_raises_exception_getter_any_attribute_private_property_key,
+      "TestObject#CachedAttributeRaisesExceptionGetterAnyAttribute")
       .DeleteProperty(holder, v8::Undefined(isolate));
 }
 
@@ -10283,6 +10336,12 @@
   test_object_v8_internal::CachedArrayAttributeAttributeSetter(v8_value, info);
 }
 
+void V8TestObject::ReadonlyCachedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
+  RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_readonlyCachedAttribute_Getter");
+
+  test_object_v8_internal::ReadonlyCachedAttributeAttributeGetter(info);
+}
+
 void V8TestObject::CachedStringOrNoneAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
   RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_cachedStringOrNoneAttribute_Getter");
 
@@ -13346,6 +13405,7 @@
       { "activityLoggingSetterForAllWorldsLongAttribute", V8TestObject::ActivityLoggingSetterForAllWorldsLongAttributeAttributeGetterCallback, V8TestObject::ActivityLoggingSetterForAllWorldsLongAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
       { "cachedAttributeAnyAttribute", V8TestObject::CachedAttributeAnyAttributeAttributeGetterCallback, V8TestObject::CachedAttributeAnyAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
       { "cachedArrayAttribute", V8TestObject::CachedArrayAttributeAttributeGetterCallback, V8TestObject::CachedArrayAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
+      { "readonlyCachedAttribute", V8TestObject::ReadonlyCachedAttributeAttributeGetterCallback, nullptr, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::ReadOnly), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
       { "cachedStringOrNoneAttribute", V8TestObject::CachedStringOrNoneAttributeAttributeGetterCallback, V8TestObject::CachedStringOrNoneAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
       { "callWithExecutionContextAnyAttribute", V8TestObject::CallWithExecutionContextAnyAttributeAttributeGetterCallback, V8TestObject::CallWithExecutionContextAnyAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
       { "callWithScriptStateAnyAttribute", V8TestObject::CallWithScriptStateAnyAttributeAttributeGetterCallback, V8TestObject::CallWithScriptStateAnyAttributeAttributeSetterCallback, V8PrivateProperty::kNoCachedAccessor, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::kOnPrototype, V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kHasSideEffect, V8DOMConfiguration::kAlwaysCallGetter, V8DOMConfiguration::kAllWorlds },
diff --git a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h
index 9e34b07..bbcde5b 100644
--- a/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h
+++ b/third_party/blink/renderer/bindings/tests/results/core/v8_test_object.h
@@ -218,6 +218,7 @@
   CORE_EXPORT static void CachedAttributeAnyAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
   CORE_EXPORT static void CachedArrayAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
   CORE_EXPORT static void CachedArrayAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
+  CORE_EXPORT static void ReadonlyCachedAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
   CORE_EXPORT static void CachedStringOrNoneAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
   CORE_EXPORT static void CachedStringOrNoneAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
   CORE_EXPORT static void CallWithExecutionContextAnyAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
diff --git a/third_party/blink/renderer/core/animation/animation.cc b/third_party/blink/renderer/core/animation/animation.cc
index 7610fc1..099c6f1 100644
--- a/third_party/blink/renderer/core/animation/animation.cc
+++ b/third_party/blink/renderer/core/animation/animation.cc
@@ -344,9 +344,9 @@
     if (!hold_time_ || hold_time_ != new_current_time)
       outdated = true;
     hold_time_ = new_current_time;
-    if (paused_) {
+    if (paused_ || !playback_rate_) {
       start_time_ = base::nullopt;
-    } else if (is_limited && !start_time_ && playback_rate_ &&
+    } else if (is_limited && !start_time_ &&
                reason == kTimingUpdateForAnimationFrame) {
       start_time_ = CalculateStartTime(new_current_time);
     }
@@ -408,6 +408,8 @@
 
 // https://drafts.csswg.org/web-animations/#the-current-time-of-an-animation
 double Animation::currentTime() {
+  PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand);
+
   // 1. If the animation’s hold time is resolved,
   //    The current time is the animation’s hold time.
   if (hold_time_.has_value())
@@ -437,7 +439,17 @@
 }
 
 double Animation::CurrentTimeInternal() const {
-  return hold_time_.value_or(CalculateCurrentTime());
+  double result = hold_time_.value_or(CalculateCurrentTime());
+#if DCHECK_IS_ON()
+  // We can't enforce this check during Unset due to other assertions.
+  if (internal_play_state_ != kUnset) {
+    const_cast<Animation*>(this)->UpdateCurrentTimingState(
+        kTimingUpdateOnDemand);
+    double hold_or_current_time = hold_time_.value_or(CalculateCurrentTime());
+    DCHECK(AreEqualOrNull(result, hold_or_current_time));
+  }
+#endif
+  return result;
 }
 
 double Animation::UnlimitedCurrentTimeInternal() const {
@@ -453,6 +465,9 @@
     int compositor_group,
     const PaintArtifactCompositor* paint_artifact_compositor,
     bool start_on_compositor) {
+  PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand,
+                                    kDoNotSetCompositorPending);
+
   bool soft_change =
       compositor_state_ &&
       (Paused() || compositor_state_->playback_rate != playback_rate_);
@@ -481,8 +496,9 @@
 
   DCHECK(!compositor_state_ || compositor_state_->start_time);
 
-  if (!should_start)
+  if (!should_start) {
     current_time_pending_ = false;
+  }
 
   if (should_start) {
     compositor_group_ = compositor_group;
@@ -501,24 +517,13 @@
     }
   }
 
-  // Apply updates if not waiting on a start time. Play pending animations that
-  // are waiting on a start time will get updated from NotifyStartTime.
-  // Finished animations may not trigger an Update call if finished in the same
-  // frame that they are started. Calling ApplyUpdates for this specific case
-  // ensures the proper propagation of events.
-  AnimationPlayState play_state = CalculateAnimationPlayState();
-  bool finished = play_state == kFinished;
-  if (pending_pause_ || (pending_play_ && (start_time_ || finished))) {
-    ApplyUpdates(timeline_
-                     ? timeline_->CurrentTimeSeconds().value_or(NullValue())
-                     : NullValue());
-  }
-
-  NotifyProbe();
   return true;
 }
 
 void Animation::PostCommit(double timeline_time) {
+  PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand,
+                                    kDoNotSetCompositorPending);
+
   compositor_pending_ = false;
 
   if (!compositor_state_ || compositor_state_->pending_action == kNone)
@@ -532,6 +537,9 @@
 }
 
 void Animation::NotifyCompositorStartTime(double timeline_time) {
+  PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand,
+                                    kDoNotSetCompositorPending);
+
   if (compositor_state_) {
     DCHECK_EQ(compositor_state_->pending_action, kStart);
     DCHECK(!compositor_state_->start_time);
@@ -549,7 +557,7 @@
       // Unlikely, but possible.
       // FIXME: Depending on what changed above this might still be pending.
       // Maybe...
-      NotifyStartTime(timeline_time);
+      current_time_pending_ = false;
       return;
     }
 
@@ -565,8 +573,23 @@
 }
 
 void Animation::NotifyStartTime(double timeline_time) {
-  current_time_pending_ = false;
-  ApplyUpdates(timeline_time);
+  if (Playing()) {
+    DCHECK(!start_time_);
+    DCHECK(hold_time_.has_value());
+
+    if (playback_rate_ == 0) {
+      SetStartTimeInternal(timeline_time);
+    } else {
+      SetStartTimeInternal(timeline_time +
+                           CurrentTimeInternal() / -playback_rate_);
+    }
+
+    // FIXME: This avoids marking this animation as outdated needlessly when a
+    // start time is notified, but we should refactor how outdating works to
+    // avoid this.
+    ClearOutdated();
+    current_time_pending_ = false;
+  }
 }
 
 bool Animation::Affects(const Element& element,
@@ -762,7 +785,11 @@
   //    * both the start time of animation is unresolved and it does not have a
   //      pending play task,
   //    then paused.
-  if (pending_pause_ || (!start_time_ && !pending_play_))
+  // TODO(crbug.com/958433): Presently using a paused_ flag that tracks an
+  // animation being in a paused state (including a pending pause). The above
+  // rules do not yet work verbatim due to subtle timing discrepancies on when
+  // start_time gets resolved.
+  if (paused_)
     return kPaused;
 
   // 3.  For animation, current time is resolved and either of the following
@@ -840,24 +867,6 @@
   SetCurrentTimeInternal(new_current_time, kTimingUpdateOnDemand);
 }
 
-void Animation::CommitPendingPause(double ready_time) {
-  internal_play_state_ = kUnset;
-
-  DCHECK(pending_pause_);
-  pending_pause_ = false;
-  if (start_time_ && !hold_time_)
-    hold_time_ = (ready_time - start_time_.value()) * playback_rate_;
-
-  ApplyPendingPlaybackRate();
-  start_time_ = base::nullopt;
-
-  // Resolve pending ready promise.
-  if (ready_promise_)
-    ResolvePromiseMaybeAsync(ready_promise_.Get());
-
-  UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync);
-}
-
 void Animation::Unpause() {
   if (!paused_)
     return;
@@ -865,7 +874,6 @@
   PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand);
 
   current_time_pending_ = true;
-  pending_play_ = true;
   UnpauseInternal();
 }
 
@@ -873,7 +881,6 @@
   if (!paused_)
     return;
   paused_ = false;
-  pending_pause_ = false;
   SetCurrentTimeInternal(CurrentTimeInternal(), kTimingUpdateOnDemand);
 }
 
@@ -890,13 +897,16 @@
     return;
   }
 
-  if (!Playing())
+  if (!Playing()) {
     start_time_ = base::nullopt;
+  }
 
-  if (PlayStateInternal() == kIdle)
+  if (PlayStateInternal() == kIdle) {
     hold_time_ = 0;
+  }
 
   internal_play_state_ = kUnset;
+  pending_play_ = true;
   pending_pause_ = false;
   finished_ = false;
   UnpauseInternal();
@@ -910,47 +920,6 @@
     start_time_ = base::nullopt;
     SetCurrentTimeInternal(EffectEnd(), kTimingUpdateOnDemand);
   }
-  pending_play_ = !start_time_ || active_playback_rate_;
-}
-
-void Animation::CommitPendingPlay(double ready_time) {
-  DCHECK(start_time_ || hold_time_);
-  DCHECK(pending_play_);
-  pending_play_ = false;
-
-  // Update hold and start time.
-  if (timeline_ && timeline_->IsScrollTimeline()) {
-    // Special handling for scroll timelines.  The start time is always zero
-    // when the animation is playing. This forces the current time to match the
-    // timeline time. TODO(crbug.com/916117): Resolve in spec.
-    start_time_ = 0;
-    ApplyPendingPlaybackRate();
-    if (playback_rate_ != 0)
-      hold_time_ = base::nullopt;
-  } else if (hold_time_) {
-    ApplyPendingPlaybackRate();
-    if (playback_rate_ != 0) {
-      start_time_ = ready_time - hold_time_.value() / playback_rate_;
-      hold_time_ = base::nullopt;
-    } else {
-      start_time_ = ready_time;
-    }
-  } else if (start_time_ && active_playback_rate_) {
-    double current_time_to_match =
-        (ready_time - start_time_.value()) * active_playback_rate_.value();
-    ApplyPendingPlaybackRate();
-    if (playback_rate_ == 0)
-      hold_time_ = start_time_ = current_time_to_match;
-    else
-      start_time_ = ready_time - current_time_to_match / playback_rate_;
-  }
-
-  // Resolve pending ready promise.
-  if (ready_promise_)
-    ResolvePromiseMaybeAsync(ready_promise_.Get());
-
-  // Update finished state.
-  UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync);
 }
 
 // https://drafts.csswg.org/web-animations/#reversing-an-animation-section
@@ -1136,38 +1105,9 @@
   QueueFinishedEvent();
 }
 
-void Animation::ApplyUpdates(double ready_time) {
-  // Applies all updates to an animation. The state of the animation may change
-  // between the time that pending updates are triggered and when the updates
-  // are applied. Thus, flags are used instead of directly queuing callbacks
-  // to enable validation that the pending state change is still relevant.
-  // Multiple updates may be applied with the caveat that the pending play and
-  // pending pause are mutually exclusive.
-  DCHECK(!(pending_play_ && pending_pause_));
-  if (pending_play_)
-    CommitPendingPlay(ready_time);
-  else if (pending_pause_)
-    CommitPendingPause(ready_time);
-
-  ApplyPendingPlaybackRate();
-
-  DCHECK(!pending_play_);
-  DCHECK(!pending_pause_);
-  DCHECK(!active_playback_rate_);
-
-  // TODO(crbug.com/960944): Deprecate.
-  current_time_pending_ = false;
-  internal_play_state_ = CalculatePlayState();
-  animation_play_state_ = CalculateAnimationPlayState();
-
-  NotifyProbe();
-}
-
 void Animation::CommitAllUpdatesForTesting() {
-  base::Optional<double> timeline_time;
-  if (timeline_)
-    timeline_time = timeline_->CurrentTimeSeconds();
-  ApplyUpdates(timeline_time.value_or(NullValue()));
+  if (pending_finish_notification_)
+    CommitFinishNotification();
 }
 
 // https://drafts.csswg.org/web-animations/#setting-the-playback-rate-of-an-animation
@@ -1196,15 +1136,6 @@
 
   setPlaybackRate(playback_rate);
 
-  if (playback_rate == 0) {
-    pending_play_ = pending_pause_ = false;
-    if (play_state == kRunning || play_state == kFinished) {
-      double timeline_time = TimelineTime();
-      if (!IsNull(timeline_time))
-        start_time_ = timeline_time;
-    }
-  }
-
   if (pending())
     active_playback_rate_ = stored_playback_rate;
 }
@@ -1224,7 +1155,7 @@
   if (!ready_promise_) {
     ready_promise_ = MakeGarbageCollected<AnimationPromise>(
         ExecutionContext::From(script_state), this, AnimationPromise::kReady);
-    if (!pending())
+    if (PlayStateInternal() != kPending)
       ready_promise_->Resolve(this);
   }
   return ready_promise_->Promise(script_state->World());
@@ -1311,20 +1242,13 @@
   DCHECK(std::isfinite(playback_rate));
   DCHECK_NE(playback_rate, playback_rate_);
 
-  if (!Limited() && !Paused() && start_time_) {
+  if (!Limited() && !Paused() && start_time_)
     current_time_pending_ = true;
-    pending_play_ = true;
-  }
 
   double stored_current_time = CurrentTimeInternal();
-  if ((playback_rate_ < 0 && playback_rate > 0) ||
-      (playback_rate_ > 0 && playback_rate < 0)) {
+  if ((playback_rate_ < 0 && playback_rate >= 0) ||
+      (playback_rate_ > 0 && playback_rate <= 0))
     finished_ = false;
-    // Reversing the direction of a finished animation will trigger playing
-    // the animation.
-    if (Limited() && !Paused() && start_time_)
-      pending_play_ = true;
-  }
 
   playback_rate_ = playback_rate;
   start_time_ = base::nullopt;
@@ -1509,6 +1433,17 @@
   if (!timeline_)
     return false;
 
+  if (reason == kTimingUpdateForAnimationFrame) {
+    // Pending tasks are committed when the animation is 'ready'. This can be
+    // at the time of promise resolution or after a frame tick.  Whereas the
+    // spec calls for creating scheduled tasks to commit pending changes, in the
+    // Blink implementation, this is an acknowledgment that the changes have
+    // taken affect.
+    // TODO(crbug.com/960944): Consider restructuring implementation to more
+    // closely align with the recommended algorithm in the spec.
+    ResetPendingTasks();
+  }
+
   PlayStateUpdateScope update_scope(*this, reason, kDoNotSetCompositorPending);
 
   ClearOutdated();
@@ -1646,6 +1581,7 @@
   paused_ = false;
   internal_play_state_ = kIdle;
   current_time_pending_ = false;
+
   animation_play_state_ = kIdle;
 
   // Apply changes synchronously.
diff --git a/third_party/blink/renderer/core/animation/animation.h b/third_party/blink/renderer/core/animation/animation.h
index 8e28b4a1..ea510e4 100644
--- a/third_party/blink/renderer/core/animation/animation.h
+++ b/third_party/blink/renderer/core/animation/animation.h
@@ -144,12 +144,11 @@
   ScriptPromise ready(ScriptState*);
 
   bool Paused() const {
-    return CalculateAnimationPlayState() == kPaused && !is_paused_for_testing_;
+    return GetPlayState() == kPaused && !is_paused_for_testing_;
   }
 
   bool Playing() const override {
-    return CalculateAnimationPlayState() == kRunning && !Limited() &&
-           !is_paused_for_testing_;
+    return GetPlayState() == kRunning && !Limited() && !is_paused_for_testing_;
   }
 
   // Indicates if the animation is out of sync with the compositor. A change to
@@ -337,9 +336,6 @@
   void ScheduleAsyncFinish();
   void AsyncFinishMicrotask();
   void CommitFinishNotification();
-  void CommitPendingPause(double ready_time);
-  void CommitPendingPlay(double ready_time);
-  void ApplyUpdates(double ready_time);
 
   // Tracking the state of animations in dev tools.
   void NotifyProbe();
diff --git a/third_party/blink/renderer/core/animation/animation_test.cc b/third_party/blink/renderer/core/animation/animation_test.cc
index 4aab40ad..f0f73253 100644
--- a/third_party/blink/renderer/core/animation/animation_test.cc
+++ b/third_party/blink/renderer/core/animation/animation_test.cc
@@ -169,8 +169,6 @@
   }
 
   bool SimulateFrame(double time_ms) {
-    animation->CommitAllUpdatesForTesting();
-
     last_frame_time = time_ms;
     const auto* paint_artifact_compositor =
         GetDocument().GetFrame()->View()->GetPaintArtifactCompositor();
@@ -441,8 +439,7 @@
   animation->setPlaybackRate(0);
   EXPECT_EQ("running", animation->playState());
   SimulateAwaitReady();
-  EXPECT_EQ("running", animation->playState());
-  EXPECT_EQ(0, animation->startTime());
+  EXPECT_FALSE(animation->startTime());
 
   SimulateFrame(10000);
   EXPECT_EQ("running", animation->playState());
diff --git a/third_party/blink/renderer/core/aom/accessible_node.cc b/third_party/blink/renderer/core/aom/accessible_node.cc
index aea0ff2..ba1aa3e 100644
--- a/third_party/blink/renderer/core/aom/accessible_node.cc
+++ b/third_party/blink/renderer/core/aom/accessible_node.cc
@@ -17,44 +17,42 @@
 
 namespace blink {
 
-using namespace html_names;
-
 namespace {
 
 QualifiedName GetCorrespondingARIAAttribute(AOMStringProperty property) {
   switch (property) {
     case AOMStringProperty::kAutocomplete:
-      return kAriaAutocompleteAttr;
+      return html_names::kAriaAutocompleteAttr;
     case AOMStringProperty::kChecked:
-      return kAriaCheckedAttr;
+      return html_names::kAriaCheckedAttr;
     case AOMStringProperty::kCurrent:
-      return kAriaCurrentAttr;
+      return html_names::kAriaCurrentAttr;
     case AOMStringProperty::kHasPopUp:
-      return kAriaHaspopupAttr;
+      return html_names::kAriaHaspopupAttr;
     case AOMStringProperty::kInvalid:
-      return kAriaInvalidAttr;
+      return html_names::kAriaInvalidAttr;
     case AOMStringProperty::kKeyShortcuts:
-      return kAriaKeyshortcutsAttr;
+      return html_names::kAriaKeyshortcutsAttr;
     case AOMStringProperty::kLabel:
-      return kAriaLabelAttr;
+      return html_names::kAriaLabelAttr;
     case AOMStringProperty::kLive:
-      return kAriaLiveAttr;
+      return html_names::kAriaLiveAttr;
     case AOMStringProperty::kOrientation:
-      return kAriaOrientationAttr;
+      return html_names::kAriaOrientationAttr;
     case AOMStringProperty::kPlaceholder:
-      return kAriaPlaceholderAttr;
+      return html_names::kAriaPlaceholderAttr;
     case AOMStringProperty::kPressed:
-      return kAriaPressedAttr;
+      return html_names::kAriaPressedAttr;
     case AOMStringProperty::kRelevant:
-      return kAriaRelevantAttr;
+      return html_names::kAriaRelevantAttr;
     case AOMStringProperty::kRole:
-      return kRoleAttr;
+      return html_names::kRoleAttr;
     case AOMStringProperty::kRoleDescription:
-      return kAriaRoledescriptionAttr;
+      return html_names::kAriaRoledescriptionAttr;
     case AOMStringProperty::kSort:
-      return kAriaSortAttr;
+      return html_names::kAriaSortAttr;
     case AOMStringProperty::kValueText:
-      return kAriaValuetextAttr;
+      return html_names::kAriaValuetextAttr;
   }
 
   NOTREACHED();
@@ -64,13 +62,13 @@
 QualifiedName GetCorrespondingARIAAttribute(AOMRelationProperty property) {
   switch (property) {
     case AOMRelationProperty::kActiveDescendant:
-      return kAriaActivedescendantAttr;
+      return html_names::kAriaActivedescendantAttr;
       break;
     case AOMRelationProperty::kDetails:
-      return kAriaDetailsAttr;
+      return html_names::kAriaDetailsAttr;
       break;
     case AOMRelationProperty::kErrorMessage:
-      return kAriaErrormessageAttr;
+      return html_names::kAriaErrormessageAttr;
       break;
   }
 
@@ -81,21 +79,21 @@
 QualifiedName GetCorrespondingARIAAttribute(AOMRelationListProperty property) {
   switch (property) {
     case AOMRelationListProperty::kDescribedBy:
-      return kAriaDescribedbyAttr;
+      return html_names::kAriaDescribedbyAttr;
       break;
     case AOMRelationListProperty::kControls:
-      return kAriaControlsAttr;
+      return html_names::kAriaControlsAttr;
       break;
     case AOMRelationListProperty::kFlowTo:
-      return kAriaFlowtoAttr;
+      return html_names::kAriaFlowtoAttr;
       break;
     case AOMRelationListProperty::kLabeledBy:
       // Note that there are two allowed spellings of this attribute.
       // Callers should check both.
-      return kAriaLabelledbyAttr;
+      return html_names::kAriaLabelledbyAttr;
       break;
     case AOMRelationListProperty::kOwns:
-      return kAriaOwnsAttr;
+      return html_names::kAriaOwnsAttr;
       break;
   }
 
@@ -106,37 +104,37 @@
 QualifiedName GetCorrespondingARIAAttribute(AOMBooleanProperty property) {
   switch (property) {
     case AOMBooleanProperty::kAtomic:
-      return kAriaAtomicAttr;
+      return html_names::kAriaAtomicAttr;
       break;
     case AOMBooleanProperty::kBusy:
-      return kAriaBusyAttr;
+      return html_names::kAriaBusyAttr;
       break;
     case AOMBooleanProperty::kDisabled:
-      return kAriaDisabledAttr;
+      return html_names::kAriaDisabledAttr;
       break;
     case AOMBooleanProperty::kExpanded:
-      return kAriaExpandedAttr;
+      return html_names::kAriaExpandedAttr;
       break;
     case AOMBooleanProperty::kHidden:
-      return kAriaHiddenAttr;
+      return html_names::kAriaHiddenAttr;
       break;
     case AOMBooleanProperty::kModal:
-      return kAriaModalAttr;
+      return html_names::kAriaModalAttr;
       break;
     case AOMBooleanProperty::kMultiline:
-      return kAriaMultilineAttr;
+      return html_names::kAriaMultilineAttr;
       break;
     case AOMBooleanProperty::kMultiselectable:
-      return kAriaMultiselectableAttr;
+      return html_names::kAriaMultiselectableAttr;
       break;
     case AOMBooleanProperty::kReadOnly:
-      return kAriaReadonlyAttr;
+      return html_names::kAriaReadonlyAttr;
       break;
     case AOMBooleanProperty::kRequired:
-      return kAriaRequiredAttr;
+      return html_names::kAriaRequiredAttr;
       break;
     case AOMBooleanProperty::kSelected:
-      return kAriaSelectedAttr;
+      return html_names::kAriaSelectedAttr;
       break;
   }
 
@@ -148,13 +146,13 @@
   AtomicString attr_value;
   switch (property) {
     case AOMFloatProperty::kValueMax:
-      return kAriaValuemaxAttr;
+      return html_names::kAriaValuemaxAttr;
       break;
     case AOMFloatProperty::kValueMin:
-      return kAriaValueminAttr;
+      return html_names::kAriaValueminAttr;
       break;
     case AOMFloatProperty::kValueNow:
-      return kAriaValuenowAttr;
+      return html_names::kAriaValuenowAttr;
       break;
   }
 
@@ -165,22 +163,22 @@
 QualifiedName GetCorrespondingARIAAttribute(AOMUIntProperty property) {
   switch (property) {
     case AOMUIntProperty::kColIndex:
-      return kAriaColindexAttr;
+      return html_names::kAriaColindexAttr;
       break;
     case AOMUIntProperty::kColSpan:
-      return kAriaColspanAttr;
+      return html_names::kAriaColspanAttr;
       break;
     case AOMUIntProperty::kLevel:
-      return kAriaLevelAttr;
+      return html_names::kAriaLevelAttr;
       break;
     case AOMUIntProperty::kPosInSet:
-      return kAriaPosinsetAttr;
+      return html_names::kAriaPosinsetAttr;
       break;
     case AOMUIntProperty::kRowIndex:
-      return kAriaRowindexAttr;
+      return html_names::kAriaRowindexAttr;
       break;
     case AOMUIntProperty::kRowSpan:
-      return kAriaRowspanAttr;
+      return html_names::kAriaRowspanAttr;
       break;
   }
 
@@ -191,13 +189,13 @@
 QualifiedName GetCorrespondingARIAAttribute(AOMIntProperty property) {
   switch (property) {
     case AOMIntProperty::kColCount:
-      return kAriaColcountAttr;
+      return html_names::kAriaColcountAttr;
       break;
     case AOMIntProperty::kRowCount:
-      return kAriaRowcountAttr;
+      return html_names::kAriaRowcountAttr;
       break;
     case AOMIntProperty::kSetSize:
-      return kAriaSetsizeAttr;
+      return html_names::kAriaSetsizeAttr;
       break;
   }
 
@@ -425,7 +423,8 @@
   String value =
       GetElementOrInternalsARIAAttribute(*element, attribute).GetString();
   if (value.IsEmpty() && property == AOMRelationListProperty::kLabeledBy) {
-    value = GetElementOrInternalsARIAAttribute(*element, kAriaLabeledbyAttr)
+    value = GetElementOrInternalsARIAAttribute(*element,
+                                               html_names::kAriaLabeledbyAttr)
                 .GetString();
   }
   if (value.IsEmpty())
@@ -552,7 +551,7 @@
 void AccessibleNode::setActiveDescendant(AccessibleNode* active_descendant) {
   SetRelationProperty(AOMRelationProperty::kActiveDescendant,
                       active_descendant);
-  NotifyAttributeChanged(kAriaActivedescendantAttr);
+  NotifyAttributeChanged(html_names::kAriaActivedescendantAttr);
 }
 
 bool AccessibleNode::atomic(bool& is_null) const {
@@ -561,7 +560,7 @@
 
 void AccessibleNode::setAtomic(bool atomic, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kAtomic, atomic, is_null);
-  NotifyAttributeChanged(kAriaAtomicAttr);
+  NotifyAttributeChanged(html_names::kAriaAtomicAttr);
 }
 
 AtomicString AccessibleNode::autocomplete() const {
@@ -570,7 +569,7 @@
 
 void AccessibleNode::setAutocomplete(const AtomicString& autocomplete) {
   SetStringProperty(AOMStringProperty::kAutocomplete, autocomplete);
-  NotifyAttributeChanged(kAriaAutocompleteAttr);
+  NotifyAttributeChanged(html_names::kAriaAutocompleteAttr);
 }
 
 bool AccessibleNode::busy(bool& is_null) const {
@@ -579,7 +578,7 @@
 
 void AccessibleNode::setBusy(bool busy, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kBusy, busy, is_null);
-  NotifyAttributeChanged(kAriaBusyAttr);
+  NotifyAttributeChanged(html_names::kAriaBusyAttr);
 }
 
 AtomicString AccessibleNode::checked() const {
@@ -588,7 +587,7 @@
 
 void AccessibleNode::setChecked(const AtomicString& checked) {
   SetStringProperty(AOMStringProperty::kChecked, checked);
-  NotifyAttributeChanged(kAriaCheckedAttr);
+  NotifyAttributeChanged(html_names::kAriaCheckedAttr);
 }
 
 int32_t AccessibleNode::colCount(bool& is_null) const {
@@ -597,7 +596,7 @@
 
 void AccessibleNode::setColCount(int32_t col_count, bool is_null) {
   SetIntProperty(AOMIntProperty::kColCount, col_count, is_null);
-  NotifyAttributeChanged(kAriaColcountAttr);
+  NotifyAttributeChanged(html_names::kAriaColcountAttr);
 }
 
 uint32_t AccessibleNode::colIndex(bool& is_null) const {
@@ -606,7 +605,7 @@
 
 void AccessibleNode::setColIndex(uint32_t col_index, bool is_null) {
   SetUIntProperty(AOMUIntProperty::kColIndex, col_index, is_null);
-  NotifyAttributeChanged(kAriaColindexAttr);
+  NotifyAttributeChanged(html_names::kAriaColindexAttr);
 }
 
 uint32_t AccessibleNode::colSpan(bool& is_null) const {
@@ -615,7 +614,7 @@
 
 void AccessibleNode::setColSpan(uint32_t col_span, bool is_null) {
   SetUIntProperty(AOMUIntProperty::kColSpan, col_span, is_null);
-  NotifyAttributeChanged(kAriaColspanAttr);
+  NotifyAttributeChanged(html_names::kAriaColspanAttr);
 }
 
 AccessibleNodeList* AccessibleNode::controls() const {
@@ -624,7 +623,7 @@
 
 void AccessibleNode::setControls(AccessibleNodeList* controls) {
   SetRelationListProperty(AOMRelationListProperty::kControls, controls);
-  NotifyAttributeChanged(kAriaControlsAttr);
+  NotifyAttributeChanged(html_names::kAriaControlsAttr);
 }
 
 AtomicString AccessibleNode::current() const {
@@ -633,7 +632,7 @@
 
 void AccessibleNode::setCurrent(const AtomicString& current) {
   SetStringProperty(AOMStringProperty::kCurrent, current);
-  NotifyAttributeChanged(kAriaCurrentAttr);
+  NotifyAttributeChanged(html_names::kAriaCurrentAttr);
 }
 
 AccessibleNodeList* AccessibleNode::describedBy() {
@@ -642,7 +641,7 @@
 
 void AccessibleNode::setDescribedBy(AccessibleNodeList* described_by) {
   SetRelationListProperty(AOMRelationListProperty::kDescribedBy, described_by);
-  NotifyAttributeChanged(kAriaDescribedbyAttr);
+  NotifyAttributeChanged(html_names::kAriaDescribedbyAttr);
 }
 
 AccessibleNode* AccessibleNode::details() const {
@@ -651,7 +650,7 @@
 
 void AccessibleNode::setDetails(AccessibleNode* details) {
   SetRelationProperty(AOMRelationProperty::kDetails, details);
-  NotifyAttributeChanged(kAriaDetailsAttr);
+  NotifyAttributeChanged(html_names::kAriaDetailsAttr);
 }
 
 bool AccessibleNode::disabled(bool& is_null) const {
@@ -660,7 +659,7 @@
 
 void AccessibleNode::setDisabled(bool disabled, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kDisabled, disabled, is_null);
-  NotifyAttributeChanged(kAriaDisabledAttr);
+  NotifyAttributeChanged(html_names::kAriaDisabledAttr);
 }
 
 AccessibleNode* AccessibleNode::errorMessage() const {
@@ -669,7 +668,7 @@
 
 void AccessibleNode::setErrorMessage(AccessibleNode* error_message) {
   SetRelationProperty(AOMRelationProperty::kErrorMessage, error_message);
-  NotifyAttributeChanged(kAriaErrormessageAttr);
+  NotifyAttributeChanged(html_names::kAriaErrormessageAttr);
 }
 
 bool AccessibleNode::expanded(bool& is_null) const {
@@ -678,7 +677,7 @@
 
 void AccessibleNode::setExpanded(bool expanded, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kExpanded, expanded, is_null);
-  NotifyAttributeChanged(kAriaExpandedAttr);
+  NotifyAttributeChanged(html_names::kAriaExpandedAttr);
 }
 
 AccessibleNodeList* AccessibleNode::flowTo() const {
@@ -687,7 +686,7 @@
 
 void AccessibleNode::setFlowTo(AccessibleNodeList* flow_to) {
   SetRelationListProperty(AOMRelationListProperty::kFlowTo, flow_to);
-  NotifyAttributeChanged(kAriaFlowtoAttr);
+  NotifyAttributeChanged(html_names::kAriaFlowtoAttr);
 }
 
 AtomicString AccessibleNode::hasPopUp() const {
@@ -696,7 +695,7 @@
 
 void AccessibleNode::setHasPopUp(const AtomicString& has_popup) {
   SetStringProperty(AOMStringProperty::kHasPopUp, has_popup);
-  NotifyAttributeChanged(kAriaHaspopupAttr);
+  NotifyAttributeChanged(html_names::kAriaHaspopupAttr);
 }
 
 bool AccessibleNode::hidden(bool& is_null) const {
@@ -705,7 +704,7 @@
 
 void AccessibleNode::setHidden(bool hidden, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kHidden, hidden, is_null);
-  NotifyAttributeChanged(kAriaHiddenAttr);
+  NotifyAttributeChanged(html_names::kAriaHiddenAttr);
 }
 
 AtomicString AccessibleNode::invalid() const {
@@ -714,7 +713,7 @@
 
 void AccessibleNode::setInvalid(const AtomicString& invalid) {
   SetStringProperty(AOMStringProperty::kInvalid, invalid);
-  NotifyAttributeChanged(kAriaInvalidAttr);
+  NotifyAttributeChanged(html_names::kAriaInvalidAttr);
 }
 
 AtomicString AccessibleNode::keyShortcuts() const {
@@ -723,7 +722,7 @@
 
 void AccessibleNode::setKeyShortcuts(const AtomicString& key_shortcuts) {
   SetStringProperty(AOMStringProperty::kKeyShortcuts, key_shortcuts);
-  NotifyAttributeChanged(kAriaKeyshortcutsAttr);
+  NotifyAttributeChanged(html_names::kAriaKeyshortcutsAttr);
 }
 
 AtomicString AccessibleNode::label() const {
@@ -732,7 +731,7 @@
 
 void AccessibleNode::setLabel(const AtomicString& label) {
   SetStringProperty(AOMStringProperty::kLabel, label);
-  NotifyAttributeChanged(kAriaLabelAttr);
+  NotifyAttributeChanged(html_names::kAriaLabelAttr);
 }
 
 AccessibleNodeList* AccessibleNode::labeledBy() {
@@ -741,7 +740,7 @@
 
 void AccessibleNode::setLabeledBy(AccessibleNodeList* labeled_by) {
   SetRelationListProperty(AOMRelationListProperty::kLabeledBy, labeled_by);
-  NotifyAttributeChanged(kAriaLabelledbyAttr);
+  NotifyAttributeChanged(html_names::kAriaLabelledbyAttr);
 }
 
 uint32_t AccessibleNode::level(bool& is_null) const {
@@ -750,7 +749,7 @@
 
 void AccessibleNode::setLevel(uint32_t level, bool is_null) {
   SetUIntProperty(AOMUIntProperty::kLevel, level, is_null);
-  NotifyAttributeChanged(kAriaLevelAttr);
+  NotifyAttributeChanged(html_names::kAriaLevelAttr);
 }
 
 AtomicString AccessibleNode::live() const {
@@ -759,7 +758,7 @@
 
 void AccessibleNode::setLive(const AtomicString& live) {
   SetStringProperty(AOMStringProperty::kLive, live);
-  NotifyAttributeChanged(kAriaLiveAttr);
+  NotifyAttributeChanged(html_names::kAriaLiveAttr);
 }
 
 bool AccessibleNode::modal(bool& is_null) const {
@@ -768,7 +767,7 @@
 
 void AccessibleNode::setModal(bool modal, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kModal, modal, is_null);
-  NotifyAttributeChanged(kAriaModalAttr);
+  NotifyAttributeChanged(html_names::kAriaModalAttr);
 }
 
 bool AccessibleNode::multiline(bool& is_null) const {
@@ -777,7 +776,7 @@
 
 void AccessibleNode::setMultiline(bool multiline, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kMultiline, multiline, is_null);
-  NotifyAttributeChanged(kAriaMultilineAttr);
+  NotifyAttributeChanged(html_names::kAriaMultilineAttr);
 }
 
 bool AccessibleNode::multiselectable(bool& is_null) const {
@@ -787,7 +786,7 @@
 void AccessibleNode::setMultiselectable(bool multiselectable, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kMultiselectable, multiselectable,
                      is_null);
-  NotifyAttributeChanged(kAriaMultiselectableAttr);
+  NotifyAttributeChanged(html_names::kAriaMultiselectableAttr);
 }
 
 AtomicString AccessibleNode::orientation() const {
@@ -796,7 +795,7 @@
 
 void AccessibleNode::setOrientation(const AtomicString& orientation) {
   SetStringProperty(AOMStringProperty::kOrientation, orientation);
-  NotifyAttributeChanged(kAriaOrientationAttr);
+  NotifyAttributeChanged(html_names::kAriaOrientationAttr);
 }
 
 AccessibleNodeList* AccessibleNode::owns() const {
@@ -805,7 +804,7 @@
 
 void AccessibleNode::setOwns(AccessibleNodeList* owns) {
   SetRelationListProperty(AOMRelationListProperty::kOwns, owns);
-  NotifyAttributeChanged(kAriaOwnsAttr);
+  NotifyAttributeChanged(html_names::kAriaOwnsAttr);
 }
 
 AtomicString AccessibleNode::placeholder() const {
@@ -814,7 +813,7 @@
 
 void AccessibleNode::setPlaceholder(const AtomicString& placeholder) {
   SetStringProperty(AOMStringProperty::kPlaceholder, placeholder);
-  NotifyAttributeChanged(kAriaPlaceholderAttr);
+  NotifyAttributeChanged(html_names::kAriaPlaceholderAttr);
 }
 
 uint32_t AccessibleNode::posInSet(bool& is_null) const {
@@ -823,7 +822,7 @@
 
 void AccessibleNode::setPosInSet(uint32_t pos_in_set, bool is_null) {
   SetUIntProperty(AOMUIntProperty::kPosInSet, pos_in_set, is_null);
-  NotifyAttributeChanged(kAriaPosinsetAttr);
+  NotifyAttributeChanged(html_names::kAriaPosinsetAttr);
 }
 
 AtomicString AccessibleNode::pressed() const {
@@ -832,7 +831,7 @@
 
 void AccessibleNode::setPressed(const AtomicString& pressed) {
   SetStringProperty(AOMStringProperty::kPressed, pressed);
-  NotifyAttributeChanged(kAriaPressedAttr);
+  NotifyAttributeChanged(html_names::kAriaPressedAttr);
 }
 
 bool AccessibleNode::readOnly(bool& is_null) const {
@@ -841,7 +840,7 @@
 
 void AccessibleNode::setReadOnly(bool read_only, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kReadOnly, read_only, is_null);
-  NotifyAttributeChanged(kAriaReadonlyAttr);
+  NotifyAttributeChanged(html_names::kAriaReadonlyAttr);
 }
 
 AtomicString AccessibleNode::relevant() const {
@@ -850,7 +849,7 @@
 
 void AccessibleNode::setRelevant(const AtomicString& relevant) {
   SetStringProperty(AOMStringProperty::kRelevant, relevant);
-  NotifyAttributeChanged(kAriaRelevantAttr);
+  NotifyAttributeChanged(html_names::kAriaRelevantAttr);
 }
 
 bool AccessibleNode::required(bool& is_null) const {
@@ -859,7 +858,7 @@
 
 void AccessibleNode::setRequired(bool required, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kRequired, required, is_null);
-  NotifyAttributeChanged(kAriaRequiredAttr);
+  NotifyAttributeChanged(html_names::kAriaRequiredAttr);
 }
 
 AtomicString AccessibleNode::role() const {
@@ -868,7 +867,7 @@
 
 void AccessibleNode::setRole(const AtomicString& role) {
   SetStringProperty(AOMStringProperty::kRole, role);
-  NotifyAttributeChanged(kRoleAttr);
+  NotifyAttributeChanged(html_names::kRoleAttr);
 }
 
 AtomicString AccessibleNode::roleDescription() const {
@@ -877,7 +876,7 @@
 
 void AccessibleNode::setRoleDescription(const AtomicString& role_description) {
   SetStringProperty(AOMStringProperty::kRoleDescription, role_description);
-  NotifyAttributeChanged(kAriaRoledescriptionAttr);
+  NotifyAttributeChanged(html_names::kAriaRoledescriptionAttr);
 }
 
 int32_t AccessibleNode::rowCount(bool& is_null) const {
@@ -886,7 +885,7 @@
 
 void AccessibleNode::setRowCount(int32_t row_count, bool is_null) {
   SetIntProperty(AOMIntProperty::kRowCount, row_count, is_null);
-  NotifyAttributeChanged(kAriaRowcountAttr);
+  NotifyAttributeChanged(html_names::kAriaRowcountAttr);
 }
 
 uint32_t AccessibleNode::rowIndex(bool& is_null) const {
@@ -895,7 +894,7 @@
 
 void AccessibleNode::setRowIndex(uint32_t row_index, bool is_null) {
   SetUIntProperty(AOMUIntProperty::kRowIndex, row_index, is_null);
-  NotifyAttributeChanged(kAriaRowindexAttr);
+  NotifyAttributeChanged(html_names::kAriaRowindexAttr);
 }
 
 uint32_t AccessibleNode::rowSpan(bool& is_null) const {
@@ -904,7 +903,7 @@
 
 void AccessibleNode::setRowSpan(uint32_t row_span, bool is_null) {
   SetUIntProperty(AOMUIntProperty::kRowSpan, row_span, is_null);
-  NotifyAttributeChanged(kAriaRowspanAttr);
+  NotifyAttributeChanged(html_names::kAriaRowspanAttr);
 }
 
 bool AccessibleNode::selected(bool& is_null) const {
@@ -913,7 +912,7 @@
 
 void AccessibleNode::setSelected(bool selected, bool is_null) {
   SetBooleanProperty(AOMBooleanProperty::kSelected, selected, is_null);
-  NotifyAttributeChanged(kAriaSelectedAttr);
+  NotifyAttributeChanged(html_names::kAriaSelectedAttr);
 }
 
 int32_t AccessibleNode::setSize(bool& is_null) const {
@@ -922,7 +921,7 @@
 
 void AccessibleNode::setSetSize(int32_t set_size, bool is_null) {
   SetIntProperty(AOMIntProperty::kSetSize, set_size, is_null);
-  NotifyAttributeChanged(kAriaSetsizeAttr);
+  NotifyAttributeChanged(html_names::kAriaSetsizeAttr);
 }
 
 AtomicString AccessibleNode::sort() const {
@@ -931,7 +930,7 @@
 
 void AccessibleNode::setSort(const AtomicString& sort) {
   SetStringProperty(AOMStringProperty::kSort, sort);
-  NotifyAttributeChanged(kAriaSortAttr);
+  NotifyAttributeChanged(html_names::kAriaSortAttr);
 }
 
 float AccessibleNode::valueMax(bool& is_null) const {
@@ -940,7 +939,7 @@
 
 void AccessibleNode::setValueMax(float value_max, bool is_null) {
   SetFloatProperty(AOMFloatProperty::kValueMax, value_max, is_null);
-  NotifyAttributeChanged(kAriaValuemaxAttr);
+  NotifyAttributeChanged(html_names::kAriaValuemaxAttr);
 }
 
 float AccessibleNode::valueMin(bool& is_null) const {
@@ -949,7 +948,7 @@
 
 void AccessibleNode::setValueMin(float value_min, bool is_null) {
   SetFloatProperty(AOMFloatProperty::kValueMin, value_min, is_null);
-  NotifyAttributeChanged(kAriaValueminAttr);
+  NotifyAttributeChanged(html_names::kAriaValueminAttr);
 }
 
 float AccessibleNode::valueNow(bool& is_null) const {
@@ -958,7 +957,7 @@
 
 void AccessibleNode::setValueNow(float value_now, bool is_null) {
   SetFloatProperty(AOMFloatProperty::kValueNow, value_now, is_null);
-  NotifyAttributeChanged(kAriaValuenowAttr);
+  NotifyAttributeChanged(html_names::kAriaValuenowAttr);
 }
 
 AtomicString AccessibleNode::valueText() const {
@@ -967,7 +966,7 @@
 
 void AccessibleNode::setValueText(const AtomicString& value_text) {
   SetStringProperty(AOMStringProperty::kValueText, value_text);
-  NotifyAttributeChanged(kAriaValuetextAttr);
+  NotifyAttributeChanged(html_names::kAriaValuetextAttr);
 }
 
 AccessibleNodeList* AccessibleNode::childNodes() {
diff --git a/third_party/blink/renderer/core/css/selector_checker.cc b/third_party/blink/renderer/core/css/selector_checker.cc
index 7bea2586..18ee209 100644
--- a/third_party/blink/renderer/core/css/selector_checker.cc
+++ b/third_party/blink/renderer/core/css/selector_checker.cc
@@ -1439,6 +1439,9 @@
   if (force_pseudo_state)
     return true;
 
+  if (!element.IsFocused() || !IsFrameFocused(element))
+    return false;
+
   const Document& document = element.GetDocument();
   bool always_show_focus_ring = element.MayTriggerVirtualKeyboard();
   bool last_focus_from_mouse =
@@ -1447,8 +1450,8 @@
       document.LastFocusType() == kWebFocusTypeMouse;
   bool had_keyboard_event = document.HadKeyboardEvent();
 
-  return element.IsFocused() && (!last_focus_from_mouse || had_keyboard_event ||
-                                 always_show_focus_ring);
+  return (!last_focus_from_mouse || had_keyboard_event ||
+          always_show_focus_ring);
 }
 
 // static
diff --git a/third_party/blink/renderer/core/dom/events/event_dispatcher.cc b/third_party/blink/renderer/core/dom/events/event_dispatcher.cc
index 630a7c1..a06846ac 100644
--- a/third_party/blink/renderer/core/dom/events/event_dispatcher.cc
+++ b/third_party/blink/renderer/core/dom/events/event_dispatcher.cc
@@ -227,6 +227,12 @@
     pre_dispatch_event_handler_result =
         activation_target->PreDispatchEventHandler(*event_);
   }
+
+  // If this is a trusted keyboard event, update the keyboard event state and
+  // trigger :focus-visible matching if necessary.
+  if (event_->isTrusted() && event_->IsKeyboardEvent())
+    node_->UpdateHadKeyboardEvent(*event_);
+
   return (event_->GetEventPath().IsEmpty() || event_->PropagationStopped())
              ? kDoneDispatching
              : kContinueDispatching;
@@ -351,7 +357,6 @@
   } else if (!event_->DefaultHandled() && is_trusted_or_click) {
     // Non-bubbling events call only one default event handler, the one for the
     // target.
-    node_->WillCallDefaultEventHandler(*event_);
     node_->DefaultEventHandler(*event_);
     DCHECK(!event_->defaultPrevented());
     // For bubbling events, call default event handlers on the same targets in
@@ -359,8 +364,6 @@
     if (!event_->DefaultHandled() && event_->bubbles()) {
       wtf_size_t size = event_->GetEventPath().size();
       for (wtf_size_t i = 1; i < size; ++i) {
-        event_->GetEventPath()[i].GetNode().WillCallDefaultEventHandler(
-            *event_);
         event_->GetEventPath()[i].GetNode().DefaultEventHandler(*event_);
         DCHECK(!event_->defaultPrevented());
         if (event_->DefaultHandled())
diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc
index 0468b57..64c9d1d 100644
--- a/third_party/blink/renderer/core/dom/node.cc
+++ b/third_party/blink/renderer/core/dom/node.cc
@@ -2883,15 +2883,8 @@
   }
 }
 
-void Node::WillCallDefaultEventHandler(const Event& event) {
-  if (!event.IsKeyboardEvent())
-    return;
-
-  if (!IsFocused() || GetDocument().LastFocusType() != kWebFocusTypeMouse)
-    return;
-
-  if (event.type() != event_type_names::kKeydown ||
-      GetDocument().HadKeyboardEvent())
+void Node::UpdateHadKeyboardEvent(const Event& event) {
+  if (GetDocument().HadKeyboardEvent())
     return;
 
   GetDocument().SetHadKeyboardEvent(true);
@@ -3005,7 +2998,7 @@
 }
 
 void Node::SetFocused(bool flag, WebFocusType focus_type) {
-  if (!flag || focus_type == kWebFocusTypeMouse)
+  if (focus_type == kWebFocusTypeMouse)
     GetDocument().SetHadKeyboardEvent(false);
   GetDocument().UserActionElements().SetFocused(this, flag);
 }
diff --git a/third_party/blink/renderer/core/dom/node.h b/third_party/blink/renderer/core/dom/node.h
index b79c7d6..9ea9cc1a 100644
--- a/third_party/blink/renderer/core/dom/node.h
+++ b/third_party/blink/renderer/core/dom/node.h
@@ -839,7 +839,7 @@
 
   // Perform the default action for an event.
   virtual void DefaultEventHandler(Event&);
-  void WillCallDefaultEventHandler(const Event&);
+  void UpdateHadKeyboardEvent(const Event&);
   // Should return true if this Node has activation behavior.
   // https://dom.spec.whatwg.org/#eventtarget-activation-behavior
   virtual bool HasActivationBehavior() const;
diff --git a/third_party/blink/renderer/core/editing/editing_style.cc b/third_party/blink/renderer/core/editing/editing_style.cc
index a8cba15..263e937 100644
--- a/third_party/blink/renderer/core/editing/editing_style.cc
+++ b/third_party/blink/renderer/core/editing/editing_style.cc
@@ -70,8 +70,6 @@
 
 namespace blink {
 
-using namespace cssvalue;
-
 // Editing style properties must be preserved during editing operation.
 // e.g. when a user inserts a new paragraph, all properties listed here must be
 // copied to the new paragraph.
@@ -426,7 +424,7 @@
   if (!value)
     return Color::kTransparent;
 
-  auto* color_value = DynamicTo<CSSColorValue>(value);
+  auto* color_value = DynamicTo<cssvalue::CSSColorValue>(value);
   if (!color_value && !value->IsPrimitiveValue() && !value->IsIdentifierValue())
     return Color::kTransparent;
 
diff --git a/third_party/blink/renderer/core/editing/editing_style_utilities.cc b/third_party/blink/renderer/core/editing/editing_style_utilities.cc
index b25aba9..90ac69a 100644
--- a/third_party/blink/renderer/core/editing/editing_style_utilities.cc
+++ b/third_party/blink/renderer/core/editing/editing_style_utilities.cc
@@ -41,8 +41,6 @@
 
 namespace blink {
 
-using namespace cssvalue;
-
 namespace {
 
 Position AdjustedSelectionStartForStyleComputation(const Position& position) {
@@ -204,7 +202,7 @@
 bool EditingStyleUtilities::IsTransparentColorValue(const CSSValue* css_value) {
   if (!css_value)
     return true;
-  if (auto* color_value = DynamicTo<CSSColorValue>(css_value))
+  if (auto* color_value = DynamicTo<cssvalue::CSSColorValue>(css_value))
     return !color_value->Value().Alpha();
   if (auto* identifier_value = DynamicTo<CSSIdentifierValue>(css_value))
     return identifier_value->GetValueID() == CSSValueID::kTransparent;
diff --git a/third_party/blink/renderer/core/editing/editing_utilities.cc b/third_party/blink/renderer/core/editing/editing_utilities.cc
index cfa485cf..749319e3b 100644
--- a/third_party/blink/renderer/core/editing/editing_utilities.cc
+++ b/third_party/blink/renderer/core/editing/editing_utilities.cc
@@ -82,8 +82,6 @@
 
 namespace blink {
 
-using namespace html_names;
-
 namespace {
 
 std::ostream& operator<<(std::ostream& os, PositionMoveType type) {
@@ -412,8 +410,10 @@
       return true;
   }
 
-  if (auto* element = DynamicTo<Element>(&node))
-    return EqualIgnoringASCIICase(element->getAttribute(kRoleAttr), "textbox");
+  if (auto* element = DynamicTo<Element>(&node)) {
+    return EqualIgnoringASCIICase(element->getAttribute(html_names::kRoleAttr),
+                                  "textbox");
+  }
 
   return false;
 }
@@ -1122,10 +1122,13 @@
   if (!element)
     return false;
 
-  return element->HasTagName(kUTag) || element->HasTagName(kSTag) ||
-         element->HasTagName(kStrikeTag) || element->HasTagName(kITag) ||
-         element->HasTagName(kEmTag) || element->HasTagName(kBTag) ||
-         element->HasTagName(kStrongTag);
+  return element->HasTagName(html_names::kUTag) ||
+         element->HasTagName(html_names::kSTag) ||
+         element->HasTagName(html_names::kStrikeTag) ||
+         element->HasTagName(html_names::kITag) ||
+         element->HasTagName(html_names::kEmTag) ||
+         element->HasTagName(html_names::kBTag) ||
+         element->HasTagName(html_names::kStrongTag);
 }
 
 Element* AssociatedElementOf(const Position& position) {
@@ -1289,7 +1292,7 @@
                                              Text* tab_text_node) {
   // Make the span to hold the tab.
   auto* span_element = MakeGarbageCollected<HTMLSpanElement>(document);
-  span_element->setAttribute(kStyleAttr, "white-space:pre");
+  span_element->setAttribute(html_names::kStyleAttr, "white-space:pre");
 
   // Add tab text to that span.
   if (!tab_text_node)
@@ -1391,7 +1394,7 @@
   if (!element)
     return false;
 
-  return element->HasTagName(kBlockquoteTag) &&
+  return element->HasTagName(html_names::kBlockquoteTag) &&
          element->getAttribute("type") == "cite";
 }
 
@@ -1516,12 +1519,17 @@
   if (!element)
     return false;
 
-  return element->HasTagName(kListingTag) || element->HasTagName(kOlTag) ||
-         element->HasTagName(kPreTag) || element->HasTagName(kTableTag) ||
-         element->HasTagName(kUlTag) || element->HasTagName(kXmpTag) ||
-         element->HasTagName(kH1Tag) || element->HasTagName(kH2Tag) ||
-         element->HasTagName(kH3Tag) || element->HasTagName(kH4Tag) ||
-         element->HasTagName(kH5Tag);
+  return element->HasTagName(html_names::kListingTag) ||
+         element->HasTagName(html_names::kOlTag) ||
+         element->HasTagName(html_names::kPreTag) ||
+         element->HasTagName(html_names::kTableTag) ||
+         element->HasTagName(html_names::kUlTag) ||
+         element->HasTagName(html_names::kXmpTag) ||
+         element->HasTagName(html_names::kH1Tag) ||
+         element->HasTagName(html_names::kH2Tag) ||
+         element->HasTagName(html_names::kH3Tag) ||
+         element->HasTagName(html_names::kH4Tag) ||
+         element->HasTagName(html_names::kH5Tag);
 }
 
 bool IsBlockFlowElement(const Node& node) {
@@ -1708,7 +1716,7 @@
   // TODO(editing-dev): This should probably be reconciled with
   // HitTestResult::absoluteImageURL.
   if (IsHTMLImageElement(node) || IsHTMLInputElement(node))
-    return To<HTMLElement>(node).getAttribute(kSrcAttr);
+    return To<HTMLElement>(node).getAttribute(html_names::kSrcAttr);
   if (IsSVGImageElement(node))
     return To<SVGElement>(node).ImageSourceURL();
   if (IsHTMLEmbedElement(node) || IsHTMLObjectElement(node) ||
diff --git a/third_party/blink/renderer/core/editing/editor.cc b/third_party/blink/renderer/core/editing/editor.cc
index f6ed360..d983a80 100644
--- a/third_party/blink/renderer/core/editing/editor.cc
+++ b/third_party/blink/renderer/core/editing/editor.cc
@@ -93,8 +93,6 @@
 
 namespace blink {
 
-using namespace html_names;
-
 namespace {
 
 bool IsInPasswordFieldWithUnrevealedPassword(const Position& position) {
@@ -639,7 +637,8 @@
     if (direction == WritingDirection::kNatural)
       return;
     focused_element->setAttribute(
-        kDirAttr, direction == WritingDirection::kLeftToRight ? "ltr" : "rtl");
+        html_names::kDirAttr,
+        direction == WritingDirection::kLeftToRight ? "ltr" : "rtl");
     focused_element->DispatchInputEvent();
     return;
   }
diff --git a/third_party/blink/renderer/core/editing/inline_box_traversal.cc b/third_party/blink/renderer/core/editing/inline_box_traversal.cc
index 4a1219c..95196990 100644
--- a/third_party/blink/renderer/core/editing/inline_box_traversal.cc
+++ b/third_party/blink/renderer/core/editing/inline_box_traversal.cc
@@ -178,7 +178,7 @@
       return false;
     case NGCaretPositionType::kAtTextOffset:
       const auto& text_fragment = To<NGPhysicalTextFragment>(
-          caret_position.fragment->PhysicalFragment());
+          caret_position.PaintFragment()->PhysicalFragment());
       DCHECK(caret_position.text_offset.has_value());
       return *caret_position.text_offset == text_fragment.StartOffset();
   }
@@ -195,7 +195,7 @@
       return true;
     case NGCaretPositionType::kAtTextOffset:
       const auto& text_fragment = To<NGPhysicalTextFragment>(
-          caret_position.fragment->PhysicalFragment());
+          caret_position.PaintFragment()->PhysicalFragment());
       DCHECK(caret_position.text_offset.has_value());
       return *caret_position.text_offset == text_fragment.EndOffset();
   }
@@ -205,12 +205,13 @@
 
 // Returns whether |caret_position| is at the left or right side of fragment.
 SideAffinity GetSideAffinity(const NGCaretPosition& caret_position) {
-  DCHECK(caret_position.fragment);
+  DCHECK(caret_position.PaintFragment());
   DCHECK(IsAtFragmentStart(caret_position) || IsAtFragmentEnd(caret_position));
   const bool is_at_start = IsAtFragmentStart(caret_position);
   const bool is_at_left_side =
-      is_at_start ==
-      IsLtr(caret_position.fragment->PhysicalFragment().ResolvedDirection());
+      is_at_start == IsLtr(caret_position.PaintFragment()
+                               ->PhysicalFragment()
+                               .ResolvedDirection());
   return is_at_left_side ? SideAffinity::kLeft : SideAffinity::kRight;
 }
 
@@ -235,8 +236,9 @@
 
   explicit AbstractInlineBoxAndSideAffinity(
       const NGCaretPosition& caret_position)
-      : box_(*caret_position.fragment), side_(GetSideAffinity(caret_position)) {
-    DCHECK(caret_position.fragment);
+      : box_(*caret_position.PaintFragment()),
+        side_(GetSideAffinity(caret_position)) {
+    DCHECK(caret_position.PaintFragment());
   }
 
   InlineBoxPosition ToInlineBoxPosition() const {
@@ -254,9 +256,11 @@
     const NGPaintFragment& fragment = box_.GetNGPaintFragment();
     const NGPhysicalFragment& physical_fragment = fragment.PhysicalFragment();
     DCHECK(physical_fragment.IsInline());
+    NGInlineCursor cursor;
+    cursor.MoveTo(fragment);
 
     if (physical_fragment.IsBox()) {
-      return {&fragment,
+      return {cursor,
               is_at_start ? NGCaretPositionType::kBeforeBox
                           : NGCaretPositionType::kAfterBox,
               base::nullopt};
@@ -264,7 +268,7 @@
 
     const auto& text_fragment = To<NGPhysicalTextFragment>(physical_fragment);
     return {
-        &fragment, NGCaretPositionType::kAtTextOffset,
+        cursor, NGCaretPositionType::kAtTextOffset,
         is_at_start ? text_fragment.StartOffset() : text_fragment.EndOffset()};
   }
 
@@ -730,8 +734,9 @@
         const NGCaretPosition caret_position = ComputeNGCaretPosition(adjusted);
         if (caret_position.IsNull())
           return RenderedPosition();
-        return RenderedPosition(AbstractInlineBox(*caret_position.fragment),
-                                GetPotentialBidiBoundaryType(caret_position));
+        return RenderedPosition(
+            AbstractInlineBox(*caret_position.PaintFragment()),
+            GetPotentialBidiBoundaryType(caret_position));
       }
 
       const InlineBoxPosition box_position = ComputeInlineBoxPosition(adjusted);
diff --git a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc
index 490c9fd..c2bff8f 100644
--- a/third_party/blink/renderer/core/editing/iterators/text_iterator.cc
+++ b/third_party/blink/renderer/core/editing/iterators/text_iterator.cc
@@ -52,8 +52,6 @@
 
 namespace blink {
 
-using namespace html_names;
-
 namespace {
 
 template <typename Strategy>
@@ -603,16 +601,25 @@
   if (!r) {
     if (HasDisplayContents(node))
       return false;
-    return (node.HasTagName(kBlockquoteTag) || node.HasTagName(kDdTag) ||
-            node.HasTagName(kDivTag) || node.HasTagName(kDlTag) ||
-            node.HasTagName(kDtTag) || node.HasTagName(kH1Tag) ||
-            node.HasTagName(kH2Tag) || node.HasTagName(kH3Tag) ||
-            node.HasTagName(kH4Tag) || node.HasTagName(kH5Tag) ||
-            node.HasTagName(kH6Tag) || node.HasTagName(kHrTag) ||
-            node.HasTagName(kLiTag) || node.HasTagName(kListingTag) ||
-            node.HasTagName(kOlTag) || node.HasTagName(kPTag) ||
-            node.HasTagName(kPreTag) || node.HasTagName(kTrTag) ||
-            node.HasTagName(kUlTag));
+    return (node.HasTagName(html_names::kBlockquoteTag) ||
+            node.HasTagName(html_names::kDdTag) ||
+            node.HasTagName(html_names::kDivTag) ||
+            node.HasTagName(html_names::kDlTag) ||
+            node.HasTagName(html_names::kDtTag) ||
+            node.HasTagName(html_names::kH1Tag) ||
+            node.HasTagName(html_names::kH2Tag) ||
+            node.HasTagName(html_names::kH3Tag) ||
+            node.HasTagName(html_names::kH4Tag) ||
+            node.HasTagName(html_names::kH5Tag) ||
+            node.HasTagName(html_names::kH6Tag) ||
+            node.HasTagName(html_names::kHrTag) ||
+            node.HasTagName(html_names::kLiTag) ||
+            node.HasTagName(html_names::kListingTag) ||
+            node.HasTagName(html_names::kOlTag) ||
+            node.HasTagName(html_names::kPTag) ||
+            node.HasTagName(html_names::kPreTag) ||
+            node.HasTagName(html_names::kTrTag) ||
+            node.HasTagName(html_names::kUlTag));
   }
 
   // Need to make an exception for option and optgroup, because we want to
@@ -669,7 +676,7 @@
   if (!r || !r->IsBox())
     return false;
 
-  return node->HasTagName(kPTag);
+  return node->HasTagName(html_names::kPTag);
 }
 
 // Whether or not we should emit a character as we enter node_ (if it's a
diff --git a/third_party/blink/renderer/core/editing/selection_modifier.cc b/third_party/blink/renderer/core/editing/selection_modifier.cc
index 9e1eec8..9fd25c3 100644
--- a/third_party/blink/renderer/core/editing/selection_modifier.cc
+++ b/third_party/blink/renderer/core/editing/selection_modifier.cc
@@ -160,7 +160,7 @@
 
   if (NGInlineFormattingContextOf(adjusted.GetPosition())) {
     if (const NGPaintFragment* fragment =
-            ComputeNGCaretPosition(adjusted).fragment)
+            ComputeNGCaretPosition(adjusted).PaintFragment())
       return fragment->PhysicalFragment().ResolvedDirection();
     return base::nullopt;
   }
@@ -182,7 +182,7 @@
 
   if (NGInlineFormattingContextOf(adjusted.GetPosition())) {
     if (const NGPaintFragment* fragment =
-            ComputeNGCaretPosition(adjusted).fragment) {
+            ComputeNGCaretPosition(adjusted).PaintFragment()) {
       return ParagraphDirectionOf(*fragment);
     }
     return base::nullopt;
diff --git a/third_party/blink/renderer/core/editing/visible_units_line.cc b/third_party/blink/renderer/core/editing/visible_units_line.cc
index d1b12b1..d715eb9 100644
--- a/third_party/blink/renderer/core/editing/visible_units_line.cc
+++ b/third_party/blink/renderer/core/editing/visible_units_line.cc
@@ -69,10 +69,10 @@
       // |caret_position| here.
       return PositionWithAffinityTemplate<Strategy>();
     }
-    DCHECK(caret_position.fragment);
-    DCHECK(caret_position.fragment->ContainerLineBox());
+    DCHECK(caret_position.PaintFragment());
+    DCHECK(caret_position.PaintFragment()->ContainerLineBox());
     const NGPaintFragment* line_box_paint =
-        caret_position.fragment->ContainerLineBox();
+        caret_position.PaintFragment()->ContainerLineBox();
     const NGPhysicalLineBoxFragment& line_box =
         To<NGPhysicalLineBoxFragment>(line_box_paint->PhysicalFragment());
     const PhysicalOffset start_point = line_box.LineStartPoint();
@@ -255,10 +255,10 @@
       // |caret_position| here.
       return PositionWithAffinityTemplate<Strategy>();
     }
-    DCHECK(caret_position.fragment);
-    DCHECK(caret_position.fragment->ContainerLineBox());
+    DCHECK(caret_position.PaintFragment());
+    DCHECK(caret_position.PaintFragment()->ContainerLineBox());
     const NGPaintFragment* line_box_paint =
-        caret_position.fragment->ContainerLineBox();
+        caret_position.PaintFragment()->ContainerLineBox();
     const NGPhysicalLineBoxFragment& line_box =
         To<NGPhysicalLineBoxFragment>(line_box_paint->PhysicalFragment());
     const PhysicalOffset end_point = line_box.LineEndPoint();
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc
index 2268166..b1ca2ffe 100644
--- a/third_party/blink/renderer/core/frame/local_frame_view.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -1193,6 +1193,25 @@
   object->SetAncestorsNeedPaintPropertyUpdateForMainThreadScrolling();
 }
 
+bool LocalFrameView::RequiresMainThreadScrollingForBackgroundAttachmentFixed()
+    const {
+  if (background_attachment_fixed_objects_.IsEmpty())
+    return false;
+  if (background_attachment_fixed_objects_.size() > 1)
+    return true;
+
+  const auto* object =
+      ToLayoutBoxModelObject(*background_attachment_fixed_objects_.begin());
+  // We should not add such object in the set.
+  DCHECK(!object->BackgroundTransfersToView());
+  // If the background is viewport background and it paints onto the main
+  // graphics layer only, then it doesn't need main thread scrolling.
+  if (object->IsLayoutView() &&
+      object->GetBackgroundPaintLocation() == kBackgroundPaintInGraphicsLayer)
+    return false;
+  return true;
+}
+
 void LocalFrameView::AddViewportConstrainedObject(LayoutObject& object) {
   if (!viewport_constrained_objects_)
     viewport_constrained_objects_ = std::make_unique<ObjectSet>();
@@ -4210,7 +4229,7 @@
   if (ShouldThrottleRendering())
     return reasons;
 
-  if (HasBackgroundAttachmentFixedObjects()) {
+  if (RequiresMainThreadScrollingForBackgroundAttachmentFixed()) {
     reasons |=
         cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
   }
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h
index 638ba2a..ae0bc40b 100644
--- a/third_party/blink/renderer/core/frame/local_frame_view.h
+++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -294,9 +294,7 @@
   // Objects with background-attachment:fixed.
   void AddBackgroundAttachmentFixedObject(LayoutObject*);
   void RemoveBackgroundAttachmentFixedObject(LayoutObject*);
-  bool HasBackgroundAttachmentFixedObjects() const {
-    return background_attachment_fixed_objects_.size();
-  }
+  bool RequiresMainThreadScrollingForBackgroundAttachmentFixed() const;
   const ObjectSet& BackgroundAttachmentFixedObjects() const {
     return background_attachment_fixed_objects_;
   }
diff --git a/third_party/blink/renderer/core/frame/local_frame_view_test.cc b/third_party/blink/renderer/core/frame/local_frame_view_test.cc
index 0c9c6049..4acda97 100644
--- a/third_party/blink/renderer/core/frame/local_frame_view_test.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_view_test.cc
@@ -186,6 +186,120 @@
   EXPECT_TRUE(ChildDocument().View()->CanHaveScrollbars());
 }
 
+TEST_F(LocalFrameViewTest,
+       MainThreadScrollingForBackgroundFixedAttachmentWithCompositing) {
+  GetDocument().GetFrame()->GetSettings()->SetPreferCompositingToLCDTextEnabled(
+      true);
+
+  SetBodyInnerHTML(R"HTML(
+    <style>
+      .fixed-background {
+        background: linear-gradient(blue, red) fixed;
+      }
+    </style>
+    <div id="div" style="width: 5000px; height: 5000px"></div>
+  )HTML");
+
+  auto* frame_view = GetDocument().View();
+  EXPECT_EQ(0u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_FALSE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  Element* body = GetDocument().body();
+  Element* html = GetDocument().documentElement();
+  Element* div = GetDocument().getElementById("div");
+
+  // Only body has fixed background. No main thread scrolling.
+  body->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(1u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_FALSE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  // Both body and div have fixed background. Requires main thread scrolling.
+  div->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(2u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  // Only div has fixed background. Requires main thread scrolling.
+  body->removeAttribute(html_names::kClassAttr);
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(1u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  // Only html has fixed background. No main thread scrolling.
+  div->removeAttribute(html_names::kClassAttr);
+  html->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(1u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_FALSE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  // Both html and body have fixed background. Requires main thread scrolling.
+  body->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(2u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+}
+
+TEST_F(LocalFrameViewTest,
+       MainThreadScrollingForBackgroundFixedAttachmentWithoutCompositing) {
+  SetBodyInnerHTML(R"HTML(
+    <style>
+      .fixed-background {
+        background: linear-gradient(blue, red) fixed;
+      }
+    </style>
+    <div id="div" style="width: 5000px; height: 5000px"></div>
+  )HTML");
+
+  auto* frame_view = GetDocument().View();
+  EXPECT_EQ(0u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_FALSE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  Element* body = GetDocument().body();
+  Element* html = GetDocument().documentElement();
+  Element* div = GetDocument().getElementById("div");
+
+  // When not prefer compositing, we use main thread scrolling when there is
+  // any object with fixed-attachment background.
+  body->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(1u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  div->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(2u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  body->removeAttribute(html_names::kClassAttr);
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(1u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  div->removeAttribute(html_names::kClassAttr);
+  html->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(1u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+
+  body->setAttribute(html_names::kClassAttr, "fixed-background");
+  UpdateAllLifecyclePhasesForTest();
+  EXPECT_EQ(2u, frame_view->BackgroundAttachmentFixedObjects().size());
+  EXPECT_TRUE(
+      frame_view->RequiresMainThreadScrollingForBackgroundAttachmentFixed());
+}
+
 // Ensure the fragment navigation "scroll into view and focus" behavior doesn't
 // activate synchronously while rendering is blocked waiting on a stylesheet.
 // See https://crbug.com/851338.
diff --git a/third_party/blink/renderer/core/html/forms/html_form_control_element.cc b/third_party/blink/renderer/core/html/forms/html_form_control_element.cc
index acc3d40..a0b23f3b 100644
--- a/third_party/blink/renderer/core/html/forms/html_form_control_element.cc
+++ b/third_party/blink/renderer/core/html/forms/html_form_control_element.cc
@@ -25,6 +25,7 @@
 #include "third_party/blink/renderer/core/html/forms/html_form_control_element.h"
 
 #include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
+#include "third_party/blink/renderer/core/css/selector_checker.h"
 #include "third_party/blink/renderer/core/dom/element_traversal.h"
 #include "third_party/blink/renderer/core/dom/events/event.h"
 #include "third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h"
@@ -296,8 +297,7 @@
 }
 
 bool HTMLFormControlElement::ShouldHaveFocusAppearance() const {
-  return (GetDocument().LastFocusType() != kWebFocusTypeMouse) ||
-         GetDocument().HadKeyboardEvent() || MayTriggerVirtualKeyboard();
+  return SelectorChecker::MatchesFocusVisiblePseudoClass(*this);
 }
 
 int HTMLFormControlElement::tabIndex() const {
diff --git a/third_party/blink/renderer/core/html/track/html_track_element.cc b/third_party/blink/renderer/core/html/track/html_track_element.cc
index f31f4b3..f43af15 100644
--- a/third_party/blink/renderer/core/html/track/html_track_element.cc
+++ b/third_party/blink/renderer/core/html/track/html_track_element.cc
@@ -40,8 +40,6 @@
 
 namespace blink {
 
-using namespace html_names;
-
 static String UrlForLoggingTrack(const KURL& url) {
   static const unsigned kMaximumURLLengthForLogging = 128;
 
@@ -51,7 +49,7 @@
 }
 
 HTMLTrackElement::HTMLTrackElement(Document& document)
-    : HTMLElement(kTrackTag, document),
+    : HTMLElement(html_names::kTrackTag, document),
       load_timer_(document.GetTaskRunner(TaskType::kNetworking),
                   this,
                   &HTMLTrackElement::LoadTimerFired) {
@@ -83,13 +81,13 @@
 void HTMLTrackElement::ParseAttribute(
     const AttributeModificationParams& params) {
   const QualifiedName& name = params.name;
-  if (name == kSrcAttr) {
+  if (name == html_names::kSrcAttr) {
     ScheduleLoad();
 
     // 4.8.10.12.3 Sourcing out-of-band text tracks
     // As the kind, label, and srclang attributes are set, changed, or removed,
     // the text track must update accordingly...
-  } else if (name == kKindAttr) {
+  } else if (name == html_names::kKindAttr) {
     AtomicString lower_case_value = params.new_value.LowerASCII();
     // 'missing value default' ("subtitles")
     if (lower_case_value.IsNull())
@@ -99,11 +97,11 @@
       lower_case_value = TextTrack::MetadataKeyword();
 
     track()->SetKind(lower_case_value);
-  } else if (name == kLabelAttr) {
+  } else if (name == html_names::kLabelAttr) {
     track()->SetLabel(params.new_value);
-  } else if (name == kSrclangAttr) {
+  } else if (name == html_names::kSrclangAttr) {
     track()->SetLanguage(params.new_value);
-  } else if (name == kIdAttr) {
+  } else if (name == html_names::kIdAttr) {
     track()->SetId(params.new_value);
   }
 
@@ -115,7 +113,7 @@
 }
 
 void HTMLTrackElement::setKind(const AtomicString& kind) {
-  setAttribute(kKindAttr, kind);
+  setAttribute(html_names::kKindAttr, kind);
 }
 
 LoadableTextTrack* HTMLTrackElement::EnsureTrack() {
@@ -131,7 +129,7 @@
 }
 
 bool HTMLTrackElement::IsURLAttribute(const Attribute& attribute) const {
-  return attribute.GetName() == kSrcAttr ||
+  return attribute.GetName() == html_names::kSrcAttr ||
          HTMLElement::IsURLAttribute(attribute);
 }
 
@@ -169,7 +167,7 @@
   DVLOG(TRACK_LOG_LEVEL) << "loadTimerFired";
 
   // 7. [X] Let URL be the track URL of the track element.
-  KURL url = GetNonEmptyURLAttribute(kSrcAttr);
+  KURL url = GetNonEmptyURLAttribute(html_names::kSrcAttr);
 
   // Whenever a track element has its src attribute set, changed,
   // or removed, the user agent must immediately empty the
diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_parser.cc b/third_party/blink/renderer/core/html/track/vtt/vtt_parser.cc
index d6db892..52a3ba9f 100644
--- a/third_party/blink/renderer/core/html/track/vtt/vtt_parser.cc
+++ b/third_party/blink/renderer/core/html/track/vtt/vtt_parser.cc
@@ -52,8 +52,6 @@
 
 namespace blink {
 
-using namespace html_names;
-
 const unsigned kFileIdentifierLength = 6;
 const unsigned kRegionIdentifierLength = 6;
 const unsigned kStyleIdentifierLength = 5;
@@ -608,7 +606,7 @@
       child->SetTrack(track_);
 
       if (!token_.Classes().IsEmpty())
-        child->setAttribute(kClassAttr, token_.Classes());
+        child->setAttribute(html_names::kClassAttr, token_.Classes());
 
       if (node_type == kVTTNodeTypeVoice) {
         child->setAttribute(VTTElement::VoiceAttributeName(),
diff --git a/third_party/blink/renderer/core/layout/line/DEPS b/third_party/blink/renderer/core/layout/line/DEPS
index 8578476..ef0a337 100644
--- a/third_party/blink/renderer/core/layout/line/DEPS
+++ b/third_party/blink/renderer/core/layout/line/DEPS
@@ -4,6 +4,7 @@
     "+third_party/blink/renderer/core/layout/api",
     "+third_party/blink/renderer/core/layout/line",
     "+third_party/blink/renderer/core/layout/logical_values.h",
+    "+third_party/blink/renderer/core/layout/ng/inline",
     "+third_party/blink/renderer/platform",
 
     "!third_party/blink/renderer/core/layout/bidi_run.h",
diff --git a/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc b/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc
index 3975237c..1907ede 100644
--- a/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc
+++ b/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc
@@ -33,6 +33,8 @@
 #include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
 #include "third_party/blink/renderer/core/editing/ephemeral_range.h"
 #include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
+#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h"
+#include "third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h"
 #include "third_party/blink/renderer/platform/text/text_break_iterator.h"
 
 namespace blink {
@@ -149,6 +151,28 @@
   return inline_text_box_->Len();
 }
 
+unsigned LegacyAbstractInlineTextBox::TextOffsetInContainer(
+    unsigned offset) const {
+  if (!inline_text_box_)
+    return 0;
+
+  unsigned offset_in_container = inline_text_box_->Start() + offset;
+
+  const NGOffsetMapping* offset_mapping = GetOffsetMapping();
+  if (!offset_mapping)
+    return offset_in_container;
+
+  // The start offset of the inline text box returned by
+  // inline_text_box_->Start() includes the collapsed white-spaces. Here, we
+  // want the position in the parent node after white-space collapsing.
+  // NGOffsetMapping can map an offset before whites-spaces are collapsed to the
+  // offset after white-spaces are collapsed.
+  Position position(GetNode(), offset_in_container);
+  const NGOffsetMappingUnit* unit =
+      offset_mapping->GetMappingUnitForPosition(position);
+  return offset_in_container - unit->DOMStart() + unit->TextContentStart();
+}
+
 AbstractInlineTextBox::Direction LegacyAbstractInlineTextBox::GetDirection()
     const {
   if (!inline_text_box_ || !GetLineLayoutItem())
@@ -279,4 +303,23 @@
   return inline_text_box_->IsLineBreak();
 }
 
+const NGOffsetMapping* LegacyAbstractInlineTextBox::GetOffsetMapping() const {
+  const auto* text_node = DynamicTo<Text>(GetNode());
+
+  LayoutBlockFlow& block_flow = *NGOffsetMapping::GetInlineFormattingContextOf(
+      *text_node->GetLayoutObject());
+  const NGOffsetMapping* offset_mapping =
+      NGInlineNode::GetOffsetMapping(&block_flow);
+
+  if (UNLIKELY(!offset_mapping)) {
+    // TODO(crbug.com/955678): There are certain cases where we fail to
+    // compute // |NGOffsetMapping| due to failures in layout. As the root
+    // cause is hard to fix at the moment, we work around it here so that the
+    // production build doesn't crash.
+    NOTREACHED();
+    return nullptr;
+  }
+  return offset_mapping;
+}
+
 }  // namespace blink
diff --git a/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.h b/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.h
index c173fe2..a820acd 100644
--- a/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.h
+++ b/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.h
@@ -42,6 +42,7 @@
 namespace blink {
 
 class InlineTextBox;
+class NGOffsetMapping;
 
 // High-level abstraction of InlineTextBox to allow the accessibility module to
 // get information about InlineTextBoxes without tight coupling.
@@ -66,6 +67,7 @@
   virtual scoped_refptr<AbstractInlineTextBox> NextInlineTextBox() const = 0;
   virtual LayoutRect LocalBounds() const = 0;
   virtual unsigned Len() const = 0;
+  virtual unsigned TextOffsetInContainer(unsigned) const = 0;
   virtual Direction GetDirection() const = 0;
   Node* GetNode() const;
   virtual void CharacterWidths(Vector<float>&) const = 0;
@@ -112,6 +114,7 @@
   scoped_refptr<AbstractInlineTextBox> NextInlineTextBox() const final;
   LayoutRect LocalBounds() const final;
   unsigned Len() const final;
+  unsigned TextOffsetInContainer(unsigned offset) const final;
   Direction GetDirection() const final;
   void CharacterWidths(Vector<float>&) const final;
   String GetText() const final;
@@ -120,6 +123,7 @@
   scoped_refptr<AbstractInlineTextBox> NextOnLine() const final;
   scoped_refptr<AbstractInlineTextBox> PreviousOnLine() const final;
   bool IsLineBreak() const final;
+  const NGOffsetMapping* GetOffsetMapping() const;
 
   InlineTextBox* inline_text_box_;
 
diff --git a/third_party/blink/renderer/core/layout/line/abstract_inline_text_box_test.cc b/third_party/blink/renderer/core/layout/line/abstract_inline_text_box_test.cc
index 3ef3eba..d63206f 100644
--- a/third_party/blink/renderer/core/layout/line/abstract_inline_text_box_test.cc
+++ b/third_party/blink/renderer/core/layout/line/abstract_inline_text_box_test.cc
@@ -114,4 +114,37 @@
   EXPECT_EQ("abc: ", inline_text_box->GetText());
 }
 
+TEST_P(AbstractInlineTextBoxTest, GetTextOffsetInContainer) {
+  // "&#10" is a Line Feed ("\n").
+  SetBodyInnerHTML(
+      R"HTML(<style>p { white-space: pre-line; }</style>
+      <p id="paragraph">First sentence of the &#10; paragraph. Second sentence of &#10; the paragraph.</p>)HTML");
+
+  const Element& paragraph = *GetDocument().getElementById("paragraph");
+  LayoutText& layout_text =
+      *ToLayoutText(paragraph.firstChild()->GetLayoutObject());
+
+  // This test has 5 AbstractInlineTextBox. 1.text 2.\n 3.text 4.\n 5.text.
+  // The AbstractInlineTextBoxes are all child of the same text node and an
+  // an offset calculated in the container node should always be the same for
+  // both LayoutNG and Legacy, even though Legacy doesn't collapse the
+  // white-spaces at the end of an AbstractInlineTextBox.
+  scoped_refptr<AbstractInlineTextBox> inline_text_box =
+      layout_text.FirstAbstractInlineTextBox();
+  String text = "First sentence of the";
+  EXPECT_EQ(LayoutNGEnabled() ? text : text + " ", inline_text_box->GetText());
+  EXPECT_EQ(0u, inline_text_box->TextOffsetInContainer(0));
+
+  // Need to jump over the line break AbstractInlineTextBox.
+  inline_text_box = inline_text_box->NextInlineTextBox()->NextInlineTextBox();
+  text = "paragraph. Second sentence of";
+  EXPECT_EQ(LayoutNGEnabled() ? text : text + " ", inline_text_box->GetText());
+  EXPECT_EQ(22u, inline_text_box->TextOffsetInContainer(0));
+
+  // See comment above.
+  inline_text_box = inline_text_box->NextInlineTextBox()->NextInlineTextBox();
+  EXPECT_EQ("the paragraph.", inline_text_box->GetText());
+  EXPECT_EQ(52u, inline_text_box->TextOffsetInContainer(0));
+}
+
 }  // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.cc
index 79775026..8a5f0a7 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.cc
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.cc
@@ -151,6 +151,12 @@
   return PhysicalTextFragment().TextLength();
 }
 
+unsigned NGAbstractInlineTextBox::TextOffsetInContainer(unsigned offset) const {
+  if (!fragment_)
+    return 0;
+  return PhysicalTextFragment().StartOffset() + offset;
+}
+
 AbstractInlineTextBox::Direction NGAbstractInlineTextBox::GetDirection() const {
   if (!fragment_ || !GetLineLayoutItem())
     return kLeftToRight;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.h b/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.h
index 551e564..1f1d57d 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.h
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.h
@@ -43,6 +43,7 @@
   scoped_refptr<AbstractInlineTextBox> NextInlineTextBox() const final;
   LayoutRect LocalBounds() const final;
   unsigned Len() const final;
+  unsigned TextOffsetInContainer(unsigned offset) const final;
   Direction GetDirection() const final;
   void CharacterWidths(Vector<float>&) const final;
   String GetText() const final;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.cc
index 01ea3fc..b01d591b 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.cc
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.cc
@@ -8,6 +8,8 @@
 #include "third_party/blink/renderer/core/editing/position_with_affinity.h"
 #include "third_party/blink/renderer/core/editing/text_affinity.h"
 #include "third_party/blink/renderer/core/layout/layout_block_flow.h"
+#include "third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.h"
+#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h"
 #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h"
 #include "third_party/blink/renderer/core/layout/ng/inline/ng_offset_mapping.h"
 #include "third_party/blink/renderer/core/layout/ng/inline/ng_physical_line_box_fragment.h"
@@ -40,40 +42,43 @@
 
 enum class ResolutionType { kFailed, kFoundCandidate, kResolved };
 struct CaretPositionResolution {
+  STACK_ALLOCATED();
+
+ public:
   ResolutionType type = ResolutionType::kFailed;
   NGCaretPosition caret_position;
 };
 
-bool CanResolveCaretPositionBeforeFragment(const NGPaintFragment& fragment,
+bool CanResolveCaretPositionBeforeFragment(const NGInlineCursor& cursor,
                                            TextAffinity affinity) {
   if (affinity == TextAffinity::kDownstream)
     return true;
   if (RuntimeEnabledFeatures::BidiCaretAffinityEnabled())
     return false;
-  const NGPaintFragment* current_line_paint = fragment.ContainerLineBox();
-  const auto& current_line =
-      To<NGPhysicalLineBoxFragment>(current_line_paint->PhysicalFragment());
+  NGInlineCursor current_line(cursor);
+  current_line.MoveToContainingLine();
   // A fragment after line wrap must be the first logical leaf in its line.
-  if (&fragment.PhysicalFragment() != current_line.FirstLogicalLeaf())
+  NGInlineCursor first_logical_leaf(current_line);
+  first_logical_leaf.MoveToFirstLogicalLeaf();
+  if (cursor != first_logical_leaf)
     return true;
-  const NGPaintFragment* last_line_paint =
-      NGPaintFragmentTraversal::PreviousLineOf(*current_line_paint);
-  return !last_line_paint ||
-         !To<NGPhysicalLineBoxFragment>(last_line_paint->PhysicalFragment())
-              .HasSoftWrapToNextLine();
+  NGInlineCursor last_line(current_line);
+  last_line.MoveToPreviousLine();
+  return !last_line || !last_line.HasSoftWrapToNextLine();
 }
 
-bool CanResolveCaretPositionAfterFragment(const NGPaintFragment& fragment,
+bool CanResolveCaretPositionAfterFragment(const NGInlineCursor& cursor,
                                           TextAffinity affinity) {
   if (affinity == TextAffinity::kUpstream)
     return true;
   if (RuntimeEnabledFeatures::BidiCaretAffinityEnabled())
     return false;
-  const NGPaintFragment* current_line_paint = fragment.ContainerLineBox();
-  const auto& current_line =
-      To<NGPhysicalLineBoxFragment>(current_line_paint->PhysicalFragment());
+  NGInlineCursor current_line(cursor);
+  current_line.MoveToContainingLine();
   // A fragment before line wrap must be the last logical leaf in its line.
-  if (&fragment.PhysicalFragment() != current_line.LastLogicalLeaf())
+  NGInlineCursor last_logical_leaf(current_line);
+  last_logical_leaf.MoveToLastLogicalLeaf();
+  if (cursor != last_logical_leaf)
     return true;
   return !current_line.HasSoftWrapToNextLine();
 }
@@ -82,16 +87,14 @@
 // fragment. Otherwise, return either |kFoundCandidate| or |kResolved| depending
 // on |affinity|.
 CaretPositionResolution TryResolveCaretPositionInTextFragment(
-    const NGPaintFragment& paint_fragment,
+    const NGInlineCursor& cursor,
     unsigned offset,
     TextAffinity affinity) {
-  const auto& fragment =
-      To<NGPhysicalTextFragment>(paint_fragment.PhysicalFragment());
-  if (fragment.IsGeneratedText())
+  if (cursor.IsGeneratedText())
     return CaretPositionResolution();
 
   const NGOffsetMapping& mapping =
-      *NGOffsetMapping::GetFor(paint_fragment.GetLayoutObject());
+      *NGOffsetMapping::GetFor(cursor.CurrentLayoutObject());
 
   // A text fragment natually allows caret placement in offset range
   // [StartOffset(), EndOffset()], i.e., from before the first character to
@@ -103,29 +106,31 @@
   // Note that we don't ignore other characters that are not in fragments. For
   // example, a trailing space of a line is not in any fragment, but its two
   // sides are still different caret positions, so we don't ignore it.
-  if (offset < fragment.StartOffset() &&
-      !mapping.HasBidiControlCharactersOnly(offset, fragment.StartOffset()))
+  const unsigned start_offset = cursor.CurrentTextStartOffset();
+  const unsigned end_offset = cursor.CurrentTextEndOffset();
+  if (offset < start_offset &&
+      !mapping.HasBidiControlCharactersOnly(offset, start_offset))
     return CaretPositionResolution();
-  if (offset > fragment.EndOffset() &&
-      !mapping.HasBidiControlCharactersOnly(fragment.EndOffset(), offset))
+  if (offset > cursor.CurrentTextEndOffset() &&
+      !mapping.HasBidiControlCharactersOnly(end_offset, offset))
     return CaretPositionResolution();
 
-  offset = std::max(offset, fragment.StartOffset());
-  offset = std::min(offset, fragment.EndOffset());
-  NGCaretPosition candidate = {&paint_fragment,
-                               NGCaretPositionType::kAtTextOffset, offset};
+  offset = std::max(offset, start_offset);
+  offset = std::min(offset, end_offset);
+  NGCaretPosition candidate = {cursor, NGCaretPositionType::kAtTextOffset,
+                               offset};
 
   // Offsets in the interior of a fragment can be resolved directly.
-  if (offset > fragment.StartOffset() && offset < fragment.EndOffset())
+  if (offset > start_offset && offset < end_offset)
     return {ResolutionType::kResolved, candidate};
 
-  if (offset == fragment.StartOffset() &&
-      CanResolveCaretPositionBeforeFragment(paint_fragment, affinity)) {
+  if (offset == start_offset &&
+      CanResolveCaretPositionBeforeFragment(cursor, affinity)) {
     return {ResolutionType::kResolved, candidate};
   }
 
-  if (offset == fragment.EndOffset() && !fragment.IsLineBreak() &&
-      CanResolveCaretPositionAfterFragment(paint_fragment, affinity)) {
+  if (offset == end_offset && !cursor.IsLineBreak() &&
+      CanResolveCaretPositionAfterFragment(cursor, affinity)) {
     return {ResolutionType::kResolved, candidate};
   }
 
@@ -133,13 +138,11 @@
   return {ResolutionType::kFoundCandidate, candidate};
 }
 
-unsigned GetTextOffsetBefore(const NGPhysicalFragment& fragment) {
+unsigned GetTextOffsetBefore(const Node& node) {
   // TODO(xiaochengh): Design more straightforward way to get text offset of
   // atomic inline box.
-  DCHECK(fragment.IsAtomicInline());
-  const Node* node = fragment.GetNode();
-  DCHECK(node);
-  const Position before_node = Position::BeforeNode(*node);
+  DCHECK(node.GetLayoutObject()->IsAtomicInlineLevel());
+  const Position before_node = Position::BeforeNode(node);
   base::Optional<unsigned> maybe_offset_before =
       NGOffsetMapping::GetFor(before_node)->GetTextContentOffset(before_node);
   // We should have offset mapping for atomic inline boxes.
@@ -151,18 +154,18 @@
 // inline box fragment. Otherwise, return either |kFoundCandidate| or
 // |kResolved| depending on |affinity|.
 CaretPositionResolution TryResolveCaretPositionByBoxFragmentSide(
-    const NGPaintFragment& fragment,
+    const NGInlineCursor& cursor,
     unsigned offset,
     TextAffinity affinity) {
+  const Node* const node = cursor.CurrentNode();
   // There is no caret position at a pseudo or generated box side.
-  if (!fragment.GetNode() || fragment.GetNode()->IsPseudoElement()) {
+  if (!node || node->IsPseudoElement()) {
     // TODO(xiaochengh): This leads to false negatives for, e.g., RUBY, where an
     // anonymous wrapping inline block is created.
     return CaretPositionResolution();
   }
 
-  const unsigned offset_before =
-      GetTextOffsetBefore(fragment.PhysicalFragment());
+  const unsigned offset_before = GetTextOffsetBefore(*node);
   const unsigned offset_after = offset_before + 1;
   // TODO(xiaochengh): Ignore bidi control characters before & after the box.
   if (offset != offset_before && offset != offset_after)
@@ -170,15 +173,15 @@
   const NGCaretPositionType position_type =
       offset == offset_before ? NGCaretPositionType::kBeforeBox
                               : NGCaretPositionType::kAfterBox;
-  NGCaretPosition candidate{&fragment, position_type, base::nullopt};
+  NGCaretPosition candidate{cursor, position_type, base::nullopt};
 
   if (offset == offset_before &&
-      CanResolveCaretPositionBeforeFragment(fragment, affinity)) {
+      CanResolveCaretPositionBeforeFragment(cursor, affinity)) {
     return {ResolutionType::kResolved, candidate};
   }
 
   if (offset == offset_after &&
-      CanResolveCaretPositionAfterFragment(fragment, affinity)) {
+      CanResolveCaretPositionAfterFragment(cursor, affinity)) {
     return {ResolutionType::kResolved, candidate};
   }
 
@@ -186,18 +189,13 @@
 }
 
 CaretPositionResolution TryResolveCaretPositionWithFragment(
-    const NGPaintFragment& paint_fragment,
+    const NGInlineCursor& cursor,
     unsigned offset,
     TextAffinity affinity) {
-  const NGPhysicalFragment& fragment = paint_fragment.PhysicalFragment();
-  if (fragment.IsText()) {
-    return TryResolveCaretPositionInTextFragment(paint_fragment, offset,
-                                                 affinity);
-  }
-  if (fragment.IsBox() && fragment.IsAtomicInline()) {
-    return TryResolveCaretPositionByBoxFragmentSide(paint_fragment, offset,
-                                                    affinity);
-  }
+  if (cursor.IsText())
+    return TryResolveCaretPositionInTextFragment(cursor, offset, affinity);
+  if (cursor.IsAtomicInline())
+    return TryResolveCaretPositionByBoxFragmentSide(cursor, offset, affinity);
   return CaretPositionResolution();
 }
 
@@ -209,15 +207,15 @@
   if (caret_position.position_type != NGCaretPositionType::kAtTextOffset)
     return true;
   DCHECK(caret_position.text_offset.has_value());
-  const auto& text_fragment =
-      To<NGPhysicalTextFragment>(caret_position.fragment->PhysicalFragment());
-  DCHECK_GE(*caret_position.text_offset, text_fragment.StartOffset());
-  DCHECK_LE(*caret_position.text_offset, text_fragment.EndOffset());
+  const unsigned start_offset = caret_position.cursor.CurrentTextStartOffset();
+  const unsigned end_offset = caret_position.cursor.CurrentTextEndOffset();
+  DCHECK_GE(*caret_position.text_offset, start_offset);
+  DCHECK_LE(*caret_position.text_offset, end_offset);
   // Bidi adjustment is needed only for caret positions at bidi boundaries.
   // Caret positions in the middle of a text fragment can't be at bidi
   // boundaries, and hence, don't need any adjustment.
-  return *caret_position.text_offset == text_fragment.StartOffset() ||
-         *caret_position.text_offset == text_fragment.EndOffset();
+  return *caret_position.text_offset == start_offset ||
+         *caret_position.text_offset == end_offset;
 }
 
 NGCaretPosition AdjustCaretPositionForBidiText(
@@ -231,14 +229,13 @@
   if (caret_position.position_type != NGCaretPositionType::kAtTextOffset)
     return false;
 
-  DCHECK(caret_position.fragment);
+  DCHECK(caret_position.cursor.IsNotNull());
   DCHECK(caret_position.text_offset.has_value());
 
-  const auto& text_fragment =
-      To<NGPhysicalTextFragment>(caret_position.fragment->PhysicalFragment());
-  if (!text_fragment.IsLineBreak())
+  if (!caret_position.cursor.IsLineBreak())
     return false;
-  return *caret_position.text_offset == text_fragment.EndOffset();
+  return *caret_position.text_offset ==
+         caret_position.cursor.CurrentTextEndOffset();
 }
 
 NGCaretPosition BetterCandidateBetween(const NGCaretPosition& current,
@@ -269,14 +266,12 @@
 NGCaretPosition ComputeNGCaretPosition(const LayoutBlockFlow& context,
                                        unsigned offset,
                                        TextAffinity affinity) {
-  const NGPaintFragment* root_fragment = context.PaintFragment();
-  DCHECK(root_fragment) << "no paint fragment on layout object " << &context;
+  NGInlineCursor cursor(context);
 
   NGCaretPosition candidate;
-  for (const NGPaintFragment* child :
-       NGPaintFragmentTraversal::InlineDescendantsOf(*root_fragment)) {
+  for (; cursor; cursor.MoveToNext()) {
     const CaretPositionResolution resolution =
-        TryResolveCaretPositionWithFragment(*child, offset, affinity);
+        TryResolveCaretPositionWithFragment(cursor, offset, affinity);
 
     if (resolution.type == ResolutionType::kFailed)
       continue;
@@ -321,28 +316,28 @@
 }
 
 PositionWithAffinity NGCaretPosition::ToPositionInDOMTreeWithAffinity() const {
-  if (!fragment)
+  if (IsNull())
     return PositionWithAffinity();
   switch (position_type) {
     case NGCaretPositionType::kBeforeBox:
-      if (!fragment->GetNode())
+      if (cursor.CurrentNode())
         return PositionWithAffinity();
-      return PositionWithAffinity(Position::BeforeNode(*fragment->GetNode()),
+      return PositionWithAffinity(Position::BeforeNode(*cursor.CurrentNode()),
                                   TextAffinity::kDownstream);
     case NGCaretPositionType::kAfterBox:
-      if (!fragment->GetNode())
+      if (cursor.CurrentNode())
         return PositionWithAffinity();
-      return PositionWithAffinity(Position::AfterNode(*fragment->GetNode()),
+      return PositionWithAffinity(Position::AfterNode(*cursor.CurrentNode()),
                                   TextAffinity::kUpstreamIfPossible);
     case NGCaretPositionType::kAtTextOffset:
+      // In case of ::first-letter, |cursor.CurrentNode()| is null.
       DCHECK(text_offset.has_value());
       const NGOffsetMapping* mapping =
-          NGOffsetMapping::GetFor(fragment->GetLayoutObject());
-      const auto& text_fragment =
-          To<NGPhysicalTextFragment>(fragment->PhysicalFragment());
-      const TextAffinity affinity = *text_offset == text_fragment.EndOffset()
-                                        ? TextAffinity::kUpstreamIfPossible
-                                        : TextAffinity::kDownstream;
+          NGOffsetMapping::GetFor(cursor.CurrentLayoutObject());
+      const TextAffinity affinity =
+          *text_offset == cursor.CurrentTextEndOffset()
+              ? TextAffinity::kUpstreamIfPossible
+              : TextAffinity::kDownstream;
       const Position position = affinity == TextAffinity::kDownstream
                                     ? mapping->GetLastPosition(*text_offset)
                                     : mapping->GetFirstPosition(*text_offset);
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.h b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.h
index 333934a..6d0d0720 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.h
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position.h
@@ -8,11 +8,11 @@
 #include "base/optional.h"
 #include "third_party/blink/renderer/core/core_export.h"
 #include "third_party/blink/renderer/core/editing/forward.h"
+#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h"
 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
 
 namespace blink {
 
-class NGPaintFragment;
 class LayoutBlockFlow;
 
 // An NGCaretPosition indicates a caret position relative to an inline
@@ -27,14 +27,21 @@
 
 enum class NGCaretPositionType { kBeforeBox, kAfterBox, kAtTextOffset };
 struct NGCaretPosition {
-  DISALLOW_NEW();
+  STACK_ALLOCATED();
 
-  bool IsNull() const { return !fragment; }
+ public:
+  bool IsNull() const { return cursor.IsNull(); }
+
+  // TODO(yosin): We'll remove |NGCaretPosition::PaintFragment()|, once all
+  // clients work with |NGInlineCursor|.
+  const NGPaintFragment* PaintFragment() const {
+    return cursor.CurrentPaintFragment();
+  }
 
   Position ToPositionInDOMTree() const;
   PositionWithAffinity ToPositionInDOMTreeWithAffinity() const;
 
-  const NGPaintFragment* fragment = nullptr;  // owned by root LayoutNGMixin
+  NGInlineCursor cursor;
   NGCaretPositionType position_type;
   base::Optional<unsigned> text_offset;
 };
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position_test.cc
index 6874232..a820dcb 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position_test.cc
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_position_test.cc
@@ -64,8 +64,8 @@
 
 #define TEST_CARET(caret, fragment_, type_, offset_)                         \
   {                                                                          \
-    EXPECT_EQ(&caret.fragment->PhysicalFragment(), fragment_)                \
-        << caret.fragment->PhysicalFragment().ToString();                    \
+    EXPECT_EQ(&caret.PaintFragment()->PhysicalFragment(), fragment_)         \
+        << caret.PaintFragment()->PhysicalFragment().ToString();             \
     EXPECT_EQ(caret.position_type, NGCaretPositionType::type_);              \
     EXPECT_EQ(caret.text_offset, offset_) << caret.text_offset.value_or(-1); \
   }
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc
index 4149569..7f7a9878 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_caret_rect.cc
@@ -117,7 +117,7 @@
   if (caret_position.IsNull())
     return LocalCaretRect();
 
-  const NGPaintFragment& fragment = *caret_position.fragment;
+  const NGPaintFragment& fragment = *caret_position.PaintFragment();
   const LayoutObject* layout_object = fragment.GetLayoutObject();
   switch (caret_position.position_type) {
     case NGCaretPositionType::kBeforeBox:
@@ -146,7 +146,7 @@
   if (!caret_rect.layout_object)
     return caret_rect;
 
-  const NGPaintFragment& fragment = *caret_position.fragment;
+  const NGPaintFragment& fragment = *caret_position.PaintFragment();
   const NGPaintFragment* line_box = fragment.ContainerLineBox();
   // TODO(xiaochengh): We'll hit this DCHECK for caret in empty block if we
   // enable LayoutNG in contenteditable.
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_utils.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_utils.cc
index d4c9f60..d0f3ac654 100644
--- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_utils.cc
+++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_utils.cc
@@ -15,7 +15,7 @@
   const NGCaretPosition caret_position = ComputeNGCaretPosition(position);
   if (caret_position.IsNull())
     return nullptr;
-  return caret_position.fragment->ContainerLineBox();
+  return caret_position.PaintFragment()->ContainerLineBox();
 }
 
 bool InSameNGLineBox(const PositionWithAffinity& position1,
diff --git a/third_party/blink/renderer/core/page/scrolling/main_thread_scrolling_reasons_test.cc b/third_party/blink/renderer/core/page/scrolling/main_thread_scrolling_reasons_test.cc
index 84a4e7a..01806ddb2 100644
--- a/third_party/blink/renderer/core/page/scrolling/main_thread_scrolling_reasons_test.cc
+++ b/third_party/blink/renderer/core/page/scrolling/main_thread_scrolling_reasons_test.cc
@@ -103,6 +103,8 @@
   frame_test_helpers::WebViewHelper helper_;
 };
 
+// More cases are tested in LocalFrameViewTest
+// .RequiresMainThreadScrollingForBackgroundFixedAttachment.
 TEST_F(MainThreadScrollingReasonsTest,
        BackgroundAttachmentFixedShouldTriggerMainThreadScroll) {
   RegisterMockedHttpURLLoad("iframe-background-attachment-fixed.html");
diff --git a/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc b/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc
index 0af714e8..077ff26 100644
--- a/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc
+++ b/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc
@@ -1048,8 +1048,10 @@
   if (text_fragment.IsGeneratedText())
     return PositionWithAffinity();
   const unsigned text_offset = text_fragment.TextOffsetForPoint(point);
+  NGInlineCursor cursor;
+  cursor.MoveTo(*this);
   const NGCaretPosition unadjusted_position{
-      this, NGCaretPositionType::kAtTextOffset, text_offset};
+      cursor, NGCaretPositionType::kAtTextOffset, text_offset};
   if (RuntimeEnabledFeatures::BidiCaretAffinityEnabled())
     return unadjusted_position.ToPositionInDOMTreeWithAffinity();
   if (text_offset > text_fragment.StartOffset() &&
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
index b604ca0..6c6084e 100644
--- a/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
+++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
@@ -1773,7 +1773,8 @@
     return reasons;
 
   if (object.IsLayoutView()) {
-    if (object.GetFrameView()->HasBackgroundAttachmentFixedObjects()) {
+    if (object.GetFrameView()
+            ->RequiresMainThreadScrollingForBackgroundAttachmentFixed()) {
       reasons |=
           cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
     }
diff --git a/third_party/blink/renderer/devtools/front_end/langpacks/shared_strings.grdp b/third_party/blink/renderer/devtools/front_end/langpacks/shared_strings.grdp
index 0cacd66..85f2069 100644
--- a/third_party/blink/renderer/devtools/front_end/langpacks/shared_strings.grdp
+++ b/third_party/blink/renderer/devtools/front_end/langpacks/shared_strings.grdp
@@ -7,6 +7,9 @@
   <message name="IDS_DEVTOOLS_03301bd5f0d1517cf88b2f8348b82dfc" desc="Accessible text for the value in bytes in memory allocation or coverage view.">
     <ph name="THIS__COVERAGEINFO_SIZE_______">$1s<ex>12345</ex></ph> bytes
   </message>
+  <message name="IDS_DEVTOOLS_02a3a357710cc2a5dfdfb74ed012fb59" desc="Text in Timeline UIUtils of the Performance panel">
+    Url
+  </message>
   <message name="IDS_DEVTOOLS_040c4b52a3c06c6067fac76c4c7c3a2c" desc="Title of the 'Network conditions' tool in the bottom drawer">
     Network conditions
   </message>
diff --git a/third_party/blink/renderer/devtools/front_end/network/NetworkDataGridNode.js b/third_party/blink/renderer/devtools/front_end/network/NetworkDataGridNode.js
index 0b186951..bb1da0cc 100644
--- a/third_party/blink/renderer/devtools/front_end/network/NetworkDataGridNode.js
+++ b/third_party/blink/renderer/devtools/front_end/network/NetworkDataGridNode.js
@@ -729,6 +729,12 @@
       case 'name':
         this._renderNameCell(cell);
         break;
+      case 'path':
+        this._setTextAndTitle(cell, this._request.pathname);
+        break;
+      case 'url':
+        this._setTextAndTitle(cell, this._request.url());
+        break;
       case 'method':
         this._setTextAndTitle(cell, this._request.requestMethod);
         break;
diff --git a/third_party/blink/renderer/devtools/front_end/network/NetworkLogViewColumns.js b/third_party/blink/renderer/devtools/front_end/network/NetworkLogViewColumns.js
index ca2d64ad..58b0d8a 100644
--- a/third_party/blink/renderer/devtools/front_end/network/NetworkLogViewColumns.js
+++ b/third_party/blink/renderer/devtools/front_end/network/NetworkLogViewColumns.js
@@ -668,7 +668,6 @@
   hideable: true,
   nonSelectable: true,
   isResponseHeader: false,
-  alwaysVisible: false,
   isCustomHeader: false
 };
 
@@ -684,10 +683,23 @@
     weight: 20,
     hideable: false,
     nonSelectable: false,
-    alwaysVisible: true,
     sortingFunction: Network.NetworkRequestNode.NameComparator
   },
   {
+    id: 'path',
+    title: ls`Path`,
+    nonSelectable: false,
+    hideable: true,
+    sortingFunction: Network.NetworkRequestNode.RequestPropertyComparator.bind(null, 'path')
+  },
+  {
+    id: 'url',
+    title: ls`Url`,
+    nonSelectable: false,
+    hideable: true,
+    sortingFunction: Network.NetworkRequestNode.RequestPropertyComparator.bind(null, 'url')
+  },
+  {
     id: 'method',
     title: Common.UIString('Method'),
     sortingFunction: Network.NetworkRequestNode.RequestPropertyComparator.bind(null, 'requestMethod')
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js b/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js
index fb9d05d1..457d6a8c 100644
--- a/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js
+++ b/third_party/blink/renderer/devtools/front_end/sdk/NetworkRequest.js
@@ -643,6 +643,13 @@
   }
 
   /**
+   * @return {string}
+   */
+  get pathname() {
+    return this._parsedURL.path;
+  }
+
+  /**
    * @return {!Common.ResourceType}
    */
   resourceType() {
diff --git a/third_party/blink/renderer/devtools/front_end/timeline/timeline_strings.grdp b/third_party/blink/renderer/devtools/front_end/timeline/timeline_strings.grdp
index de624f64..057d183e 100644
--- a/third_party/blink/renderer/devtools/front_end/timeline/timeline_strings.grdp
+++ b/third_party/blink/renderer/devtools/front_end/timeline/timeline_strings.grdp
@@ -18,9 +18,6 @@
   <message name="IDS_DEVTOOLS_01ea16e89d02c33ef2a6a5db67665e0a" desc="Text in Timeline Flame Chart Data Provider of the Performance panel">
     Main — <ph name="TRACK_URL">$1s<ex>example.com</ex></ph>
   </message>
-  <message name="IDS_DEVTOOLS_02a3a357710cc2a5dfdfb74ed012fb59" desc="Text in Timeline UIUtils of the Performance panel">
-    Url
-  </message>
   <message name="IDS_DEVTOOLS_04cbdd8baeb482d9ff2e48b186479a06" desc="Text in Timeline UIUtils of the Performance panel">
     Streaming Wasm Response
   </message>
diff --git a/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc b/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc
index 16e8fbc..961b69c 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc
+++ b/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc
@@ -131,6 +131,13 @@
   }
 }
 
+unsigned AXInlineTextBox::TextOffsetInContainer(unsigned offset) const {
+  if (!inline_text_box_)
+    return 0;
+
+  return inline_text_box_->TextOffsetInContainer(offset);
+}
+
 String AXInlineTextBox::GetName(ax::mojom::NameFrom& name_from,
                                 AXObject::AXObjectVector* name_objects) const {
   if (!inline_text_box_)
diff --git a/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.h b/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.h
index 648986ef..76af7737 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.h
+++ b/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.h
@@ -59,6 +59,7 @@
   void TextCharacterOffsets(Vector<int>&) const override;
   void GetWordBoundaries(Vector<int>& word_starts,
                          Vector<int>& word_ends) const override;
+  unsigned TextOffsetInContainer(unsigned offset) const override;
   void GetRelativeBounds(AXObject** out_container,
                          FloatRect& out_bounds_in_container,
                          SkMatrix44& out_container_transform,
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.h b/third_party/blink/renderer/modules/accessibility/ax_object.h
index fc0cb6b..da4f4d1 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_object.h
+++ b/third_party/blink/renderer/modules/accessibility/ax_object.h
@@ -687,6 +687,11 @@
   // The start and end character offset of each word in the object's text.
   virtual void GetWordBoundaries(Vector<int>& word_starts,
                                  Vector<int>& word_ends) const;
+  // Returns the text offset (text offset as in AXPosition, not as in
+  // pixel offset) in the container of an inline text box.
+  virtual unsigned TextOffsetInContainer(unsigned offset) const {
+    return offset;
+  }
 
   // Properties of interactive elements.
   ax::mojom::DefaultActionVerb Action() const;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_position.cc b/third_party/blink/renderer/modules/accessibility/ax_position.cc
index fd7dd48d..745e159 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_position.cc
+++ b/third_party/blink/renderer/modules/accessibility/ax_position.cc
@@ -822,8 +822,11 @@
   const auto last_position = Position::LastPositionInNode(*container_node);
   CharacterIterator character_iterator(first_position, last_position,
                                        text_iterator_behavior);
+  unsigned text_offset_in_container =
+      adjusted_position.container_object_->TextOffsetInContainer(
+          adjusted_position.TextOffset());
   const EphemeralRange range = character_iterator.CalculateCharacterSubrange(
-      0, adjusted_position.text_offset_or_child_index_);
+      0, text_offset_in_container);
   return PositionWithAffinity(range.EndPosition(), affinity_);
 }
 
diff --git a/third_party/blink/renderer/modules/accessibility/ax_position_test.cc b/third_party/blink/renderer/modules/accessibility/ax_position_test.cc
index 31193ad..5019ed0 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_position_test.cc
+++ b/third_party/blink/renderer/modules/accessibility/ax_position_test.cc
@@ -1654,5 +1654,32 @@
   EXPECT_EQ(0, position_after.GetPosition().OffsetInContainerNode());
 }
 
+TEST_P(ParameterizedAccessibilityTest,
+       ToPositionWithAffinityWithMultipleInlineTextBoxes) {
+  // "&#10" is a Line Feed ("\n").
+  SetBodyInnerHTML(
+      R"HTML(<style>p { white-space: pre-line; }</style>
+      <p id="paragraph">Hello &#10; world</p>)HTML");
+  const Node* text = GetElementById("paragraph")->firstChild();
+  ASSERT_NE(nullptr, text);
+  ASSERT_TRUE(text->IsTextNode());
+  AXObject* ax_static_text = GetAXObjectByElementId("paragraph")->FirstChild();
+
+  ASSERT_NE(nullptr, ax_static_text);
+  ASSERT_EQ(ax::mojom::Role::kStaticText, ax_static_text->RoleValue());
+
+  ax_static_text->LoadInlineTextBoxes();
+  ASSERT_EQ(3, ax_static_text->ChildCount());
+
+  // This test expects the starting offset of the last InlineTextBox object to
+  // equates the sum of the previous inline text boxes length, without the
+  // collapsed white-spaces.
+  const auto ax_position =
+      AXPosition::CreatePositionBeforeObject(*(ax_static_text->LastChild()));
+  const auto position = ax_position.ToPositionWithAffinity();
+  EXPECT_EQ(LayoutNGEnabled() ? 7 : 6,
+            position.GetPosition().OffsetInContainerNode());
+}
+
 }  // namespace test
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/accessibility/testing/accessibility_test.h b/third_party/blink/renderer/modules/accessibility/testing/accessibility_test.h
index 0608c4e..a6ebd50 100644
--- a/third_party/blink/renderer/modules/accessibility/testing/accessibility_test.h
+++ b/third_party/blink/renderer/modules/accessibility/testing/accessibility_test.h
@@ -53,6 +53,18 @@
                                         size_t level) const;
 };
 
+class ParameterizedAccessibilityTest : public testing::WithParamInterface<bool>,
+                                       private ScopedLayoutNGForTest,
+                                       public AccessibilityTest {
+ public:
+  ParameterizedAccessibilityTest() : ScopedLayoutNGForTest(GetParam()) {}
+
+ protected:
+  bool LayoutNGEnabled() const { return GetParam(); }
+};
+
+INSTANTIATE_TEST_SUITE_P(, ParameterizedAccessibilityTest, testing::Bool());
+
 }  // namespace test
 }  // namespace blink
 
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
index aaca436..f5b4cfd 100644
--- a/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
+++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_test.cc
@@ -291,6 +291,32 @@
   EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("bar"));
 }
 
+TEST_P(MainOrOffThreadPaintWorkletTest, AllGlobalScopesMustBeCreated) {
+  PaintWorklet* paint_worklet_to_test =
+      MakeGarbageCollected<PaintWorklet>(&GetFrame());
+
+  EXPECT_TRUE(paint_worklet_to_test->GetGlobalScopesForTesting().IsEmpty());
+
+  std::unique_ptr<PaintWorkletPaintDispatcher> dispatcher =
+      std::make_unique<PaintWorkletPaintDispatcher>();
+  Persistent<PaintWorkletProxyClient> proxy_client =
+      MakeGarbageCollected<PaintWorkletProxyClient>(
+          1, paint_worklet_to_test, dispatcher->GetWeakPtr(), nullptr);
+  paint_worklet_to_test->SetProxyClientForTesting(proxy_client);
+
+  while (paint_worklet_to_test->NeedsToCreateGlobalScopeForTesting()) {
+    paint_worklet_to_test->AddGlobalScopeForTesting();
+  }
+
+  if (RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) {
+    EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
+              2 * PaintWorklet::kNumGlobalScopesPerThread);
+  } else {
+    EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
+              PaintWorklet::kNumGlobalScopesPerThread);
+  }
+}
+
 TEST_F(PaintWorkletTest, ConsistentGlobalScopeCrossThread) {
   ScopedOffMainThreadCSSPaintForTest off_main_thread_css_paint(true);
   PaintWorklet* paint_worklet_to_test =
@@ -516,30 +542,4 @@
   EXPECT_TRUE(paint_worklet_to_test->GetDocumentDefinitionMap().at("foo"));
 }
 
-TEST_P(MainOrOffThreadPaintWorkletTest, AllGlobalScopesMustBeCreated) {
-  PaintWorklet* paint_worklet_to_test =
-      MakeGarbageCollected<PaintWorklet>(&GetFrame());
-
-  EXPECT_TRUE(paint_worklet_to_test->GetGlobalScopesForTesting().IsEmpty());
-
-  std::unique_ptr<PaintWorkletPaintDispatcher> dispatcher =
-      std::make_unique<PaintWorkletPaintDispatcher>();
-  Persistent<PaintWorkletProxyClient> proxy_client =
-      MakeGarbageCollected<PaintWorkletProxyClient>(
-          1, paint_worklet_to_test, dispatcher->GetWeakPtr(), nullptr);
-  paint_worklet_to_test->SetProxyClientForTesting(proxy_client);
-
-  while (paint_worklet_to_test->NeedsToCreateGlobalScopeForTesting()) {
-    paint_worklet_to_test->AddGlobalScopeForTesting();
-  }
-
-  if (RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) {
-    EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
-              2 * PaintWorklet::kNumGlobalScopesPerThread);
-  } else {
-    EXPECT_EQ(paint_worklet_to_test->GetGlobalScopesForTesting().size(),
-              PaintWorklet::kNumGlobalScopesPerThread);
-  }
-}
-
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/event_target_modules_names.json5 b/third_party/blink/renderer/modules/event_target_modules_names.json5
index 3445dc8..67818f7 100644
--- a/third_party/blink/renderer/modules/event_target_modules_names.json5
+++ b/third_party/blink/renderer/modules/event_target_modules_names.json5
@@ -37,7 +37,7 @@
     "RTCDtlsTransport",
     "RTCPeerConnection",
     "RTCSctpTransport",
-    "NFCReader",
+    "NDEFReader",
     "NetworkInformation",
     "Notification",
     "PaymentRequest",
diff --git a/third_party/blink/renderer/modules/filesystem/README.md b/third_party/blink/renderer/modules/filesystem/README.md
index 6e3f3df..a08a077 100644
--- a/third_party/blink/renderer/modules/filesystem/README.md
+++ b/third_party/blink/renderer/modules/filesystem/README.md
@@ -5,7 +5,7 @@
 
 ## Related directories
 
-[`//storage/browser/fileapi/`](../../../storage/browser/fileapi) contains part
+[`//storage/browser/file_system/`](../../../storage/browser/file_system) contains part
 of the browser side implementation, while
 [`//content/browser/fileapi/`](../../../content/browser/fileapi) contains the
 rest of the browser side implementation and
diff --git a/third_party/blink/renderer/modules/manifest/manifest_manager.cc b/third_party/blink/renderer/modules/manifest/manifest_manager.cc
index 2eb33b3..6284ad9b 100644
--- a/third_party/blink/renderer/modules/manifest/manifest_manager.cc
+++ b/third_party/blink/renderer/modules/manifest/manifest_manager.cc
@@ -100,7 +100,7 @@
 bool ManifestManager::CanFetchManifest() {
   if (!GetSupplementable())
     return false;
-  // Do not fetch the manifest if we are on an opqaue origin.
+  // Do not fetch the manifest if we are on an opaque origin.
   return !GetSupplementable()->GetDocument()->GetSecurityOrigin()->IsOpaque();
 }
 
@@ -149,7 +149,7 @@
 
 void ManifestManager::FetchManifest() {
   if (!CanFetchManifest()) {
-    ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_FROM_UNIQUE_ORIGIN);
+    ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_FROM_OPAQUE_ORIGIN);
     ResolveCallbacks(ResolveStateFailure);
     return;
   }
diff --git a/third_party/blink/renderer/modules/manifest/manifest_uma_util.cc b/third_party/blink/renderer/modules/manifest/manifest_uma_util.cc
index ed75fc1..91b8d6989 100644
--- a/third_party/blink/renderer/modules/manifest/manifest_uma_util.cc
+++ b/third_party/blink/renderer/modules/manifest/manifest_uma_util.cc
@@ -20,7 +20,7 @@
   MANIFEST_FETCH_SUCCESS = 0,
   MANIFEST_FETCH_ERROR_EMPTY_URL = 1,
   MANIFEST_FETCH_ERROR_UNSPECIFIED = 2,
-  MANIFEST_FETCH_ERROR_FROM_UNIQUE_ORIGIN = 3,
+  MANIFEST_FETCH_ERROR_FROM_OPAQUE_ORIGIN = 3,
 
   // Must stay at the end.
   MANIFEST_FETCH_RESULT_TYPE_COUNT
@@ -33,7 +33,6 @@
   UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, true);
 
   auto empty_manifest = mojom::blink::Manifest::New();
-  UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest == empty_manifest);
   if (manifest == empty_manifest)
     return;
 
@@ -71,8 +70,8 @@
     case FETCH_EMPTY_URL:
       fetch_result_type = MANIFEST_FETCH_ERROR_EMPTY_URL;
       break;
-    case FETCH_FROM_UNIQUE_ORIGIN:
-      fetch_result_type = MANIFEST_FETCH_ERROR_FROM_UNIQUE_ORIGIN;
+    case FETCH_FROM_OPAQUE_ORIGIN:
+      fetch_result_type = MANIFEST_FETCH_ERROR_FROM_OPAQUE_ORIGIN;
       break;
     case FETCH_UNSPECIFIED_REASON:
       fetch_result_type = MANIFEST_FETCH_ERROR_UNSPECIFIED;
diff --git a/third_party/blink/renderer/modules/manifest/manifest_uma_util.h b/third_party/blink/renderer/modules/manifest/manifest_uma_util.h
index 2e6793b..6d1052d 100644
--- a/third_party/blink/renderer/modules/manifest/manifest_uma_util.h
+++ b/third_party/blink/renderer/modules/manifest/manifest_uma_util.h
@@ -13,7 +13,7 @@
  public:
   enum FetchFailureReason {
     FETCH_EMPTY_URL = 0,
-    FETCH_FROM_UNIQUE_ORIGIN,
+    FETCH_FROM_OPAQUE_ORIGIN,
     FETCH_UNSPECIFIED_REASON
   };
 
diff --git a/third_party/blink/renderer/modules/modules_idl_files.gni b/third_party/blink/renderer/modules/modules_idl_files.gni
index b319564..658025d 100644
--- a/third_party/blink/renderer/modules/modules_idl_files.gni
+++ b/third_party/blink/renderer/modules/modules_idl_files.gni
@@ -226,10 +226,10 @@
           "netinfo/network_information.idl",
           "nfc/ndef_message.idl",
           "nfc/ndef_record.idl",
-          "nfc/nfc_error_event.idl",
-          "nfc/nfc_reader.idl",
-          "nfc/nfc_reading_event.idl",
-          "nfc/nfc_writer.idl",
+          "nfc/ndef_error_event.idl",
+          "nfc/ndef_reader.idl",
+          "nfc/ndef_reading_event.idl",
+          "nfc/ndef_writer.idl",
           "notifications/notification.idl",
           "notifications/notification_event.idl",
           "notifications/timestamp_trigger.idl",
@@ -694,10 +694,10 @@
           "native_file_system/native_file_system_directory_iterator_entry.idl",
           "nfc/ndef_message_init.idl",
           "nfc/ndef_record_init.idl",
-          "nfc/nfc_error_event_init.idl",
-          "nfc/nfc_push_options.idl",
-          "nfc/nfc_reading_event_init.idl",
-          "nfc/nfc_scan_options.idl",
+          "nfc/ndef_error_event_init.idl",
+          "nfc/ndef_push_options.idl",
+          "nfc/ndef_reading_event_init.idl",
+          "nfc/ndef_scan_options.idl",
           "notifications/get_notification_options.idl",
           "notifications/notification_action.idl",
           "notifications/notification_event_init.idl",
diff --git a/third_party/blink/renderer/modules/nfc/BUILD.gn b/third_party/blink/renderer/modules/nfc/BUILD.gn
index 2ee6df3..1585a0f8 100644
--- a/third_party/blink/renderer/modules/nfc/BUILD.gn
+++ b/third_party/blink/renderer/modules/nfc/BUILD.gn
@@ -6,23 +6,23 @@
 
 blink_modules_sources("nfc") {
   sources = [
+    "ndef_error_event.cc",
+    "ndef_error_event.h",
     "ndef_message.cc",
     "ndef_message.h",
+    "ndef_reader.cc",
+    "ndef_reader.h",
+    "ndef_reading_event.cc",
+    "ndef_reading_event.h",
     "ndef_record.cc",
     "ndef_record.h",
-    "nfc_error_event.cc",
-    "nfc_error_event.h",
+    "ndef_writer.cc",
+    "ndef_writer.h",
     "nfc_proxy.cc",
     "nfc_proxy.h",
-    "nfc_reader.cc",
-    "nfc_reader.h",
-    "nfc_reading_event.cc",
-    "nfc_reading_event.h",
     "nfc_type_converters.cc",
     "nfc_type_converters.h",
     "nfc_utils.cc",
     "nfc_utils.h",
-    "nfc_writer.cc",
-    "nfc_writer.h",
   ]
 }
diff --git a/third_party/blink/renderer/modules/nfc/ndef_error_event.cc b/third_party/blink/renderer/modules/nfc/ndef_error_event.cc
new file mode 100644
index 0000000..2e3a9249
--- /dev/null
+++ b/third_party/blink/renderer/modules/nfc/ndef_error_event.cc
@@ -0,0 +1,35 @@
+// Copyright 2019 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 "third_party/blink/renderer/modules/nfc/ndef_error_event.h"
+
+#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
+#include "v8/include/v8.h"
+
+namespace blink {
+
+NDEFErrorEvent::NDEFErrorEvent(const AtomicString& event_type,
+                               DOMException* error)
+    : Event(event_type, Bubbles::kNo, Cancelable::kNo), error_(error) {
+  DCHECK(error_);
+}
+
+NDEFErrorEvent::NDEFErrorEvent(const AtomicString& event_type,
+                               const NDEFErrorEventInit* initializer)
+    : Event(event_type, initializer), error_(initializer->error()) {
+  DCHECK(error_);
+}
+
+NDEFErrorEvent::~NDEFErrorEvent() = default;
+
+const AtomicString& NDEFErrorEvent::InterfaceName() const {
+  return event_interface_names::kNDEFErrorEvent;
+}
+
+void NDEFErrorEvent::Trace(blink::Visitor* visitor) {
+  visitor->Trace(error_);
+  Event::Trace(visitor);
+}
+
+}  // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/ndef_error_event.h b/third_party/blink/renderer/modules/nfc/ndef_error_event.h
new file mode 100644
index 0000000..e4595f73
--- /dev/null
+++ b/third_party/blink/renderer/modules/nfc/ndef_error_event.h
@@ -0,0 +1,49 @@
+// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_ERROR_EVENT_H_
+#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_ERROR_EVENT_H_
+
+#include "third_party/blink/renderer/core/dom/dom_exception.h"
+#include "third_party/blink/renderer/modules/event_modules.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_error_event_init.h"
+#include "third_party/blink/renderer/platform/heap/handle.h"
+
+namespace blink {
+
+class NDEFErrorEvent : public Event {
+  DEFINE_WRAPPERTYPEINFO();
+
+ public:
+  static NDEFErrorEvent* Create(const AtomicString& event_type,
+                                const NDEFErrorEventInit* initializer) {
+    return MakeGarbageCollected<NDEFErrorEvent>(event_type, initializer);
+  }
+
+  NDEFErrorEvent(const AtomicString& event_type, DOMException* error);
+  NDEFErrorEvent(const AtomicString& event_type,
+                 const NDEFErrorEventInit* initializer);
+  ~NDEFErrorEvent() override;
+
+  void Trace(blink::Visitor*) override;
+
+  const AtomicString& InterfaceName() const override;
+
+  DOMException* error() { return error_; }
+
+ private:
+  Member<DOMException> error_;
+};
+
+DEFINE_TYPE_CASTS(NDEFErrorEvent,
+                  Event,
+                  event,
+                  event->InterfaceName() ==
+                      event_interface_names::kNDEFErrorEvent,
+                  event.InterfaceName() ==
+                      event_interface_names::kNDEFErrorEvent);
+
+}  // namespace blink
+
+#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_ERROR_EVENT_H_
diff --git a/third_party/blink/renderer/modules/nfc/nfc_error_event.idl b/third_party/blink/renderer/modules/nfc/ndef_error_event.idl
similarity index 66%
rename from third_party/blink/renderer/modules/nfc/nfc_error_event.idl
rename to third_party/blink/renderer/modules/nfc/ndef_error_event.idl
index 72400b6..a0e1e60 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_error_event.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_error_event.idl
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 // Specification at:
-// http://w3c.github.io/web-nfc/#dom-nfcerrorevent
+// http://w3c.github.io/web-nfc/#dom-ndeferrorevent
 
 [
     RuntimeEnabled=WebNFC,
     SecureContext,
-    Constructor(DOMString type, NFCErrorEventInit eventInitDict),
+    Constructor(DOMString type, NDEFErrorEventInit eventInitDict),
     Exposed=Window
-] interface NFCErrorEvent : Event {
+] interface NDEFErrorEvent : Event {
     readonly attribute DOMException error;
 };
diff --git a/third_party/blink/renderer/modules/nfc/nfc_error_event_init.idl b/third_party/blink/renderer/modules/nfc/ndef_error_event_init.idl
similarity index 69%
rename from third_party/blink/renderer/modules/nfc/nfc_error_event_init.idl
rename to third_party/blink/renderer/modules/nfc/ndef_error_event_init.idl
index 7c5b1dc..b8d7f50 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_error_event_init.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_error_event_init.idl
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 // Specification at:
-// http://w3c.github.io/web-nfc/#dom-nfcerroreventinit
+// http://w3c.github.io/web-nfc/#dom-ndeferroreventinit
 
-dictionary NFCErrorEventInit : EventInit {
+dictionary NDEFErrorEventInit : EventInit {
     required DOMException error;
 };
diff --git a/third_party/blink/renderer/modules/nfc/nfc_push_options.idl b/third_party/blink/renderer/modules/nfc/ndef_push_options.idl
similarity index 60%
rename from third_party/blink/renderer/modules/nfc/nfc_push_options.idl
rename to third_party/blink/renderer/modules/nfc/ndef_push_options.idl
index 2156206..d26640b7 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_push_options.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_push_options.idl
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// https://w3c.github.io/web-nfc/#the-nfcpushoptions-dictionary
+// https://w3c.github.io/web-nfc/#the-ndefpushoptions-dictionary
 
-enum NFCPushTarget { "tag", "peer", "any" };
+enum NDEFPushTarget { "tag", "peer", "any" };
 
-dictionary NFCPushOptions {
-    NFCPushTarget target = "any";
+dictionary NDEFPushOptions {
+    NDEFPushTarget target = "any";
     unrestricted double timeout; // in ms
     boolean ignoreRead = true;
     AbortSignal? signal;
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reader.cc b/third_party/blink/renderer/modules/nfc/ndef_reader.cc
similarity index 65%
rename from third_party/blink/renderer/modules/nfc/nfc_reader.cc
rename to third_party/blink/renderer/modules/nfc/ndef_reader.cc
index 5fbab481..172a4cf 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_reader.cc
+++ b/third_party/blink/renderer/modules/nfc/ndef_reader.cc
@@ -2,52 +2,52 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "third_party/blink/renderer/modules/nfc/nfc_reader.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_reader.h"
 
 #include <utility>
 
 #include "services/device/public/mojom/nfc.mojom-blink.h"
 #include "third_party/blink/renderer/core/dom/abort_signal.h"
 #include "third_party/blink/renderer/modules/event_target_modules.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_error_event.h"
 #include "third_party/blink/renderer/modules/nfc/ndef_message.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_error_event.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_reading_event.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_scan_options.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_proxy.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_reading_event.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_scan_options.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_utils.h"
 #include "third_party/blink/renderer/platform/weborigin/kurl.h"
 
 namespace blink {
 
 // static
-NFCReader* NFCReader::Create(ExecutionContext* context) {
-  return MakeGarbageCollected<NFCReader>(context);
+NDEFReader* NDEFReader::Create(ExecutionContext* context) {
+  return MakeGarbageCollected<NDEFReader>(context);
 }
 
-NFCReader::NFCReader(ExecutionContext* context)
+NDEFReader::NDEFReader(ExecutionContext* context)
     : ContextLifecycleObserver(context) {
   // Call GetNFCProxy to create a proxy. This guarantees no allocation will
   // be needed when calling HasPendingActivity later during gc tracing.
   GetNfcProxy();
 }
 
-NFCReader::~NFCReader() = default;
+NDEFReader::~NDEFReader() = default;
 
-const AtomicString& NFCReader::InterfaceName() const {
-  return event_target_names::kNFCReader;
+const AtomicString& NDEFReader::InterfaceName() const {
+  return event_target_names::kNDEFReader;
 }
 
-ExecutionContext* NFCReader::GetExecutionContext() const {
+ExecutionContext* NDEFReader::GetExecutionContext() const {
   return ContextLifecycleObserver::GetExecutionContext();
 }
 
-bool NFCReader::HasPendingActivity() const {
+bool NDEFReader::HasPendingActivity() const {
   return GetExecutionContext() && GetNfcProxy()->IsReading(this) &&
          HasEventListeners();
 }
 
 // https://w3c.github.io/web-nfc/#the-scan-method
-void NFCReader::scan(const NFCScanOptions* options) {
+void NDEFReader::scan(const NDEFScanOptions* options) {
   if (!CheckSecurity())
     return;
 
@@ -59,15 +59,16 @@
     // 7. If reader.[[Signal]] is not null, then add the following abort steps
     // to reader.[[Signal]]:
     options->signal()->AddAlgorithm(
-        WTF::Bind(&NFCReader::Abort, WrapPersistent(this)));
+        WTF::Bind(&NDEFReader::Abort, WrapPersistent(this)));
   }
 
   // Step 8.4, if the url is not an empty string and it is not a valid URL
-  // pattern, fire a NFCErrorEvent with "SyntaxError" DOMException, then return.
+  // pattern, fire a NDEFErrorEvent with "SyntaxError" DOMException, then
+  // return.
   if (options->hasURL() && !options->url().IsEmpty()) {
     KURL pattern_url(options->url());
     if (!pattern_url.IsValid() || pattern_url.Protocol() != "https") {
-      DispatchEvent(*MakeGarbageCollected<NFCErrorEvent>(
+      DispatchEvent(*MakeGarbageCollected<NDEFErrorEvent>(
           event_type_names::kError, MakeGarbageCollected<DOMException>(
                                         DOMExceptionCode::kSyntaxError,
                                         "Invalid URL pattern was provided.")));
@@ -78,41 +79,41 @@
   GetNfcProxy()->StartReading(this, options);
 }
 
-void NFCReader::Trace(blink::Visitor* visitor) {
+void NDEFReader::Trace(blink::Visitor* visitor) {
   EventTargetWithInlineData::Trace(visitor);
   ActiveScriptWrappable::Trace(visitor);
   ContextLifecycleObserver::Trace(visitor);
 }
 
-void NFCReader::OnReading(const String& serial_number,
-                          const device::mojom::blink::NDEFMessage& message) {
+void NDEFReader::OnReading(const String& serial_number,
+                           const device::mojom::blink::NDEFMessage& message) {
   DCHECK(GetNfcProxy()->IsReading(this));
-  DispatchEvent(*MakeGarbageCollected<NFCReadingEvent>(
+  DispatchEvent(*MakeGarbageCollected<NDEFReadingEvent>(
       event_type_names::kReading, serial_number,
       MakeGarbageCollected<NDEFMessage>(message)));
 }
 
-void NFCReader::OnError(device::mojom::blink::NFCErrorType error) {
-  DispatchEvent(*MakeGarbageCollected<NFCErrorEvent>(
-      event_type_names::kError, NFCErrorTypeToDOMException(error)));
+void NDEFReader::OnError(device::mojom::blink::NDEFErrorType error) {
+  DispatchEvent(*MakeGarbageCollected<NDEFErrorEvent>(
+      event_type_names::kError, NDEFErrorTypeToDOMException(error)));
 }
 
-void NFCReader::ContextDestroyed(ExecutionContext*) {
+void NDEFReader::ContextDestroyed(ExecutionContext*) {
   GetNfcProxy()->StopReading(this);
 }
 
-void NFCReader::Abort() {
+void NDEFReader::Abort() {
   GetNfcProxy()->StopReading(this);
 }
 
-bool NFCReader::CheckSecurity() {
+bool NDEFReader::CheckSecurity() {
   ExecutionContext* execution_context = GetExecutionContext();
   if (!execution_context)
     return false;
   // https://w3c.github.io/web-nfc/#security-policies
   // WebNFC API must be only accessible from top level browsing context.
   if (!To<Document>(execution_context)->IsInMainFrame()) {
-    DispatchEvent(*MakeGarbageCollected<NFCErrorEvent>(
+    DispatchEvent(*MakeGarbageCollected<NDEFErrorEvent>(
         event_type_names::kError,
         MakeGarbageCollected<DOMException>(DOMExceptionCode::kNotAllowedError,
                                            "NFC interfaces are only avaliable "
@@ -122,7 +123,7 @@
   return true;
 }
 
-NFCProxy* NFCReader::GetNfcProxy() const {
+NFCProxy* NDEFReader::GetNfcProxy() const {
   DCHECK(GetExecutionContext());
   return NFCProxy::From(*To<Document>(GetExecutionContext()));
 }
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reader.h b/third_party/blink/renderer/modules/nfc/ndef_reader.h
similarity index 68%
rename from third_party/blink/renderer/modules/nfc/nfc_reader.h
rename to third_party/blink/renderer/modules/nfc/ndef_reader.h
index 6380920..0580b1d 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_reader.h
+++ b/third_party/blink/renderer/modules/nfc/ndef_reader.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_READER_H_
-#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_READER_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_READER_H_
+#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_READER_H_
 
 #include "services/device/public/mojom/nfc.mojom-blink-forward.h"
 #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h"
@@ -16,19 +16,19 @@
 
 class ExecutionContext;
 class NFCProxy;
-class NFCScanOptions;
+class NDEFScanOptions;
 
-class MODULES_EXPORT NFCReader : public EventTargetWithInlineData,
-                                 public ActiveScriptWrappable<NFCReader>,
-                                 public ContextLifecycleObserver {
-  USING_GARBAGE_COLLECTED_MIXIN(NFCReader);
+class MODULES_EXPORT NDEFReader : public EventTargetWithInlineData,
+                                  public ActiveScriptWrappable<NDEFReader>,
+                                  public ContextLifecycleObserver {
+  USING_GARBAGE_COLLECTED_MIXIN(NDEFReader);
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static NFCReader* Create(ExecutionContext*);
+  static NDEFReader* Create(ExecutionContext*);
 
-  NFCReader(ExecutionContext*);
-  ~NFCReader() override;
+  NDEFReader(ExecutionContext*);
+  ~NDEFReader() override;
 
   // EventTarget overrides.
   const AtomicString& InterfaceName() const override;
@@ -39,14 +39,14 @@
 
   DEFINE_ATTRIBUTE_EVENT_LISTENER(error, kError)
   DEFINE_ATTRIBUTE_EVENT_LISTENER(reading, kReading)
-  void scan(const NFCScanOptions*);
+  void scan(const NDEFScanOptions*);
 
   void Trace(blink::Visitor*) override;
 
   // Called by NFCProxy for dispatching events.
   virtual void OnReading(const String& serial_number,
                          const device::mojom::blink::NDEFMessage& message);
-  virtual void OnError(device::mojom::blink::NFCErrorType error);
+  virtual void OnError(device::mojom::blink::NDEFErrorType error);
 
  private:
   // ContextLifecycleObserver overrides.
@@ -61,4 +61,4 @@
 
 }  // namespace blink
 
-#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_READER_H_
+#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_READER_H_
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reader.idl b/third_party/blink/renderer/modules/nfc/ndef_reader.idl
similarity index 74%
rename from third_party/blink/renderer/modules/nfc/nfc_reader.idl
rename to third_party/blink/renderer/modules/nfc/ndef_reader.idl
index 00eff52..1bad821 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_reader.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_reader.idl
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// http://w3c.github.io/web-nfc/#dom-nfcreader
+// http://w3c.github.io/web-nfc/#dom-ndefreader
 
 [
     RuntimeEnabled=WebNFC,
@@ -11,9 +11,9 @@
     Constructor(),
     ConstructorCallWith=ExecutionContext,
     Exposed=Window
-] interface NFCReader : EventTarget {
+] interface NDEFReader : EventTarget {
     attribute EventHandler onreading;
     attribute EventHandler onerror;
 
-    void scan(optional NFCScanOptions options);
+    void scan(optional NDEFScanOptions options);
 };
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc b/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc
new file mode 100644
index 0000000..eec110d
--- /dev/null
+++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event.cc
@@ -0,0 +1,59 @@
+// Copyright 2019 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 "third_party/blink/renderer/modules/nfc/ndef_reading_event.h"
+
+#include "third_party/blink/renderer/modules/nfc/ndef_message.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_reading_event_init.h"
+#include "third_party/blink/renderer/platform/bindings/exception_state.h"
+
+namespace blink {
+
+// static
+NDEFReadingEvent* NDEFReadingEvent::Create(const AtomicString& event_type,
+                                           const NDEFReadingEventInit* init,
+                                           ExceptionState& exception_state) {
+  NDEFMessage* message = NDEFMessage::Create(init->message(), exception_state);
+  if (exception_state.HadException())
+    return nullptr;
+  DCHECK(message);
+  return MakeGarbageCollected<NDEFReadingEvent>(event_type, init, message);
+}
+
+NDEFReadingEvent::NDEFReadingEvent(const AtomicString& event_type,
+                                   const NDEFReadingEventInit* init,
+                                   NDEFMessage* message)
+    : Event(event_type, init),
+      serial_number_(init->serialNumber()),
+      message_(message) {}
+
+NDEFReadingEvent::NDEFReadingEvent(const AtomicString& event_type,
+                                   const String& serial_number,
+                                   NDEFMessage* message)
+    : Event(event_type, Bubbles::kNo, Cancelable::kNo),
+      serial_number_(serial_number),
+      message_(message) {}
+
+NDEFReadingEvent::~NDEFReadingEvent() = default;
+
+const AtomicString& NDEFReadingEvent::InterfaceName() const {
+  return event_interface_names::kNDEFReadingEvent;
+}
+
+void NDEFReadingEvent::Trace(blink::Visitor* visitor) {
+  visitor->Trace(message_);
+  Event::Trace(visitor);
+}
+
+const String& NDEFReadingEvent::serialNumber() const {
+  if (serial_number_.IsNull())
+    return g_empty_string;
+  return serial_number_;
+}
+
+NDEFMessage* NDEFReadingEvent::message() const {
+  return message_;
+}
+
+}  // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reading_event.h b/third_party/blink/renderer/modules/nfc/ndef_reading_event.h
new file mode 100644
index 0000000..239437d
--- /dev/null
+++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event.h
@@ -0,0 +1,54 @@
+// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_READING_EVENT_H_
+#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_READING_EVENT_H_
+
+#include "third_party/blink/renderer/modules/event_modules.h"
+#include "third_party/blink/renderer/platform/heap/handle.h"
+#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+
+namespace blink {
+
+class ExceptionState;
+class NDEFMessage;
+class NDEFReadingEventInit;
+
+class NDEFReadingEvent final : public Event {
+  DEFINE_WRAPPERTYPEINFO();
+
+ public:
+  static NDEFReadingEvent* Create(const AtomicString&,
+                                  const NDEFReadingEventInit*,
+                                  ExceptionState&);
+
+  NDEFReadingEvent(const AtomicString&,
+                   const NDEFReadingEventInit*,
+                   NDEFMessage*);
+  NDEFReadingEvent(const AtomicString&, const String&, NDEFMessage*);
+  ~NDEFReadingEvent() override;
+
+  const AtomicString& InterfaceName() const override;
+
+  void Trace(blink::Visitor*) override;
+
+  const String& serialNumber() const;
+  NDEFMessage* message() const;
+
+ private:
+  String serial_number_;
+  Member<NDEFMessage> message_;
+};
+
+DEFINE_TYPE_CASTS(NDEFReadingEvent,
+                  Event,
+                  event,
+                  event->InterfaceName() ==
+                      event_interface_names::kNDEFReadingEvent,
+                  event.InterfaceName() ==
+                      event_interface_names::kNDEFReadingEvent);
+
+}  // namespace blink
+
+#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_READING_EVENT_H_
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reading_event.idl b/third_party/blink/renderer/modules/nfc/ndef_reading_event.idl
similarity index 71%
rename from third_party/blink/renderer/modules/nfc/nfc_reading_event.idl
rename to third_party/blink/renderer/modules/nfc/ndef_reading_event.idl
index d32c5408..61e21cb 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_reading_event.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event.idl
@@ -3,15 +3,15 @@
 // found in the LICENSE file.
 
 // Specification at:
-// http://w3c.github.io/web-nfc/#dom-nfcreadingevent
+// http://w3c.github.io/web-nfc/#dom-ndefreadingevent
 
 [
     RuntimeEnabled=WebNFC,
     SecureContext,
-    Constructor(DOMString type, NFCReadingEventInit eventInitDict),
+    Constructor(DOMString type, NDEFReadingEventInit eventInitDict),
     RaisesException=Constructor,
     Exposed=Window
-] interface NFCReadingEvent : Event {
+] interface NDEFReadingEvent : Event {
     readonly attribute DOMString serialNumber;
     [SameObject] readonly attribute NDEFMessage message;
 };
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reading_event_init.idl b/third_party/blink/renderer/modules/nfc/ndef_reading_event_init.idl
similarity index 71%
rename from third_party/blink/renderer/modules/nfc/nfc_reading_event_init.idl
rename to third_party/blink/renderer/modules/nfc/ndef_reading_event_init.idl
index 69641859..eee3049 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_reading_event_init.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_reading_event_init.idl
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 // Specification at:
-// http://w3c.github.io/web-nfc/#dom-nfcreadingeventinit
+// http://w3c.github.io/web-nfc/#dom-ndefreadingeventinit
 
-dictionary NFCReadingEventInit : EventInit {
+dictionary NDEFReadingEventInit : EventInit {
     DOMString? serialNumber = "";
     required NDEFMessageInit message;
 };
diff --git a/third_party/blink/renderer/modules/nfc/nfc_scan_options.idl b/third_party/blink/renderer/modules/nfc/ndef_scan_options.idl
similarity index 75%
rename from third_party/blink/renderer/modules/nfc/nfc_scan_options.idl
rename to third_party/blink/renderer/modules/nfc/ndef_scan_options.idl
index af62a8e..41fb7a5 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_scan_options.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_scan_options.idl
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// https://w3c.github.io/web-nfc/#the-nfcscanoptions-dictionary
-dictionary NFCScanOptions {
+// https://w3c.github.io/web-nfc/#the-ndefscanoptions-dictionary
+dictionary NDEFScanOptions {
     AbortSignal? signal;
     USVString url = "";
     NDEFRecordType? recordType;
diff --git a/third_party/blink/renderer/modules/nfc/nfc_writer.cc b/third_party/blink/renderer/modules/nfc/ndef_writer.cc
similarity index 79%
rename from third_party/blink/renderer/modules/nfc/nfc_writer.cc
rename to third_party/blink/renderer/modules/nfc/ndef_writer.cc
index a69c3e2..0527bfc 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_writer.cc
+++ b/third_party/blink/renderer/modules/nfc/ndef_writer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "third_party/blink/renderer/modules/nfc/nfc_writer.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_writer.h"
 
 #include <utility>
 
@@ -11,7 +11,7 @@
 #include "third_party/blink/renderer/bindings/modules/v8/string_or_array_buffer_or_ndef_message_init.h"
 #include "third_party/blink/renderer/core/dom/abort_signal.h"
 #include "third_party/blink/renderer/core/dom/dom_exception.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_push_options.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_push_options.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_type_converters.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_utils.h"
 #include "third_party/blink/renderer/platform/weborigin/security_origin.h"
@@ -19,13 +19,13 @@
 namespace blink {
 
 // static
-NFCWriter* NFCWriter::Create(ExecutionContext* context) {
-  return MakeGarbageCollected<NFCWriter>(context);
+NDEFWriter* NDEFWriter::Create(ExecutionContext* context) {
+  return MakeGarbageCollected<NDEFWriter>(context);
 }
 
-NFCWriter::NFCWriter(ExecutionContext* context) : ContextClient(context) {}
+NDEFWriter::NDEFWriter(ExecutionContext* context) : ContextClient(context) {}
 
-void NFCWriter::Trace(blink::Visitor* visitor) {
+void NDEFWriter::Trace(blink::Visitor* visitor) {
   visitor->Trace(nfc_proxy_);
   visitor->Trace(requests_);
   ScriptWrappable::Trace(visitor);
@@ -34,10 +34,10 @@
 
 // https://w3c.github.io/web-nfc/#writing-or-pushing-content
 // https://w3c.github.io/web-nfc/#the-push-method
-ScriptPromise NFCWriter::push(ScriptState* script_state,
-                              const NDEFMessageSource& push_message,
-                              const NFCPushOptions* options,
-                              ExceptionState& exception_state) {
+ScriptPromise NDEFWriter::push(ScriptState* script_state,
+                               const NDEFMessageSource& push_message,
+                               const NDEFPushOptions* options,
+                               ExceptionState& exception_state) {
   ExecutionContext* execution_context = GetExecutionContext();
   // https://w3c.github.io/web-nfc/#security-policies
   // WebNFC API must be only accessible from top level browsing context.
@@ -66,7 +66,7 @@
         script_state,
         V8ThrowException::CreateTypeError(
             script_state->GetIsolate(),
-            "Invalid NFCPushOptions.timeout value was provided."));
+            "Invalid NDEFPushOptions.timeout value was provided."));
   }
 
   // Step 10.8: Run "create Web NFC message", if this throws an exception,
@@ -111,32 +111,32 @@
   // If signal is not null, then add the abort steps to signal.
   if (options->hasSignal() && !options->signal()->aborted()) {
     options->signal()->AddAlgorithm(
-        WTF::Bind(&NFCWriter::Abort, WrapPersistent(this), options->target(),
+        WTF::Bind(&NDEFWriter::Abort, WrapPersistent(this), options->target(),
                   WrapPersistent(resolver)));
   }
 
-  auto callback = WTF::Bind(&NFCWriter::OnRequestCompleted,
+  auto callback = WTF::Bind(&NDEFWriter::OnRequestCompleted,
                             WrapPersistent(this), WrapPersistent(resolver));
   nfc_proxy_->Push(std::move(message),
-                   device::mojom::blink::NFCPushOptions::From(options),
+                   device::mojom::blink::NDEFPushOptions::From(options),
                    std::move(callback));
 
   return resolver->Promise();
 }
 
-void NFCWriter::OnMojoConnectionError() {
+void NDEFWriter::OnMojoConnectionError() {
   nfc_proxy_.Clear();
 
   // If the mojo connection breaks, all push requests will be reject with a
   // default error.
   for (ScriptPromiseResolver* resolver : requests_) {
-    resolver->Reject(NFCErrorTypeToDOMException(
-        device::mojom::blink::NFCErrorType::NOT_SUPPORTED));
+    resolver->Reject(NDEFErrorTypeToDOMException(
+        device::mojom::blink::NDEFErrorType::NOT_SUPPORTED));
   }
   requests_.clear();
 }
 
-void NFCWriter::InitNfcProxyIfNeeded() {
+void NDEFWriter::InitNfcProxyIfNeeded() {
   // Init NfcProxy if needed.
   if (nfc_proxy_)
     return;
@@ -149,7 +149,7 @@
   nfc_proxy_->AddWriter(this);
 }
 
-void NFCWriter::Abort(const String& target, ScriptPromiseResolver* resolver) {
+void NDEFWriter::Abort(const String& target, ScriptPromiseResolver* resolver) {
   // |nfc_proxy_| could be null on Mojo connection failure, simply ignore the
   // abort request in this case.
   if (!nfc_proxy_)
@@ -161,8 +161,8 @@
                          device::mojom::blink::NFC::CancelPushCallback());
 }
 
-void NFCWriter::OnRequestCompleted(ScriptPromiseResolver* resolver,
-                                   device::mojom::blink::NFCErrorPtr error) {
+void NDEFWriter::OnRequestCompleted(ScriptPromiseResolver* resolver,
+                                    device::mojom::blink::NDEFErrorPtr error) {
   DCHECK(requests_.Contains(resolver));
 
   requests_.erase(resolver);
@@ -170,7 +170,7 @@
   if (error.is_null())
     resolver->Resolve();
   else
-    resolver->Reject(NFCErrorTypeToDOMException(error->error_type));
+    resolver->Reject(NDEFErrorTypeToDOMException(error->error_type));
 }
 
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/nfc_writer.h b/third_party/blink/renderer/modules/nfc/ndef_writer.h
similarity index 74%
rename from third_party/blink/renderer/modules/nfc/nfc_writer.h
rename to third_party/blink/renderer/modules/nfc/ndef_writer.h
index 9a3ad66..11931931 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_writer.h
+++ b/third_party/blink/renderer/modules/nfc/ndef_writer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_WRITER_H_
-#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_WRITER_H_
+#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_WRITER_H_
+#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_WRITER_H_
 
 #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
 #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h"
@@ -13,7 +13,7 @@
 
 namespace blink {
 
-class NFCPushOptions;
+class NDEFPushOptions;
 class ExceptionState;
 class ExecutionContext;
 class ScriptPromise;
@@ -21,22 +21,22 @@
 
 using NDEFMessageSource = StringOrArrayBufferOrNDEFMessageInit;
 
-class NFCWriter : public ScriptWrappable, public ContextClient {
+class NDEFWriter : public ScriptWrappable, public ContextClient {
   DEFINE_WRAPPERTYPEINFO();
-  USING_GARBAGE_COLLECTED_MIXIN(NFCWriter);
+  USING_GARBAGE_COLLECTED_MIXIN(NDEFWriter);
 
  public:
-  static NFCWriter* Create(ExecutionContext*);
+  static NDEFWriter* Create(ExecutionContext*);
 
-  explicit NFCWriter(ExecutionContext*);
-  ~NFCWriter() override = default;
+  explicit NDEFWriter(ExecutionContext*);
+  ~NDEFWriter() override = default;
 
   void Trace(blink::Visitor*) override;
 
   // Pushes NDEFMessageSource asynchronously to NFC tag / peer.
   ScriptPromise push(ScriptState*,
                      const NDEFMessageSource&,
-                     const NFCPushOptions*,
+                     const NDEFPushOptions*,
                      ExceptionState&);
 
   // Called by NFCProxy for notification about connection error.
@@ -46,7 +46,7 @@
   void InitNfcProxyIfNeeded();
   void Abort(const String& target, ScriptPromiseResolver* resolver);
   void OnRequestCompleted(ScriptPromiseResolver* resolver,
-                          device::mojom::blink::NFCErrorPtr error);
+                          device::mojom::blink::NDEFErrorPtr error);
 
   // |requests_| are kept here to handle Mojo connection failures because
   // in that case the callback passed to Push() won't be called and
@@ -58,4 +58,4 @@
 
 }  // namespace blink
 
-#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_WRITER_H_
+#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NDEF_WRITER_H_
diff --git a/third_party/blink/renderer/modules/nfc/nfc_writer.idl b/third_party/blink/renderer/modules/nfc/ndef_writer.idl
similarity index 86%
rename from third_party/blink/renderer/modules/nfc/nfc_writer.idl
rename to third_party/blink/renderer/modules/nfc/ndef_writer.idl
index 78de13eb..b255144 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_writer.idl
+++ b/third_party/blink/renderer/modules/nfc/ndef_writer.idl
@@ -14,6 +14,6 @@
     Constructor(),
     ConstructorCallWith=ExecutionContext,
     Exposed=Window
-] interface NFCWriter {
-    [CallWith=ScriptState, RaisesException] Promise<void> push (NDEFMessageSource message, optional NFCPushOptions options);
+] interface NDEFWriter {
+    [CallWith=ScriptState, RaisesException] Promise<void> push (NDEFMessageSource message, optional NDEFPushOptions options);
 };
diff --git a/third_party/blink/renderer/modules/nfc/nfc_error_event.cc b/third_party/blink/renderer/modules/nfc/nfc_error_event.cc
deleted file mode 100644
index ba7a4580..0000000
--- a/third_party/blink/renderer/modules/nfc/nfc_error_event.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2019 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 "third_party/blink/renderer/modules/nfc/nfc_error_event.h"
-
-#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
-#include "v8/include/v8.h"
-
-namespace blink {
-
-NFCErrorEvent::NFCErrorEvent(const AtomicString& event_type,
-                             DOMException* error)
-    : Event(event_type, Bubbles::kNo, Cancelable::kNo), error_(error) {
-  DCHECK(error_);
-}
-
-NFCErrorEvent::NFCErrorEvent(const AtomicString& event_type,
-                             const NFCErrorEventInit* initializer)
-    : Event(event_type, initializer), error_(initializer->error()) {
-  DCHECK(error_);
-}
-
-NFCErrorEvent::~NFCErrorEvent() = default;
-
-const AtomicString& NFCErrorEvent::InterfaceName() const {
-  return event_interface_names::kNFCErrorEvent;
-}
-
-void NFCErrorEvent::Trace(blink::Visitor* visitor) {
-  visitor->Trace(error_);
-  Event::Trace(visitor);
-}
-
-}  // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/nfc_error_event.h b/third_party/blink/renderer/modules/nfc/nfc_error_event.h
deleted file mode 100644
index 106a66c..0000000
--- a/third_party/blink/renderer/modules/nfc/nfc_error_event.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_ERROR_EVENT_H_
-#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_ERROR_EVENT_H_
-
-#include "third_party/blink/renderer/core/dom/dom_exception.h"
-#include "third_party/blink/renderer/modules/event_modules.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_error_event_init.h"
-#include "third_party/blink/renderer/platform/heap/handle.h"
-
-namespace blink {
-
-class NFCErrorEvent : public Event {
-  DEFINE_WRAPPERTYPEINFO();
-
- public:
-  static NFCErrorEvent* Create(const AtomicString& event_type,
-                               const NFCErrorEventInit* initializer) {
-    return MakeGarbageCollected<NFCErrorEvent>(event_type, initializer);
-  }
-
-  NFCErrorEvent(const AtomicString& event_type, DOMException* error);
-  NFCErrorEvent(const AtomicString& event_type,
-                const NFCErrorEventInit* initializer);
-  ~NFCErrorEvent() override;
-
-  void Trace(blink::Visitor*) override;
-
-  const AtomicString& InterfaceName() const override;
-
-  DOMException* error() { return error_; }
-
- private:
-  Member<DOMException> error_;
-};
-
-DEFINE_TYPE_CASTS(NFCErrorEvent,
-                  Event,
-                  event,
-                  event->InterfaceName() ==
-                      event_interface_names::kNFCErrorEvent,
-                  event.InterfaceName() ==
-                      event_interface_names::kNFCErrorEvent);
-
-}  // namespace blink
-
-#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_ERROR_EVENT_H_
diff --git a/third_party/blink/renderer/modules/nfc/nfc_proxy.cc b/third_party/blink/renderer/modules/nfc/nfc_proxy.cc
index 58c193e..b0a84e1 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_proxy.cc
+++ b/third_party/blink/renderer/modules/nfc/nfc_proxy.cc
@@ -8,10 +8,10 @@
 
 #include "third_party/blink/public/common/browser_interface_broker_proxy.h"
 #include "third_party/blink/renderer/core/page/focus_controller.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_reader.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_reader.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_writer.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_type_converters.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_utils.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_writer.h"
 #include "third_party/blink/renderer/platform/mojo/mojo_helper.h"
 
 namespace blink {
@@ -54,21 +54,22 @@
   Supplement<Document>::Trace(visitor);
 }
 
-void NFCProxy::StartReading(NFCReader* reader, const NFCScanOptions* options) {
+void NFCProxy::StartReading(NDEFReader* reader,
+                            const NDEFScanOptions* options) {
   DCHECK(reader);
   if (readers_.Contains(reader))
     return;
 
   EnsureMojoConnection();
   nfc_remote_->Watch(
-      device::mojom::blink::NFCScanOptions::From(options), next_watch_id_,
+      device::mojom::blink::NDEFScanOptions::From(options), next_watch_id_,
       WTF::Bind(&NFCProxy::OnReaderRegistered, WrapPersistent(this),
                 WrapPersistent(reader), next_watch_id_));
   readers_.insert(reader, next_watch_id_);
   next_watch_id_++;
 }
 
-void NFCProxy::StopReading(NFCReader* reader) {
+void NFCProxy::StopReading(NDEFReader* reader) {
   DCHECK(reader);
   auto iter = readers_.find(reader);
   if (iter != readers_.end()) {
@@ -81,18 +82,18 @@
   }
 }
 
-bool NFCProxy::IsReading(const NFCReader* reader) {
+bool NFCProxy::IsReading(const NDEFReader* reader) {
   DCHECK(reader);
-  return readers_.Contains(const_cast<NFCReader*>(reader));
+  return readers_.Contains(const_cast<NDEFReader*>(reader));
 }
 
-void NFCProxy::AddWriter(NFCWriter* writer) {
+void NFCProxy::AddWriter(NDEFWriter* writer) {
   DCHECK(!writers_.Contains(writer));
   writers_.insert(writer);
 }
 
 void NFCProxy::Push(device::mojom::blink::NDEFMessagePtr message,
-                    device::mojom::blink::NFCPushOptionsPtr options,
+                    device::mojom::blink::NDEFPushOptionsPtr options,
                     device::mojom::blink::NFC::PushCallback cb) {
   EnsureMojoConnection();
   nfc_remote_->Push(std::move(message), std::move(options), std::move(cb));
@@ -102,7 +103,7 @@
     const String& target,
     device::mojom::blink::NFC::CancelPushCallback callback) {
   DCHECK(nfc_remote_);
-  nfc_remote_->CancelPush(StringToNFCPushTarget(target), std::move(callback));
+  nfc_remote_->CancelPush(StringToNDEFPushTarget(target), std::move(callback));
 }
 
 // device::mojom::blink::NFCClient implementation.
@@ -110,8 +111,8 @@
                        const String& serial_number,
                        device::mojom::blink::NDEFMessagePtr message) {
   // Dispatch the event to all matched readers. We iterate on a copy of
-  // |readers_| because the user's NFCReader#onreading event handler may call
-  // NFCReader#stop() to modify |readers_| just during the iteration process.
+  // |readers_| because the user's NDEFReader#onreading event handler may call
+  // NDEFReader#stop() to modify |readers_| just during the iteration process.
   // This loop is O(n^2), however, we assume the number of readers to be small
   // so it'd be just OK.
   ReaderMap copy = readers_;
@@ -121,9 +122,9 @@
   }
 }
 
-void NFCProxy::OnReaderRegistered(NFCReader* reader,
+void NFCProxy::OnReaderRegistered(NDEFReader* reader,
                                   uint32_t watch_id,
-                                  device::mojom::blink::NFCErrorPtr error) {
+                                  device::mojom::blink::NDEFErrorPtr error) {
   DCHECK(reader);
   // |reader| may have already stopped reading.
   if (!readers_.Contains(reader))
@@ -210,7 +211,7 @@
   for (auto& pair : readers) {
     // The reader may call StopReading() to remove itself from |readers_| when
     // handling the error.
-    pair.key->OnError(device::mojom::blink::NFCErrorType::NOT_SUPPORTED);
+    pair.key->OnError(device::mojom::blink::NDEFErrorType::NOT_SUPPORTED);
   }
 
   // Each connection maintains its own watch ID numbering, so reset to 1 on
diff --git a/third_party/blink/renderer/modules/nfc/nfc_proxy.h b/third_party/blink/renderer/modules/nfc/nfc_proxy.h
index 9500909..0c0e242 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_proxy.h
+++ b/third_party/blink/renderer/modules/nfc/nfc_proxy.h
@@ -17,11 +17,11 @@
 namespace blink {
 
 class Document;
-class NFCScanOptions;
-class NFCReader;
-class NFCWriter;
+class NDEFScanOptions;
+class NDEFReader;
+class NDEFWriter;
 
-// This is a proxy class used by NFCWriter(s) and NFCReader(s) to connect
+// This is a proxy class used by NDEFWriter(s) and NDEFReader(s) to connect
 // to implementation of device::mojom::blink::NFC interface.
 class MODULES_EXPORT NFCProxy final : public GarbageCollected<NFCProxy>,
                                       public PageVisibilityObserver,
@@ -45,13 +45,13 @@
   // There is no matching RemoveWriter() method because writers are
   // automatically removed from the weak hash set when they are garbage
   // collected.
-  void AddWriter(NFCWriter*);
+  void AddWriter(NDEFWriter*);
 
-  void StartReading(NFCReader*, const NFCScanOptions*);
-  void StopReading(NFCReader*);
-  bool IsReading(const NFCReader*);
+  void StartReading(NDEFReader*, const NDEFScanOptions*);
+  void StopReading(NDEFReader*);
+  bool IsReading(const NDEFReader*);
   void Push(device::mojom::blink::NDEFMessagePtr,
-            device::mojom::blink::NFCPushOptionsPtr,
+            device::mojom::blink::NDEFPushOptionsPtr,
             device::mojom::blink::NFC::PushCallback);
   void CancelPush(const String&, device::mojom::blink::NFC::CancelPushCallback);
 
@@ -61,9 +61,9 @@
                const String&,
                device::mojom::blink::NDEFMessagePtr) override;
 
-  void OnReaderRegistered(NFCReader*,
+  void OnReaderRegistered(NDEFReader*,
                           uint32_t watch_id,
-                          device::mojom::blink::NFCErrorPtr);
+                          device::mojom::blink::NDEFErrorPtr);
 
   // Implementation of PageVisibilityObserver.
   void PageVisibilityChanged() override;
@@ -83,12 +83,12 @@
   // i.e. |nfc_|. Incremented each time a watch request is made.
   uint32_t next_watch_id_ = 1;
 
-  // The <NFCReader, WatchId> map keeps all readers that have started reading.
+  // The <NDEFReader, WatchId> map keeps all readers that have started reading.
   // The watch id comes from |next_watch_id_|.
-  using ReaderMap = HeapHashMap<WeakMember<NFCReader>, uint32_t>;
+  using ReaderMap = HeapHashMap<WeakMember<NDEFReader>, uint32_t>;
   ReaderMap readers_;
 
-  using WriterSet = HeapHashSet<WeakMember<NFCWriter>>;
+  using WriterSet = HeapHashSet<WeakMember<NDEFWriter>>;
   WriterSet writers_;
 
   mojo::Remote<device::mojom::blink::NFC> nfc_remote_;
diff --git a/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc b/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc
index eac4afa..0381ff3 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc
+++ b/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc
@@ -14,9 +14,9 @@
 #include "third_party/blink/public/common/browser_interface_broker_proxy.h"
 #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
 #include "third_party/blink/renderer/core/testing/page_test_base.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_reader.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_scan_options.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_proxy.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_reader.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_scan_options.h"
 #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
 
 namespace blink {
@@ -45,15 +45,15 @@
   return true;
 }
 
-class MockNFCReader : public NFCReader {
+class MockNDEFReader : public NDEFReader {
  public:
-  explicit MockNFCReader(ExecutionContext* execution_context)
-      : NFCReader(execution_context) {}
+  explicit MockNDEFReader(ExecutionContext* execution_context)
+      : NDEFReader(execution_context) {}
 
   MOCK_METHOD2(OnReading,
                void(const String& serial_number,
                     const device::mojom::blink::NDEFMessage& message));
-  MOCK_METHOD1(OnError, void(device::mojom::blink::NFCErrorType error));
+  MOCK_METHOD1(OnError, void(device::mojom::blink::NDEFErrorType error));
 };
 
 class FakeNfcService : public device::mojom::blink::NFC {
@@ -111,16 +111,16 @@
     client_.Bind(std::move(client));
   }
   void Push(device::mojom::blink::NDEFMessagePtr message,
-            device::mojom::blink::NFCPushOptionsPtr options,
+            device::mojom::blink::NDEFPushOptionsPtr options,
             PushCallback callback) override {
     set_tag_message(std::move(message));
     std::move(callback).Run(nullptr);
   }
-  void CancelPush(device::mojom::blink::NFCPushTarget target,
+  void CancelPush(device::mojom::blink::NDEFPushTarget target,
                   CancelPushCallback callback) override {
     std::move(callback).Run(nullptr);
   }
-  void Watch(device::mojom::blink::NFCScanOptionsPtr options,
+  void Watch(device::mojom::blink::NDEFScanOptionsPtr options,
              uint32_t id,
              WatchCallback callback) override {
     watches_.emplace(id, std::move(options));
@@ -128,8 +128,8 @@
   }
   void CancelWatch(uint32_t id, CancelWatchCallback callback) override {
     if (watches_.erase(id) < 1) {
-      std::move(callback).Run(device::mojom::blink::NFCError::New(
-          device::mojom::blink::NFCErrorType::NOT_FOUND));
+      std::move(callback).Run(device::mojom::blink::NDEFError::New(
+          device::mojom::blink::NDEFErrorType::NOT_FOUND));
     } else {
       std::move(callback).Run(nullptr);
     }
@@ -143,7 +143,7 @@
 
   device::mojom::blink::NDEFMessagePtr tag_message_;
   mojo::Remote<device::mojom::blink::NFCClient> client_;
-  std::map<uint32_t, device::mojom::blink::NFCScanOptionsPtr> watches_;
+  std::map<uint32_t, device::mojom::blink::NDEFScanOptionsPtr> watches_;
   mojo::Receiver<device::mojom::blink::NFC> receiver_;
 };
 
@@ -176,9 +176,9 @@
 TEST_F(NFCProxyTest, SuccessfulPath) {
   auto& document = GetDocument();
   auto* nfc_proxy = NFCProxy::From(document);
-  auto* scan_options = NFCScanOptions::Create();
+  auto* scan_options = NDEFScanOptions::Create();
   scan_options->setURL(kTestUrl);
-  auto* reader = MakeGarbageCollected<MockNFCReader>(&document);
+  auto* reader = MakeGarbageCollected<MockNDEFReader>(&document);
 
   nfc_proxy->StartReading(reader, scan_options);
   EXPECT_TRUE(nfc_proxy->IsReading(reader));
@@ -205,7 +205,7 @@
 
   nfc_proxy->Push(
       std::move(message), /*options=*/nullptr,
-      base::BindLambdaForTesting([&](device::mojom::blink::NFCErrorPtr error) {
+      base::BindLambdaForTesting([&](device::mojom::blink::NDEFErrorPtr error) {
         nfc_service()->TriggerWatchEvent();
       }));
   loop.Run();
@@ -219,9 +219,9 @@
 TEST_F(NFCProxyTest, ErrorPath) {
   auto& document = GetDocument();
   auto* nfc_proxy = NFCProxy::From(document);
-  auto* scan_options = NFCScanOptions::Create();
+  auto* scan_options = NDEFScanOptions::Create();
   scan_options->setURL(kTestUrl);
-  auto* reader = MakeGarbageCollected<MockNFCReader>(&document);
+  auto* reader = MakeGarbageCollected<MockNDEFReader>(&document);
 
   nfc_proxy->StartReading(reader, scan_options);
   EXPECT_TRUE(nfc_proxy->IsReading(reader));
@@ -230,7 +230,7 @@
   base::RunLoop loop;
   EXPECT_CALL(*reader, OnError(_))
       .WillOnce(
-          Invoke([&](device::mojom::blink::NFCErrorType) { loop.Quit(); }));
+          Invoke([&](device::mojom::blink::NDEFErrorType) { loop.Quit(); }));
   DestroyNfcService();
   loop.Run();
   EXPECT_FALSE(nfc_proxy->IsReading(reader));
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reading_event.cc b/third_party/blink/renderer/modules/nfc/nfc_reading_event.cc
deleted file mode 100644
index 3443dc72..0000000
--- a/third_party/blink/renderer/modules/nfc/nfc_reading_event.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2019 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 "third_party/blink/renderer/modules/nfc/nfc_reading_event.h"
-
-#include "third_party/blink/renderer/modules/nfc/ndef_message.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_reading_event_init.h"
-#include "third_party/blink/renderer/platform/bindings/exception_state.h"
-
-namespace blink {
-
-// static
-NFCReadingEvent* NFCReadingEvent::Create(const AtomicString& event_type,
-                                         const NFCReadingEventInit* init,
-                                         ExceptionState& exception_state) {
-  NDEFMessage* message = NDEFMessage::Create(init->message(), exception_state);
-  if (exception_state.HadException())
-    return nullptr;
-  DCHECK(message);
-  return MakeGarbageCollected<NFCReadingEvent>(event_type, init, message);
-}
-
-NFCReadingEvent::NFCReadingEvent(const AtomicString& event_type,
-                                 const NFCReadingEventInit* init,
-                                 NDEFMessage* message)
-    : Event(event_type, init),
-      serial_number_(init->serialNumber()),
-      message_(message) {}
-
-NFCReadingEvent::NFCReadingEvent(const AtomicString& event_type,
-                                 const String& serial_number,
-                                 NDEFMessage* message)
-    : Event(event_type, Bubbles::kNo, Cancelable::kNo),
-      serial_number_(serial_number),
-      message_(message) {}
-
-NFCReadingEvent::~NFCReadingEvent() = default;
-
-const AtomicString& NFCReadingEvent::InterfaceName() const {
-  return event_interface_names::kNFCReadingEvent;
-}
-
-void NFCReadingEvent::Trace(blink::Visitor* visitor) {
-  visitor->Trace(message_);
-  Event::Trace(visitor);
-}
-
-const String& NFCReadingEvent::serialNumber() const {
-  if (serial_number_.IsNull())
-    return g_empty_string;
-  return serial_number_;
-}
-
-NDEFMessage* NFCReadingEvent::message() const {
-  return message_;
-}
-
-}  // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/nfc_reading_event.h b/third_party/blink/renderer/modules/nfc/nfc_reading_event.h
deleted file mode 100644
index 169fde59..0000000
--- a/third_party/blink/renderer/modules/nfc/nfc_reading_event.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_READING_EVENT_H_
-#define THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_READING_EVENT_H_
-
-#include "third_party/blink/renderer/modules/event_modules.h"
-#include "third_party/blink/renderer/platform/heap/handle.h"
-#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
-
-namespace blink {
-
-class ExceptionState;
-class NDEFMessage;
-class NFCReadingEventInit;
-
-class NFCReadingEvent final : public Event {
-  DEFINE_WRAPPERTYPEINFO();
-
- public:
-  static NFCReadingEvent* Create(const AtomicString&,
-                                 const NFCReadingEventInit*,
-                                 ExceptionState&);
-
-  NFCReadingEvent(const AtomicString&,
-                  const NFCReadingEventInit*,
-                  NDEFMessage*);
-  NFCReadingEvent(const AtomicString&, const String&, NDEFMessage*);
-  ~NFCReadingEvent() override;
-
-  const AtomicString& InterfaceName() const override;
-
-  void Trace(blink::Visitor*) override;
-
-  const String& serialNumber() const;
-  NDEFMessage* message() const;
-
- private:
-  String serial_number_;
-  Member<NDEFMessage> message_;
-};
-
-DEFINE_TYPE_CASTS(NFCReadingEvent,
-                  Event,
-                  event,
-                  event->InterfaceName() ==
-                      event_interface_names::kNFCReadingEvent,
-                  event.InterfaceName() ==
-                      event_interface_names::kNFCReadingEvent);
-
-}  // namespace blink
-
-#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_READING_EVENT_H_
diff --git a/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc b/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc
index a11da094..a9d0a1b 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc
+++ b/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc
@@ -9,21 +9,21 @@
 
 #include "services/device/public/mojom/nfc.mojom-blink.h"
 #include "third_party/blink/renderer/modules/nfc/ndef_message.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_push_options.h"
 #include "third_party/blink/renderer/modules/nfc/ndef_record.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_push_options.h"
-#include "third_party/blink/renderer/modules/nfc/nfc_scan_options.h"
+#include "third_party/blink/renderer/modules/nfc/ndef_scan_options.h"
 #include "third_party/blink/renderer/modules/nfc/nfc_utils.h"
 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
 
 using device::mojom::blink::NDEFMessage;
 using device::mojom::blink::NDEFMessagePtr;
+using device::mojom::blink::NDEFPushOptions;
+using device::mojom::blink::NDEFPushOptionsPtr;
 using device::mojom::blink::NDEFRecord;
 using device::mojom::blink::NDEFRecordPtr;
 using device::mojom::blink::NDEFRecordTypeFilter;
-using device::mojom::blink::NFCPushOptions;
-using device::mojom::blink::NFCPushOptionsPtr;
-using device::mojom::blink::NFCScanOptions;
-using device::mojom::blink::NFCScanOptionsPtr;
+using device::mojom::blink::NDEFScanOptions;
+using device::mojom::blink::NDEFScanOptionsPtr;
 
 // Mojo type converters
 namespace mojo {
@@ -47,14 +47,14 @@
   return messagePtr;
 }
 
-NFCPushOptionsPtr
-TypeConverter<NFCPushOptionsPtr, const blink::NFCPushOptions*>::Convert(
-    const blink::NFCPushOptions* pushOptions) {
-  // https://w3c.github.io/web-nfc/#the-nfcpushoptions-dictionary
-  // Default values for NFCPushOptions dictionary are:
+NDEFPushOptionsPtr
+TypeConverter<NDEFPushOptionsPtr, const blink::NDEFPushOptions*>::Convert(
+    const blink::NDEFPushOptions* pushOptions) {
+  // https://w3c.github.io/web-nfc/#the-ndefpushoptions-dictionary
+  // Default values for NDEFPushOptions dictionary are:
   // target = 'any', timeout = Infinity, ignoreRead = true
-  NFCPushOptionsPtr pushOptionsPtr = NFCPushOptions::New();
-  pushOptionsPtr->target = blink::StringToNFCPushTarget(pushOptions->target());
+  NDEFPushOptionsPtr pushOptionsPtr = NDEFPushOptions::New();
+  pushOptionsPtr->target = blink::StringToNDEFPushTarget(pushOptions->target());
   pushOptionsPtr->ignore_read = pushOptions->ignoreRead();
 
   if (pushOptions->hasTimeout())
@@ -65,13 +65,13 @@
   return pushOptionsPtr;
 }
 
-NFCScanOptionsPtr
-TypeConverter<NFCScanOptionsPtr, const blink::NFCScanOptions*>::Convert(
-    const blink::NFCScanOptions* scanOptions) {
-  // https://w3c.github.io/web-nfc/#dom-nfcscanoptions
-  // Default values for NFCScanOptions dictionary are:
+NDEFScanOptionsPtr
+TypeConverter<NDEFScanOptionsPtr, const blink::NDEFScanOptions*>::Convert(
+    const blink::NDEFScanOptions* scanOptions) {
+  // https://w3c.github.io/web-nfc/#dom-ndefscanoptions
+  // Default values for NDEFScanOptions dictionary are:
   // url = "", recordType = null, mediaType = ""
-  NFCScanOptionsPtr scanOptionsPtr = NFCScanOptions::New();
+  NDEFScanOptionsPtr scanOptionsPtr = NDEFScanOptions::New();
   scanOptionsPtr->url = scanOptions->url();
   scanOptionsPtr->media_type = scanOptions->mediaType();
 
diff --git a/third_party/blink/renderer/modules/nfc/nfc_type_converters.h b/third_party/blink/renderer/modules/nfc/nfc_type_converters.h
index e96c73b..751246b 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_type_converters.h
+++ b/third_party/blink/renderer/modules/nfc/nfc_type_converters.h
@@ -13,8 +13,8 @@
 
 class NDEFRecord;
 class NDEFMessage;
-class NFCScanOptions;
-class NFCPushOptions;
+class NDEFScanOptions;
+class NDEFPushOptions;
 
 }  // namespace blink
 
@@ -36,17 +36,17 @@
 };
 
 template <>
-struct TypeConverter<device::mojom::blink::NFCPushOptionsPtr,
-                     const ::blink::NFCPushOptions*> {
-  static device::mojom::blink::NFCPushOptionsPtr Convert(
-      const ::blink::NFCPushOptions* pushOptions);
+struct TypeConverter<device::mojom::blink::NDEFPushOptionsPtr,
+                     const ::blink::NDEFPushOptions*> {
+  static device::mojom::blink::NDEFPushOptionsPtr Convert(
+      const ::blink::NDEFPushOptions* pushOptions);
 };
 
 template <>
-struct TypeConverter<device::mojom::blink::NFCScanOptionsPtr,
-                     const ::blink::NFCScanOptions*> {
-  static device::mojom::blink::NFCScanOptionsPtr Convert(
-      const ::blink::NFCScanOptions* scanOptions);
+struct TypeConverter<device::mojom::blink::NDEFScanOptionsPtr,
+                     const ::blink::NDEFScanOptions*> {
+  static device::mojom::blink::NDEFScanOptionsPtr Convert(
+      const ::blink::NDEFScanOptions* scanOptions);
 };
 
 }  // namespace mojo
diff --git a/third_party/blink/renderer/modules/nfc/nfc_utils.cc b/third_party/blink/renderer/modules/nfc/nfc_utils.cc
index 32477ef..cfa57ac 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_utils.cc
+++ b/third_party/blink/renderer/modules/nfc/nfc_utils.cc
@@ -13,7 +13,7 @@
 #include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/weborigin/kurl.h"
 
-using device::mojom::blink::NFCPushTarget;
+using device::mojom::blink::NDEFPushTarget;
 
 namespace blink {
 
@@ -38,47 +38,47 @@
   return origin_url.IsValid();
 }
 
-NFCPushTarget StringToNFCPushTarget(const String& target) {
+NDEFPushTarget StringToNDEFPushTarget(const String& target) {
   if (target == "tag")
-    return NFCPushTarget::TAG;
+    return NDEFPushTarget::TAG;
 
   if (target == "peer")
-    return NFCPushTarget::PEER;
+    return NDEFPushTarget::PEER;
 
-  return NFCPushTarget::ANY;
+  return NDEFPushTarget::ANY;
 }
 
-DOMException* NFCErrorTypeToDOMException(
-    device::mojom::blink::NFCErrorType error_type) {
+DOMException* NDEFErrorTypeToDOMException(
+    device::mojom::blink::NDEFErrorType error_type) {
   switch (error_type) {
-    case device::mojom::blink::NFCErrorType::NOT_ALLOWED:
+    case device::mojom::blink::NDEFErrorType::NOT_ALLOWED:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kNotAllowedError, "NFC operation not allowed.");
-    case device::mojom::blink::NFCErrorType::NOT_SUPPORTED:
+    case device::mojom::blink::NDEFErrorType::NOT_SUPPORTED:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kNotSupportedError,
           "No NFC adapter or cannot establish connection.");
-    case device::mojom::blink::NFCErrorType::NOT_READABLE:
+    case device::mojom::blink::NDEFErrorType::NOT_READABLE:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kNotReadableError, "NFC is not enabled.");
-    case device::mojom::blink::NFCErrorType::NOT_FOUND:
+    case device::mojom::blink::NDEFErrorType::NOT_FOUND:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kNotFoundError,
           "Provided watch id cannot be found.");
-    case device::mojom::blink::NFCErrorType::INVALID_MESSAGE:
+    case device::mojom::blink::NDEFErrorType::INVALID_MESSAGE:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kSyntaxError, "Invalid NFC message was provided.");
-    case device::mojom::blink::NFCErrorType::OPERATION_CANCELLED:
+    case device::mojom::blink::NDEFErrorType::OPERATION_CANCELLED:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kAbortError, "The NFC operation was cancelled.");
-    case device::mojom::blink::NFCErrorType::TIMER_EXPIRED:
+    case device::mojom::blink::NDEFErrorType::TIMER_EXPIRED:
       return MakeGarbageCollected<DOMException>(DOMExceptionCode::kTimeoutError,
                                                 "NFC operation has timed out.");
-    case device::mojom::blink::NFCErrorType::CANNOT_CANCEL:
+    case device::mojom::blink::NDEFErrorType::CANNOT_CANCEL:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kNoModificationAllowedError,
           "NFC operation cannot be cancelled.");
-    case device::mojom::blink::NFCErrorType::IO_ERROR:
+    case device::mojom::blink::NDEFErrorType::IO_ERROR:
       return MakeGarbageCollected<DOMException>(
           DOMExceptionCode::kNetworkError,
           "NFC data transfer error has occurred.");
diff --git a/third_party/blink/renderer/modules/nfc/nfc_utils.h b/third_party/blink/renderer/modules/nfc/nfc_utils.h
index 5c1954e..72e2282 100644
--- a/third_party/blink/renderer/modules/nfc/nfc_utils.h
+++ b/third_party/blink/renderer/modules/nfc/nfc_utils.h
@@ -20,11 +20,11 @@
 bool SetNDEFMessageURL(const String& origin,
                        device::mojom::blink::NDEFMessage* message);
 
-device::mojom::blink::NFCPushTarget StringToNFCPushTarget(
+device::mojom::blink::NDEFPushTarget StringToNDEFPushTarget(
     const WTF::String& target);
 
-DOMException* NFCErrorTypeToDOMException(
-    device::mojom::blink::NFCErrorType error_type);
+DOMException* NDEFErrorTypeToDOMException(
+    device::mojom::blink::NDEFErrorType error_type);
 
 }  // namespace blink
 
diff --git a/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.idl b/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.idl
index 36fc458..6686d62 100644
--- a/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.idl
+++ b/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.idl
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// https://w3c.github.io/wake-lock/#extensions-to-the-navigator-interface
+
 [
   ImplementedAs=NavigatorWakeLock,
   RuntimeEnabled=WakeLock,
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock.cc b/third_party/blink/renderer/modules/wake_lock/wake_lock.cc
index 652e18b..33a45aa 100644
--- a/third_party/blink/renderer/modules/wake_lock/wake_lock.cc
+++ b/third_party/blink/renderer/modules/wake_lock/wake_lock.cc
@@ -40,7 +40,7 @@
                                                       WakeLockType::kSystem)} {}
 
 ScriptPromise WakeLock::request(ScriptState* script_state, const String& type) {
-  // https://w3c.github.io/wake-lock/#request-static-method
+  // https://w3c.github.io/wake-lock/#the-request-method
   auto* context = ExecutionContext::From(script_state);
   DCHECK(context->IsDocument() || context->IsDedicatedWorkerGlobalScope());
 
@@ -110,6 +110,7 @@
     }
   }
 
+  // 1. Let promise be a new promise.
   auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
   ScriptPromise promise = resolver->Promise();
 
@@ -127,10 +128,8 @@
       break;
   }
 
-  // 6. Run the following steps in parallel, but abort when options' signal
-  // member is present and its aborted flag is set:
-  // 6.1. Let state be the result of awaiting obtain permission steps with
-  //      type:
+  // 5. Run the following steps in parallel, but abort when type is "screen" and
+  // document is hidden:
   DoRequest(wake_lock_type, resolver);
 
   // 7. Return promise.
@@ -138,6 +137,8 @@
 }
 
 void WakeLock::DoRequest(WakeLockType type, ScriptPromiseResolver* resolver) {
+  // https://w3c.github.io/wake-lock/#the-request-method
+  // 5.1. Let state be the result of awaiting obtain permission steps with type:
   ObtainPermission(
       type, WTF::Bind(&WakeLock::DidReceivePermissionResponse,
                       WrapPersistent(this), type, WrapPersistent(resolver)));
@@ -146,11 +147,11 @@
 void WakeLock::DidReceivePermissionResponse(WakeLockType type,
                                             ScriptPromiseResolver* resolver,
                                             PermissionStatus status) {
-  // https://w3c.github.io/wake-lock/#request-static-method
+  // https://w3c.github.io/wake-lock/#the-request-method
   DCHECK(status == PermissionStatus::GRANTED ||
          status == PermissionStatus::DENIED);
   DCHECK(resolver);
-  // 6.1.1. If state is "denied", then reject promise with a "NotAllowedError"
+  // 5.1.1. If state is "denied", then reject promise with a "NotAllowedError"
   //        DOMException, and abort these steps.
   if (status != PermissionStatus::GRANTED) {
     resolver->Reject(MakeGarbageCollected<DOMException>(
@@ -158,9 +159,8 @@
         "Wake Lock permission request denied"));
     return;
   }
-  // https://github.com/w3c/wake-lock/issues/222: the page can become hidden
-  // between request() and WakeLockManager::AcquireWakeLock(), in which case
-  // we need to abort early.
+  // 6. If aborted, run these steps:
+  // 6.1. Reject promise with a "NotAllowedError" DOMException.
   if (type == WakeLockType::kScreen &&
       !(GetPage() && GetPage()->IsPageVisible())) {
     resolver->Reject(MakeGarbageCollected<DOMException>(
@@ -168,9 +168,9 @@
         "The requesting page is not visible"));
     return;
   }
-  // 6.2. Let success be the result of awaiting acquire a wake lock with promise
+  // 5.3. Let success be the result of awaiting acquire a wake lock with lock
   // and type:
-  // 6.2.1. If success is false then reject promise with a "NotAllowedError"
+  // 5.3.1. If success is false then reject promise with a "NotAllowedError"
   //        DOMException, and abort these steps.
   WakeLockManager* manager = managers_[static_cast<size_t>(type)];
   DCHECK(manager);
@@ -182,12 +182,12 @@
   // 1. Let document be the responsible document of the current settings object.
   // 2. Let screenRecord be the platform wake lock's state record associated
   // with document and wake lock type "screen".
-  // 3. For each lockPromise in screenRecord.[[ActiveLocks]]:
-  // 3.1. Run release a wake lock with lockPromise and "screen".
+  // 3. For each lock in screenRecord.[[ActiveLocks]]:
+  // 3.1. Run release a wake lock with lock and "screen".
   // 4. Let systemRecord be the platform wake lock's state record associated
   // with document and wake lock type "system".
-  // 5. For each lockPromise in systemRecord.[[ActiveLocks]]:
-  // 5.1. Run release a wake lock with lockPromise and "system".
+  // 5. For each lock in systemRecord.[[ActiveLocks]]:
+  // 5.1. Run release a wake lock with lock and "system".
   for (WakeLockManager* manager : managers_) {
     if (manager)
       manager->ClearWakeLocks();
@@ -202,8 +202,8 @@
     return;
   // 3. Let screenRecord be the platform wake lock's state record associated
   // with wake lock type "screen".
-  // 4. For each lockPromise in screenRecord.[[ActiveLocks]]:
-  // 4.1. Run release a wake lock with lockPromise and "screen".
+  // 4. For each lock in screenRecord.[[ActiveLocks]]:
+  // 4.1. Run release a wake lock with lock and "screen".
   WakeLockManager* manager =
       managers_[static_cast<size_t>(WakeLockType::kScreen)];
   if (manager)
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock_manager.cc b/third_party/blink/renderer/modules/wake_lock/wake_lock_manager.cc
index dade239..7de2db7e 100644
--- a/third_party/blink/renderer/modules/wake_lock/wake_lock_manager.cc
+++ b/third_party/blink/renderer/modules/wake_lock/wake_lock_manager.cc
@@ -34,7 +34,7 @@
   //      object.
   // 4.2. Let record be the platform wake lock's state record associated with
   //      document and type.
-  // 4.3. Add lockPromise to record.[[ActiveLocks]].
+  // 4.3. Add lock to record.[[ActiveLocks]].
   // 5. Return active.
   if (!wake_lock_) {
     mojo::Remote<mojom::blink::WakeLockService> wake_lock_service;
@@ -49,6 +49,10 @@
         &WakeLockManager::OnWakeLockConnectionError, WrapWeakPersistent(this)));
     wake_lock_->RequestWakeLock();
   }
+  // https://w3c.github.io/wake-lock/#the-request-method
+  // 5.2. Let lock be a new WakeLockSentinel object with its type attribute set
+  // to type.
+  // 5.4. Resolve promise with lock.
   auto* sentinel = MakeGarbageCollected<WakeLockSentinel>(
       resolver->GetScriptState(), wake_lock_type_, this);
   wake_lock_sentinels_.insert(sentinel);
@@ -56,13 +60,29 @@
 }
 
 void WakeLockManager::UnregisterSentinel(WakeLockSentinel* sentinel) {
+  // https://w3c.github.io/wake-lock/#release-wake-lock-algorithm
+  // 1. Let document be the responsible document of the current settings object.
+  // 2. Let record be the platform wake lock's state record associated with
+  // document and type.
+  // 3. If record.[[ActiveLocks]] does not contain lock, abort these steps.
   auto iterator = wake_lock_sentinels_.find(sentinel);
   DCHECK(iterator != wake_lock_sentinels_.end());
+
+  // 4. Remove lock from record.[[ActiveLocks]].
   wake_lock_sentinels_.erase(iterator);
 
+  // 5. If the internal slot [[ActiveLocks]] of all the platform wake lock's
+  // state records are all empty, then run the following steps in parallel:
+  // 5.1. Ask the underlying operation system to release the wake lock of type
+  //      type and let success be true if the operation succeeded, or else
+  //      false.
   if (wake_lock_sentinels_.IsEmpty() && wake_lock_.is_bound()) {
     wake_lock_->CancelWakeLock();
     wake_lock_.reset();
+
+    // 5.2. If success is true and type is "screen" run the following:
+    // 5.2.1. Reset the platform-specific inactivity timer after which the
+    //        screen is actually turned off.
   }
 }
 
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.cc b/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.cc
index 7c9de8e..28ec5a6 100644
--- a/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.cc
+++ b/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.cc
@@ -23,11 +23,20 @@
 WakeLockSentinel::~WakeLockSentinel() = default;
 
 ScriptPromise WakeLockSentinel::release(ScriptState* script_state) {
+  // https://w3c.github.io/wake-lock/#the-release-method
+  // 1. Let promise be a new promise.
+  // 2. Run the following steps in parallel:
+  // 2.1. Run release wake lock with lock set to this object and type set to the
+  //      value of this object's type attribute.
+  // 2.2. Resolve promise.
+  // 3. Return promise.
   DoRelease();
   return ScriptPromise::CastUndefined(script_state);
 }
 
 String WakeLockSentinel::type() const {
+  // https://w3c.github.io/wake-lock/#dom-wakelocksentinel-type
+  // The type attribute corresponds to the WakeLockSentinel's wake lock type.
   switch (type_) {
     case WakeLockType::kScreen:
       return "screen";
@@ -51,7 +60,10 @@
 }
 
 bool WakeLockSentinel::HasPendingActivity() const {
-  return HasEventListeners();
+  // This WakeLockSentinel needs to remain alive as long as:
+  // 1. DoRelease() has not not been called yet AND
+  // 2. It has at least one event listener.
+  return manager_ && HasEventListeners();
 }
 
 void WakeLockSentinel::ContextDestroyed(ExecutionContext*) {
@@ -62,12 +74,18 @@
 }
 
 void WakeLockSentinel::DoRelease() {
+  // https://w3c.github.io/wake-lock/#release-wake-lock-algorithm
+  // 1. Let document be the responsible document of the current settings object.
+  // 2. Let record be the platform wake lock's state record associated with
+  // document and type.
+  // 3. If record.[[ActiveLocks]] does not contain lock, abort these steps.
   if (!manager_)
     return;
 
   manager_->UnregisterSentinel(this);
   manager_.Clear();
 
+  // 6. Queue a task to fire an event named "release" at lock.
   DispatchEvent(*Event::Create(event_type_names::kRelease));
 }
 
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.idl b/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.idl
index f747650..45b382cf 100644
--- a/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.idl
+++ b/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel.idl
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// https://w3c.github.io/wake-lock/#the-wakelocksentinel-interface
+
 [
   ActiveScriptWrappable,
   Exposed=(DedicatedWorker,Window),
diff --git a/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel_test.cc b/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel_test.cc
index 370f6e3..9354ca5 100644
--- a/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel_test.cc
+++ b/third_party/blink/renderer/modules/wake_lock/wake_lock_sentinel_test.cc
@@ -103,4 +103,40 @@
   EXPECT_FALSE(sentinel->HasPendingActivity());
 }
 
+TEST(WakeLockSentinelTest, HasPendingActivityConditions) {
+  MockWakeLockService wake_lock_service;
+  WakeLockTestingContext context(&wake_lock_service);
+
+  auto* manager = MakeGarbageCollected<WakeLockManager>(context.GetDocument(),
+                                                        WakeLockType::kScreen);
+  auto* resolver =
+      MakeGarbageCollected<ScriptPromiseResolver>(context.GetScriptState());
+  ScriptPromise promise = resolver->Promise();
+  manager->AcquireWakeLock(resolver);
+  context.WaitForPromiseFulfillment(promise);
+  auto* sentinel =
+      ScriptPromiseUtils::GetPromiseResolutionAsWakeLockSentinel(promise);
+  ASSERT_TRUE(sentinel);
+
+  // A new WakeLockSentinel was created and it can be GC'ed.
+  EXPECT_FALSE(sentinel->HasPendingActivity());
+
+  base::RunLoop run_loop;
+  auto* event_listener =
+      MakeGarbageCollected<SyncEventListener>(run_loop.QuitClosure());
+  sentinel->addEventListener(event_type_names::kRelease, event_listener);
+
+  // The sentinel cannot be GC'ed, it has an event listener and it has not been
+  // released.
+  EXPECT_TRUE(sentinel->HasPendingActivity());
+
+  // An event such as a page visibility change will eventually call this method.
+  manager->ClearWakeLocks();
+  run_loop.Run();
+
+  // The sentinel can be GC'ed even though it still has an event listener, as
+  // it has already been released.
+  EXPECT_FALSE(sentinel->HasPendingActivity());
+}
+
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/wake_lock/worker_navigator_wake_lock.idl b/third_party/blink/renderer/modules/wake_lock/worker_navigator_wake_lock.idl
index ddcc2c2..251ff83 100644
--- a/third_party/blink/renderer/modules/wake_lock/worker_navigator_wake_lock.idl
+++ b/third_party/blink/renderer/modules/wake_lock/worker_navigator_wake_lock.idl
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// https://w3c.github.io/wake-lock/#extensions-to-the-workernavigator-interface
+
 [
   ImplementedAs=WorkerNavigatorWakeLock,
   RuntimeEnabled=WakeLock,
diff --git a/third_party/blink/renderer/modules/webaudio/audio_param.cc b/third_party/blink/renderer/modules/webaudio/audio_param.cc
index a065a30..e8dbea2d 100644
--- a/third_party/blink/renderer/modules/webaudio/audio_param.cc
+++ b/third_party/blink/renderer/modules/webaudio/audio_param.cc
@@ -30,6 +30,7 @@
 #include "third_party/blink/renderer/modules/webaudio/audio_node.h"
 #include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
 #include "third_party/blink/renderer/platform/audio/audio_utilities.h"
+#include "third_party/blink/renderer/platform/audio/vector_math.h"
 #include "third_party/blink/renderer/platform/bindings/exception_state.h"
 #include "third_party/blink/renderer/platform/instrumentation/histogram.h"
 #include "third_party/blink/renderer/platform/wtf/math_extras.h"
@@ -283,6 +284,13 @@
       // Sum, with unity-gain.
       summing_bus_->SumFrom(*connection_bus);
     }
+
+    // Clamp the values now to the nominal range
+    float min_value = MinValue();
+    float max_value = MaxValue();
+
+    vector_math::Vclip(values, 1, &min_value, &max_value, values, 1,
+                       number_of_values);
   }
 }
 
diff --git a/third_party/blink/renderer/platform/bindings/v8_private_property.h b/third_party/blink/renderer/platform/bindings/v8_private_property.h
index 20342d95..a2b3d830 100644
--- a/third_party/blink/renderer/platform/bindings/v8_private_property.h
+++ b/third_party/blink/renderer/platform/bindings/v8_private_property.h
@@ -36,11 +36,9 @@
   X(DOMException, Error)                                \
   X(Global, Event)                                      \
   X(IDBCursor, Request)                                 \
-  X(IntersectionObserver, Callback)                     \
   X(MessageChannel, Port1)                              \
   X(MessageChannel, Port2)                              \
   X(MessageEvent, CachedData)                           \
-  X(MutationObserver, Callback)                         \
   X(NamedConstructor, Initialized)                      \
   X(PopStateEvent, State)                               \
   X(SameObject, DetectedBarcodeCornerPoints)            \
diff --git a/third_party/blink/renderer/platform/heap/thread_state.cc b/third_party/blink/renderer/platform/heap/thread_state.cc
index 9e803dcc..f424931 100644
--- a/third_party/blink/renderer/platform/heap/thread_state.cc
+++ b/third_party/blink/renderer/platform/heap/thread_state.cc
@@ -657,6 +657,7 @@
       ThreadHeapStatsCollector::kAtomicPauseMarkPrologue, "epoch", gc_age_,
       "forced", IsForcedGC(reason));
   EnterAtomicPause();
+  EnterNoAllocationScope();
   EnterGCForbiddenScope();
   // Compaction needs to be canceled when incremental marking ends with a
   // conservative GC.
@@ -1268,8 +1269,9 @@
       ThreadHeapStatsCollector::kAtomicPauseMarkEpilogue, "epoch", gc_age_,
       "forced", IsForcedGC(current_gc_data_.reason));
   MarkPhaseEpilogue(marking_type);
-  LeaveAtomicPause();
   LeaveGCForbiddenScope();
+  LeaveNoAllocationScope();
+  LeaveAtomicPause();
   static_cast<MutexBase&>(ProcessHeap::CrossThreadPersistentMutex()).unlock();
 }
 
diff --git a/third_party/blink/web_tests/ASANExpectations b/third_party/blink/web_tests/ASANExpectations
index 551217e..156d396 100644
--- a/third_party/blink/web_tests/ASANExpectations
+++ b/third_party/blink/web_tests/ASANExpectations
@@ -72,4 +72,3 @@
 # Sheriff 2019-07-31
 crbug.com/989365 [ Linux ] external/wpt/cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html [ Pass Timeout ]
 
-crbug.com/1015737 [ Linux ] external/wpt/webaudio/the-audio-api/the-delaynode-interface/no-dezippering.html [ Crash ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations
index b3e921a9..880e1ff 100644
--- a/third_party/blink/web_tests/TestExpectations
+++ b/third_party/blink/web_tests/TestExpectations
@@ -5760,9 +5760,12 @@
 crbug.com/1015187 [ Linux Mac ] virtual/cross-origin-embedder-policy/external/wpt/html/cross-origin-embedder-policy/none.https.html [ Pass Failure ]
 
 # Sheriff 2019-10-18
-crbug.com/996250 external/wpt/web-nfc/NFCReader_scan_iframe.https.html [ Timeout ]
+crbug.com/996250 external/wpt/web-nfc/NDEFReader_scan_iframe.https.html [ Timeout ]
 crbug.com/1015254 [ Mac ] external/wpt/pointerevents/extension/pointerevent_coalesced_events_attributes.html [ Pass Failure ]
 crbug.com/1015859 [ Linux ] http/tests/devtools/a11y-axe-core/performance/landing-page-a11y-test.js [ Pass Failure ]
 crbug.com/1015764 compositing/video/video-poster.html [ Pass Crash ]
 crbug.com/1015975 media/video-currentTime.html [ Pass Failure ]
 crbug.com/1015975 virtual/audio-service/media/video-currentTime.html [ Pass Failure ]
+
+# Sheriff 2019-10-21
+crbug.com/1016364 [ Linux Mac Debug ] http/tests/devtools/console/console-search.js [ Pass Timeout ]
diff --git a/third_party/blink/web_tests/WPTOverrideExpectations b/third_party/blink/web_tests/WPTOverrideExpectations
index 72717e9..65522df 100644
--- a/third_party/blink/web_tests/WPTOverrideExpectations
+++ b/third_party/blink/web_tests/WPTOverrideExpectations
@@ -1760,7 +1760,7 @@
 crbug.com/lpz external/wpt/web-animations/timing-model/animations/setting-the-timeline-of-an-animation.html [ Failure ]
 crbug.com/lpz external/wpt/web-locks/clientids.tentative.https.html [ Failure ]
 crbug.com/lpz external/wpt/web-locks/query-ordering.tentative.https.html [ Pass Failure ]
-crbug.com/lpz external/wpt/web-nfc/NFCWriter_push.https.html [ Failure ]
+crbug.com/lpz external/wpt/web-nfc/NDEFWriter_push.https.html [ Failure ]
 crbug.com/lpz external/wpt/web-nfc/idlharness.https.window.html [ Failure ]
 crbug.com/lpz external/wpt/webaudio/idlharness.https.window.html [ Failure ]
 crbug.com/lpz external/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-output-channel-count.https.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/animations/web-animations/animation-state-changes-negative-playback-rate.html b/third_party/blink/web_tests/animations/web-animations/animation-state-changes-negative-playback-rate.html
index f9c40f70..c3774c6 100644
--- a/third_party/blink/web_tests/animations/web-animations/animation-state-changes-negative-playback-rate.html
+++ b/third_party/blink/web_tests/animations/web-animations/animation-state-changes-negative-playback-rate.html
@@ -82,7 +82,7 @@
 
 test(function() {
   var animation = finishedAnimation();
-  assert_times_equal(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
+  assert_equals(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
   assert_equals(animation.currentTime, 0);
   assert_false(animation.pending);
   assert_equals(animation.playState, 'finished');
@@ -118,7 +118,7 @@
 test(function() {
   var animation = idleAnimation();
   animation.finish();
-  assert_times_equal(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
+  assert_equals(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
   assert_equals(animation.currentTime, 0);
   assert_false(animation.pending);
   assert_equals(animation.playState, 'finished');
@@ -221,7 +221,7 @@
   animation.play();
   assert_equals(animation.startTime, startTime);
   assert_equals(animation.currentTime, currentTime);
-  assert_false(animation.pending);
+  assert_true(animation.pending);
   assert_equals(animation.playState, 'running');
 }, "Calling play() on a running animation");
 
diff --git a/third_party/blink/web_tests/animations/web-animations/animation-state-changes-positive-playback-rate.html b/third_party/blink/web_tests/animations/web-animations/animation-state-changes-positive-playback-rate.html
index 1c3e593..0592cbc3 100644
--- a/third_party/blink/web_tests/animations/web-animations/animation-state-changes-positive-playback-rate.html
+++ b/third_party/blink/web_tests/animations/web-animations/animation-state-changes-positive-playback-rate.html
@@ -212,7 +212,7 @@
   animation.play();
   assert_equals(animation.startTime, startTime);
   assert_equals(animation.currentTime, currentTime);
-  assert_false(animation.pending);
+  assert_true(animation.pending);
   assert_equals(animation.playState, 'running');
 }, "Setting play() on a running animation");
 
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
index 560154d..f1aca7c 100644
--- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
+++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -6913,15 +6913,15 @@
      {}
     ]
    ],
-   "web-nfc/NFCReader-document-hidden-manual.https.html": [
+   "web-nfc/NDEFReader-document-hidden-manual.https.html": [
     [
-     "web-nfc/NFCReader-document-hidden-manual.https.html",
+     "web-nfc/NDEFReader-document-hidden-manual.https.html",
      {}
     ]
    ],
-   "web-nfc/NFCWriter-document-hidden-manual.https.html": [
+   "web-nfc/NDEFWriter-document-hidden-manual.https.html": [
     [
-     "web-nfc/NFCWriter-document-hidden-manual.https.html",
+     "web-nfc/NDEFWriter-document-hidden-manual.https.html",
      {}
     ]
    ],
@@ -176434,13 +176434,13 @@
    "web-nfc/NDEFMessage_constructor.https-expected.txt": [
     []
    ],
-   "web-nfc/NFCReader-document-hidden-manual.https-expected.txt": [
+   "web-nfc/NDEFReader-document-hidden-manual.https-expected.txt": [
     []
    ],
-   "web-nfc/NFCWriter-document-hidden-manual.https-expected.txt": [
+   "web-nfc/NDEFWriter-document-hidden-manual.https-expected.txt": [
     []
    ],
-   "web-nfc/NFCWriter_push.https-expected.txt": [
+   "web-nfc/NDEFWriter_push.https-expected.txt": [
     []
    ],
    "web-nfc/OWNERS": [
@@ -310371,39 +310371,39 @@
      {}
     ]
    ],
-   "web-nfc/NFCErrorEvent_constructor.https.html": [
+   "web-nfc/NDEFErrorEvent_constructor.https.html": [
     [
-     "web-nfc/NFCErrorEvent_constructor.https.html",
+     "web-nfc/NDEFErrorEvent_constructor.https.html",
      {}
     ]
    ],
-   "web-nfc/NFCReader_options.https.html": [
+   "web-nfc/NDEFReader_options.https.html": [
     [
-     "web-nfc/NFCReader_options.https.html",
+     "web-nfc/NDEFReader_options.https.html",
      {}
     ]
    ],
-   "web-nfc/NFCReader_scan.https.html": [
+   "web-nfc/NDEFReader_scan.https.html": [
     [
-     "web-nfc/NFCReader_scan.https.html",
+     "web-nfc/NDEFReader_scan.https.html",
      {}
     ]
    ],
-   "web-nfc/NFCReader_scan_iframe.https.html": [
+   "web-nfc/NDEFReader_scan_iframe.https.html": [
     [
-     "web-nfc/NFCReader_scan_iframe.https.html",
+     "web-nfc/NDEFReader_scan_iframe.https.html",
      {}
     ]
    ],
-   "web-nfc/NFCReadingEvent_constructor.https.html": [
+   "web-nfc/NDEFReadingEvent_constructor.https.html": [
     [
-     "web-nfc/NFCReadingEvent_constructor.https.html",
+     "web-nfc/NDEFReadingEvent_constructor.https.html",
      {}
     ]
    ],
-   "web-nfc/NFCWriter_push.https.html": [
+   "web-nfc/NDEFWriter_push.https.html": [
     [
-     "web-nfc/NFCWriter_push.https.html",
+     "web-nfc/NDEFWriter_push.https.html",
      {}
     ]
    ],
@@ -512484,47 +512484,47 @@
    "849a6ae336ea4026888e9835e89db64fd03eb555",
    "testharness"
   ],
-  "web-nfc/NFCErrorEvent_constructor.https.html": [
+  "web-nfc/NDEFErrorEvent_constructor.https.html": [
    "1cc9ce160be46955a9b15485ee4c040605722961",
    "testharness"
   ],
-  "web-nfc/NFCReader-document-hidden-manual.https-expected.txt": [
+  "web-nfc/NDEFReader-document-hidden-manual.https-expected.txt": [
    "9fba7c80883b5144c3a444df0b6bfb6fef0ebb64",
    "support"
   ],
-  "web-nfc/NFCReader-document-hidden-manual.https.html": [
+  "web-nfc/NDEFReader-document-hidden-manual.https.html": [
    "6d9a52c1ecf5bfb2f9ac9876b0ff5988bcc285e0",
    "manual"
   ],
-  "web-nfc/NFCReader_options.https.html": [
+  "web-nfc/NDEFReader_options.https.html": [
    "5761747f907fad40873023f8ba746bef19fb08e7",
    "testharness"
   ],
-  "web-nfc/NFCReader_scan.https.html": [
+  "web-nfc/NDEFReader_scan.https.html": [
    "638d0c5a1d1b8d0e2e8e8422bd4b9e9488512e54",
    "testharness"
   ],
-  "web-nfc/NFCReader_scan_iframe.https.html": [
+  "web-nfc/NDEFReader_scan_iframe.https.html": [
    "31e79b0388aa5f407a7c9a1b591f162b3e42001f",
    "testharness"
   ],
-  "web-nfc/NFCReadingEvent_constructor.https.html": [
+  "web-nfc/NDEFReadingEvent_constructor.https.html": [
    "20585176b7f89a129fad99f17d068b2deb828f68",
    "testharness"
   ],
-  "web-nfc/NFCWriter-document-hidden-manual.https-expected.txt": [
+  "web-nfc/NDEFWriter-document-hidden-manual.https-expected.txt": [
    "777243f850377f2f6a0ef99e452fed18cb9fc2d9",
    "support"
   ],
-  "web-nfc/NFCWriter-document-hidden-manual.https.html": [
+  "web-nfc/NDEFWriter-document-hidden-manual.https.html": [
    "72d8c8143cd934ad3ff0f8e32968851a1769b0c3",
    "manual"
   ],
-  "web-nfc/NFCWriter_push.https-expected.txt": [
+  "web-nfc/NDEFWriter_push.https-expected.txt": [
    "72884b7e143029113a014f4653c8f857bc8d0c77",
    "support"
   ],
-  "web-nfc/NFCWriter_push.https.html": [
+  "web-nfc/NDEFWriter_push.https.html": [
    "6b4034fccc2987c0366ccdfd58dd394a5111709b",
    "testharness"
   ],
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-011.html b/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-011.html
new file mode 100644
index 0000000..f95458fc
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-011.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8" />
+  <title>CSS Test (Selectors): :focus-visible matches even if preventDefault() is called</title>
+  <link rel="author" title="Alice Boxhall" href="aboxhall@chromium.org" />
+  <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+  <script src="/resources/testdriver.js"></script>
+  <script src="/resources/testdriver-vendor.js"></script>
+  <style>
+    button {
+      border: 0;
+    }
+
+    #next:focus-visible {
+      outline: darkgreen auto 5px;
+    }
+
+    #next:focus:not(:focus-visible) {
+      background-color: tomato;
+      outline: 0;
+    }
+  </style>
+</head>
+<body>
+  This test checks that <code>:focus-visible</code> matches after a keyboard event,
+  even if the event handler calls preventDefault() on the event.
+  <ul id="instructions">
+    <li>Click "Click here and press right arrow.".</li>
+    <li>Press the right arrow key.</li>
+    <li>If "Focus moves here." has a red background, then the test result is FAILURE.
+        If it has a green outline, then the test result is SUCCESS.</li>
+  </ul>
+  <br />
+  <button id="start" tabindex="0">Click here and press right arrow.</button>
+  <button id="next" tabindex="-1">Focus moves here.</button>
+  <script>
+    start.addEventListener('keydown', (e) => {
+      next.focus();
+    });
+
+    async_test(async function(t) {
+      next.addEventListener("focus", t.step_func(() => {
+        assert_equals(getComputedStyle(next).outlineColor, "rgb(0, 100, 0)");
+        t.done()
+      }));
+
+      // \ue014 -> ARROW_RIGHT
+      test_driver.send_keys(start, "\ue014").catch(t.step_func(() => {
+        assert_true(false, "send_keys not implemented yet");
+        t.done();
+      }));
+    }, ":focus-visible matches even if preventDefault() is called");
+  </script>
+</body>
+</html>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl
index 5f0dd23..56b7479e 100644
--- a/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl
+++ b/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl
@@ -45,61 +45,61 @@
 typedef (DOMString or BufferSource or NDEFMessageInit) NDEFMessageSource;
 
 [SecureContext, Exposed=Window]
-interface NFCWriter {
+interface NDEFWriter {
   constructor();
 
-  Promise<void> push(NDEFMessageSource message, optional NFCPushOptions options={});
+  Promise<void> push(NDEFMessageSource message, optional NDEFPushOptions options={});
 };
 
 [SecureContext, Exposed=Window]
-interface NFCReader : EventTarget {
+interface NDEFReader : EventTarget {
   constructor();
 
   attribute EventHandler onreading;
   attribute EventHandler onerror;
 
-  void scan(optional NFCScanOptions options={});
+  void scan(optional NDEFScanOptions options={});
 };
 
 [SecureContext, Exposed=Window]
-interface NFCReadingEvent : Event {
-  constructor(DOMString type, NFCReadingEventInit readingEventInitDict);
+interface NDEFReadingEvent : Event {
+  constructor(DOMString type, NDEFReadingEventInit readingEventInitDict);
 
   readonly attribute DOMString serialNumber;
   [SameObject] readonly attribute NDEFMessage message;
 };
 
-dictionary NFCReadingEventInit : EventInit {
+dictionary NDEFReadingEventInit : EventInit {
   DOMString? serialNumber = "";
   required NDEFMessageInit message;
 };
 
 [SecureContext, Exposed=Window]
-interface NFCErrorEvent : Event {
-  constructor(DOMString type, NFCErrorEventInit errorEventInitDict);
+interface NDEFErrorEvent : Event {
+  constructor(DOMString type, NDEFErrorEventInit errorEventInitDict);
 
   readonly attribute DOMException error;
 };
 
-dictionary NFCErrorEventInit : EventInit {
+dictionary NDEFErrorEventInit : EventInit {
   required DOMException error;
 };
 
-dictionary NFCPushOptions {
-  NFCPushTarget target = "any";
+dictionary NDEFPushOptions {
+  NDEFPushTarget target = "any";
   unrestricted double timeout = Infinity;
   boolean ignoreRead = true;
   boolean overwrite = true;
   AbortSignal? signal;
 };
 
-enum NFCPushTarget {
+enum NDEFPushTarget {
   "tag",
   "peer",
   "any"
 };
 
-dictionary NFCScanOptions {
+dictionary NDEFScanOptions {
   USVString id = "";
   USVString recordType;
   USVString mediaType = "";
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js b/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js
index 6ef03b3..d279fcf 100644
--- a/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js
+++ b/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js
@@ -1,14 +1,14 @@
 'use strict';
 
-function toMojoNFCPushTarget(target) {
+function toMojoNDEFPushTarget(target) {
   switch (target) {
   case 'peer':
-    return device.mojom.NFCPushTarget.PEER;
+    return device.mojom.NDEFPushTarget.PEER;
   case 'tag':
-    return device.mojom.NFCPushTarget.TAG;
+    return device.mojom.NDEFPushTarget.TAG;
   }
 
-  return device.mojom.NFCPushTarget.ANY;
+  return device.mojom.NDEFPushTarget.ANY;
 }
 
 // Converts between NDEFMessageInit https://w3c.github.io/web-nfc/#dom-ndefmessage
@@ -65,9 +65,9 @@
                       new Uint8Array(receivedRecord.data));
 }
 
-// Compares NFCPushOptions structures that were provided to API and
+// Compares NDEFPushOptions structures that were provided to API and
 // received by the mock mojo service.
-function assertNFCPushOptionsEqual(provided, received) {
+function assertNDEFPushOptionsEqual(provided, received) {
   if (provided.ignoreRead !== undefined)
     assert_equals(provided.ignoreRead, !!received.ignoreRead);
   else
@@ -79,14 +79,14 @@
     assert_equals(received.timeout, Infinity);
 
   if (provided.target !== undefined)
-    assert_equals(toMojoNFCPushTarget(provided.target), received.target);
+    assert_equals(toMojoNDEFPushTarget(provided.target), received.target);
   else
-    assert_equals(received.target, device.mojom.NFCPushTarget.ANY);
+    assert_equals(received.target, device.mojom.NDEFPushTarget.ANY);
 }
 
-// Compares NFCReaderOptions structures that were provided to API and
+// Compares NDEFReaderOptions structures that were provided to API and
 // received by the mock mojo service.
-function assertNFCReaderOptionsEqual(provided, received) {
+function assertNDEFReaderOptionsEqual(provided, received) {
   if (provided.url !== undefined)
     assert_equals(provided.url, received.url);
   else
@@ -103,7 +103,7 @@
   }
 }
 
-// Checks whether NFCReaderOptions are matched with given message.
+// Checks whether NDEFReaderOptions are matched with given message.
 function matchesWatchOptions(message, options) {
   // Filter by Web NFC id.
   if (!matchesWebNfcId(message.url, options.url)) return false;
@@ -150,9 +150,9 @@
   return true;
 }
 
-function createNFCError(type) {
+function createNDEFError(type) {
   return { error: type ?
-      new device.mojom.NFCError({ errorType: type }) : null };
+      new device.mojom.NDEFError({ errorType: type }) : null };
 }
 
 var WebNFCTest = (() => {
@@ -201,21 +201,21 @@
           // Resolve with TimeoutError, else pend push operation.
           if (this.push_should_timeout_) {
             resolve(
-                createNFCError(device.mojom.NFCErrorType.TIMER_EXPIRED));
+                createNDEFError(device.mojom.NDEFErrorType.TIMER_EXPIRED));
           }
         } else {
-          resolve(createNFCError(null));
+          resolve(createNDEFError(null));
         }
       });
     }
 
     async cancelPush(target) {
-      if (this.push_options_ && ((target === device.mojom.NFCPushTarget.ANY) ||
+      if (this.push_options_ && ((target === device.mojom.NDEFPushTarget.ANY) ||
           (this.push_options_.target === target))) {
         this.cancelPendingPushOperation();
       }
 
-      return createNFCError(null);
+      return createNDEFError(null);
     }
 
     setClient(client) {
@@ -241,33 +241,33 @@
         }
       }
 
-      return createNFCError(null);
+      return createNDEFError(null);
     }
 
     async cancelWatch(id) {
       let index = this.watchers_.findIndex(value => value.id === id);
       if (index === -1) {
-        return createNFCError(device.mojom.NFCErrorType.NOT_FOUND);
+        return createNDEFError(device.mojom.NDEFErrorType.NOT_FOUND);
       }
 
       this.watchers_.splice(index, 1);
-      return createNFCError(null);
+      return createNDEFError(null);
     }
 
     async cancelAllWatches() {
       if (this.watchers_.length === 0) {
-        return createNFCError(device.mojom.NFCErrorType.NOT_FOUND);
+        return createNDEFError(device.mojom.NDEFErrorType.NOT_FOUND);
       }
 
       this.watchers_.splice(0, this.watchers_.length);
-      return createNFCError(null);
+      return createNDEFError(null);
     }
 
     getHWError() {
       if (this.hw_status_ === NFCHWStatus.DISABLED)
-        return createNFCError(device.mojom.NFCErrorType.NOT_READABLE);
+        return createNDEFError(device.mojom.NDEFErrorType.NOT_READABLE);
       if (this.hw_status_ === NFCHWStatus.NOT_SUPPORTED)
-        return createNFCError(device.mojom.NFCErrorType.NOT_SUPPORTED);
+        return createNDEFError(device.mojom.NDEFErrorType.NOT_SUPPORTED);
       return null;
     }
 
@@ -306,7 +306,7 @@
     cancelPendingPushOperation() {
       if (this.pending_promise_func_) {
         this.pending_promise_func_(
-            createNFCError(device.mojom.NFCErrorType.OPERATION_CANCELLED));
+            createNDEFError(device.mojom.NDEFErrorType.OPERATION_CANCELLED));
       }
 
       this.pushed_message_ = null;
@@ -321,7 +321,7 @@
       this.reading_messages_.push(message);
       // Ignore reading if NFC operation is suspended.
       if(this.operations_suspended_) return;
-      // Ignore reading if NFCPushOptions.ignoreRead is true.
+      // Ignore reading if NDEFPushOptions.ignoreRead is true.
       if(this.push_options_ && this.push_options_.ignoreRead)
         return;
       // Triggers onWatch if the new message matches existing watchers.
@@ -359,7 +359,7 @@
       }
       // Resumes pending push operation.
       if (this.pending_promise_func_) {
-        this.pending_promise_func_(createNFCError(null));
+        this.pending_promise_func_(createNDEFError(null));
       }
     }
   }
diff --git a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/test-helpers.sub.js b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/test-helpers.sub.js
index db7433dc..bbd16ab 100644
--- a/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/test-helpers.sub.js
+++ b/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/test-helpers.sub.js
@@ -6,11 +6,14 @@
  * @param options.updateViaCache a ServiceWorkerUpdateViaCache.
  * @see https://w3c.github.io/ServiceWorker/#dictdef-registrationoptions
  */
-function service_worker_unregister_and_register(test, url, scope, options = {}) {
+function service_worker_unregister_and_register(test, url, scope, options) {
   if (!scope || scope.length == 0)
     return Promise.reject(new Error('tests must define a scope'));
 
-  options.scope = scope;
+  if (options && options.scope)
+    return Promise.reject(new Error('scope must not be passed in options'));
+
+  options = Object.assign({ scope: scope }, options);
   return service_worker_unregister(test, scope)
     .then(function() {
         return navigator.serviceWorker.register(url, options);
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFErrorEvent_constructor.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFErrorEvent_constructor.https.html
new file mode 100644
index 0000000..2438936
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFErrorEvent_constructor.https.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<title>NDEFErrorEvent constructor</title>
+<link rel="help" href="https://w3c.github.io/web-nfc/#dom-ndeferrorevent">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+  test(() => {
+    assert_equals(NDEFErrorEvent.length, 2);
+    assert_throws(new TypeError, () => new NDEFErrorEvent('error'));
+  }, 'NDEFErrorEvent constructor without init dict');
+
+  test(() => {
+    assert_throws(new TypeError, () => new NDEFErrorEvent('error', { error : null }));
+  }, 'NDEFErrorEvent constructor with a null that is not of type DOMException');
+
+  test(() => {
+    const event = new NDEFErrorEvent('error', { error : new DOMException() });
+    assert_true(event.error instanceof DOMException);
+  }, 'NDEFErrorEvent constructor with a valid DOMException');
+</script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader-document-hidden-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader-document-hidden-manual.https-expected.txt
new file mode 100644
index 0000000..e2f2377
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader-document-hidden-manual.https-expected.txt
@@ -0,0 +1,4 @@
+This is a testharness.js-based test.
+FAIL Test NDEFReader.onreading is not fired when document is hidden assert_equals: Expected reading event, but got error event instead expected "reading" but got "error"
+Harness: the test ran to completion.
+
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader-document-hidden-manual.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader-document-hidden-manual.https.html
similarity index 80%
rename from third_party/blink/web_tests/external/wpt/web-nfc/NFCReader-document-hidden-manual.https.html
rename to third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader-document-hidden-manual.https.html
index 6d9a52c..868cf1a 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader-document-hidden-manual.https.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader-document-hidden-manual.https.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
 <meta name="timeout" content="long">
-<title>NFCReader.onreading respect page visibility changes</title>
+<title>NDEFReader.onreading respect page visibility changes</title>
 <link rel="help" href="https://w3c.github.io/web-nfc/#visible-document">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 
 promise_test(async t => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   reader.scan();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
@@ -18,7 +18,7 @@
       resolve();
     });
   });
-}, "Test NFCReader.onreading is not fired when document is hidden");
+}, "Test NDEFReader.onreading is not fired when document is hidden");
 
 </script>
 
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_options.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_options.https.html
similarity index 77%
rename from third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_options.https.html
rename to third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_options.https.html
index 5761747..b9015dc 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_options.https.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_options.https.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <meta charset=utf-8>
-<title>Web NFC: NFCReader option tests</title>
+<title>Web NFC: NDEFReader option tests</title>
 <link rel="author" title="Intel" href="http://www.intel.com"/>
 <link rel="help" href="https://w3c.github.io/web-nfc/"/>
 <script src="/resources/testharness.js"></script>
@@ -10,45 +10,45 @@
 
 'use strict';
 
-const NFCReaderOptionTests =
+const NDEFReaderOptionTests =
   [
     {
-      desc: "Test that reading data succeed when NFCScanOptions'" +
+      desc: "Test that reading data succeed when NDEFScanOptions'" +
             " recordType is set to 'empty'.",
       scanOptions: {recordType: "empty"},
       unmatchedScanOptions: {recordType: "json"},
       message: createMessage([createRecord('empty', '')])
     },
     {
-      desc: "Test that reading data succeed when NFCScanOptions'" +
+      desc: "Test that reading data succeed when NDEFScanOptions'" +
             " recordType is set to 'json'.",
       scanOptions: {recordType: "json"},
       unmatchedScanOptions: {recordType: "url"},
       message: createMessage([createJsonRecord(test_json_data)])
     },
     {
-      desc: "Test that reading data succeed when NFCScanOptions'" +
+      desc: "Test that reading data succeed when NDEFScanOptions'" +
             " recordType is set to 'opaque'.",
       scanOptions: {recordType: "opaque"},
       unmatchedScanOptions: {recordType: "json"},
       message: createMessage([createOpaqueRecord(test_buffer_data)])
     },
     {
-      desc: "Test that reading data succeed when NFCScanOptions'" +
+      desc: "Test that reading data succeed when NDEFScanOptions'" +
             " recordType is set to 'text'.",
       scanOptions: {recordType: "text"},
       unmatchedScanOptions: {recordType: "json"},
       message: createMessage([createTextRecord(test_text_data)])
     },
     {
-      desc: "Test that reading data succeed when NFCScanOptions'" +
+      desc: "Test that reading data succeed when NDEFScanOptions'" +
             " recordType is set to 'url'.",
       scanOptions: {recordType: "url"},
       unmatchedScanOptions: {recordType: "json"},
       message: createMessage([createUrlRecord(test_url_data)])
     },
     {
-      desc: "Test that reading data succeed when NFCScanOptions'" +
+      desc: "Test that reading data succeed when NDEFScanOptions'" +
             " recordType is set to a custom type for external type records.",
       scanOptions: {recordType: "w3.org:xyz"},
       unmatchedScanOptions: {recordType: "opaque"},
@@ -56,7 +56,7 @@
             test_buffer_data)])
     },
     {
-      desc: "Test that the url of NFCScanOptions filters relevant data" +
+      desc: "Test that the url of NDEFScanOptions filters relevant data" +
             " sources correctly.",
       scanOptions: {url: `${location.origin}/custom/path`},
       unmatchedScanOptions: {url: `${location.origin}/custom/invalid`},
@@ -64,7 +64,7 @@
           records: [createTextRecord(test_text_data)]}
     },
     {
-      desc: "Test that the mediaType of NFCScanOptions filters relevant data" +
+      desc: "Test that the mediaType of NDEFScanOptions filters relevant data" +
             " sources correctly.",
       scanOptions: {mediaType: "application/octet-stream"},
       unmatchedScanOptions: {mediaType: "application/json"},
@@ -76,42 +76,42 @@
   [
     {
       desc: "Test that filtering 'empty' record from different messages" +
-            " correctly with NFCScanOptions' recordType is set to 'empty'.",
+            " correctly with NDEFScanOptions' recordType is set to 'empty'.",
       scanOptions: {recordType: "empty"},
       message: createMessage([createRecord('empty', '')]),
       unmatchedMessage: createMessage([createJsonRecord(test_json_data)]),
     },
     {
       desc: "Test that filtering 'json' record from different messages" +
-            " correctly with NFCScanOptions' recordType is set to 'json'.",
+            " correctly with NDEFScanOptions' recordType is set to 'json'.",
       scanOptions: {recordType: "json"},
       message: createMessage([createJsonRecord(test_json_data)]),
       unmatchedMessage: createMessage([createUrlRecord(test_url_data)])
     },
     {
       desc: "Test that filtering 'opaque' record from different messages" +
-            " correctly with NFCScanOptions' recordType is set to 'opaque'.",
+            " correctly with NDEFScanOptions' recordType is set to 'opaque'.",
       scanOptions: {recordType: "opaque"},
       message: createMessage([createOpaqueRecord(test_buffer_data)]),
       unmatchedMessage: createMessage([createJsonRecord(test_json_data)])
     },
     {
       desc: "Test that filtering 'text' record from different messages" +
-            " correctly with NFCScanOptions' recordType is set to 'text'.",
+            " correctly with NDEFScanOptions' recordType is set to 'text'.",
       scanOptions: {recordType: "text"},
       message: createMessage([createTextRecord(test_text_data)]),
       unmatchedMessage: createMessage([createUrlRecord(test_url_data)])
     },
     {
       desc: "Test that filtering 'url' record from different messages" +
-            " correctly with NFCScanOptions' recordType is set to 'url'.",
+            " correctly with NDEFScanOptions' recordType is set to 'url'.",
       scanOptions: {recordType: "url"},
       message: createMessage([createUrlRecord(test_url_data)]),
       unmatchedMessage: createMessage([createTextRecord(test_text_data)])
     },
     {
       desc: "Test that filtering external record from different messages" +
-            " correctly with NFCScanOptions' recordType is set to the custom type.",
+            " correctly with NDEFScanOptions' recordType is set to the custom type.",
       scanOptions: {recordType: "w3.org:xyz"},
       message: createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
             test_buffer_data)]),
@@ -119,7 +119,7 @@
     },
     {
       desc: "Test that filtering 'text' record from different messages" +
-            " correctly with NFCScanOptions' url set.",
+            " correctly with NDEFScanOptions' url set.",
       scanOptions: {url: `${location.origin}/custom/path`},
       message: {url: `${location.origin}/custom/path/update`,
           records: [createTextRecord(test_text_data)]},
@@ -128,19 +128,19 @@
     },
     {
       desc: "Test that filtering 'opaque' record from different messages" +
-            " correctly with NFCScanOptions' mediaType set.",
+            " correctly with NDEFScanOptions' mediaType set.",
       scanOptions: {mediaType: "application/octet-stream"},
       message: createMessage([createOpaqueRecord(test_buffer_data)]),
       unmatchedMessage: createMessage([createJsonRecord(test_json_data)])
     }
   ];
 
-for (let NFCReaderOptionTest of NFCReaderOptionTests) {
-  testNFCScanOptions(
-    NFCReaderOptionTest.message,
-    NFCReaderOptionTest.scanOptions,
-    NFCReaderOptionTest.unmatchedScanOptions,
-    NFCReaderOptionTest.desc
+for (let NDEFReaderOptionTest of NDEFReaderOptionTests) {
+  testNDEFScanOptions(
+    NDEFReaderOptionTest.message,
+    NDEFReaderOptionTest.scanOptions,
+    NDEFReaderOptionTest.unmatchedScanOptions,
+    NDEFReaderOptionTest.desc
   );
 }
 
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_scan.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan.https.html
similarity index 72%
rename from third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_scan.https.html
rename to third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan.https.html
index 638d0c5a..0a36100 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_scan.https.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan.https.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <meta charset=utf-8>
-<title>Web NFC: NFCReader.scan tests</title>
+<title>Web NFC: NDEFReader.scan tests</title>
 <link rel="author" title="Intel" href="http://www.intel.com"/>
 <link rel="help" href="https://w3c.github.io/web-nfc/"/>
 <script src="/resources/testharness.js"></script>
@@ -21,128 +21,128 @@
 ];
 
 function waitSyntaxErrorPromise(t, scan_options) {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   const promise = readerWatcher.wait_for("error").then(event => {
     assert_equals(event.error.name, 'SyntaxError');
   });
-  // NFCReader#scan() asynchronously dispatches the syntax error event.
+  // NDEFReader#scan() asynchronously dispatches the syntax error event.
   reader.scan(scan_options);
   return promise;
 }
 
 promise_test(async t => {
   await waitSyntaxErrorPromise(t, {url: "www.a.com"});
-}, "Test that NFCReader.scan fails if NFCScanOptions.url is missing \
+}, "Test that NDEFReader.scan fails if NDEFScanOptions.url is missing \
 components.");
 
 promise_test(async t => {
   await waitSyntaxErrorPromise(t, {url: "invalid"});
-}, "Test that NFCReader.scan fails if NFCScanOptions.url is invalid.");
+}, "Test that NDEFReader.scan fails if NDEFScanOptions.url is invalid.");
 
 promise_test(async t => {
   await waitSyntaxErrorPromise(t, {url: "http://a.com"});
-}, "Test that NFCReader.scan fails if NFCScanOptions.url has wrong \
+}, "Test that NDEFReader.scan fails if NDEFScanOptions.url has wrong \
 protocol.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   reader.scan();
   mockNFC.setHWStatus(NFCHWStatus.DISABLED);
   const event = await readerWatcher.wait_for("error");
   assert_equals(event.error.name, 'NotReadableError');
-}, "NFCReader.scan should fail if NFC HW is disabled.");
+}, "NDEFReader.scan should fail if NFC HW is disabled.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   reader.scan();
   mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED);
   const event = await readerWatcher.wait_for("error");
   assert_equals(event.error.name, 'NotSupportedError');
-}, "NFCReader.scan should fail if NFC HW is not supported.");
+}, "NDEFReader.scan should fail if NFC HW is not supported.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
   const promise = readerWatcher.wait_for("reading").then(event => {
-    assert_true(event instanceof NFCReadingEvent);
+    assert_true(event instanceof NDEFReadingEvent);
     controller.abort();
   });
-  // NFCReader#scan() asynchronously dispatches the reading event.
+  // NDEFReader#scan() asynchronously dispatches the reading event.
   reader.scan({signal : controller.signal});
   await promise;
 }, "Test that nfc watch success if NFC HW is enabled.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
   const promise = readerWatcher.wait_for("reading").then(event => {
-    assert_true(event instanceof NFCReadingEvent);
+    assert_true(event instanceof NDEFReadingEvent);
     controller.abort();
   });
-  // NFCReader#scan() asynchronously dispatches the reading event.
+  // NDEFReader#scan() asynchronously dispatches the reading event.
   reader.scan({signal : controller.signal, url: "https://a.com"});
   await promise;
-}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is valid URL.");
+}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is valid URL.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
   const promise = readerWatcher.wait_for("reading").then(event => {
-    assert_true(event instanceof NFCReadingEvent);
+    assert_true(event instanceof NDEFReadingEvent);
     controller.abort();
   });
-  // NFCReader#scan() asynchronously dispatches the reading event.
+  // NDEFReader#scan() asynchronously dispatches the reading event.
   reader.scan({signal : controller.signal, url: "https://a.com/*"});
   await promise;
-}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is valid URL \
+}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is valid URL \
 with '*' wildcard character in path.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
   const promise = readerWatcher.wait_for("reading").then(event => {
-    assert_true(event instanceof NFCReadingEvent);
+    assert_true(event instanceof NDEFReadingEvent);
     controller.abort();
   });
-  // NFCReader#scan() asynchronously dispatches the reading event.
+  // NDEFReader#scan() asynchronously dispatches the reading event.
   reader.scan({signal : controller.signal, url: "https://a.com/*/bar"});
   await promise;
-}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is valid URL \
+}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is valid URL \
 with '*' wildcard character in the beginning of path component followed by \
 subpath.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
   const promise = readerWatcher.wait_for("reading").then(event => {
-    assert_true(event instanceof NFCReadingEvent);
+    assert_true(event instanceof NDEFReadingEvent);
     controller.abort();
   });
-  // NFCReader#scan() asynchronously dispatches the reading event.
+  // NDEFReader#scan() asynchronously dispatches the reading event.
   reader.scan({signal : controller.signal, url: ""});
   await promise;
-}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is empty.");
+}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is empty.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
 
@@ -157,11 +157,11 @@
     t.step_timeout(resolve, 100);
   });
 
-}, "Test that NFCReader.onreading should not be fired if NFCScanOptions.signal \
+}, "Test that NDEFReader.onreading should not be fired if NDEFScanOptions.signal \
 is aborted.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   const message = createMessage([createTextRecord(test_text_data)]);
@@ -170,7 +170,7 @@
 
   reader.scan({signal: controller.signal});
   const event = await readerWatcher.wait_for("reading");
-  assert_true(event instanceof NFCReadingEvent);
+  assert_true(event instanceof NDEFReadingEvent);
   mockNFC.setReadingMessage(message);
   controller.abort();
 
@@ -184,11 +184,11 @@
 }, "Synchronously signaled abort.");
 
 test(() => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   invalid_signals.forEach(invalid_signal => {
     assert_throws(new TypeError(),
         () => { reader.scan({ signal: invalid_signal }); });
   });
-}, "NFCReader.scan should fail if signal is not an AbortSignal.");
+}, "NDEFReader.scan should fail if signal is not an AbortSignal.");
 
 </script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_scan_iframe.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan_iframe.https.html
similarity index 86%
rename from third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_scan_iframe.https.html
rename to third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan_iframe.https.html
index 31e79b0..e9720e9 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader_scan_iframe.https.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan_iframe.https.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <meta charset=utf-8>
-<title>NFCWriter.scan with an focused iframe</title>
+<title>NDEFWriter.scan with an focused iframe</title>
 <link rel="help" href="https://w3c.github.io/web-nfc/"/>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
@@ -9,12 +9,12 @@
 <script>
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
   const promise = readerWatcher.wait_for("reading").then(event => {
-    assert_true(event instanceof NFCReadingEvent);
+    assert_true(event instanceof NDEFReadingEvent);
     controller.abort();
   });
   reader.scan({ signal: controller.signal });
@@ -37,7 +37,7 @@
 
   // Remove iframe from main document.
   iframe.parentNode.removeChild(iframe);
-}, 'Test that NFCWriter.scan is not suspended if iframe gains focus.');
+}, 'Test that NDEFWriter.scan is not suspended if iframe gains focus.');
 
 </script>
 </body>
\ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.html
new file mode 100644
index 0000000..c23a68a
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReadingEvent_constructor.https.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>NDEFReadingEvent constructor</title>
+<link rel="help" href="https://w3c.github.io/web-nfc/#dom-ndefreadingevent">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/nfc-helpers.js"></script>
+<script>
+
+  test(() => {
+    assert_equals(NDEFReadingEvent.length, 2);
+    assert_throws(new TypeError, () => new NDEFReadingEvent('message'));
+  }, 'NDEFReadingEvent constructor without init dict');
+
+  test(() => {
+    const message = createMessage([createJsonRecord(test_json_data)]);
+    const event = new NDEFReadingEvent('type', {serialNumber: null, message: message});
+    assert_equals(event.serialNumber, '', 'serialNumber');
+  }, 'NDEFReadingEvent constructor with null serialNumber');
+
+  test(() => {
+    const message = createMessage([createJsonRecord(test_json_data)]);
+    const event = new NDEFReadingEvent('type', {message: message});
+    assert_equals(event.serialNumber, '', 'serialNumber');
+  }, 'NDEFReadingEvent constructor with serialNumber not present');
+
+  test(() => {
+    const event = new NDEFReadingEvent('type', {serialNumber: '', message: null});
+    assert_equals(0, event.message.records.length, 'no records');
+    assert_equals(0, event.message.url.length, 'empty url');
+  }, 'NDEFReadingEvent constructor with null message');
+
+  test(() => {
+    const message = createMessage([createJsonRecord(test_json_data)]);
+    const event = new NDEFReadingEvent('type', {serialNumber: '', message: message});
+    assert_equals(event.type, 'type', 'type');
+    assert_equals(event.serialNumber, '', 'serialNumber');
+    assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
+  }, 'NDEFReadingEvent constructor with valid parameters');
+
+</script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter-document-hidden-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter-document-hidden-manual.https-expected.txt
new file mode 100644
index 0000000..799e5509
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter-document-hidden-manual.https-expected.txt
@@ -0,0 +1,4 @@
+This is a testharness.js-based test.
+FAIL Test NDEFWriter.push operation should be suspend when document is not visible promise_test: Unhandled rejection with value: undefined
+Harness: the test ran to completion.
+
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter-document-hidden-manual.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter-document-hidden-manual.https.html
similarity index 79%
rename from third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter-document-hidden-manual.https.html
rename to third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter-document-hidden-manual.https.html
index 72d8c81..2f291e5 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter-document-hidden-manual.https.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter-document-hidden-manual.https.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
 <meta name="timeout" content="long">
-<title>NFCWriter.push respect page visibility changes</title>
+<title>NDEFWriter.push respect page visibility changes</title>
 <link rel="help" href="https://w3c.github.io/web-nfc/#visible-document">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
@@ -9,7 +9,7 @@
 <script>
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const p1 = writer.push(test_text_data);
 
   return await new Promise((resolve, reject) => {
@@ -20,7 +20,7 @@
       reject();
     });
   });
-}, "Test NFCWriter.push operation should be suspend when document is not visible");
+}, "Test NDEFWriter.push operation should be suspend when document is not visible");
 
 </script>
 
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter_push.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter_push.https-expected.txt
new file mode 100644
index 0000000..ad892ff
--- /dev/null
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter_push.https-expected.txt
@@ -0,0 +1,37 @@
+This is a testharness.js-based test.
+PASS Test that promise is rejected with TypeError if NDEFMessageSource is invalid.
+PASS Test that promise is rejected with SyntaxError if NDEFMessageSource contains invalid records.
+PASS NDEFWriter.push should fail if abort push request before push happends.
+PASS NDEFWriter.push should fail if signal's aborted flag is set.
+PASS NDEFWriter.push should fail if signal is not an AbortSignal.
+PASS Synchronously signaled abort.
+PASS NDEFWriter.push should fail when NFC HW is disabled.
+PASS NDEFWriter.push should fail when NFC HW is not supported.
+PASS NDEFWriter.push should fail with TypeError when invalid timeout is provided.
+PASS NDEFWriter.push should fail with TypeError when invalid negative timeout value is provided.
+PASS NDEFWriter.push should fail with TimeoutError when timer expires.
+PASS Reject promise with NotSupportedError if NFC message size exceeds 32KB.
+PASS Reject promise with SyntaxError if WebNFC Id cannot be created from provided URL.
+PASS Reject promise with exceptions thrown from serializing the 'json' record data.
+PASS NDEFWriter.push should fail with TypeError when invalid target value is provided.
+PASS Test that WebNFC API is not accessible from iframe context.
+PASS NDEFWriter.push should succeed when NFC HW is enabled
+PASS NDEFWriter.push NDEFMessage containing text, json, opaque, url and external records with default NDEFPushOptions.
+PASS Test that NDEFWriter.push succeeds when message is DOMString.
+PASS Test that NDEFWriter.push succeeds when message is ArrayBuffer.
+PASS NDEFWriter.push with 'empty' record should succeed.
+PASS Check that default NDEFPushOptions values are correctly set.
+PASS Check that provided NDEFPushOptions values are correctly converted.
+PASS NDEFWriter.push should read data when ignoreRead is false.
+PASS NDEFWriter.push should ignore reading data when ignoreRead is true.
+PASS NDEFWriter.push should replace all previously configured push operations.
+PASS Test that recordType should be set to 'text' if NDEFRecordInit.record's recordType is undefined and NDEFRecordInit.record's data is DOMString.
+PASS Test that recordType should be set to 'opaque' if NDEFRecordInit.record's recordType is undefined and NDEFRecordInit.record's data is ArrayBuffer.
+PASS Test that recordType should be set to 'json' if NDEFRecordInit.record's recordType is undefined and NDEFRecordInit.record's data is not DOMString or ArrayBuffer.
+PASS Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's recordType is 'text' and NDEFRecordInit.record's mediaType is undefined.
+PASS Test that mediaType should be set to 'application/octet-stream' if NDEFRecordInit.record's recordType is 'opaque' and NDEFRecordInit.record's mediaType is undefined.
+PASS Test that mediaType should be set to 'application/json' if NDEFRecordInit.record's recordType is 'json' and NDEFRecordInit.record's mediaType is undefined.
+FAIL Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's recordType is 'url' and NDEFRecordInit.record's mediaType is undefined. promise_test: Unhandled rejection with value: object "TypeError: Cannot read property 'substring' of null"
+PASS Test that mediaType should be set to 'application/octet-stream' if NDEFRecordInit.record's recordType is external type and NDEFRecordInit.record's mediaType is undefined.
+Harness: the test ran to completion.
+
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter_push.https.html
similarity index 80%
rename from third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html
rename to third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter_push.https.html
index 6b4034f..b909bee 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFWriter_push.https.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <meta charset=utf-8>
-<title>Web NFC: NFCWriter.push Tests</title>
+<title>Web NFC: NDEFWriter.push Tests</title>
 <link rel="author" title="Intel" href="http://www.intel.com"/>
 <link rel="help" href="https://w3c.github.io/web-nfc/"/>
 <script src="/resources/testharness.js"></script>
@@ -92,7 +92,7 @@
 ];
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const promises = [];
   invalid_type_messages.forEach(message => {
     promises.push(
@@ -102,7 +102,7 @@
 }, "Test that promise is rejected with TypeError if NDEFMessageSource is invalid.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const promises = [];
   invalid_syntax_messages.forEach(message => {
     promises.push(
@@ -113,7 +113,7 @@
  invalid records.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const controller = new AbortController();
 
   //Make sure push is pending
@@ -131,31 +131,31 @@
   });
   await rejected;
   assert_true(callback_called, 'timeout should have caused the abort');
-}, "NFCWriter.push should fail if abort push request before push happends.");
+}, "NDEFWriter.push should fail if abort push request before push happends.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const controller = new AbortController();
   assert_false(controller.signal.aborted);
   controller.abort();
   assert_true(controller.signal.aborted);
   await promise_rejects(t, 'AbortError',
       writer.push(test_text_data, { signal: controller.signal }));
-}, "NFCWriter.push should fail if signal's aborted flag is set.");
+}, "NDEFWriter.push should fail if signal's aborted flag is set.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const promises = [];
   invalid_signals.forEach(invalid_signal => {
     promises.push(promise_rejects(t, new TypeError(),
         writer.push(test_text_data, { signal: invalid_signal })));
   });
   await Promise.all(promises);
-}, "NFCWriter.push should fail if signal is not an AbortSignal.");
+}, "NDEFWriter.push should fail if signal is not an AbortSignal.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer1 = new NFCWriter();
-  const writer2 = new NFCWriter();
+  const writer1 = new NDEFWriter();
+  const writer2 = new NDEFWriter();
   const controller = new AbortController();
   mockNFC.setPendingPushCompleted(false);
   const p1 = writer1.push(test_text_data,
@@ -171,47 +171,47 @@
 }, "Synchronously signaled abort.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   mockNFC.setHWStatus(NFCHWStatus.DISABLED);
   await promise_rejects(t, 'NotReadableError', writer.push(test_text_data));
-}, "NFCWriter.push should fail when NFC HW is disabled.");
+}, "NDEFWriter.push should fail when NFC HW is disabled.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED);
   await promise_rejects(t, 'NotSupportedError', writer.push(test_text_data));
-}, "NFCWriter.push should fail when NFC HW is not supported.");
+}, "NDEFWriter.push should fail when NFC HW is not supported.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await promise_rejects(
     t, new TypeError(), writer.push(test_text_data, { timeout: "invalid"}));
-}, "NFCWriter.push should fail with TypeError when invalid timeout is \
+}, "NDEFWriter.push should fail with TypeError when invalid timeout is \
 provided.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await promise_rejects(
     t, new TypeError(), writer.push(test_text_data, { timeout: -1 }));
-}, "NFCWriter.push should fail with TypeError when invalid negative timeout \
+}, "NDEFWriter.push should fail with TypeError when invalid negative timeout \
 value is provided.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   mockNFC.setPendingPushCompleted(false);
   const p = writer.push(test_text_data, { timeout: 1 });
   mockNFC.setPushShouldTimeout(true);
   await promise_rejects(t, 'TimeoutError', p);
-}, "NFCWriter.push should fail with TimeoutError when timer expires.");
+}, "NDEFWriter.push should fail with TimeoutError when timer expires.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await promise_rejects(
     t, 'NotSupportedError', writer.push(new ArrayBuffer(32 * 1024 + 1)));
 }, "Reject promise with NotSupportedError if NFC message size exceeds 32KB.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const message = createMessage([createTextRecord(test_text_data)]);
   message.url = '%00/invalid/ path';
   await promise_rejects(t, 'SyntaxError', writer.push(message));
@@ -219,17 +219,17 @@
 provided URL.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   const message = createMessage([createRecord('json','application/json',
       { get x(){ return this; } })]);
   await promise_rejects(t, new TypeError(), writer.push(message));
 }, "Reject promise with exceptions thrown from serializing the 'json' record data.");
 
 promise_test(async t => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await promise_rejects(
     t, new TypeError(), writer.push(test_text_data, {target: "invalid"}));
-}, "NFCWriter.push should fail with TypeError when invalid target value is \
+}, "NDEFWriter.push should fail with TypeError when invalid target value is \
 provided.");
 
 promise_test(async () => {
@@ -249,7 +249,7 @@
                             }
                           };
                           try {
-                            const writer = new NFCWriter();
+                            const writer = new NDEFWriter();
                             writer.push("Test").then(onSuccess, onError);
                           } catch(e) {
                             parent.postMessage("Failure", "*");
@@ -270,12 +270,12 @@
 }, 'Test that WebNFC API is not accessible from iframe context.');
 
 nfc_test(async () => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(test_text_data, { timeout: 1 });
-}, 'NFCWriter.push should succeed when NFC HW is enabled');
+}, 'NDEFWriter.push should succeed when NFC HW is enabled');
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   let message = createMessage([createTextRecord(test_text_data),
                                createJsonRecord(test_json_data),
                                createJsonRecord(test_number_data),
@@ -285,42 +285,42 @@
                                test_message_origin);
   await writer.push(message);
   assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
-}, "NFCWriter.push NDEFMessage containing text, json, opaque, url and external records \
-with default NFCPushOptions.");
+}, "NDEFWriter.push NDEFMessage containing text, json, opaque, url and external records \
+with default NDEFPushOptions.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(test_text_data);
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
-}, "Test that NFCWriter.push succeeds when message is DOMString.");
+}, "Test that NDEFWriter.push succeeds when message is DOMString.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(test_buffer_data);
   assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage());
-}, "Test that NFCWriter.push succeeds when message is ArrayBuffer.");
+}, "Test that NDEFWriter.push succeeds when message is ArrayBuffer.");
 
 nfc_test(async () => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(createMessage([createRecord('empty')]));
-}, "NFCWriter.push with 'empty' record should succeed.");
+}, "NDEFWriter.push with 'empty' record should succeed.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(test_text_data);
-  assertNFCPushOptionsEqual(createNFCPushOptions('any', Infinity, true),
+  assertNDEFPushOptionsEqual(createNDEFPushOptions('any', Infinity, true),
                             mockNFC.pushOptions());
-}, "Check that default NFCPushOptions values are correctly set.");
+}, "Check that default NDEFPushOptions values are correctly set.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
-  let nfcPushOptions = createNFCPushOptions('tag', 1, false);
-  await writer.push(test_text_data, nfcPushOptions);
-  assertNFCPushOptionsEqual(nfcPushOptions, mockNFC.pushOptions());
-}, "Check that provided NFCPushOptions values are correctly converted.");
+  const writer = new NDEFWriter();
+  let ndefPushOptions = createNDEFPushOptions('tag', 1, false);
+  await writer.push(test_text_data, ndefPushOptions);
+  assertNDEFPushOptionsEqual(ndefPushOptions, mockNFC.pushOptions());
+}, "Check that provided NDEFPushOptions values are correctly converted.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const message = createMessage([createTextRecord(test_text_data)]);
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
@@ -331,34 +331,34 @@
 
   reader.scan({ signal: controller.signal });
 
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(test_text_data, { ignoreRead: false });
   mockNFC.setReadingMessage(message);
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
   await promise;
-}, "NFCWriter.push should read data when ignoreRead is false.");
+}, "NDEFWriter.push should read data when ignoreRead is false.");
 
 nfc_test(async (t, mockNFC) => {
-  const reader = new NFCReader();
+  const reader = new NDEFReader();
   const message = createMessage([createTextRecord(test_text_data)]);
-  // Ignore reading if NFCPushOptions.ignoreRead is true
+  // Ignore reading if NDEFPushOptions.ignoreRead is true
   reader.onreading = t.unreached_func("reading event should not be fired.");
   reader.scan();
 
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push(test_text_data, { ignoreRead: true });
   mockNFC.setReadingMessage(message);
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
-}, "NFCWriter.push should ignore reading data when ignoreRead is true.");
+}, "NDEFWriter.push should ignore reading data when ignoreRead is true.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer1 = new NFCWriter();
-  const writer2 = new NFCWriter();
+  const writer1 = new NDEFWriter();
+  const writer2 = new NDEFWriter();
 
-  const nfcPushOptions1 = createNFCPushOptions('tag', 1000, false);
-  const nfcPushOptions2 = createNFCPushOptions('tag', Infinity, true);
-  const p1 = writer1.push(test_text_data, nfcPushOptions1);
-  const p2 = writer2.push(test_url_data, nfcPushOptions2);
+  const ndefPushOptions1 = createNDEFPushOptions('tag', 1000, false);
+  const ndefPushOptions2 = createNDEFPushOptions('tag', Infinity, true);
+  const p1 = writer1.push(test_text_data, ndefPushOptions1);
+  const p2 = writer2.push(test_url_data, ndefPushOptions2);
 
   await new Promise((resolve, reject) => {
     // Make first push pending
@@ -371,29 +371,29 @@
     });
     p2.then(() => {
       assertNDEFMessagesEqual(test_url_data, mockNFC.pushedMessage());
-      assertNFCPushOptionsEqual(nfcPushOptions2, mockNFC.pushOptions());
+      assertNDEFPushOptionsEqual(ndefPushOptions2, mockNFC.pushOptions());
       assert_equals(err, "AbortError", "the pending push should be aborted");
       resolve();
     });
   });
-}, "NFCWriter.push should replace all previously configured push operations.");
+}, "NDEFWriter.push should replace all previously configured push operations.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ data: test_text_data}] });
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
 }, "Test that recordType should be set to 'text' if NDEFRecordInit.record's \
 recordType is undefined and NDEFRecordInit.record's data is DOMString.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ data: test_buffer_data}] });
   assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage());
 }, "Test that recordType should be set to 'opaque' if NDEFRecordInit.record's \
 recordType is undefined and NDEFRecordInit.record's data is ArrayBuffer.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ data: test_json_data }] });
   const message = createMessage([createJsonRecord(test_json_data)]);
   assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
@@ -402,14 +402,14 @@
 ArrayBuffer.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ recordType: "text", data: test_text_data }] });
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
 }, "Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's \
 recordType is 'text' and NDEFRecordInit.record's mediaType is undefined.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ recordType: "opaque", data: test_buffer_data }] });
   assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage());
 }, "Test that mediaType should be set to 'application/octet-stream' if \
@@ -417,7 +417,7 @@
 mediaType is undefined.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ recordType: "json", data: test_json_data }] });
   const message = createMessage([createJsonRecord(test_json_data)]);
   assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
@@ -426,7 +426,7 @@
 mediaType is undefined.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ recordType: "url", data: test_url_data }] });
   const message = createMessage([createUrlRecord(test_url_data)]);
   assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
@@ -434,7 +434,7 @@
 recordType is 'url' and NDEFRecordInit.record's mediaType is undefined.");
 
 nfc_test(async (t, mockNFC) => {
-  const writer = new NFCWriter();
+  const writer = new NDEFWriter();
   await writer.push({ records: [{ recordType: "w3.org:xyz", data: test_buffer_data }] });
   const message = createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
       test_buffer_data)]);
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCErrorEvent_constructor.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NFCErrorEvent_constructor.https.html
deleted file mode 100644
index 1cc9ce1..0000000
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCErrorEvent_constructor.https.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<title>NFCErrorEvent constructor</title>
-<link rel="help" href="https://w3c.github.io/web-nfc/#dom-nfcerrorevent">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script>
-  test(() => {
-    assert_equals(NFCErrorEvent.length, 2);
-    assert_throws(new TypeError, () => new NFCErrorEvent('error'));
-  }, 'NFCErrorEvent constructor without init dict');
-
-  test(() => {
-    assert_throws(new TypeError, () => new NFCErrorEvent('error', { error : null }));
-  }, 'NFCErrorEvent constructor with a null that is not of type DOMException');
-
-  test(() => {
-    const event = new NFCErrorEvent('error', { error : new DOMException() });
-    assert_true(event.error instanceof DOMException);
-  }, 'NFCErrorEvent constructor with a valid DOMException');
-</script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader-document-hidden-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader-document-hidden-manual.https-expected.txt
deleted file mode 100644
index 9fba7c8..0000000
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReader-document-hidden-manual.https-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a testharness.js-based test.
-FAIL Test NFCReader.onreading is not fired when document is hidden assert_equals: Expected reading event, but got error event instead expected "reading" but got "error"
-Harness: the test ran to completion.
-
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html
deleted file mode 100644
index 2058517..0000000
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCReadingEvent_constructor.https.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<title>NFCReadingEvent constructor</title>
-<link rel="help" href="https://w3c.github.io/web-nfc/#dom-nfcreadingevent">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/nfc-helpers.js"></script>
-<script>
-
-  test(() => {
-    assert_equals(NFCReadingEvent.length, 2);
-    assert_throws(new TypeError, () => new NFCReadingEvent('message'));
-  }, 'NFCReadingEvent constructor without init dict');
-
-  test(() => {
-    const message = createMessage([createJsonRecord(test_json_data)]);
-    const event = new NFCReadingEvent('type', {serialNumber: null, message: message});
-    assert_equals(event.serialNumber, '', 'serialNumber');
-  }, 'NFCReadingEvent constructor with null serialNumber');
-
-  test(() => {
-    const message = createMessage([createJsonRecord(test_json_data)]);
-    const event = new NFCReadingEvent('type', {message: message});
-    assert_equals(event.serialNumber, '', 'serialNumber');
-  }, 'NFCReadingEvent constructor with serialNumber not present');
-
-  test(() => {
-    const event = new NFCReadingEvent('type', {serialNumber: '', message: null});
-    assert_equals(0, event.message.records.length, 'no records');
-    assert_equals(0, event.message.url.length, 'empty url');
-  }, 'NFCReadingEvent constructor with null message');
-
-  test(() => {
-    const message = createMessage([createJsonRecord(test_json_data)]);
-    const event = new NFCReadingEvent('type', {serialNumber: '', message: message});
-    assert_equals(event.type, 'type', 'type');
-    assert_equals(event.serialNumber, '', 'serialNumber');
-    assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
-  }, 'NFCReadingEvent constructor with valid parameters');
-
-</script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter-document-hidden-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter-document-hidden-manual.https-expected.txt
deleted file mode 100644
index 777243f..0000000
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter-document-hidden-manual.https-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a testharness.js-based test.
-FAIL Test NFCWriter.push operation should be suspend when document is not visible promise_test: Unhandled rejection with value: undefined
-Harness: the test ran to completion.
-
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt
deleted file mode 100644
index 72884b7..0000000
--- a/third_party/blink/web_tests/external/wpt/web-nfc/NFCWriter_push.https-expected.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-This is a testharness.js-based test.
-PASS Test that promise is rejected with TypeError if NDEFMessageSource is invalid.
-PASS Test that promise is rejected with SyntaxError if NDEFMessageSource contains invalid records.
-PASS NFCWriter.push should fail if abort push request before push happends.
-PASS NFCWriter.push should fail if signal's aborted flag is set.
-PASS NFCWriter.push should fail if signal is not an AbortSignal.
-PASS Synchronously signaled abort.
-PASS NFCWriter.push should fail when NFC HW is disabled.
-PASS NFCWriter.push should fail when NFC HW is not supported.
-PASS NFCWriter.push should fail with TypeError when invalid timeout is provided.
-PASS NFCWriter.push should fail with TypeError when invalid negative timeout value is provided.
-PASS NFCWriter.push should fail with TimeoutError when timer expires.
-PASS Reject promise with NotSupportedError if NFC message size exceeds 32KB.
-PASS Reject promise with SyntaxError if WebNFC Id cannot be created from provided URL.
-PASS Reject promise with exceptions thrown from serializing the 'json' record data.
-PASS NFCWriter.push should fail with TypeError when invalid target value is provided.
-PASS Test that WebNFC API is not accessible from iframe context.
-PASS NFCWriter.push should succeed when NFC HW is enabled
-PASS NFCWriter.push NDEFMessage containing text, json, opaque, url and external records with default NFCPushOptions.
-PASS Test that NFCWriter.push succeeds when message is DOMString.
-PASS Test that NFCWriter.push succeeds when message is ArrayBuffer.
-PASS NFCWriter.push with 'empty' record should succeed.
-PASS Check that default NFCPushOptions values are correctly set.
-PASS Check that provided NFCPushOptions values are correctly converted.
-PASS NFCWriter.push should read data when ignoreRead is false.
-PASS NFCWriter.push should ignore reading data when ignoreRead is true.
-PASS NFCWriter.push should replace all previously configured push operations.
-PASS Test that recordType should be set to 'text' if NDEFRecordInit.record's recordType is undefined and NDEFRecordInit.record's data is DOMString.
-PASS Test that recordType should be set to 'opaque' if NDEFRecordInit.record's recordType is undefined and NDEFRecordInit.record's data is ArrayBuffer.
-PASS Test that recordType should be set to 'json' if NDEFRecordInit.record's recordType is undefined and NDEFRecordInit.record's data is not DOMString or ArrayBuffer.
-PASS Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's recordType is 'text' and NDEFRecordInit.record's mediaType is undefined.
-PASS Test that mediaType should be set to 'application/octet-stream' if NDEFRecordInit.record's recordType is 'opaque' and NDEFRecordInit.record's mediaType is undefined.
-PASS Test that mediaType should be set to 'application/json' if NDEFRecordInit.record's recordType is 'json' and NDEFRecordInit.record's mediaType is undefined.
-FAIL Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's recordType is 'url' and NDEFRecordInit.record's mediaType is undefined. promise_test: Unhandled rejection with value: object "TypeError: Cannot read property 'substring' of null"
-PASS Test that mediaType should be set to 'application/octet-stream' if NDEFRecordInit.record's recordType is external type and NDEFRecordInit.record's mediaType is undefined.
-Harness: the test ran to completion.
-
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/README.md b/third_party/blink/web_tests/external/wpt/web-nfc/README.md
index dd072174..87145b0e 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/README.md
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/README.md
@@ -16,7 +16,7 @@
     setPendingPushCompleted(boolean result); // Sets if the pending push is completed.
     setPushShouldTimeout(boolean result); // Sets flag to trigger the pending push to timeout.
     pushedMessage(); // Gets the pushed `NDEFMessageSource`.
-    pushOptions(); // Gets the pushed `NFCPushOptions`.
+    pushOptions(); // Gets the pushed `NDEFPushOptions`.
   };
 ```
 
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window-expected.txt
index c55a3fe..40fac1c 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window-expected.txt
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window-expected.txt
@@ -40,53 +40,53 @@
 PASS NDEFRecord interface: new NDEFRecord({"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}); must inherit property "arrayBuffer()" with the proper type
 PASS NDEFRecord interface: new NDEFRecord({"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}); must inherit property "json()" with the proper type
 FAIL NDEFRecord interface: new NDEFRecord({"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}); must inherit property "toRecords()" with the proper type assert_inherits: property "toRecords" not found in prototype chain
-PASS NFCWriter interface: existence and properties of interface object
-PASS NFCWriter interface object length
-PASS NFCWriter interface object name
-PASS NFCWriter interface: existence and properties of interface prototype object
-PASS NFCWriter interface: existence and properties of interface prototype object's "constructor" property
-PASS NFCWriter interface: existence and properties of interface prototype object's @@unscopables property
-PASS NFCWriter interface: operation push(NDEFMessageSource, NFCPushOptions)
-PASS NFCWriter must be primary interface of new NFCWriter();
-PASS Stringification of new NFCWriter();
-PASS NFCWriter interface: new NFCWriter(); must inherit property "push(NDEFMessageSource, NFCPushOptions)" with the proper type
-PASS NFCWriter interface: calling push(NDEFMessageSource, NFCPushOptions) on new NFCWriter(); with too few arguments must throw TypeError
-PASS NFCReader interface: existence and properties of interface object
-PASS NFCReader interface object length
-PASS NFCReader interface object name
-PASS NFCReader interface: existence and properties of interface prototype object
-PASS NFCReader interface: existence and properties of interface prototype object's "constructor" property
-PASS NFCReader interface: existence and properties of interface prototype object's @@unscopables property
-PASS NFCReader interface: attribute onreading
-PASS NFCReader interface: attribute onerror
-PASS NFCReader interface: operation scan(NFCScanOptions)
-PASS NFCReader must be primary interface of new NFCReader();
-PASS Stringification of new NFCReader();
-PASS NFCReader interface: new NFCReader(); must inherit property "onreading" with the proper type
-PASS NFCReader interface: new NFCReader(); must inherit property "onerror" with the proper type
-PASS NFCReader interface: new NFCReader(); must inherit property "scan(NFCScanOptions)" with the proper type
-PASS NFCReader interface: calling scan(NFCScanOptions) on new NFCReader(); with too few arguments must throw TypeError
-PASS NFCReadingEvent interface: existence and properties of interface object
-PASS NFCReadingEvent interface object length
-PASS NFCReadingEvent interface object name
-PASS NFCReadingEvent interface: existence and properties of interface prototype object
-PASS NFCReadingEvent interface: existence and properties of interface prototype object's "constructor" property
-PASS NFCReadingEvent interface: existence and properties of interface prototype object's @@unscopables property
-PASS NFCReadingEvent interface: attribute serialNumber
-PASS NFCReadingEvent interface: attribute message
-PASS NFCReadingEvent must be primary interface of new NFCReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} })
-PASS Stringification of new NFCReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} })
-PASS NFCReadingEvent interface: new NFCReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} }) must inherit property "serialNumber" with the proper type
-PASS NFCReadingEvent interface: new NFCReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} }) must inherit property "message" with the proper type
-PASS NFCErrorEvent interface: existence and properties of interface object
-PASS NFCErrorEvent interface object length
-PASS NFCErrorEvent interface object name
-PASS NFCErrorEvent interface: existence and properties of interface prototype object
-PASS NFCErrorEvent interface: existence and properties of interface prototype object's "constructor" property
-PASS NFCErrorEvent interface: existence and properties of interface prototype object's @@unscopables property
-PASS NFCErrorEvent interface: attribute error
-PASS NFCErrorEvent must be primary interface of new NFCErrorEvent("error", { error: new DOMException() });
-PASS Stringification of new NFCErrorEvent("error", { error: new DOMException() });
-PASS NFCErrorEvent interface: new NFCErrorEvent("error", { error: new DOMException() }); must inherit property "error" with the proper type
+PASS NDEFWriter interface: existence and properties of interface object
+PASS NDEFWriter interface object length
+PASS NDEFWriter interface object name
+PASS NDEFWriter interface: existence and properties of interface prototype object
+PASS NDEFWriter interface: existence and properties of interface prototype object's "constructor" property
+PASS NDEFWriter interface: existence and properties of interface prototype object's @@unscopables property
+PASS NDEFWriter interface: operation push(NDEFMessageSource, NDEFPushOptions)
+PASS NDEFWriter must be primary interface of new NDEFWriter();
+PASS Stringification of new NDEFWriter();
+PASS NDEFWriter interface: new NDEFWriter(); must inherit property "push(NDEFMessageSource, NDEFPushOptions)" with the proper type
+PASS NDEFWriter interface: calling push(NDEFMessageSource, NDEFPushOptions) on new NDEFWriter(); with too few arguments must throw TypeError
+PASS NDEFReader interface: existence and properties of interface object
+PASS NDEFReader interface object length
+PASS NDEFReader interface object name
+PASS NDEFReader interface: existence and properties of interface prototype object
+PASS NDEFReader interface: existence and properties of interface prototype object's "constructor" property
+PASS NDEFReader interface: existence and properties of interface prototype object's @@unscopables property
+PASS NDEFReader interface: attribute onreading
+PASS NDEFReader interface: attribute onerror
+PASS NDEFReader interface: operation scan(NDEFScanOptions)
+PASS NDEFReader must be primary interface of new NDEFReader();
+PASS Stringification of new NDEFReader();
+PASS NDEFReader interface: new NDEFReader(); must inherit property "onreading" with the proper type
+PASS NDEFReader interface: new NDEFReader(); must inherit property "onerror" with the proper type
+PASS NDEFReader interface: new NDEFReader(); must inherit property "scan(NDEFScanOptions)" with the proper type
+PASS NDEFReader interface: calling scan(NDEFScanOptions) on new NDEFReader(); with too few arguments must throw TypeError
+PASS NDEFReadingEvent interface: existence and properties of interface object
+PASS NDEFReadingEvent interface object length
+PASS NDEFReadingEvent interface object name
+PASS NDEFReadingEvent interface: existence and properties of interface prototype object
+PASS NDEFReadingEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS NDEFReadingEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS NDEFReadingEvent interface: attribute serialNumber
+PASS NDEFReadingEvent interface: attribute message
+PASS NDEFReadingEvent must be primary interface of new NDEFReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} })
+PASS Stringification of new NDEFReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} })
+PASS NDEFReadingEvent interface: new NDEFReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} }) must inherit property "serialNumber" with the proper type
+PASS NDEFReadingEvent interface: new NDEFReadingEvent("reading", { message: {"url":"/custom/path","records":[{"recordType":"text","mediaType":"text/plain","data":"Hello World","id":"/custom/path"}]} }) must inherit property "message" with the proper type
+PASS NDEFErrorEvent interface: existence and properties of interface object
+PASS NDEFErrorEvent interface object length
+PASS NDEFErrorEvent interface object name
+PASS NDEFErrorEvent interface: existence and properties of interface prototype object
+PASS NDEFErrorEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS NDEFErrorEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS NDEFErrorEvent interface: attribute error
+PASS NDEFErrorEvent must be primary interface of new NDEFErrorEvent("error", { error: new DOMException() });
+PASS Stringification of new NDEFErrorEvent("error", { error: new DOMException() });
+PASS NDEFErrorEvent interface: new NDEFErrorEvent("error", { error: new DOMException() }); must inherit property "error" with the proper type
 Harness: the test ran to completion.
 
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window.js
index 869433d2f..f59ad9b 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window.js
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/idlharness.https.window.js
@@ -21,12 +21,12 @@
   ['html', 'dom', 'WebIDL'],
   idl_array => {
     idl_array.add_objects({
-      NFCWriter: ['new NFCWriter();'],
-      NFCReader: ['new NFCReader();'],
+      NDEFWriter: ['new NDEFWriter();'],
+      NDEFReader: ['new NDEFReader();'],
       NDEFRecord: [`new NDEFRecord(${JSON.stringify(record)});`],
       NDEFMessage: [`new NDEFMessage(${JSON.stringify(message)});`],
-      NFCReadingEvent: [`new NFCReadingEvent("reading", { message: ${JSON.stringify(message)} })`],
-      NFCErrorEvent: ['new NFCErrorEvent("error", { error: new DOMException() });'],
+      NDEFReadingEvent: [`new NDEFReadingEvent("reading", { message: ${JSON.stringify(message)} })`],
+      NDEFErrorEvent: ['new NDEFErrorEvent("error", { error: new DOMException() });'],
     });
   }
 );
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/nfc_insecure_context.html b/third_party/blink/web_tests/external/wpt/web-nfc/nfc_insecure_context.html
index f883f047..9a8e58c 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/nfc_insecure_context.html
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/nfc_insecure_context.html
@@ -17,12 +17,12 @@
 
 test(t => {
   assert_false(isSecureContext);
-  assert_false('NFCWriter' in window);
-}, 'NFCWriter requires a secure context');
+  assert_false('NDEFWriter' in window);
+}, 'NDEFWriter requires a secure context');
 
 test(t => {
   assert_false(isSecureContext);
-  assert_false('NFCReader' in window);
-}, 'NFCReader requires a secure context');
+  assert_false('NDEFReader' in window);
+}, 'NDEFReader requires a secure context');
 
 </script>
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/resources/nfc-helpers.js b/third_party/blink/web_tests/external/wpt/web-nfc/resources/nfc-helpers.js
index ed5cc9c..ce4079a 100644
--- a/third_party/blink/web_tests/external/wpt/web-nfc/resources/nfc-helpers.js
+++ b/third_party/blink/web_tests/external/wpt/web-nfc/resources/nfc-helpers.js
@@ -111,12 +111,12 @@
   return createRecord('url', 'text/plain', url);
 }
 
-function createNFCPushOptions(target, timeout, ignoreRead) {
+function createNDEFPushOptions(target, timeout, ignoreRead) {
   return {target, timeout, ignoreRead};
 }
 
 // Compares NDEFMessageSource that was provided to the API
-// (e.g. NFCWriter.push), and NDEFMessage that was received by the
+// (e.g. NDEFWriter.push), and NDEFMessage that was received by the
 // mock NFC service.
 function assertNDEFMessagesEqual(providedMessage, receivedMessage) {
   // If simple data type is passed, e.g. String or ArrayBuffer, convert it
@@ -137,7 +137,7 @@
 }
 
 // Used to compare two NDEFMessage, one that is received from
-// NFCWriter.onreading() EventHandler and another that is provided to mock NFC
+// NDEFWriter.onreading() EventHandler and another that is provided to mock NFC
 // service.
 function assertWebNDEFMessagesEqual(message, expectedMessage) {
   if (expectedMessage.url)
@@ -172,10 +172,10 @@
   }
 }
 
-function testNFCScanOptions(message, scanOptions, unmatchedScanOptions, desc) {
+function testNDEFScanOptions(message, scanOptions, unmatchedScanOptions, desc) {
   nfc_test(async (t, mockNFC) => {
-    const reader1 = new NFCReader();
-    const reader2 = new NFCReader();
+    const reader1 = new NDEFReader();
+    const reader2 = new NDEFReader();
     const controller = new AbortController();
 
     mockNFC.setReadingMessage(message);
@@ -191,7 +191,7 @@
       controller.abort();
       assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
     });
-    // NFCReader#scan() asynchronously dispatches the onreading event.
+    // NDEFReader#scan() asynchronously dispatches the onreading event.
     scanOptions.signal = controller.signal;
     reader2.scan(scanOptions);
     await promise;
@@ -201,7 +201,7 @@
 function testReadingMultiMessages(
     message, scanOptions, unmatchedMessage, desc) {
   nfc_test(async (t, mockNFC) => {
-    const reader = new NFCReader();
+    const reader = new NDEFReader();
     const controller = new AbortController();
     const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
 
@@ -209,7 +209,7 @@
       controller.abort();
       assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
     });
-    // NFCReader#scan() asynchronously dispatches the onreading event.
+    // NDEFReader#scan() asynchronously dispatches the onreading event.
     scanOptions.signal = controller.signal;
     reader.scan(scanOptions);
 
diff --git a/third_party/blink/web_tests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js b/third_party/blink/web_tests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
index ff6c2ff..11e8efb15 100644
--- a/third_party/blink/web_tests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
+++ b/third_party/blink/web_tests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
@@ -7,17 +7,17 @@
   // This script is supposed to be evaluated in inspector-protocol/heap-profiler tests
   // and the relative paths below are relative to that location.
   await testRunner.loadScriptModule(
-      '../../../../blink/renderer/devtools/front_end/platform/utilities.js');
+      '../../../../devtools-frontend/src/front_end/platform/utilities.js');
   await testRunner.loadScriptModule(
-      '../../../../blink/renderer/devtools/front_end/common/UIString.js');
+      '../../../../devtools-frontend/src/front_end/common/UIString.js');
   await testRunner.loadScriptModule(
-      '../../../../blink/renderer/devtools/front_end/heap_snapshot_model/HeapSnapshotModel.js');
+      '../../../../devtools-frontend/src/front_end/heap_snapshot_model/HeapSnapshotModel.js');
   await testRunner.loadScriptModule(
-      '../../../../blink/renderer/devtools/front_end/heap_snapshot_worker/HeapSnapshot.js');
+      '../../../../devtools-frontend/src/front_end/heap_snapshot_worker/HeapSnapshot.js');
   await testRunner.loadScriptModule(
-      '../../../../blink/renderer/devtools/front_end/text_utils/TextUtils.js');
+      '../../../../devtools-frontend/src/front_end/text_utils/TextUtils.js');
   await testRunner.loadScriptModule(
-      '../../../../blink/renderer/devtools/front_end/heap_snapshot_worker/HeapSnapshotLoader.js');
+      '../../../../devtools-frontend/src/front_end/heap_snapshot_worker/HeapSnapshotLoader.js');
 
   // Expose the (de)serialize code from Common because the worker expects it on self.
   // TODO(https://crbug.com/680046) Remove the dupe code below.
diff --git a/third_party/blink/web_tests/resources/testdriver-vendor.js b/third_party/blink/web_tests/resources/testdriver-vendor.js
index 0250c168..0f337091 100644
--- a/third_party/blink/web_tests/resources/testdriver-vendor.js
+++ b/third_party/blink/web_tests/resources/testdriver-vendor.js
@@ -95,6 +95,14 @@
         eventSenderKeys = "Tab";
       } else if (charCode == 0xE050) {
         eventSenderKeys = "ShiftRight";
+      } else if (charCode == 0xE012) {
+        eventSenderKeys = "ArrowLeft";
+      } else if (charCode == 0xE013) {
+        eventSenderKeys = "ArrowUp";
+      } else if (charCode == 0xE014) {
+        eventSenderKeys = "ArrowRight";
+      } else if (charCode == 0xE015) {
+        eventSenderKeys = "ArrowDown";
       } else if (charCode >= 0xE000 && charCode <= 0xF8FF) {
         reject(new Error("No support for this code: U+" + charCode.toString(16)));
       }
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
index 3b97774..6737247 100644
--- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -5111,11 +5111,28 @@
     getter target
     getter type
     method constructor
+interface NDEFErrorEvent : Event
+    attribute @@toStringTag
+    getter error
+    method constructor
 interface NDEFMessage
     attribute @@toStringTag
     getter records
     getter url
     method constructor
+interface NDEFReader : EventTarget
+    attribute @@toStringTag
+    getter onerror
+    getter onreading
+    method constructor
+    method scan
+    setter onerror
+    setter onreading
+interface NDEFReadingEvent : Event
+    attribute @@toStringTag
+    getter message
+    getter serialNumber
+    method constructor
 interface NDEFRecord
     attribute @@toStringTag
     getter mediaType
@@ -5124,24 +5141,7 @@
     method constructor
     method json
     method text
-interface NFCErrorEvent : Event
-    attribute @@toStringTag
-    getter error
-    method constructor
-interface NFCReader : EventTarget
-    attribute @@toStringTag
-    getter onerror
-    getter onreading
-    method constructor
-    method scan
-    setter onerror
-    setter onreading
-interface NFCReadingEvent : Event
-    attribute @@toStringTag
-    getter message
-    getter serialNumber
-    method constructor
-interface NFCWriter
+interface NDEFWriter
     attribute @@toStringTag
     method constructor
     method push
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index 3daebb7..6453874f 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -855,40 +855,32 @@
                                   '--device={}'.format(
                                       self._profiler._device.serial),
                                   '--browser=exact',
-                                  '--output-format=chartjson',
+                                  '--output-format=csv',
                                   '--output-dir={}'.format(out_dir),
                                   '--reset-results',
                                   '--browser-executable={}'.format(apk),
                                   'orderfile.memory_mobile'])
 
-      out_file_path = os.path.join(out_dir, 'results-chart.json')
+      out_file_path = os.path.join(out_dir, 'results.csv')
       if not os.path.exists(out_file_path):
         raise Exception('Results file not found!')
 
+      results = {}
       with open(out_file_path, 'r') as f:
-        json_results = json.load(f)
-
-      if not json_results:
-        raise Exception('Results file is empty')
-
-      if not 'charts' in json_results:
-        raise Exception('charts can not be found in results!')
-
-      charts = json_results['charts']
-      results = dict()
-      for story in charts:
-        if not story.endswith("NativeCodeResidentMemory_avg"):
-          continue
-
-        results[story] = dict()
-        for substory in charts[story]:
-          if substory == 'summary':
+        reader = csv.DictReader(f)
+        for row in reader:
+          if not row['name'].endswith('NativeCodeResidentMemory'):
             continue
-          if not 'values' in charts[story][substory]:
-            raise Exception(
-              'Values can not be found in charts:%s:%s' % (story, substory))
+          # Note: NativeCodeResidentMemory records a single sample from each
+          # story run, so this average (reported as 'avg') is exactly the value
+          # of that one sample. Each story is run multiple times, so this loop
+          # will accumulate into a list all values for all runs of each story.
+          results.setdefault(row['name'], {}).setdefault(
+              row['stories'], []).append(row['avg'])
 
-          results[story][substory] = charts[story][substory]['values']
+      if not results:
+        raise Exception('Could not find relevant results')
+
       return results
 
     except Exception as e:
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl
index a5a74bf..c860ea1 100644
--- a/tools/mb/mb_config.pyl
+++ b/tools/mb/mb_config.pyl
@@ -84,7 +84,7 @@
       'Memory Infra Tester': 'android_release_thumb_bot',
       'android-marshmallow-x86-fyi-rel': 'android_release_bot_minimal_symbols_x86_resource_whitelisting',
       'android-pie-x86-fyi-rel': 'android_release_bot_minimal_symbols_x86',
-      'android-bfcache-debug': 'android_debug_bot',
+      'android-bfcache-debug': 'android_debug_static_bot',
     },
 
     'chromium.chromedriver': {
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml
index 7444ef6..f32eca7 100644
--- a/tools/metrics/actions/actions.xml
+++ b/tools/metrics/actions/actions.xml
@@ -17709,12 +17709,54 @@
   </description>
 </action>
 
+<action name="ProfileMenu_ActionableItemClicked_Guest">
+  <owner>droger@chromium.org</owner>
+  <owner>tangltom@chromium.org</owner>
+  <description>
+    The user clicked a button or a link in the guest profile menu.
+  </description>
+</action>
+
+<action name="ProfileMenu_ActionableItemClicked_Incognito">
+  <owner>droger@chromium.org</owner>
+  <owner>tangltom@chromium.org</owner>
+  <description>
+    The user clicked a button or a link in the incognito profile menu.
+  </description>
+</action>
+
+<action name="ProfileMenu_ActionableItemClicked_Regular">
+  <owner>droger@chromium.org</owner>
+  <owner>tangltom@chromium.org</owner>
+  <description>
+    The user clicked a button or a link in the regular profile menu.
+  </description>
+</action>
+
 <action name="ProfileMenu_Opened">
   <owner>msarda@chromium.org</owner>
   <owner>tangltom@chromium.org</owner>
   <description>The user opened the profile menu.</description>
 </action>
 
+<action name="ProfileMenu_Opened_Guest">
+  <owner>droger@chromium.org</owner>
+  <owner>tangltom@chromium.org</owner>
+  <description>The user opened the guest profile menu.</description>
+</action>
+
+<action name="ProfileMenu_Opened_Incognito">
+  <owner>droger@chromium.org</owner>
+  <owner>tangltom@chromium.org</owner>
+  <description>The user opened the incognito profile menu.</description>
+</action>
+
+<action name="ProfileMenu_Opened_Regular">
+  <owner>droger@chromium.org</owner>
+  <owner>tangltom@chromium.org</owner>
+  <description>The user opened the regular profile menu.</description>
+</action>
+
 <action name="PWAInstallIcon">
   <owner>alancutter@chromium.org</owner>
   <description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 0e4e7a2..0e6069d 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -11378,6 +11378,17 @@
   <int value="2147483646" label="STATUS_DATATYPE_MISALIGNMENT"/>
 </enum>
 
+<enum name="CrasHfpCodec">
+  <summary>
+    List of codec ids used for SCO audio, in Bluetooth Hands-free profile. This
+    list should be aligned with CRAS:
+    https://chromium.googlesource.com/chromiumos/third_party/adhd/+/master/cras/src/server/cras_hfp_slc.h
+  </summary>
+  <int value="0" label="HFP_CODEC_UNUSED"/>
+  <int value="1" label="HFP_CODEC_ID_CVSD"/>
+  <int value="2" label="HFP_CODEC_ID_MSBC"/>
+</enum>
+
 <enum name="CrashpadExceptionCaptureResult">
   <int value="0" label="kSuccess"/>
   <int value="1" label="kUnexpectedExceptionBehavior"/>
@@ -13963,6 +13974,7 @@
   <int value="98" label="Phone Chooser"/>
   <int value="99" label="QR Code Generator"/>
   <int value="100" label="Crostini Force Close"/>
+  <int value="101" label="App Uninstall"/>
 </enum>
 
 <enum name="DialogOriginRelationship">
@@ -18445,6 +18457,7 @@
   <int value="633" label="DefaultInsecureContentSetting"/>
   <int value="634" label="InsecureContentAllowedForUrls"/>
   <int value="635" label="InsecureContentBlockedForUrls"/>
+  <int value="636" label="DeviceWebBasedAttestationAllowedUrls"/>
 </enum>
 
 <enum name="EnterprisePolicyInvalidations">
@@ -39207,7 +39220,7 @@
   <int value="0" label="Fetch succeeded"/>
   <int value="1" label="Fetch failed because of empty URL"/>
   <int value="2" label="Fetch failed (unspecified reason)"/>
-  <int value="3" label="Fetch failed because the document origin is unique"/>
+  <int value="3" label="Fetch failed because the document origin is opaque"/>
 </enum>
 
 <enum name="MappedCSSProperties">
@@ -64173,6 +64186,7 @@
   <int value="12" label="WebAppDisabled"/>
   <int value="13" label="InstallURLRedirected"/>
   <int value="14" label="InstallURLLoadFailed"/>
+  <int value="15" label="ExpectedAppIdCheckFailed"/>
 </enum>
 
 <enum name="WebAppInstallSource">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 69b9968..1058ebf 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -26046,6 +26046,16 @@
   </summary>
 </histogram>
 
+<histogram name="Cras.kHfpWidebandSpeechSelectedCodec" enum="CrasHfpCodec"
+    expires_after="2020-10-15">
+  <owner>hychao@chromium.org</owner>
+  <owner>chromeos-audio@google.com</owner>
+  <summary>
+    For each single connection of bluetooth HFP record the result of codec
+    negotiation, if supported.
+  </summary>
+</histogram>
+
 <histogram name="Cras.MissedCallbackFirstTimeInput" units="seconds"
     expires_after="2020-01-17">
   <owner>yuhsuan@chromium.org</owner>
@@ -60004,6 +60014,7 @@
 
 <histogram name="Manifest.FetchResult" enum="ManifestFetchResultType"
     expires_after="2020-04-05">
+  <owner>mgiuca@chromium.org</owner>
   <owner>mlamouri@chromium.org</owner>
   <summary>
     Tracks whether the Manifest fetch succeed and why it failed if it failed.
@@ -60012,6 +60023,7 @@
 
 <histogram name="Manifest.HasProperty" enum="Boolean"
     expires_after="2020-04-05">
+  <owner>mgiuca@chromium.org</owner>
   <owner>mlamouri@chromium.org</owner>
   <summary>
     Tracks which properties of a Manifest were present when it was parsed. If a
@@ -60021,13 +60033,18 @@
   </summary>
 </histogram>
 
-<histogram name="Manifest.IsEmpty" enum="Boolean" expires_after="2020-04-05">
+<histogram name="Manifest.IsEmpty" enum="Boolean" expires_after="2020-02-04">
+  <obsolete>
+    Deprecated as of 2019-10-21.
+  </obsolete>
+  <owner>mgiuca@chromium.org</owner>
   <owner>mlamouri@chromium.org</owner>
   <summary>Tracks whether the parsed Manifest is the empty Manifest.</summary>
 </histogram>
 
 <histogram name="Manifest.ParseSuccess" enum="Boolean"
     expires_after="2020-04-05">
+  <owner>mgiuca@chromium.org</owner>
   <owner>mlamouri@chromium.org</owner>
   <summary>
     Tracks the Manifest parsing result. A failure will be recorded if the
@@ -176035,6 +176052,10 @@
       Replaced by NonSyncPasswordEntry in M78.
     </obsolete>
   </suffix>
+  <suffix name="SavedPasswordEntry"
+      label="Password protection triggered by entering a password saved in
+             the password manager where the account is not signed-in to
+             Google."/>
   <suffix name="SyncPasswordEntry"
       label="Password protection triggered by entering the sync password,
              which may or may not also match a saved password. (This was
diff --git a/tools/perf/measurements/rasterize_and_record_micro.py b/tools/perf/measurements/rasterize_and_record_micro.py
index 2c776f9..0bb171e1 100644
--- a/tools/perf/measurements/rasterize_and_record_micro.py
+++ b/tools/perf/measurements/rasterize_and_record_micro.py
@@ -71,8 +71,8 @@
     paint_op_memory_usage = data.get('paint_op_memory_usage', 0)
     paint_op_count = data.get('paint_op_count', 0)
 
-    results.AddMeasurement('pixels_recorded', 'pixels', pixels_recorded)
-    results.AddMeasurement('pixels_rasterized', 'pixels', pixels_rasterized)
+    results.AddMeasurement('pixels_recorded', 'count', pixels_recorded)
+    results.AddMeasurement('pixels_rasterized', 'count', pixels_rasterized)
     results.AddMeasurement('rasterize_time', 'ms', rasterize_time)
     results.AddMeasurement('record_time', 'ms', record_time)
     results.AddMeasurement('painter_memory_usage', 'bytes',
@@ -111,8 +111,8 @@
       total_picture_layers_off_screen = data['total_picture_layers_off_screen']
 
       results.AddMeasurement('pixels_rasterized_with_non_solid_color',
-                             'pixels', pixels_rasterized_with_non_solid_color)
-      results.AddMeasurement('pixels_rasterized_as_opaque', 'pixels',
+                             'count', pixels_rasterized_with_non_solid_color)
+      results.AddMeasurement('pixels_rasterized_as_opaque', 'count',
                              pixels_rasterized_as_opaque)
       results.AddMeasurement('total_layers', 'count', total_layers)
       results.AddMeasurement('total_picture_layers', 'count',
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc
index 53b0513..b850a79 100644
--- a/ui/accessibility/platform/ax_platform_node_auralinux.cc
+++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -754,11 +754,31 @@
                                  value);
 }
 
+#if defined(ATK_212)
+void SetValue(AtkValue* atk_value, const double new_value) {
+  g_return_if_fail(ATK_VALUE(atk_value));
+
+  AtkObject* atk_object = ATK_OBJECT(atk_value);
+  AXPlatformNodeAuraLinux* obj = AtkObjectToAXPlatformNodeAuraLinux(atk_object);
+  if (!obj)
+    return;
+
+  AXActionData data;
+  data.action = ax::mojom::Action::kSetValue;
+  data.value = base::NumberToString(new_value);
+  obj->GetDelegate()->AccessibilityPerformAction(data);
+}
+#endif  // defined(ATK_212)
+
 void Init(AtkValueIface* iface) {
   iface->get_current_value = GetCurrentValue;
   iface->get_maximum_value = GetMaximumValue;
   iface->get_minimum_value = GetMinimumValue;
   iface->get_minimum_increment = GetMinimumIncrement;
+
+#if defined(ATK_212)
+  iface->set_value = SetValue;
+#endif  // defined(ATK_212)
 }
 
 const GInterfaceInfo Info = {reinterpret_cast<GInterfaceInitFunc>(Init),
@@ -3392,10 +3412,8 @@
   // If this is a non-web-content text entry, then we need to trigger text
   // change signals when the value changes. This is handled by browser
   // accessibility for web content.
-  if (IsPlainTextField() || !GetDelegate()->IsWebContent()) {
+  if (IsPlainTextField() && !GetDelegate()->IsWebContent())
     UpdateHypertext();
-    return;
-  }
 
   if (!IsRangeValueSupported(GetData()))
     return;
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc b/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc
index 75908ed..1f7579f 100644
--- a/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc
+++ b/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc
@@ -973,6 +973,53 @@
   g_object_unref(root_obj);
 }
 
+#if ATK_CHECK_VERSION(2, 12, 0)
+TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkValueChangedSignal) {
+  AXNodeData root;
+  root.id = 1;
+  root.role = ax::mojom::Role::kSlider;
+  root.AddFloatAttribute(ax::mojom::FloatAttribute::kMaxValueForRange, 5.0);
+  Init(root);
+
+  AtkObject* root_object(GetRootAtkObject());
+  ASSERT_TRUE(ATK_IS_OBJECT(root_object));
+  ASSERT_TRUE(ATK_IS_VALUE(root_object));
+  g_object_ref(root_object);
+
+  bool saw_value_change = false;
+  g_signal_connect(
+      root_object, "property-change::accessible-value",
+      G_CALLBACK(+[](AtkObject*, void* property, bool* saw_value_change) {
+        *saw_value_change = true;
+      }),
+      &saw_value_change);
+
+  atk_value_set_value(ATK_VALUE(root_object), 24.0);
+  GetRootPlatformNode()->NotifyAccessibilityEvent(
+      ax::mojom::Event::kValueChanged);
+
+  GValue current_value = G_VALUE_INIT;
+  atk_value_get_current_value(ATK_VALUE(root_object), &current_value);
+  EXPECT_EQ(G_TYPE_FLOAT, G_VALUE_TYPE(&current_value));
+  EXPECT_EQ(24.0, g_value_get_float(&current_value));
+  EXPECT_TRUE(saw_value_change);
+
+  saw_value_change = false;
+  atk_value_set_value(ATK_VALUE(root_object), 100.0);
+  GetRootPlatformNode()->NotifyAccessibilityEvent(
+      ax::mojom::Event::kValueChanged);
+
+  g_value_unset(&current_value);
+  atk_value_get_current_value(ATK_VALUE(root_object), &current_value);
+  EXPECT_EQ(G_TYPE_FLOAT, G_VALUE_TYPE(&current_value));
+  EXPECT_EQ(100.0, g_value_get_float(&current_value));
+  EXPECT_TRUE(saw_value_change);
+
+  g_value_unset(&current_value);
+  g_object_unref(root_object);
+}
+#endif  // ATK_CHECK_VERSION(2, 12, 0)
+
 //
 // AtkHyperlinkImpl interface
 //